@astryxdesign/cli 0.6.6 → 0.6.7-canary.13feb39
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 +129 -0
- package/README.md +84 -82
- package/api/build/_adapter.d.mts +20 -0
- package/api/build/_adapter.mjs +24 -0
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.test.mjs +1 -1
- package/api/build/build.type.d.mts +12 -0
- package/api/build/build.type.mjs +3 -0
- package/api/build/help/help.mjs +1 -1
- package/api/build/kit/kit.mjs +13 -1
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +615 -0
- package/api/component/component.doc.mjs +5 -2
- package/api/component/component.mjs +49 -15
- package/api/component/component.test.mjs +32 -0
- package/api/component/component.type.d.mts +33 -3
- package/api/component/component.type.mjs +10 -3
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +5 -2
- package/api/component/detail/detail.mjs +5 -1
- package/api/component/detail/props/props.d.mts +2 -1
- package/api/component/detail/props/props.mjs +3 -2
- package/api/component/detail/showcase/showcase.d.mts +3 -1
- package/api/component/detail/showcase/showcase.mjs +3 -1
- package/api/component/detail/source/source.d.mts +3 -2
- package/api/component/detail/source/source.mjs +7 -3
- package/api/component/list/list.mjs +128 -10
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +73 -1
- package/api/docs/compiled-topics.test.mjs +1 -1
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.d.mts +44 -0
- package/api/docs/detail/section/section.mjs +171 -14
- package/api/docs/detail/section/section.test.mjs +4 -4
- package/api/docs/docOverlays.test.mjs +52 -23
- package/api/docs/docs.depth.test.mjs +2 -0
- package/api/docs/docs.doc.mjs +3 -3
- package/api/docs/docs.mjs +13 -16
- package/api/docs/docs.test.mjs +9 -10
- package/api/docs/docs.type.d.mts +43 -3
- package/api/docs/docs.type.mjs +23 -3
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +26 -26
- package/api/docs/integrationDocs.test.mjs +8 -7
- package/api/docs/namespace-section.test.mjs +260 -0
- package/api/docs/node/node.mjs +3 -0
- package/api/docs/token-tables.test.mjs +93 -0
- package/api/doctor/_adapter.d.mts +50 -0
- package/api/doctor/_adapter.mjs +190 -0
- package/api/doctor/doctor.d.mts +6 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +144 -150
- package/api/doctor/doctor.test.mjs +104 -0
- package/api/doctor/theme-checks.d.mts +24 -0
- package/api/doctor/theme-checks.mjs +1231 -0
- package/api/doctor/theme-checks.test.mjs +667 -0
- package/api/gap-report/gap-report.doc.mjs +2 -1
- package/api/gap-report/gap-report.mjs +15 -1
- package/api/hook/_adapter.d.mts +1 -0
- package/api/hook/_adapter.mjs +3 -0
- package/api/hook/detail/detail.mjs +2 -2
- package/api/hook/detail/params/params.mjs +2 -2
- package/api/hook/hook.type.d.mts +12 -0
- package/api/hook/hook.type.mjs +3 -0
- package/api/hook/list/list.mjs +8 -8
- package/api/index.d.mts +1 -1
- package/api/index.mjs +4 -0
- package/api/init/run/run.d.mts +3 -5
- package/api/init/run/run.mjs +11 -11
- package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
- package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
- package/api/integration/add-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +16 -2
- package/api/integration/add-theme.test.mjs +66 -15
- package/api/integration/authoring-checks.mjs +21 -1
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- package/api/integration/pack-check.component-replaces.test.mjs +126 -0
- package/api/integration/pack-check.d.mts +10 -0
- package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
- package/api/integration/pack-check.mjs +485 -3
- package/api/integration/pack-check.test.mjs +578 -10
- package/api/integration/validate-integration.mjs +20 -4
- package/api/integration/validate-integration.test.mjs +73 -0
- package/api/layout/check/check.d.mts +1 -0
- package/api/layout/check/check.mjs +1 -0
- package/api/layout/expand/expand.d.mts +1 -0
- package/api/layout/expand/expand.mjs +1 -0
- package/api/layout/grammar/grammar.d.mts +1 -0
- package/api/layout/grammar/grammar.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -1
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -1
- package/api/search/search.d.mts +47 -3
- package/api/search/search.doc.mjs +1 -1
- package/api/search/search.domain-priority.test.mjs +261 -0
- package/api/search/search.mjs +247 -43
- package/api/search/search.test.mjs +5 -1
- package/api/search/search.type.d.mts +3 -3
- package/api/search/search.type.mjs +2 -2
- package/api/swizzle/_adapter.d.mts +10 -0
- package/api/swizzle/_adapter.mjs +23 -0
- package/api/swizzle/copy/copy.d.mts +5 -6
- package/api/swizzle/copy/copy.mjs +29 -10
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +5 -2
- package/api/swizzle/swizzle.test.mjs +55 -5
- package/api/swizzle/swizzle.type.d.mts +8 -0
- package/api/swizzle/swizzle.type.mjs +2 -0
- package/api/template/copy/copy.mjs +14 -1
- package/api/template/show/show.mjs +2 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +1 -0
- package/api/template/template.type.d.mts +15 -0
- package/api/template/template.type.mjs +6 -0
- package/api/theme/_adapter.d.mts +106 -6
- package/api/theme/_adapter.mjs +687 -18
- package/api/theme/add/add.binary.test.mjs +76 -3
- package/api/theme/add/add.d.mts +5 -9
- package/api/theme/add/add.mjs +87 -64
- package/api/theme/add/add.rollback.test.mjs +9 -9
- package/api/theme/add/add.staging.test.mjs +9 -9
- package/api/theme/add/add.test.mjs +461 -55
- package/api/theme/add/add.types.test.mjs +151 -0
- package/api/theme/build/build.d.mts +96 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.mjs +286 -118
- package/api/theme/build/build.test.mjs +30 -0
- package/api/theme/build/font-warning.d.mts +11 -0
- package/api/theme/build/font-warning.mjs +28 -3
- package/api/theme/eject/eject.binary.test.mjs +90 -0
- package/api/theme/eject/eject.d.mts +17 -0
- package/api/theme/eject/eject.mjs +65 -0
- package/api/theme/eject/eject.rollback.test.mjs +158 -0
- package/api/theme/eject/eject.staging.test.mjs +83 -0
- package/api/theme/eject/eject.test.mjs +160 -0
- package/api/theme/integration-themes.test.mjs +30 -6
- package/api/theme/list/list.d.mts +10 -0
- package/api/theme/list/list.mjs +75 -7
- package/api/theme/list/list.test.mjs +155 -4
- package/api/theme/remove/remove.d.mts +12 -0
- package/api/theme/remove/remove.mjs +15 -0
- package/api/theme/remove/remove.test.mjs +94 -0
- package/api/theme/template/template.mjs +3 -4
- package/api/theme/theme.d.mts +5 -2
- package/api/theme/theme.mjs +13 -8
- package/api/theme/theme.type.d.mts +106 -2
- package/api/theme/theme.type.mjs +54 -5
- package/api/theme/themeAdd.doc.d.mts +1 -3
- package/api/theme/themeAdd.doc.mjs +35 -22
- package/api/theme/themeBuild.doc.mjs +1 -1
- package/api/theme/themeEject.doc.d.mts +8 -0
- package/api/theme/themeEject.doc.mjs +89 -0
- package/api/theme/themeListAvailable.doc.mjs +4 -4
- package/api/theme/themeListCopySources.doc.d.mts +8 -0
- package/api/theme/themeListCopySources.doc.mjs +60 -0
- package/api/theme/themeRemove.doc.d.mts +6 -0
- package/api/theme/themeRemove.doc.mjs +50 -0
- package/api/theme/themeTemplate.doc.mjs +4 -3
- package/api/theme/themeUse.doc.d.mts +6 -0
- package/api/theme/themeUse.doc.mjs +47 -0
- package/api/theme/use/use.d.mts +12 -0
- package/api/theme/use/use.mjs +15 -0
- package/api/theme/use/use.test.mjs +98 -0
- package/api/upgrade/_adapter.d.mts +1 -0
- package/api/upgrade/_adapter.mjs +3 -0
- package/api/upgrade/list/list.mjs +9 -3
- package/api/upgrade/upgrade.type.d.mts +4 -0
- package/api/upgrade/upgrade.type.mjs +1 -0
- package/assets/codemods/__tests__/registry.test.mjs +1 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/registry.mjs +1 -0
- package/assets/codemods/transforms/v0.6.7/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/v0.6.7/index.mjs +23 -0
- package/assets/codemods/transforms/v0.6.7/migrate-copied-themes-to-descriptors.mjs +54 -0
- package/assets/docs/author-a-theme.doc.mjs +166 -0
- package/assets/docs/getting-started.doc.mjs +61 -17
- package/assets/docs/principles.doc.dense.mjs +4 -4
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/principles.doc.zh.mjs +4 -4
- package/assets/docs/styling-overview.doc.mjs +211 -0
- package/assets/docs/theme.doc.dense.mjs +11 -197
- package/assets/docs/theme.doc.mjs +16 -764
- package/assets/docs/theme.doc.zh.mjs +31 -12
- package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +6 -5
- package/assets/docs/tree/component-migration.doc.mjs +107 -0
- package/assets/docs/tree/css-and-stylex.doc.mjs +150 -0
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
- package/assets/docs/tree/font-setup.doc.mjs +122 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
- package/assets/docs/tree/headers-and-footers.doc.mjs +67 -0
- package/assets/docs/tree/i18n-library-integration.doc.mjs +167 -0
- package/assets/docs/tree/i18n-quick-start.doc.mjs +101 -0
- package/assets/docs/{internationalization.doc.mjs → tree/i18n-rtl-and-testing.doc.mjs} +17 -223
- package/assets/docs/tree/internationalization.doc.mjs +29 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
- package/assets/docs/tree/layout.doc.mjs +55 -0
- package/assets/docs/{migration.doc.mjs → tree/migration-setup.doc.mjs} +24 -129
- package/assets/docs/tree/migration-verification.doc.mjs +67 -0
- package/assets/docs/tree/migration.doc.mjs +28 -0
- package/assets/docs/tree/non-css-processing.doc.mjs +112 -0
- package/assets/docs/tree/other-libraries.doc.mjs +218 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
- package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
- package/assets/docs/tree/responsive.doc.mjs +98 -0
- package/assets/docs/tree/scaffold.doc.mjs +140 -0
- package/assets/docs/tree/side-panels.doc.mjs +81 -0
- package/assets/docs/tree/structure.doc.mjs +140 -0
- package/assets/docs/tree/styling-advanced.doc.mjs +159 -0
- package/assets/docs/tree/styling-basics.doc.mjs +181 -0
- package/assets/docs/tree/styling-libraries.doc.mjs +30 -0
- package/assets/docs/tree/styling.doc.mjs +29 -0
- package/assets/docs/tree/tailwind.doc.mjs +65 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/themes.doc.mjs +2 -2
- package/assets/docs/tree/tokens-and-setup.doc.mjs +128 -0
- package/assets/docs/tree/tokens-border.doc.mjs +46 -0
- package/assets/docs/tree/tokens-color.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-color.doc.mjs +438 -0
- package/assets/docs/tree/tokens-color.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-data.doc.mjs +323 -0
- package/assets/docs/tree/tokens-duration.doc.mjs +78 -0
- package/assets/docs/tree/tokens-ease.doc.mjs +46 -0
- package/assets/docs/tree/tokens-focus.doc.mjs +57 -0
- package/assets/docs/tree/tokens-font-weight.doc.mjs +58 -0
- package/assets/docs/tree/tokens-radius.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-radius.doc.mjs +70 -0
- package/assets/docs/tree/tokens-radius.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.mjs +74 -0
- package/assets/docs/tree/tokens-shadow.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.mjs +54 -0
- package/assets/docs/tree/tokens-size.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.mjs +102 -0
- package/assets/docs/tree/tokens-spacing.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-syntax.doc.mjs +98 -0
- package/assets/docs/tree/tokens-text-size.doc.mjs +90 -0
- package/assets/docs/tree/tokens-type-scale.doc.mjs +210 -0
- package/assets/docs/tree/tokens-typography.doc.mjs +54 -0
- package/assets/docs/tree/tokens-usage.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-usage.doc.mjs +36 -0
- package/assets/docs/tree/tokens-usage.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens.doc.mjs +28 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +7 -3
- package/assets/docs/tree/type-scale.doc.mjs +147 -0
- package/assets/docs/tree/typography-best-practices.doc.mjs +55 -0
- package/assets/docs/tree/typography.doc.mjs +29 -0
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
- package/assets/docs/tree/versioning.doc.mjs +6 -3
- package/assets/docs/use-a-theme.doc.mjs +212 -0
- package/assets/templates/pages/incident-console/page.tsx +1 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
- package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
- package/assets/templates/pages/table-comparison/page.tsx +1449 -0
- package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
- package/assets/theme.template.ts +28 -11
- package/authoring/doctypes/command/command.doc.mjs +5 -0
- package/authoring/doctypes/command/type.ts +2 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -4
- package/authoring/doctypes/template/template.doc.mjs +2 -2
- package/authoring/doctypes/template/type.ts +5 -3
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +3 -3
- package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
- package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
- package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
- package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
- package/clients/cli/commands/build-theme.mjs +338 -45
- package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
- package/clients/cli/commands/build.mjs +8 -6
- package/clients/cli/commands/build.text-fields.test.mjs +1 -1
- package/clients/cli/commands/component/index.mjs +91 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +316 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/docs.doc.mjs +2 -1
- package/clients/cli/commands/docs.mjs +63 -23
- package/clients/cli/commands/docs.test.mjs +17 -15
- package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.test.mjs +59 -52
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/hook/index.mjs +7 -2
- package/clients/cli/commands/import-hint-correctness.test.mjs +28 -5
- package/clients/cli/commands/init.next-steps.test.mjs +18 -23
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/layout-check.doc.mjs +2 -0
- package/clients/cli/commands/layout-expand.doc.mjs +2 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +2 -0
- package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
- package/clients/cli/commands/layout.doc.mjs +2 -0
- package/clients/cli/commands/layout.mjs +40 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.test.mjs +10 -4
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
- package/clients/cli/commands/template.mjs +56 -5
- package/clients/cli/commands/text-json-parity.test.mjs +40 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +135 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-build.doc.mjs +3 -1
- package/clients/cli/commands/theme-eject.doc.mjs +47 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +5 -2
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
- package/clients/cli/commands/theme-remove.doc.mjs +22 -0
- package/clients/cli/commands/theme-template.doc.mjs +4 -3
- package/clients/cli/commands/theme-use.doc.mjs +22 -0
- package/clients/cli/commands/theme.doc.mjs +21 -16
- package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/index.mjs +5 -2
- package/clients/cli/lib/component-format.mjs +29 -2
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +4 -0
- package/clients/cli/lib/resolve-theme.mjs +80 -78
- package/clients/cli/lib/resolve-theme.test.mjs +523 -27
- package/foundation/agent-docs/agent-docs.mjs +48 -30
- package/foundation/agent-docs/agent-docs.test.mjs +47 -34
- package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
- package/foundation/config/project.d.mts +20 -5
- package/foundation/config/project.mjs +43 -6
- package/foundation/config/project.test.mjs +1 -1
- package/foundation/config/theme-private-vars.d.mts +12 -0
- package/foundation/config/theme-private-vars.mjs +107 -0
- package/foundation/config/theme-private-vars.test.mjs +55 -0
- package/foundation/config/theme-state.d.mts +145 -0
- package/foundation/config/theme-state.mjs +417 -0
- package/foundation/config/theme-state.test.mjs +182 -0
- package/foundation/discovery/component-discovery.d.mts +5 -2
- package/foundation/discovery/component-discovery.mjs +12 -6
- package/foundation/discovery/component-replacement.d.mts +91 -0
- package/foundation/discovery/component-replacement.mjs +417 -0
- package/foundation/discovery/component-replacement.test.mjs +480 -0
- package/foundation/discovery/docs-discovery.test.mjs +1 -1
- package/foundation/discovery/docs-output-budget.d.mts +6 -2
- package/foundation/discovery/docs-output-budget.mjs +2 -1
- package/foundation/discovery/docs-section-key.d.mts +4 -2
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/module-exports.d.mts +10 -0
- package/foundation/discovery/module-exports.mjs +146 -0
- package/foundation/discovery/package-exports.d.mts +29 -0
- package/foundation/discovery/package-exports.mjs +200 -0
- package/foundation/discovery/template-needs.d.mts +31 -0
- package/foundation/discovery/template-needs.mjs +156 -0
- package/foundation/discovery/template-needs.test.mjs +203 -0
- package/foundation/discovery/theme-discovery.d.mts +72 -5
- package/foundation/discovery/theme-discovery.mjs +134 -18
- package/foundation/discovery/theme-discovery.test.mjs +9 -3
- package/foundation/discovery/theme-imports.d.mts +15 -0
- package/foundation/discovery/theme-imports.mjs +217 -0
- package/foundation/discovery/theme-imports.test.mjs +173 -0
- package/foundation/doc-compiler/bundle.mjs +52 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +15 -5
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/split-topic-keywords.test.mjs +73 -0
- package/foundation/doc-compiler/tree.d.mts +10 -0
- package/foundation/doc-compiler/tree.mjs +22 -0
- package/foundation/doc-compiler/tree.test.mjs +3 -2
- package/foundation/env/package-manager.d.mts +31 -8
- package/foundation/env/package-manager.mjs +120 -13
- package/foundation/env/package-manager.test.mjs +174 -1
- package/foundation/fs/module-loader.d.mts +9 -0
- package/foundation/fs/module-loader.mjs +71 -2
- package/foundation/integrations/cli-requirement.d.mts +43 -10
- package/foundation/integrations/cli-requirement.mjs +56 -13
- package/foundation/integrations/cli-requirement.test.mjs +160 -23
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- package/foundation/integrations/validate-contributions.d.mts +16 -0
- package/foundation/integrations/validate-contributions.mjs +56 -8
- package/foundation/response/base.d.ts +9 -3
- package/foundation/response/json.d.mts +7 -4
- package/foundation/response/json.mjs +10 -6
- package/foundation/response/response-types.doc.mjs +41 -26
- package/foundation/response/response.doc.mjs +18 -4
- package/foundation/text/copyright-header.mjs +1 -1
- package/foundation/text/copyright-header.test.mjs +1 -1
- package/package.json +9 -9
- package/assets/docs/layout.doc.dense.mjs +0 -388
- package/assets/docs/layout.doc.mjs +0 -550
- package/assets/docs/styling-libraries.doc.mjs +0 -469
- package/assets/docs/styling.doc.mjs +0 -412
- package/assets/docs/tokens.doc.dense.mjs +0 -15
- package/assets/docs/tokens.doc.mjs +0 -1491
- package/assets/docs/tokens.doc.zh.mjs +0 -15
- package/assets/docs/typography.doc.mjs +0 -286
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* @astryxdesign/core's shared generator (the SINGLE source of truth so the
|
|
12
12
|
* build emits the exact CSS the `<Theme>` runtime does), writes:
|
|
13
13
|
* - A CSS file with token overrides and component styles
|
|
14
|
+
* - A CSS declaration module for strict side-effect imports
|
|
14
15
|
* - A JS module that re-exports the built theme (+ icon registry)
|
|
15
16
|
* - A .d.ts (plus an optional .variants.d.ts for custom prop values)
|
|
16
17
|
*
|
|
@@ -41,7 +42,9 @@
|
|
|
41
42
|
* `theme.build.check` receipt listing any stale or missing outputs. This is
|
|
42
43
|
* the CI guard for committed, generated theme CSS: the source of truth is
|
|
43
44
|
* `<theme>.ts`, and `theme build --check` fails when the committed
|
|
44
|
-
* `<theme>.css`/`.js`/`.d.ts` no longer match it.
|
|
45
|
+
* `<theme>.css`/`.js`/`.d.ts` no longer match it. Builds also write a
|
|
46
|
+
* `<theme>.css.d.ts` import stub; check mode tolerates that one file being absent
|
|
47
|
+
* so output sets from the released CLI stay valid after an upgrade.
|
|
45
48
|
*/
|
|
46
49
|
|
|
47
50
|
import * as fs from 'node:fs';
|
|
@@ -62,6 +65,7 @@ import {
|
|
|
62
65
|
PathSafetyError,
|
|
63
66
|
} from '../../../foundation/fs/path-safety.mjs';
|
|
64
67
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
68
|
+
import {validatePrivateVars} from '../../../foundation/config/theme-private-vars.mjs';
|
|
65
69
|
import {AstryxError} from '../../error.mjs';
|
|
66
70
|
import {applyWrites} from '../../integration/add-helpers.mjs';
|
|
67
71
|
import {logger} from '../../logger.mjs';
|
|
@@ -70,7 +74,11 @@ import {
|
|
|
70
74
|
collectThemingTargets,
|
|
71
75
|
targetValidationRegistry,
|
|
72
76
|
} from '../../../foundation/discovery/theming-targets.mjs';
|
|
73
|
-
import {
|
|
77
|
+
import {
|
|
78
|
+
collectUnloadedFonts,
|
|
79
|
+
formatBatchFontLoadingHelp,
|
|
80
|
+
formatFontLoadingHelp,
|
|
81
|
+
} from './font-warning.mjs';
|
|
74
82
|
import {interceptCore} from './core-interception.mjs';
|
|
75
83
|
import {generateFamilyCSS, resolveThemeFamily} from './family.mjs';
|
|
76
84
|
import {resolveIconImports} from './icon-imports.mjs';
|
|
@@ -431,7 +439,7 @@ function generatedHeader(sourceFile, lang = 'js', command, versions) {
|
|
|
431
439
|
* @param {string} content
|
|
432
440
|
* @returns {string}
|
|
433
441
|
*/
|
|
434
|
-
function
|
|
442
|
+
export function normalizeThemeBuildForCompare(content) {
|
|
435
443
|
return content
|
|
436
444
|
.split('\n')
|
|
437
445
|
.filter(line => {
|
|
@@ -441,24 +449,36 @@ function normalizeForCompare(content) {
|
|
|
441
449
|
.join('\n');
|
|
442
450
|
}
|
|
443
451
|
|
|
444
|
-
/** @param {Array<{dest: string, content: string}>} writes @param {string} cwd @returns {Array<{path: string, reason: 'missing' | 'outdated'}>} */
|
|
452
|
+
/** @param {Array<{dest: string, content: string, allowMissingInCheck?: boolean}>} writes @param {string} cwd @returns {Array<{path: string, reason: 'missing' | 'outdated'}>} */
|
|
445
453
|
function staleBuildOutputs(writes, cwd) {
|
|
446
454
|
/** @type {Array<{path: string, reason: 'missing' | 'outdated'}>} */
|
|
447
455
|
const stale = [];
|
|
448
456
|
for (const write of writes) {
|
|
449
457
|
const rel = path.relative(cwd, write.dest);
|
|
450
458
|
if (!fs.existsSync(write.dest)) {
|
|
451
|
-
|
|
459
|
+
if (!write.allowMissingInCheck) {
|
|
460
|
+
stale.push({path: rel, reason: 'missing'});
|
|
461
|
+
}
|
|
452
462
|
continue;
|
|
453
463
|
}
|
|
454
464
|
const onDisk = fs.readFileSync(write.dest, 'utf8');
|
|
455
|
-
if (
|
|
465
|
+
if (
|
|
466
|
+
normalizeThemeBuildForCompare(onDisk) !==
|
|
467
|
+
normalizeThemeBuildForCompare(write.content)
|
|
468
|
+
) {
|
|
456
469
|
stale.push({path: rel, reason: 'outdated'});
|
|
457
470
|
}
|
|
458
471
|
}
|
|
459
472
|
return stale;
|
|
460
473
|
}
|
|
461
474
|
|
|
475
|
+
/** @param {Array<{dest: string, allowMissingInCheck?: boolean}>} writes @param {string} cwd */
|
|
476
|
+
function checkedBuildOutputs(writes, cwd) {
|
|
477
|
+
return writes
|
|
478
|
+
.filter(write => !write.allowMissingInCheck || fs.existsSync(write.dest))
|
|
479
|
+
.map(write => path.relative(cwd, write.dest));
|
|
480
|
+
}
|
|
481
|
+
|
|
462
482
|
/** @param {Array<{dest: string, content: string}>} writes */
|
|
463
483
|
function writeBuildOutputs(writes) {
|
|
464
484
|
if (writes.length === 0) return;
|
|
@@ -515,8 +535,6 @@ function toIdentifier(name) {
|
|
|
515
535
|
* from the cwd-relative dir (most consumers import from a file under src/) but
|
|
516
536
|
* keeps the rest of the path (e.g. `themes/gothic`). Callers note the path is
|
|
517
537
|
* relative to the consumer's file.
|
|
518
|
-
* Exported (not just used by `themeBuild`'s install instructions) because the
|
|
519
|
-
* thin CLI's `theme add` action reuses it for its own scaffold instructions.
|
|
520
538
|
* @param {string} relDir
|
|
521
539
|
* @param {string} base
|
|
522
540
|
* @returns {string}
|
|
@@ -1106,30 +1124,6 @@ function assertAdaptationCapability(
|
|
|
1106
1124
|
);
|
|
1107
1125
|
}
|
|
1108
1126
|
|
|
1109
|
-
/**
|
|
1110
|
-
* Every `[component, rules]` pair a theme may emit, including ordered
|
|
1111
|
-
* adaptation rules. Validators, private-variable checks, and notices must see
|
|
1112
|
-
* rule-only values even though variant augmentation is root-owned.
|
|
1113
|
-
*
|
|
1114
|
-
* @param {Record<string, any>} themeDef
|
|
1115
|
-
* @returns {[string, Record<string, any>][]}
|
|
1116
|
-
*/
|
|
1117
|
-
function themedComponentEntries(themeDef) {
|
|
1118
|
-
const maps = [
|
|
1119
|
-
themeDef.components,
|
|
1120
|
-
...adaptationRuleValues(themeDef).map(
|
|
1121
|
-
(/** @type {any} */ value) => value.components,
|
|
1122
|
-
),
|
|
1123
|
-
];
|
|
1124
|
-
|
|
1125
|
-
/** @type {[string, Record<string, any>][]} */
|
|
1126
|
-
const entries = [];
|
|
1127
|
-
for (const map of maps) {
|
|
1128
|
-
if (map) entries.push(...Object.entries(map));
|
|
1129
|
-
}
|
|
1130
|
-
return entries;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
1127
|
/**
|
|
1134
1128
|
* Root component entries are the only surface allowed to introduce variants.
|
|
1135
1129
|
* @param {Record<string, any>} themeDef
|
|
@@ -1686,6 +1680,46 @@ async function extractThemeDefinition(filePath, interception, /** @type {any} */
|
|
|
1686
1680
|
}
|
|
1687
1681
|
}
|
|
1688
1682
|
|
|
1683
|
+
/**
|
|
1684
|
+
* Load one theme through the build's real module loader and validate the raw
|
|
1685
|
+
* input captured from its defineTheme lineage. Used by doctor so it applies the
|
|
1686
|
+
* same direct-input rule as theme build without mistaking compiler output for
|
|
1687
|
+
* authored input.
|
|
1688
|
+
*
|
|
1689
|
+
* @param {string} file
|
|
1690
|
+
* @param {{cwd?: string}} [ctx]
|
|
1691
|
+
* @returns {Promise<string[]>}
|
|
1692
|
+
*/
|
|
1693
|
+
export async function validateThemePrivateInputs(
|
|
1694
|
+
file,
|
|
1695
|
+
{cwd = process.cwd()} = {},
|
|
1696
|
+
) {
|
|
1697
|
+
const filePath = path.resolve(cwd, file);
|
|
1698
|
+
if (!fs.existsSync(filePath)) {
|
|
1699
|
+
throw new AstryxError(
|
|
1700
|
+
`File not found: ${filePath}`,
|
|
1701
|
+
undefined,
|
|
1702
|
+
ERROR_CODES.ERR_FILE_NOT_FOUND,
|
|
1703
|
+
);
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
const interception = interceptCore(_coreThemeModule, _coreRootModule);
|
|
1707
|
+
let theme;
|
|
1708
|
+
try {
|
|
1709
|
+
theme = (await extractThemeDefinition(filePath, interception)).theme;
|
|
1710
|
+
} catch (error) {
|
|
1711
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1712
|
+
throw new AstryxError(message, undefined, ERROR_CODES.ERR_THEME_LOAD);
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
const inputs = interception.lineageOf(theme);
|
|
1716
|
+
try {
|
|
1717
|
+
return [...new Set(inputs.flatMap(input => validatePrivateVars(input)))];
|
|
1718
|
+
} finally {
|
|
1719
|
+
interception.strip(theme);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1689
1723
|
/**
|
|
1690
1724
|
* Fallback extraction via regex + eval.
|
|
1691
1725
|
* Only works for plain object literals — can't follow imports or variables.
|
|
@@ -2092,48 +2126,6 @@ async function validateComponentOverrides(themeDef) {
|
|
|
2092
2126
|
: validateComponentOverridesAgainstRegistry(themeDef, knownComponents);
|
|
2093
2127
|
}
|
|
2094
2128
|
|
|
2095
|
-
/**
|
|
2096
|
-
* Validate that themes don't set private (--_*) CSS custom properties directly.
|
|
2097
|
-
* Private vars are internal implementation details managed by the derived var
|
|
2098
|
-
* expansion pipeline. Theme authors should write standard CSS properties
|
|
2099
|
-
* (e.g. borderRadius, padding) instead.
|
|
2100
|
-
*
|
|
2101
|
-
* Returns array of error strings.
|
|
2102
|
-
* @param {{components?: Record<string, Record<string, Record<string, unknown>>>}} themeDef
|
|
2103
|
-
* @returns {string[]}
|
|
2104
|
-
*/
|
|
2105
|
-
function validatePrivateVars(themeDef) {
|
|
2106
|
-
/** @type {string[]} */
|
|
2107
|
-
const errors = [];
|
|
2108
|
-
|
|
2109
|
-
for (const [component, rules] of themedComponentEntries(themeDef)) {
|
|
2110
|
-
for (const [key, styles] of Object.entries(rules)) {
|
|
2111
|
-
/**
|
|
2112
|
-
* @param {unknown} value
|
|
2113
|
-
* @param {string[]} [path]
|
|
2114
|
-
*/
|
|
2115
|
-
const visit = (value, path = []) => {
|
|
2116
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) return;
|
|
2117
|
-
for (const [prop, nested] of Object.entries(value)) {
|
|
2118
|
-
if (prop.startsWith('--_')) {
|
|
2119
|
-
errors.push(
|
|
2120
|
-
`Component "${component}" (${[key, ...path].join(' ')}) sets private var "${prop}". ` +
|
|
2121
|
-
`Private vars (--_*) are internal; use standard CSS properties ` +
|
|
2122
|
-
`(e.g. borderRadius, padding) instead. The pipeline expands them automatically.`,
|
|
2123
|
-
);
|
|
2124
|
-
}
|
|
2125
|
-
visit(nested, [...path, prop]);
|
|
2126
|
-
}
|
|
2127
|
-
};
|
|
2128
|
-
visit(styles);
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
|
-
// One entry per distinct message: a component declared both at the root and
|
|
2133
|
-
// in one or more adaptations would otherwise report the same problem twice.
|
|
2134
|
-
return [...new Set(errors)];
|
|
2135
|
-
}
|
|
2136
|
-
|
|
2137
2129
|
const BUILTIN_HEADING_TYPES = new Set(['display-1', 'display-2', 'display-3']);
|
|
2138
2130
|
|
|
2139
2131
|
/**
|
|
@@ -2332,8 +2324,8 @@ function validateHeadingTypeAugmentationSupport(themeDef) {
|
|
|
2332
2324
|
}
|
|
2333
2325
|
|
|
2334
2326
|
/**
|
|
2335
|
-
* Compile a defineTheme file to CSS + JS + .d.ts (and an
|
|
2336
|
-
* `.variants.d.ts`). Performs the writes and returns a `theme.build` receipt,
|
|
2327
|
+
* Compile a defineTheme file to CSS + CSS .d.ts + JS + JS .d.ts (and an
|
|
2328
|
+
* optional `.variants.d.ts`). Performs the writes and returns a `theme.build` receipt,
|
|
2337
2329
|
* or `null` when the theme produced no CSS (nothing to build). Throws
|
|
2338
2330
|
* AstryxError (stable code) on failure. Progress is emitted through the shared
|
|
2339
2331
|
* `logger` (silent by default).
|
|
@@ -2351,6 +2343,7 @@ async function themeBuildInternal(
|
|
|
2351
2343
|
file,
|
|
2352
2344
|
options = {},
|
|
2353
2345
|
{cwd = process.cwd()} = {},
|
|
2346
|
+
/** @type {{compact?: boolean, trailers?: ThemeBuildTrailer[]}} */ report = {},
|
|
2354
2347
|
) {
|
|
2355
2348
|
const filePath = path.resolve(cwd, file);
|
|
2356
2349
|
|
|
@@ -2362,7 +2355,11 @@ async function themeBuildInternal(
|
|
|
2362
2355
|
);
|
|
2363
2356
|
}
|
|
2364
2357
|
|
|
2365
|
-
|
|
2358
|
+
if (!report.compact) {
|
|
2359
|
+
logger.log(`\nBuilding theme from ${path.relative(cwd, filePath)}...`);
|
|
2360
|
+
}
|
|
2361
|
+
// A compact report has no per-theme heading, so each warning names its file.
|
|
2362
|
+
const source = report.compact ? `${path.relative(cwd, filePath)}: ` : '';
|
|
2366
2363
|
|
|
2367
2364
|
await selectCore(cwd);
|
|
2368
2365
|
|
|
@@ -2481,18 +2478,18 @@ async function themeBuildInternal(
|
|
|
2481
2478
|
const noticeMessages = [];
|
|
2482
2479
|
for (const w of warnings) {
|
|
2483
2480
|
warningMessages.push(w);
|
|
2484
|
-
logger.warn(` [warn] ${w}`);
|
|
2481
|
+
logger.warn(` [warn] ${source}${w}`);
|
|
2485
2482
|
}
|
|
2486
2483
|
|
|
2487
2484
|
// Validate no private vars are set directly
|
|
2488
2485
|
const privateVarErrors = validatePrivateVars(themeDef);
|
|
2489
2486
|
for (const e of privateVarErrors) {
|
|
2490
2487
|
warningMessages.push(e);
|
|
2491
|
-
logger.error(` [error] ${e}`);
|
|
2488
|
+
logger.error(` [error] ${source}${e}`);
|
|
2492
2489
|
}
|
|
2493
2490
|
if (privateVarErrors.length > 0) {
|
|
2494
2491
|
logger.error(
|
|
2495
|
-
`\n ${privateVarErrors.length} private var error(s). Use standard CSS properties instead.`,
|
|
2492
|
+
`\n ${source}${privateVarErrors.length} private var error(s). Use standard CSS properties instead.`,
|
|
2496
2493
|
);
|
|
2497
2494
|
}
|
|
2498
2495
|
|
|
@@ -2731,7 +2728,7 @@ async function themeBuildInternal(
|
|
|
2731
2728
|
for (const message of droppedDeclarations) {
|
|
2732
2729
|
const w = `Declaration ${message}. The generated CSS omits it; fix the value in the theme source.`;
|
|
2733
2730
|
warningMessages.push(w);
|
|
2734
|
-
logger.warn(` [warn] ${w}`);
|
|
2731
|
+
logger.warn(` [warn] ${source}${w}`);
|
|
2735
2732
|
}
|
|
2736
2733
|
const unemittedHeadingTypes = headingTypesWithoutEmittedRule(
|
|
2737
2734
|
customHeadingTypes(themeDef),
|
|
@@ -2753,7 +2750,7 @@ async function themeBuildInternal(
|
|
|
2753
2750
|
);
|
|
2754
2751
|
}
|
|
2755
2752
|
if (cssParts.length === 0) {
|
|
2756
|
-
logger.log(
|
|
2753
|
+
logger.log(`${source}No overrides found; nothing to build.`);
|
|
2757
2754
|
return null;
|
|
2758
2755
|
}
|
|
2759
2756
|
// The data-token defaults are theme-independent and go in @layer
|
|
@@ -2836,6 +2833,7 @@ async function themeBuildInternal(
|
|
|
2836
2833
|
// was left as orphaned half-built output. Stage-then-commit avoids
|
|
2837
2834
|
// that.
|
|
2838
2835
|
const outDir = path.dirname(outPath);
|
|
2836
|
+
const cssDtsPath = `${outPath}.d.ts`;
|
|
2839
2837
|
const jsPath = path.join(outDir, `${baseName}.js`);
|
|
2840
2838
|
const dtsPath = path.join(outDir, `${baseName}.d.ts`);
|
|
2841
2839
|
|
|
@@ -2859,6 +2857,9 @@ async function themeBuildInternal(
|
|
|
2859
2857
|
// importing the theme also loads the custom-variant augmentations.
|
|
2860
2858
|
const cssContent =
|
|
2861
2859
|
generatedHeader(sourceRelative, 'css', buildCommand, versions) + css;
|
|
2860
|
+
const cssDtsContent =
|
|
2861
|
+
generatedHeader(sourceRelative, 'ts', buildCommand, versions) +
|
|
2862
|
+
'export {};\n';
|
|
2862
2863
|
const jsContent =
|
|
2863
2864
|
generatedHeader(sourceRelative, 'js', buildCommand, versions) +
|
|
2864
2865
|
generateBuiltModule(
|
|
@@ -2900,6 +2901,7 @@ async function themeBuildInternal(
|
|
|
2900
2901
|
|
|
2901
2902
|
const writes = [
|
|
2902
2903
|
{dest: outPath, content: cssContent},
|
|
2904
|
+
{dest: cssDtsPath, content: cssDtsContent, allowMissingInCheck: true},
|
|
2903
2905
|
{dest: jsPath, content: jsContent},
|
|
2904
2906
|
{dest: dtsPath, content: dtsContent},
|
|
2905
2907
|
];
|
|
@@ -2933,25 +2935,28 @@ async function themeBuildInternal(
|
|
|
2933
2935
|
name: themeDef.name,
|
|
2934
2936
|
upToDate,
|
|
2935
2937
|
stale,
|
|
2936
|
-
checked: writes
|
|
2938
|
+
checked: checkedBuildOutputs(writes, cwd),
|
|
2937
2939
|
},
|
|
2938
2940
|
};
|
|
2939
2941
|
}
|
|
2940
2942
|
|
|
2941
2943
|
writeBuildOutputs(writes);
|
|
2942
2944
|
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
`
|
|
2946
|
-
);
|
|
2947
|
-
logger.log(` ${size} KB`);
|
|
2948
|
-
logger.log(`[ok] ${path.relative(cwd, jsPath)}`);
|
|
2949
|
-
logger.log(`[ok] ${path.relative(cwd, dtsPath)}`);
|
|
2950
|
-
if (variantDtsPath && variantDecl) {
|
|
2951
|
-
const augCount = (variantDecl.match(/': true;/g) || []).length;
|
|
2945
|
+
if (!report.compact) {
|
|
2946
|
+
logger.log(`\n[ok] ${path.relative(cwd, outPath)}`);
|
|
2947
|
+
logger.log(`[ok] ${path.relative(cwd, cssDtsPath)}`);
|
|
2952
2948
|
logger.log(
|
|
2953
|
-
`
|
|
2949
|
+
` ${tokenCount} token overrides, ${componentCount} component overrides`,
|
|
2954
2950
|
);
|
|
2951
|
+
logger.log(` ${size} KB`);
|
|
2952
|
+
logger.log(`[ok] ${path.relative(cwd, jsPath)}`);
|
|
2953
|
+
logger.log(`[ok] ${path.relative(cwd, dtsPath)}`);
|
|
2954
|
+
if (variantDtsPath && variantDecl) {
|
|
2955
|
+
const augCount = (variantDecl.match(/': true;/g) || []).length;
|
|
2956
|
+
logger.log(
|
|
2957
|
+
`[ok] ${path.relative(cwd, variantDtsPath)} (${augCount} type augmentations)`,
|
|
2958
|
+
);
|
|
2959
|
+
}
|
|
2955
2960
|
}
|
|
2956
2961
|
|
|
2957
2962
|
const relOutDir = path.relative(cwd, outDir) || '.';
|
|
@@ -2959,25 +2964,6 @@ async function themeBuildInternal(
|
|
|
2959
2964
|
const jsImport = importSpecifier(relOutDir, baseName);
|
|
2960
2965
|
const cssImport = importSpecifier(relOutDir, cssBase) + '.css';
|
|
2961
2966
|
const exportName = `${toIdentifier(baseName)}Theme`;
|
|
2962
|
-
logger.log(`
|
|
2963
|
-
Install in your app (paths are relative to a file in src/; adjust if yours lives elsewhere):
|
|
2964
|
-
|
|
2965
|
-
import { ${exportName} } from '${jsImport}';
|
|
2966
|
-
import '${cssImport}';
|
|
2967
|
-
|
|
2968
|
-
<Theme theme={${exportName}}>
|
|
2969
|
-
<App />
|
|
2970
|
-
</Theme>
|
|
2971
|
-
|
|
2972
|
-
Or with a <link> tag:
|
|
2973
|
-
|
|
2974
|
-
import { ${exportName} } from '${jsImport}';
|
|
2975
|
-
|
|
2976
|
-
<link rel="stylesheet" href="${cssImport}" />
|
|
2977
|
-
<Theme theme={${exportName}}>
|
|
2978
|
-
<App />
|
|
2979
|
-
</Theme>
|
|
2980
|
-
`);
|
|
2981
2967
|
|
|
2982
2968
|
// Fonts the theme names but nothing loads (#5015). Resolved tokens and
|
|
2983
2969
|
// component overrides carry the final font-family values on both load
|
|
@@ -2991,15 +2977,27 @@ Or with a <link> tag:
|
|
|
2991
2977
|
// permanently in violation of its own "compiles with no warnings" guard).
|
|
2992
2978
|
// Adaptation rules are resolved theme writes in their own right, so a family
|
|
2993
2979
|
// named only inside one needs the same notice as one named at the root.
|
|
2980
|
+
/** @type {string[]} */
|
|
2981
|
+
const fontNotices = [];
|
|
2994
2982
|
for (const family of unloadedFonts) {
|
|
2995
2983
|
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)`;
|
|
2996
2984
|
noticeMessages.push(msg);
|
|
2997
|
-
|
|
2998
|
-
}
|
|
2999
|
-
if (unloadedFonts.length > 0) {
|
|
3000
|
-
logger.log(formatFontLoadingHelp(themeDef.name, unloadedFonts));
|
|
2985
|
+
fontNotices.push(msg);
|
|
3001
2986
|
}
|
|
3002
2987
|
|
|
2988
|
+
/** @type {ThemeBuildTrailer} */
|
|
2989
|
+
const trailer = {
|
|
2990
|
+
themeName: themeDef.name,
|
|
2991
|
+
exportName,
|
|
2992
|
+
jsImport,
|
|
2993
|
+
cssImport,
|
|
2994
|
+
unloadedFonts,
|
|
2995
|
+
fontNotices,
|
|
2996
|
+
};
|
|
2997
|
+
// A batch or compact report prints this once for the whole run instead.
|
|
2998
|
+
if (report.trailers) report.trailers.push(trailer);
|
|
2999
|
+
else printBuildTrailer(trailer);
|
|
3000
|
+
|
|
3003
3001
|
return {
|
|
3004
3002
|
type: 'theme.build',
|
|
3005
3003
|
data: {
|
|
@@ -3009,6 +3007,7 @@ Or with a <link> tag:
|
|
|
3009
3007
|
sizeKB: parseFloat(size),
|
|
3010
3008
|
outputs: {
|
|
3011
3009
|
css: path.relative(cwd, outPath),
|
|
3010
|
+
cssDts: path.relative(cwd, cssDtsPath),
|
|
3012
3011
|
js: path.relative(cwd, jsPath),
|
|
3013
3012
|
dts: path.relative(cwd, dtsPath),
|
|
3014
3013
|
...(variantDecl && variantDtsPath
|
|
@@ -3021,6 +3020,166 @@ Or with a <link> tag:
|
|
|
3021
3020
|
};
|
|
3022
3021
|
}
|
|
3023
3022
|
|
|
3023
|
+
/**
|
|
3024
|
+
* What a standalone build prints after its [ok] lines, kept as data so a
|
|
3025
|
+
* batch can print it once for every theme.
|
|
3026
|
+
* @typedef {object} ThemeBuildTrailer
|
|
3027
|
+
* @property {string} themeName The theme's name.
|
|
3028
|
+
* @property {string} exportName The built module's theme export.
|
|
3029
|
+
* @property {string} jsImport Import specifier of the built JS module.
|
|
3030
|
+
* @property {string} cssImport Import specifier of the built CSS.
|
|
3031
|
+
* @property {string[]} unloadedFonts Font families the theme names but does not load.
|
|
3032
|
+
* @property {string[]} fontNotices One notice per unloaded font family.
|
|
3033
|
+
*/
|
|
3034
|
+
|
|
3035
|
+
/**
|
|
3036
|
+
* Print a standalone build's install snippet and font guidance.
|
|
3037
|
+
* @param {ThemeBuildTrailer} trailer
|
|
3038
|
+
*/
|
|
3039
|
+
function printBuildTrailer(trailer) {
|
|
3040
|
+
logger.log(`
|
|
3041
|
+
Install in your app (paths are relative to a file in src/; adjust if yours lives elsewhere):
|
|
3042
|
+
|
|
3043
|
+
import { Theme } from '@astryxdesign/core';
|
|
3044
|
+
import { ${trailer.exportName} } from '${trailer.jsImport}';
|
|
3045
|
+
import '${trailer.cssImport}';
|
|
3046
|
+
|
|
3047
|
+
<Theme theme={${trailer.exportName}}>
|
|
3048
|
+
<App />
|
|
3049
|
+
</Theme>
|
|
3050
|
+
|
|
3051
|
+
Or with a <link> tag:
|
|
3052
|
+
|
|
3053
|
+
import { Theme } from '@astryxdesign/core';
|
|
3054
|
+
import { ${trailer.exportName} } from '${trailer.jsImport}';
|
|
3055
|
+
|
|
3056
|
+
<link rel="stylesheet" href="${trailer.cssImport}" />
|
|
3057
|
+
<Theme theme={${trailer.exportName}}>
|
|
3058
|
+
<App />
|
|
3059
|
+
</Theme>
|
|
3060
|
+
`);
|
|
3061
|
+
for (const msg of trailer.fontNotices) logger.log(` note: ${msg}`);
|
|
3062
|
+
if (trailer.unloadedFonts.length > 0) {
|
|
3063
|
+
logger.log(formatFontLoadingHelp(trailer.themeName, trailer.unloadedFonts));
|
|
3064
|
+
}
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
/**
|
|
3068
|
+
* Print the install snippet and font guidance once for a batch: the first
|
|
3069
|
+
* theme as the full example, one import line per built theme, and one font
|
|
3070
|
+
* recipe naming every family the themes do not load.
|
|
3071
|
+
* @param {ThemeBuildTrailer[]} trailers
|
|
3072
|
+
*/
|
|
3073
|
+
export function printBatchTrailer(trailers) {
|
|
3074
|
+
if (trailers.length === 0) return;
|
|
3075
|
+
const [first] = trailers;
|
|
3076
|
+
logger.log(`
|
|
3077
|
+
Install in your app (paths are relative to a file in src/; adjust if yours lives elsewhere):
|
|
3078
|
+
|
|
3079
|
+
import { Theme } from '@astryxdesign/core';
|
|
3080
|
+
import { ${first.exportName} } from '${first.jsImport}';
|
|
3081
|
+
import '${first.cssImport}';
|
|
3082
|
+
|
|
3083
|
+
<Theme theme={${first.exportName}}>
|
|
3084
|
+
<App />
|
|
3085
|
+
</Theme>
|
|
3086
|
+
|
|
3087
|
+
Or with a <link> tag:
|
|
3088
|
+
|
|
3089
|
+
import { Theme } from '@astryxdesign/core';
|
|
3090
|
+
import { ${first.exportName} } from '${first.jsImport}';
|
|
3091
|
+
|
|
3092
|
+
<link rel="stylesheet" href="${first.cssImport}" />
|
|
3093
|
+
<Theme theme={${first.exportName}}>
|
|
3094
|
+
<App />
|
|
3095
|
+
</Theme>
|
|
3096
|
+
`);
|
|
3097
|
+
if (trailers.length > 1) {
|
|
3098
|
+
logger.log('Each built theme imports the same way:');
|
|
3099
|
+
for (const trailer of trailers) {
|
|
3100
|
+
logger.log(
|
|
3101
|
+
` import { ${trailer.exportName} } from '${trailer.jsImport}'; import '${trailer.cssImport}';`,
|
|
3102
|
+
);
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
const fonts = groupUnloadedFonts(trailers);
|
|
3106
|
+
if (fonts.length > 0) logger.log(formatBatchFontLoadingHelp(fonts));
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
/**
|
|
3110
|
+
* Print what a short report keeps after its one line per theme: one line
|
|
3111
|
+
* naming the fonts the themes do not load, and, when the caller chose no
|
|
3112
|
+
* detail level, where the install example and font recipe are.
|
|
3113
|
+
* @param {ThemeBuildTrailer[]} trailers
|
|
3114
|
+
* @param {{hint?: boolean}} [options]
|
|
3115
|
+
*/
|
|
3116
|
+
export function printCompactTrailer(trailers, {hint = false} = {}) {
|
|
3117
|
+
if (trailers.length === 0) return;
|
|
3118
|
+
const fonts = groupUnloadedFonts(trailers);
|
|
3119
|
+
if (fonts.length > 0) {
|
|
3120
|
+
const named = fonts
|
|
3121
|
+
.map(({family, themes}) =>
|
|
3122
|
+
trailers.length > 1
|
|
3123
|
+
? `"${family}" (${themes.join(', ')})`
|
|
3124
|
+
: `"${family}"`,
|
|
3125
|
+
)
|
|
3126
|
+
.join(', ');
|
|
3127
|
+
logger.log(
|
|
3128
|
+
`[note] Fonts named but not loaded: ${named}. Load them in your app (recipe: astryx docs typography).`,
|
|
3129
|
+
);
|
|
3130
|
+
}
|
|
3131
|
+
if (hint) {
|
|
3132
|
+
logger.log(
|
|
3133
|
+
'Run with --detail full for the install example and font recipe.',
|
|
3134
|
+
);
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
/**
|
|
3139
|
+
* Each font family the themes name but do not load, with the themes that
|
|
3140
|
+
* name it, in first-seen order.
|
|
3141
|
+
* @param {ThemeBuildTrailer[]} trailers
|
|
3142
|
+
* @returns {Array<{family: string, themes: string[]}>}
|
|
3143
|
+
*/
|
|
3144
|
+
function groupUnloadedFonts(trailers) {
|
|
3145
|
+
/** @type {Map<string, {family: string, themes: string[]}>} */
|
|
3146
|
+
const byFamily = new Map();
|
|
3147
|
+
for (const trailer of trailers) {
|
|
3148
|
+
for (const family of trailer.unloadedFonts) {
|
|
3149
|
+
const key = family.toLowerCase();
|
|
3150
|
+
const entry = byFamily.get(key) ?? {family, themes: []};
|
|
3151
|
+
entry.themes.push(trailer.themeName);
|
|
3152
|
+
byFamily.set(key, entry);
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
return [...byFamily.values()];
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
/**
|
|
3159
|
+
* Build one theme for a batch or compact CLI report. Same build, outputs, and
|
|
3160
|
+
* receipt as {@link themeBuild}; the install snippet and font guidance come
|
|
3161
|
+
* back as `trailer` instead of being printed, and `compact` leaves out the
|
|
3162
|
+
* per-file progress lines. CLI-internal: not exported from the API entry.
|
|
3163
|
+
* @param {string} file
|
|
3164
|
+
* @param {{out?: string, check?: boolean, iconsSpecifier?: string}} [options]
|
|
3165
|
+
* @param {{cwd?: string}} [ctx]
|
|
3166
|
+
* @param {{compact?: boolean}} [report]
|
|
3167
|
+
* @returns {Promise<{receipt: import('../theme.type.mjs').ThemeBuildResponse | import('../theme.type.mjs').ThemeBuildCheckResponse | null, trailer: ThemeBuildTrailer | null}>}
|
|
3168
|
+
*/
|
|
3169
|
+
export async function themeBuildForReport(
|
|
3170
|
+
file,
|
|
3171
|
+
options = {},
|
|
3172
|
+
ctx = {},
|
|
3173
|
+
{compact = false} = {},
|
|
3174
|
+
) {
|
|
3175
|
+
/** @type {ThemeBuildTrailer[]} */
|
|
3176
|
+
const trailers = [];
|
|
3177
|
+
const receipt = /** @type {any} */ (
|
|
3178
|
+
await themeBuildInternal(file, options, ctx, {compact, trailers})
|
|
3179
|
+
);
|
|
3180
|
+
return {receipt, trailer: trailers[0] ?? null};
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3024
3183
|
/** @param {string} file @param {{out?: string, check?: boolean, iconsSpecifier?: string}} [options] @param {{cwd?: string}} [ctx] @returns {Promise<import('../theme.type.mjs').ThemeBuildResponse | import('../theme.type.mjs').ThemeBuildCheckResponse | null>} */
|
|
3025
3184
|
export async function themeBuild(file, options = {}, ctx = {}) {
|
|
3026
3185
|
return /** @type {any} */ (themeBuildInternal(file, options, ctx));
|
|
@@ -3174,6 +3333,7 @@ export async function themeBuildFamily(
|
|
|
3174
3333
|
const root = members[0];
|
|
3175
3334
|
const outDir = path.dirname(root.filePath);
|
|
3176
3335
|
const outPath = path.join(outDir, `${baseName}.css`);
|
|
3336
|
+
const cssDtsPath = `${outPath}.d.ts`;
|
|
3177
3337
|
const jsPath = path.join(outDir, `${baseName}.js`);
|
|
3178
3338
|
const dtsPath = path.join(outDir, `${baseName}.d.ts`);
|
|
3179
3339
|
const sources = new Set(
|
|
@@ -3183,7 +3343,7 @@ export async function themeBuildFamily(
|
|
|
3183
3343
|
),
|
|
3184
3344
|
),
|
|
3185
3345
|
);
|
|
3186
|
-
const collision = [outPath, jsPath, dtsPath].find(output => {
|
|
3346
|
+
const collision = [outPath, cssDtsPath, jsPath, dtsPath].find(output => {
|
|
3187
3347
|
const candidates = [path.resolve(output)];
|
|
3188
3348
|
if (fs.existsSync(output)) candidates.push(fs.realpathSync(output));
|
|
3189
3349
|
return candidates.some(value => sources.has(value.toLowerCase()));
|
|
@@ -3267,6 +3427,13 @@ export async function themeBuildFamily(
|
|
|
3267
3427
|
generatedHeader(sourceRelative, 'css', buildCommand, root.versions) +
|
|
3268
3428
|
css,
|
|
3269
3429
|
},
|
|
3430
|
+
{
|
|
3431
|
+
dest: cssDtsPath,
|
|
3432
|
+
allowMissingInCheck: true,
|
|
3433
|
+
content:
|
|
3434
|
+
generatedHeader(sourceRelative, 'ts', buildCommand, root.versions) +
|
|
3435
|
+
'export {};\n',
|
|
3436
|
+
},
|
|
3270
3437
|
{
|
|
3271
3438
|
dest: jsPath,
|
|
3272
3439
|
content:
|
|
@@ -3282,6 +3449,7 @@ export async function themeBuildFamily(
|
|
|
3282
3449
|
];
|
|
3283
3450
|
const outputs = {
|
|
3284
3451
|
css: path.relative(cwd, outPath),
|
|
3452
|
+
cssDts: path.relative(cwd, cssDtsPath),
|
|
3285
3453
|
js: path.relative(cwd, jsPath),
|
|
3286
3454
|
dts: path.relative(cwd, dtsPath),
|
|
3287
3455
|
};
|
|
@@ -3309,7 +3477,7 @@ export async function themeBuildFamily(
|
|
|
3309
3477
|
name: root.theme.name,
|
|
3310
3478
|
upToDate,
|
|
3311
3479
|
stale,
|
|
3312
|
-
checked: writes
|
|
3480
|
+
checked: checkedBuildOutputs(writes, cwd),
|
|
3313
3481
|
},
|
|
3314
3482
|
};
|
|
3315
3483
|
}
|
|
@@ -74,11 +74,13 @@ describe('themeBuild() — receipt', () => {
|
|
|
74
74
|
|
|
75
75
|
// Output paths are cwd-relative and derive from the theme name…
|
|
76
76
|
expect(result?.data.outputs.css).toBe('apitheme.css');
|
|
77
|
+
expect(result?.data.outputs.cssDts).toBe('apitheme.css.d.ts');
|
|
77
78
|
expect(result?.data.outputs.js).toBe('apitheme.js');
|
|
78
79
|
expect(result?.data.outputs.dts).toBe('apitheme.d.ts');
|
|
79
80
|
// …and every declared output actually exists on disk.
|
|
80
81
|
for (const rel of [
|
|
81
82
|
result?.data.outputs.css,
|
|
83
|
+
result?.data.outputs.cssDts,
|
|
82
84
|
result?.data.outputs.js,
|
|
83
85
|
result?.data.outputs.dts,
|
|
84
86
|
]) {
|
|
@@ -86,6 +88,9 @@ describe('themeBuild() — receipt', () => {
|
|
|
86
88
|
fs.existsSync(path.join(tmpDir, /** @type {string} */ (rel))),
|
|
87
89
|
).toBe(true);
|
|
88
90
|
}
|
|
91
|
+
expect(
|
|
92
|
+
fs.readFileSync(path.join(tmpDir, 'apitheme.css.d.ts'), 'utf8'),
|
|
93
|
+
).toContain('export {};');
|
|
89
94
|
});
|
|
90
95
|
|
|
91
96
|
it('emits local tokens and preserves enrollment metadata in the built module', async () => {
|
|
@@ -377,6 +382,31 @@ describe('themeBuild() — check mode', () => {
|
|
|
377
382
|
expect(fs.readFileSync(path.join(tmpDir, 'chk.css'), 'utf8')).toBe(before);
|
|
378
383
|
});
|
|
379
384
|
|
|
385
|
+
it('accepts released outputs that do not have a CSS type stub', async () => {
|
|
386
|
+
const themeFile = path.join(tmpDir, 'released.mjs');
|
|
387
|
+
fs.writeFileSync(
|
|
388
|
+
themeFile,
|
|
389
|
+
`export default { name: 'released', tokens: { '--color-bg': '#0a0a0a' } };\n`,
|
|
390
|
+
);
|
|
391
|
+
await themeBuild('released.mjs', {}, {cwd: tmpDir});
|
|
392
|
+
fs.rmSync(path.join(tmpDir, 'released.css.d.ts'));
|
|
393
|
+
|
|
394
|
+
const result = await themeBuild(
|
|
395
|
+
'released.mjs',
|
|
396
|
+
{check: true},
|
|
397
|
+
{cwd: tmpDir},
|
|
398
|
+
);
|
|
399
|
+
|
|
400
|
+
expect(result?.data.upToDate).toBe(true);
|
|
401
|
+
expect(result?.data.stale).toEqual([]);
|
|
402
|
+
expect(result?.data.checked).toEqual([
|
|
403
|
+
'released.css',
|
|
404
|
+
'released.js',
|
|
405
|
+
'released.d.ts',
|
|
406
|
+
]);
|
|
407
|
+
expect(fs.existsSync(path.join(tmpDir, 'released.css.d.ts'))).toBe(false);
|
|
408
|
+
});
|
|
409
|
+
|
|
380
410
|
it('flags a stale output when the committed CSS content drifts from the source', async () => {
|
|
381
411
|
const themeFile = path.join(tmpDir, 'drift.mjs');
|
|
382
412
|
fs.writeFileSync(
|