@astryxdesign/cli 0.7.17-canary.g5a3fd39 → 0.7.17-canary.g5cf5d69
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 +64 -63
- package/api/build/_adapter.d.mts +51 -0
- package/api/build/_adapter.mjs +122 -6
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.mjs +23 -14
- package/api/build/build.type.d.mts +1 -1
- package/api/build/build.type.mjs +3 -3
- package/api/build/help/help.d.mts +15 -14
- package/api/build/help/help.mjs +62 -3
- package/api/build/kit/answer.mjs +2 -3
- package/api/build/kit/signals.d.mts +10 -0
- package/api/build/kit/signals.mjs +15 -2
- package/api/component/detail/blocks/blocks.mjs +2 -1
- package/api/discover/_adapter.d.mts +57 -6
- package/api/discover/_adapter.mjs +278 -49
- package/api/discover/_catalog-view.d.mts +7 -0
- package/api/discover/_catalog-view.mjs +10 -1
- package/api/discover/detail/detail.d.mts +3 -2
- package/api/discover/detail/detail.mjs +3 -2
- package/api/discover/detail/doc/doc.mjs +1 -1
- package/api/discover/discover.d.mts +24 -0
- package/api/discover/discover.doc.mjs +1 -1
- package/api/discover/discover.mjs +146 -25
- package/api/discover/discover.type.d.mts +6 -4
- package/api/discover/discover.type.mjs +6 -4
- package/api/discover/search/search.d.mts +22 -0
- package/api/discover/search/search.mjs +290 -70
- package/api/docs/_entry-names.mjs +4 -3
- package/api/doctor/_adapter.d.mts +43 -3
- package/api/doctor/_adapter.mjs +142 -18
- package/api/doctor/built-checks.d.mts +30 -3
- package/api/doctor/built-checks.mjs +132 -5
- package/api/doctor/doctor.d.mts +93 -6
- package/api/doctor/doctor.doc.mjs +2 -2
- package/api/doctor/doctor.mjs +524 -33
- package/api/doctor/doctor.type.d.mts +2 -1
- package/api/doctor/doctor.type.mjs +2 -1
- package/api/doctor/theme-checks.d.mts +19 -0
- package/api/doctor/theme-checks.mjs +74 -6
- package/api/hook/hook.type.d.mts +1 -1
- package/api/hook/hook.type.mjs +1 -1
- package/api/hook/list/list.mjs +11 -7
- package/api/icon/_adapter.d.mts +2 -1
- package/api/icon/_adapter.mjs +10 -15
- package/api/icon/_records.d.mts +3 -1
- package/api/icon/_records.mjs +30 -3
- package/api/icon/exportIconIndex.doc.mjs +1 -1
- package/api/icon/icon.doc.mjs +3 -3
- package/api/icon/icon.type.d.mts +32 -1
- package/api/icon/icon.type.mjs +19 -3
- package/api/icon/list/list.mjs +4 -1
- package/api/icon/rankIconIndex.doc.mjs +1 -1
- package/api/icon/search/icon-index.mjs +18 -8
- package/api/icon/search/search.d.mts +26 -3
- package/api/icon/search/search.mjs +155 -9
- package/api/init/_adapter.d.mts +14 -0
- package/api/init/_adapter.mjs +26 -4
- package/api/init/init.d.mts +1 -1
- package/api/init/init.doc.mjs +2 -2
- package/api/init/init.mjs +1 -1
- package/api/init/init.type.d.mts +29 -1
- package/api/init/init.type.mjs +14 -1
- package/api/init/run/run.d.mts +11 -1
- package/api/init/run/run.mjs +84 -5
- package/api/integration/_adapter.d.mts +5 -4
- package/api/integration/_adapter.mjs +7 -5
- package/api/integration/integrationCheck.doc.mjs +1 -1
- package/api/integration/pack-check.mjs +8 -9
- package/api/integration/validate-integration.d.mts +1 -1
- package/api/integration/validate-integration.mjs +26 -24
- package/api/integration/validate-integration.type.d.mts +5 -2
- package/api/integration/validate-integration.type.mjs +5 -2
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.d.mts +4 -2
- package/api/render/_adapter.mjs +62 -21
- package/api/render/render.doc.mjs +8 -5
- package/api/render/render.mjs +1 -1
- package/api/render/render.type.d.mts +2 -0
- package/api/render/render.type.mjs +2 -0
- package/api/search/ORDERING.md +2 -2
- package/api/search/_candidate-score.d.mts +3 -0
- package/api/search/_candidate-score.mjs +36 -3
- package/api/search/_gather-docs.mjs +29 -2
- package/api/search/_gather-templates.mjs +2 -1
- package/api/search/_main-searcher.mjs +13 -0
- package/api/search/_named-keywords.d.mts +2 -1
- package/api/search/_named-keywords.mjs +48 -6
- package/api/search/_order.d.mts +36 -1
- package/api/search/_order.mjs +141 -3
- package/api/swizzle/list/list.mjs +8 -1
- package/api/swizzle/swizzle.type.d.mts +1 -1
- package/api/swizzle/swizzle.type.mjs +1 -1
- package/api/template/copy/copy.mjs +3 -4
- package/api/template/list/list.mjs +2 -1
- package/api/template/show/show.mjs +2 -1
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +19 -1
- package/api/template/template.type.d.mts +1 -0
- package/api/template/template.type.mjs +2 -1
- package/api/theme/_adapter.d.mts +1 -0
- package/api/theme/_adapter.mjs +3 -5
- package/api/theme/_app-provider.d.mts +42 -0
- package/api/theme/_app-provider.mjs +61 -27
- package/api/theme/build/build.d.mts +4 -10
- package/api/theme/build/build.mjs +165 -116
- package/api/theme/build/input-fields.d.mts +9 -0
- package/api/theme/build/input-fields.mjs +155 -16
- package/api/theme/build/radius-values.d.mts +18 -0
- package/api/theme/build/radius-values.mjs +76 -0
- package/api/theme/build/typography-values.mjs +7 -23
- package/api/theme/build/written-values.d.mts +18 -0
- package/api/theme/build/written-values.mjs +107 -31
- package/api/theme/eject/eject.mjs +6 -1
- package/api/theme/palette/generate/generator.mjs +24 -0
- package/api/theme/theme.type.d.mts +4 -2
- package/api/theme/theme.type.mjs +3 -2
- package/api/theme/themeBuild.doc.mjs +2 -2
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme-edit/_catalog.d.mts +40 -0
- package/api/theme-edit/_catalog.mjs +100 -22
- package/api/theme-edit/_check.mjs +213 -43
- package/api/theme-edit/_color.d.mts +14 -0
- package/api/theme-edit/_color.mjs +22 -0
- package/api/theme-edit/_compiler.mjs +52 -0
- package/api/theme-edit/_context.d.mts +20 -2
- package/api/theme-edit/_context.mjs +157 -29
- package/api/theme-edit/_edit.mjs +426 -58
- package/api/theme-edit/_how-question.d.mts +14 -0
- package/api/theme-edit/_how-question.mjs +1541 -127
- package/api/theme-edit/_how.mjs +43 -0
- package/api/theme-edit/_missed.mjs +107 -27
- package/api/theme-edit/_normal.d.mts +18 -4
- package/api/theme-edit/_normal.mjs +84 -3
- package/api/theme-edit/_palette.d.mts +9 -0
- package/api/theme-edit/_palette.mjs +158 -33
- package/api/theme-edit/_part-words.mjs +16 -3
- package/api/theme-edit/_parts.d.mts +8 -0
- package/api/theme-edit/_parts.mjs +120 -36
- package/api/theme-edit/_png.d.mts +24 -0
- package/api/theme-edit/_png.mjs +99 -0
- package/api/theme-edit/_preview-app.d.mts +16 -0
- package/api/theme-edit/_preview-app.mjs +52 -18
- package/api/theme-edit/_preview.d.mts +44 -26
- package/api/theme-edit/_preview.mjs +255 -67
- package/api/theme-edit/_project.d.mts +12 -1
- package/api/theme-edit/_project.mjs +16 -1
- package/api/theme-edit/_settings.d.mts +116 -0
- package/api/theme-edit/_settings.mjs +1197 -58
- package/api/theme-edit/_tables.d.mts +16 -0
- package/api/theme-edit/_tables.mjs +34 -4
- package/api/theme-edit/theme-edit.type.d.mts +15 -2
- package/api/theme-edit/theme-edit.type.mjs +8 -6
- package/api/upgrade/_adapter.d.mts +46 -7
- package/api/upgrade/_adapter.mjs +110 -15
- package/api/upgrade/registry/registry.d.mts +6 -3
- package/api/upgrade/registry/registry.mjs +21 -6
- package/api/upgrade/run/run.mjs +23 -11
- package/api/upgrade/upgrade.doc.mjs +4 -3
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/tree/agent-guidance.doc.mjs +3 -2
- package/assets/docs/tree/checks.doc.mjs +2 -2
- package/assets/docs/tree/host-entry.doc.mjs +4 -0
- package/assets/docs/tree/icon-definitions.doc.mjs +3 -3
- package/assets/docs/tree/icon-sets.doc.mjs +6 -6
- package/assets/docs/tree/problems.doc.mjs +3 -3
- package/assets/docs/tree/render-pages.doc.mjs +17 -3
- package/assets/docs/tree/share-a-page.doc.mjs +5 -5
- package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
- package/assets/docs/tree/troubleshooting.doc.mjs +8 -0
- package/assets/docs/tree/updates.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +40 -5
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/installed-icon-set.doc.mjs +30 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +6 -1
- package/assets/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +3 -1
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +6 -2
- package/assets/templates/pages/ai-chat-landing/page.tsx +1 -1
- package/assets/templates/pages/blank/page.tsx +4 -2
- package/assets/templates/pages/canvas-editor/page.tsx +3 -1
- package/assets/templates/pages/centered-hero/page.tsx +1 -1
- package/assets/templates/pages/checkout-wizard/page.tsx +1 -1
- package/assets/templates/pages/classic-gallery/page.tsx +1 -1
- package/assets/templates/pages/contact-form/page.tsx +2 -2
- package/assets/templates/pages/course-detail/page.tsx +1 -1
- package/assets/templates/pages/dashboard/page.tsx +24 -8
- package/assets/templates/pages/dashboard-alert-rail/page.tsx +4 -2
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +7 -3
- package/assets/templates/pages/dashboard-comparison/page.tsx +5 -2
- package/assets/templates/pages/dashboard-composition/page.tsx +10 -4
- package/assets/templates/pages/dashboard-progress/page.tsx +6 -3
- package/assets/templates/pages/dashboard-scorecard/page.tsx +17 -8
- package/assets/templates/pages/detail-page/page.tsx +22 -5
- package/assets/templates/pages/documentation/page.tsx +4 -2
- package/assets/templates/pages/documentation-design/page.tsx +5 -2
- package/assets/templates/pages/documentation-technical/page.tsx +4 -2
- package/assets/templates/pages/editor/page.tsx +28 -9
- package/assets/templates/pages/file-explorer/page.tsx +3 -1
- package/assets/templates/pages/form-two-column/page.tsx +1 -1
- package/assets/templates/pages/form-wizard/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-dialog/page.tsx +3 -1
- package/assets/templates/pages/form-wizard-inline/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
- package/assets/templates/pages/gallery-hero/page.tsx +1 -1
- package/assets/templates/pages/ide/page.tsx +7 -2
- package/assets/templates/pages/kanban-board/page.tsx +10 -4
- package/assets/templates/pages/library/page.tsx +31 -61
- package/assets/templates/pages/login/page.tsx +4 -2
- package/assets/templates/pages/login-card/page.tsx +4 -2
- package/assets/templates/pages/login-split/page.tsx +3 -2
- package/assets/templates/pages/login-sso/page.tsx +4 -4
- package/assets/templates/pages/mixed-gallery/page.tsx +1 -1
- package/assets/templates/pages/payment-form/page.tsx +1 -1
- package/assets/templates/pages/product-detail/page.tsx +16 -4
- package/assets/templates/pages/product-gallery/page.tsx +1 -1
- package/assets/templates/pages/settings/page.tsx +10 -4
- package/assets/templates/pages/settings-dialog/page.tsx +5 -6
- package/assets/templates/pages/settings-sidebar/page.tsx +39 -13
- package/assets/templates/pages/side-gallery/page.tsx +1 -1
- package/assets/templates/pages/table/page.tsx +2 -2
- package/assets/templates/pages/table-filter/page.tsx +21 -6
- package/assets/templates/pages/table-grouped/page.tsx +23 -2
- package/assets/templates/pages/table-inbox/page.tsx +82 -32
- package/assets/templates/pages/theme-showcase/page.tsx +3 -2
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +12 -12
- package/assets/templates/themes/butter/butterTheme.ts +197 -4
- package/assets/templates/themes/chocolate/chocolateTheme.ts +72 -8
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +3 -3
- package/assets/templates/themes/gothic/gothicTheme.ts +114 -4
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +8 -8
- package/assets/templates/themes/matcha/matchaTheme.ts +48 -12
- package/assets/templates/themes/neutral/neutralTheme.ts +29 -0
- package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +2 -2
- package/assets/templates/themes/stone/stoneTheme.ts +69 -0
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +9 -9
- package/assets/templates/themes/y2k/y2kTheme.ts +249 -14
- package/authoring/codemod/parse.d.mts +0 -36
- package/authoring/codemod/parse.mjs +62 -41
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/config/parse.d.mts +0 -47
- package/authoring/config/parse.mjs +128 -103
- package/authoring/config/type.ts +4 -3
- package/authoring/debug/parse.d.mts +2 -2
- package/authoring/discover/parse.d.mts +2 -2
- package/authoring/discover/parse.mjs +52 -38
- package/authoring/discover/type.ts +2 -1
- package/authoring/doctypes/_schema.d.mts +834 -950
- package/authoring/doctypes/_schema.mjs +863 -825
- package/authoring/doctypes/command/parse.mjs +2 -2
- package/authoring/doctypes/component/parse.mjs +2 -2
- package/authoring/doctypes/enum/parse.mjs +2 -2
- package/authoring/doctypes/hook/parse.mjs +2 -2
- package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +1 -1
- package/authoring/doctypes/icon-definition/parse.d.mts +0 -24
- package/authoring/doctypes/icon-definition/parse.mjs +59 -43
- package/authoring/doctypes/icon-set/parse.d.mts +0 -75
- package/authoring/doctypes/icon-set/parse.mjs +239 -210
- package/authoring/doctypes/legacy.mjs +3 -3
- package/authoring/doctypes/namespace/parse.mjs +2 -2
- package/authoring/doctypes/reference/parse.mjs +2 -2
- package/authoring/doctypes/schema/parse.mjs +2 -2
- package/authoring/doctypes/template/parse.d.mts +0 -101
- package/authoring/doctypes/template/parse.mjs +131 -106
- package/authoring/doctypes/theme/parse.d.mts +0 -23
- package/authoring/doctypes/theme/parse.mjs +52 -36
- package/authoring/gap-report/parse.d.mts +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +14 -3
- package/authoring/integration/schema.mjs +20 -2
- package/authoring/integration/type.ts +14 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/build.mjs +27 -13
- package/clients/cli/commands/component.mjs +14 -3
- package/clients/cli/commands/discover.doc.mjs +2 -2
- package/clients/cli/commands/discover.mjs +20 -3
- package/clients/cli/commands/docs.doc.mjs +11 -9
- package/clients/cli/commands/docs.mjs +50 -21
- package/clients/cli/commands/experimental/icon.mjs +330 -227
- package/clients/cli/commands/experimental/render.mjs +16 -1
- package/clients/cli/commands/experimental/theme.mjs +42 -17
- package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-map.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-render.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/init.doc.mjs +36 -24
- package/clients/cli/commands/integration-check.doc.mjs +1 -1
- package/clients/cli/commands/mcp.doc.mjs +53 -0
- package/clients/cli/commands/mcp.mjs +51 -0
- package/clients/cli/commands/search.mjs +46 -9
- package/clients/cli/commands/template.mjs +3 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +12 -2
- package/clients/cli/commands/upgrade.doc.mjs +3 -2
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/formatters/index.mjs +52 -6
- package/clients/cli/index.mjs +23 -17
- package/clients/cli/lib/base-gate.mjs +37 -5
- package/clients/cli/lib/define-command.mjs +82 -4
- package/clients/cli/lib/json-shim.mjs +61 -4
- package/clients/cli/lib/manifest.mjs +9 -1
- package/clients/cli/lib/mcp-server.mjs +286 -0
- package/clients/cli/lib/mcp-tools.mjs +405 -0
- package/clients/cli/lib/other-cli-words.mjs +99 -0
- package/clients/cli/lib/stray-option.mjs +27 -1
- package/clients/cli/lib/unknown-command.mjs +326 -11
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +49 -1
- package/foundation/agent-docs/agent-docs.mjs +108 -7
- package/foundation/agent-docs/computer-agent-text.mjs +1 -1
- package/foundation/bases/core.d.mts +1 -1
- package/foundation/bases/core.mjs +3 -3
- package/foundation/bases/resolve.d.mts +4 -8
- package/foundation/bases/resolve.mjs +15 -21
- package/foundation/bases/state.d.mts +15 -9
- package/foundation/bases/state.mjs +33 -6
- package/foundation/config/project.d.mts +5 -4
- package/foundation/config/project.mjs +33 -17
- package/foundation/discovery/component-discovery.mjs +15 -28
- package/foundation/discovery/icon-imports.d.mts +66 -0
- package/foundation/discovery/icon-imports.mjs +225 -0
- package/foundation/discovery/icon-ranking.d.mts +12 -2
- package/foundation/discovery/icon-ranking.mjs +197 -10
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.d.mts +28 -0
- package/foundation/discovery/icon-set-discovery.mjs +42 -0
- package/foundation/discovery/icon-set-writer.d.mts +2 -11
- package/foundation/discovery/icon-set-writer.mjs +3 -29
- package/foundation/discovery/module-exports.d.mts +1 -1
- package/foundation/discovery/module-exports.mjs +136 -33
- package/foundation/discovery/name-roots.d.mts +5 -0
- package/foundation/discovery/name-roots.mjs +11 -0
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/runner-commands.mjs +1 -0
- package/foundation/discovery/template-adapter.d.mts +1 -1
- package/foundation/discovery/template-destination.d.mts +14 -6
- package/foundation/discovery/template-destination.mjs +42 -8
- package/foundation/discovery/template-icons.d.mts +45 -2
- package/foundation/discovery/template-icons.mjs +26 -54
- package/foundation/discovery/template-needs.d.mts +28 -2
- package/foundation/discovery/template-needs.mjs +92 -11
- package/foundation/discovery/theme-discovery.d.mts +8 -0
- package/foundation/discovery/theme-discovery.mjs +23 -6
- package/foundation/discovery/theme-imports.mjs +2 -4
- package/foundation/doc-compiler/parse-readable.mjs +4 -3
- package/foundation/doc-compiler/stored-docs.d.mts +13 -0
- package/foundation/doc-compiler/stored-docs.mjs +74 -3
- package/foundation/env/cli-command.d.mts +68 -10
- package/foundation/env/cli-command.mjs +116 -22
- package/foundation/env/project-scope.d.mts +9 -0
- package/foundation/env/project-scope.mjs +28 -2
- package/foundation/fs/gather-cache.d.mts +23 -0
- package/foundation/fs/gather-cache.mjs +94 -2
- package/foundation/fs/module-loader.d.mts +3 -1
- package/foundation/fs/module-loader.mjs +85 -5
- package/foundation/fs/read-record.mjs +9 -5
- package/foundation/identity/package-names.d.mts +18 -0
- package/foundation/identity/package-names.mjs +19 -0
- package/foundation/identity/providers.mjs +3 -2
- package/foundation/integrations/icon-features.d.mts +63 -0
- package/foundation/integrations/icon-features.mjs +54 -0
- package/foundation/integrations/integrations.d.mts +13 -1
- package/foundation/integrations/integrations.mjs +47 -6
- package/foundation/integrations/pack-state.d.mts +21 -0
- package/foundation/integrations/pack-state.mjs +42 -19
- package/foundation/integrations/validate-contributions.d.mts +11 -3
- package/foundation/integrations/validate-contributions.mjs +51 -13
- package/foundation/release/cache.d.mts +13 -1
- package/foundation/release/cache.mjs +94 -14
- package/foundation/release/notices.d.mts +15 -0
- package/foundation/release/notices.mjs +111 -7
- package/foundation/release/project.d.mts +3 -4
- package/foundation/release/project.mjs +5 -6
- package/foundation/render/client-bundle.d.mts +126 -0
- package/foundation/render/client-bundle.mjs +565 -0
- package/foundation/render/cut-short.d.mts +7 -1
- package/foundation/render/cut-short.mjs +46 -6
- package/foundation/render/embedded-imports.d.mts +4 -3
- package/foundation/render/embedded-imports.mjs +13 -8
- package/foundation/render/esbuild-dependency.d.mts +14 -0
- package/foundation/render/esbuild-dependency.mjs +41 -0
- package/foundation/render/file-header.mjs +5 -4
- package/foundation/render/page-worker.mjs +562 -86
- package/foundation/render/picture-chrome.mjs +54 -29
- package/foundation/render/picture-playwright.mjs +78 -42
- package/foundation/render/picture-window.d.mts +33 -0
- package/foundation/render/picture-window.mjs +78 -0
- package/foundation/render/render-page.d.mts +55 -4
- package/foundation/render/render-page.mjs +199 -28
- package/foundation/render/restore-folder.d.mts +13 -0
- package/foundation/render/restore-folder.mjs +30 -0
- package/foundation/render/served-packages.d.mts +2 -1
- package/foundation/render/served-packages.mjs +5 -3
- package/foundation/render/ts-paths.d.mts +11 -0
- package/foundation/render/ts-paths.mjs +27 -2
- package/foundation/render/value-uses.d.mts +43 -0
- package/foundation/render/value-uses.mjs +110 -0
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.doc.mjs +7 -1
- package/foundation/response/error-codes.mjs +10 -2
- package/foundation/response/response-types.doc.mjs +12 -12
- package/foundation/runtime/package-root.d.mts +8 -0
- package/foundation/runtime/package-root.mjs +20 -0
- package/foundation/suggest/other-command.d.mts +11 -0
- package/foundation/suggest/other-command.mjs +1 -1
- package/foundation/text/icon-id.d.mts +20 -0
- package/foundation/text/icon-id.mjs +40 -0
- package/foundation/text/icon-set-next.d.mts +25 -0
- package/foundation/text/icon-set-next.mjs +29 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +7 -6
|
@@ -163,6 +163,32 @@ export function iconUseCommand(main: string, backups: readonly string[], variant
|
|
|
163
163
|
* @returns {string | null}
|
|
164
164
|
*/
|
|
165
165
|
export function iconSetLook(set: DiscoveredIconSet, variant: string): string | null;
|
|
166
|
+
/**
|
|
167
|
+
* The export that draws an icon in a look: the icon's variant of that name
|
|
168
|
+
* when it has one, else its own export, which draws the set's default look.
|
|
169
|
+
* Template mapping and `experimental icon <words>` both use it.
|
|
170
|
+
* @param {IconSetIcon} icon
|
|
171
|
+
* @param {DiscoveredIconSet} set
|
|
172
|
+
* @param {string | undefined} variant the look asked for
|
|
173
|
+
* @returns {{module: string, export: string}}
|
|
174
|
+
*/
|
|
175
|
+
export function iconLookExport(icon: IconSetIcon, set: DiscoveredIconSet, variant: string | undefined): {
|
|
176
|
+
module: string;
|
|
177
|
+
export: string;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* What an icon draws when it does not have the look asked for: that look,
|
|
181
|
+
* and the set's default look it draws instead (null for a set with one
|
|
182
|
+
* look). Undefined when the icon has the look, or when none is asked for.
|
|
183
|
+
* @param {IconSetIcon} icon
|
|
184
|
+
* @param {DiscoveredIconSet} set
|
|
185
|
+
* @param {string | undefined} variant the look asked for
|
|
186
|
+
* @returns {{asked: string, used: string | null} | undefined}
|
|
187
|
+
*/
|
|
188
|
+
export function missingIconLook(icon: IconSetIcon, set: DiscoveredIconSet, variant: string | undefined): {
|
|
189
|
+
asked: string;
|
|
190
|
+
used: string | null;
|
|
191
|
+
} | undefined;
|
|
166
192
|
/**
|
|
167
193
|
* Installed sets the project's list leaves out: the problem, and the fix that
|
|
168
194
|
* adds them as backups after the list's own, keeping the project's look.
|
|
@@ -224,6 +250,8 @@ export function iconSetKey(set: {
|
|
|
224
250
|
* @returns {DiscoveredIconSet[]}
|
|
225
251
|
*/
|
|
226
252
|
export function orderIconSets(sets: DiscoveredIconSet[], choice: IconSetChoice): DiscoveredIconSet[];
|
|
253
|
+
/** The name every icon export has (the icon export contract): `<Name>Icon`. */
|
|
254
|
+
export const ICON_EXPORT_NAME_RE: RegExp;
|
|
227
255
|
/** A license or notice file a set ships beside its data (FR15). */
|
|
228
256
|
export const NOTICE_FILE_RE: RegExp;
|
|
229
257
|
/** The command that chooses a main set and backups, as the CLI prints it. */
|
|
@@ -41,6 +41,9 @@ import {compareText} from '../text/compare-text.mjs';
|
|
|
41
41
|
|
|
42
42
|
const SET_NAME_RE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
|
|
43
43
|
|
|
44
|
+
/** The name every icon export has (the icon export contract): `<Name>Icon`. */
|
|
45
|
+
export const ICON_EXPORT_NAME_RE = /^[A-Z][A-Za-z0-9]*Icon$/u;
|
|
46
|
+
|
|
44
47
|
/** A license or notice file a set ships beside its data (FR15). */
|
|
45
48
|
export const NOTICE_FILE_RE = /^(?:licen[cs]e|notice|copying)(?:[.-].*)?$/iu;
|
|
46
49
|
|
|
@@ -505,6 +508,45 @@ export function iconSetLook(set, variant) {
|
|
|
505
508
|
: (set.data.default?.variant ?? null);
|
|
506
509
|
}
|
|
507
510
|
|
|
511
|
+
/**
|
|
512
|
+
* The export that draws an icon in a look: the icon's variant of that name
|
|
513
|
+
* when it has one, else its own export, which draws the set's default look.
|
|
514
|
+
* Template mapping and `experimental icon <words>` both use it.
|
|
515
|
+
* @param {IconSetIcon} icon
|
|
516
|
+
* @param {DiscoveredIconSet} set
|
|
517
|
+
* @param {string | undefined} variant the look asked for
|
|
518
|
+
* @returns {{module: string, export: string}}
|
|
519
|
+
*/
|
|
520
|
+
export function iconLookExport(icon, set, variant) {
|
|
521
|
+
const module = icon.module ?? set.data.module;
|
|
522
|
+
if (variant && variant !== set.data.default?.variant) {
|
|
523
|
+
const entry = (icon.variants ?? []).find(each => each.variant === variant);
|
|
524
|
+
if (entry) {
|
|
525
|
+
return {module: entry.module ?? module, export: entry.export};
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return {module, export: icon.export};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* What an icon draws when it does not have the look asked for: that look,
|
|
533
|
+
* and the set's default look it draws instead (null for a set with one
|
|
534
|
+
* look). Undefined when the icon has the look, or when none is asked for.
|
|
535
|
+
* @param {IconSetIcon} icon
|
|
536
|
+
* @param {DiscoveredIconSet} set
|
|
537
|
+
* @param {string | undefined} variant the look asked for
|
|
538
|
+
* @returns {{asked: string, used: string | null} | undefined}
|
|
539
|
+
*/
|
|
540
|
+
export function missingIconLook(icon, set, variant) {
|
|
541
|
+
if (!variant) return undefined;
|
|
542
|
+
const fallback = set.data.default?.variant ?? null;
|
|
543
|
+
if (variant === fallback) return undefined;
|
|
544
|
+
if ((icon.variants ?? []).some(each => each.variant === variant)) {
|
|
545
|
+
return undefined;
|
|
546
|
+
}
|
|
547
|
+
return {asked: variant, used: fallback};
|
|
548
|
+
}
|
|
549
|
+
|
|
508
550
|
/**
|
|
509
551
|
* Installed sets the project's list leaves out: the problem, and the fix that
|
|
510
552
|
* adds them as backups after the list's own, keeping the project's look.
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* `XMarkIcon` → `x-mark`; `Trash2` → `trash-2`; `ArrowUpDown` →
|
|
6
|
-
* `arrow-up-down`; `Squares2X2Icon` and `Grid2x2` → `squares-2x2`,
|
|
7
|
-
* `grid-2x2`: an icon id from an export name. A dimension (a digit, `x` or
|
|
8
|
-
* `X`, a digit) stays one word.
|
|
9
|
-
* @param {string} name
|
|
10
|
-
*/
|
|
11
|
-
export function iconIdOf(name: string): string;
|
|
12
4
|
/**
|
|
13
5
|
* The name an icon set exports an icon as: PascalCase ending in `Icon`
|
|
14
6
|
* (`Trash2` → `Trash2Icon`; `TrashIcon` stays). A JavaScript name cannot
|
|
@@ -634,8 +626,6 @@ export function iconsWithWord(set: {
|
|
|
634
626
|
* @returns {string | null}
|
|
635
627
|
*/
|
|
636
628
|
export function localSourceNote(packageDir: string, module: string): string | null;
|
|
637
|
-
/** @typedef {import('./icon-set-discovery.mjs').DiscoveredIconSet} DiscoveredIconSet */
|
|
638
|
-
/** @typedef {import('../../authoring/doctypes/icon-set/type').IconSetData} IconSetData */
|
|
639
629
|
/**
|
|
640
630
|
* An authoring error with an ERR_* code and suggestions.
|
|
641
631
|
*/
|
|
@@ -740,5 +730,6 @@ export type GeneratedIcon = {
|
|
|
740
730
|
adapt: boolean;
|
|
741
731
|
};
|
|
742
732
|
import { generatedTypesPath } from './icon-set-paths.mjs';
|
|
733
|
+
import { iconIdOf } from '../text/icon-id.mjs';
|
|
743
734
|
import { THEME_MAP_NAME } from './icon-set-theme-maps.mjs';
|
|
744
|
-
export { generatedTypesPath, THEME_MAP_NAME };
|
|
735
|
+
export { generatedTypesPath, iconIdOf, THEME_MAP_NAME };
|
|
@@ -56,10 +56,13 @@ import {
|
|
|
56
56
|
moduleExportOrigin,
|
|
57
57
|
staticExportBindings,
|
|
58
58
|
} from './module-exports.mjs';
|
|
59
|
+
import {iconIdOf} from '../text/icon-id.mjs';
|
|
59
60
|
|
|
60
61
|
/** @typedef {import('./icon-set-discovery.mjs').DiscoveredIconSet} DiscoveredIconSet */
|
|
61
62
|
/** @typedef {import('../../authoring/doctypes/icon-set/type').IconSetData} IconSetData */
|
|
62
63
|
|
|
64
|
+
export {iconIdOf};
|
|
65
|
+
|
|
63
66
|
/**
|
|
64
67
|
* An authoring error with an ERR_* code and suggestions.
|
|
65
68
|
*/
|
|
@@ -76,35 +79,6 @@ export class IconSetAuthoringError extends Error {
|
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
/**
|
|
80
|
-
* `XMarkIcon` → `x-mark`; `Trash2` → `trash-2`; `ArrowUpDown` →
|
|
81
|
-
* `arrow-up-down`; `Squares2X2Icon` and `Grid2x2` → `squares-2x2`,
|
|
82
|
-
* `grid-2x2`: an icon id from an export name. A dimension (a digit, `x` or
|
|
83
|
-
* `X`, a digit) stays one word.
|
|
84
|
-
* @param {string} name
|
|
85
|
-
*/
|
|
86
|
-
export function iconIdOf(name) {
|
|
87
|
-
return (
|
|
88
|
-
name
|
|
89
|
-
.replace(/Icon$/u, '')
|
|
90
|
-
// `2X2` and `2x2` are one word: lower the x first.
|
|
91
|
-
.replace(/([0-9])[xX](?=[0-9])/gu, '$1x')
|
|
92
|
-
// A one-letter word before a digit ends there: `CalendarX2` is
|
|
93
|
-
// `calendar-x-2`, as its library names it.
|
|
94
|
-
.replace(/([a-z][A-Z])(?=[0-9])/gu, '$1-')
|
|
95
|
-
// A lower-case letter before a capital or a digit ends a word, except
|
|
96
|
-
// the x inside a dimension.
|
|
97
|
-
.replace(/([a-z])(?=[A-Z0-9])/gu, (match, letter, offset, whole) =>
|
|
98
|
-
letter === 'x' && /[0-9]/u.test(whole[offset - 1] ?? '')
|
|
99
|
-
? letter
|
|
100
|
-
: `${letter}-`,
|
|
101
|
-
)
|
|
102
|
-
.replace(/([0-9])([A-Z])/gu, '$1-$2')
|
|
103
|
-
.replace(/([A-Z])([A-Z][a-z])/gu, '$1-$2')
|
|
104
|
-
.toLowerCase()
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
82
|
/**
|
|
109
83
|
* The name an icon set exports an icon as: PascalCase ending in `Icon`
|
|
110
84
|
* (`Trash2` → `Trash2Icon`; `TrashIcon` stays). A JavaScript name cannot
|
|
@@ -96,7 +96,7 @@ export function moduleExportOrigins(file: string, { types, memo }?: {
|
|
|
96
96
|
* only when every export the module writes was read and none binds it, and
|
|
97
97
|
* `unknown`, with the first reason, when some export could not be read: a
|
|
98
98
|
* re-export from another package or from a specifier that resolves to no
|
|
99
|
-
* file, a destructured binding, a namespace, an ambient or const enum
|
|
99
|
+
* file (the package's own name resolves through its `exports`), a destructured binding, a namespace, an ambient or const enum
|
|
100
100
|
* declaration, `export =`, CommonJS exports, or a file that does not parse.
|
|
101
101
|
* @param {string} file
|
|
102
102
|
* @param {string} exportName
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* @file Static JavaScript module export inspection.
|
|
5
5
|
*
|
|
6
6
|
* Proves a runtime export without executing package code. Local ESM re-exports
|
|
7
|
-
* are followed recursively
|
|
7
|
+
* are followed recursively, and so is a re-export of the package's own name,
|
|
8
|
+
* through its `exports` as Node resolves it; unresolved or unparsable modules
|
|
9
|
+
* fail closed. A
|
|
8
10
|
* check that must fail only what it proves asks for a verdict: an export is
|
|
9
11
|
* present (followed to its declaration, `const` aliases included), proved
|
|
10
12
|
* absent, or unknown with the reason.
|
|
@@ -20,6 +22,7 @@
|
|
|
20
22
|
import * as fs from 'node:fs';
|
|
21
23
|
import * as path from 'node:path';
|
|
22
24
|
import {findInstalledPackage} from '../fs/paths.mjs';
|
|
25
|
+
import {fileStamp, recordContentRead} from '../fs/read-record.mjs';
|
|
23
26
|
import {inspectPackageExport} from './package-exports.mjs';
|
|
24
27
|
import {babelParser} from '../runtime/lazy-dependencies.mjs';
|
|
25
28
|
|
|
@@ -69,47 +72,94 @@ const PARSE_OPTIONS = /** @type {any} */ ({
|
|
|
69
72
|
],
|
|
70
73
|
});
|
|
71
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The most modules whose text and tree are kept; the least recently used go
|
|
77
|
+
* first. The modules one command reads again are few: a package entry, the
|
|
78
|
+
* barrels it re-exports and a set's own modules stay kept while they are
|
|
79
|
+
* read. A library of tens of thousands of icon modules reads each one once
|
|
80
|
+
* or twice in a row, so they pass through, and memory stays flat however
|
|
81
|
+
* many modules a library has.
|
|
82
|
+
*/
|
|
83
|
+
const MAX_KEPT_MODULES = 256;
|
|
84
|
+
|
|
72
85
|
/**
|
|
73
86
|
* Modules parsed in this process, by path, reused while the file is unchanged:
|
|
74
|
-
* one command can ask about the same module more than once.
|
|
87
|
+
* one command can ask about the same module more than once. Most recently
|
|
88
|
+
* used last.
|
|
75
89
|
* @type {Map<string, {stamp: string, ast: any}>}
|
|
76
90
|
*/
|
|
77
91
|
const parsedModules = new Map();
|
|
78
92
|
|
|
79
93
|
/**
|
|
80
94
|
* Module texts read in this process, by path, reused while the file is
|
|
81
|
-
* unchanged.
|
|
95
|
+
* unchanged. Most recently used last.
|
|
82
96
|
* @type {Map<string, {stamp: string, text: string}>}
|
|
83
97
|
*/
|
|
84
98
|
const moduleTexts = new Map();
|
|
85
99
|
|
|
86
100
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
101
|
+
* The kept entry of `file` while its stamp is `stamp`, marked most recently
|
|
102
|
+
* used.
|
|
103
|
+
* @template {{stamp: string}} T
|
|
104
|
+
* @param {Map<string, T>} kept
|
|
89
105
|
* @param {string} file
|
|
106
|
+
* @param {string} stamp
|
|
107
|
+
* @returns {T | undefined}
|
|
90
108
|
*/
|
|
91
|
-
function
|
|
92
|
-
const
|
|
93
|
-
return
|
|
109
|
+
function keptEntry(kept, file, stamp) {
|
|
110
|
+
const entry = kept.get(file);
|
|
111
|
+
if (entry?.stamp !== stamp) return undefined;
|
|
112
|
+
kept.delete(file);
|
|
113
|
+
kept.set(file, entry);
|
|
114
|
+
return entry;
|
|
94
115
|
}
|
|
95
116
|
|
|
96
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Keep `entry` for `file`; past {@link MAX_KEPT_MODULES}, the least recently
|
|
119
|
+
* used entry goes. An entry read under the absent stamp `-` is not kept: the
|
|
120
|
+
* file appeared after its stamp, and a kept entry would outlive its removal.
|
|
121
|
+
* @template {{stamp: string}} T
|
|
122
|
+
* @param {Map<string, T>} kept
|
|
123
|
+
* @param {string} file
|
|
124
|
+
* @param {T} entry
|
|
125
|
+
*/
|
|
126
|
+
function keepEntry(kept, file, entry) {
|
|
127
|
+
if (entry.stamp === '-') return;
|
|
128
|
+
kept.delete(file);
|
|
129
|
+
kept.set(file, entry);
|
|
130
|
+
if (kept.size > MAX_KEPT_MODULES) {
|
|
131
|
+
kept.delete(/** @type {string} */ (kept.keys().next().value));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The text of `file`, kept while its stamp (`fileStamp`) is the same. A kept
|
|
137
|
+
* text still counts as a read of the file, so a caller that keeps its own
|
|
138
|
+
* result while what it read is unchanged sees a change to it.
|
|
139
|
+
* @param {string} file
|
|
140
|
+
*/
|
|
97
141
|
function moduleText(file) {
|
|
142
|
+
recordContentRead(file);
|
|
98
143
|
const stamp = fileStamp(file);
|
|
99
|
-
const cached = moduleTexts
|
|
100
|
-
if (cached
|
|
144
|
+
const cached = keptEntry(moduleTexts, file, stamp);
|
|
145
|
+
if (cached) return cached.text;
|
|
101
146
|
const text = fs.readFileSync(file, 'utf-8');
|
|
102
|
-
moduleTexts
|
|
147
|
+
keepEntry(moduleTexts, file, {stamp, text});
|
|
103
148
|
return text;
|
|
104
149
|
}
|
|
105
150
|
|
|
106
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* The parsed module at `file`, kept while its stamp is the same, and counted
|
|
153
|
+
* as a read of the file as `moduleText` is.
|
|
154
|
+
* @param {string} file
|
|
155
|
+
*/
|
|
107
156
|
function parseModule(file) {
|
|
157
|
+
recordContentRead(file);
|
|
108
158
|
const stamp = fileStamp(file);
|
|
109
|
-
const cached = parsedModules
|
|
110
|
-
if (cached
|
|
159
|
+
const cached = keptEntry(parsedModules, file, stamp);
|
|
160
|
+
if (cached) return cached.ast;
|
|
111
161
|
const ast = babelParser().parse(moduleText(file), PARSE_OPTIONS);
|
|
112
|
-
parsedModules
|
|
162
|
+
keepEntry(parsedModules, file, {stamp, ast});
|
|
113
163
|
return ast;
|
|
114
164
|
}
|
|
115
165
|
|
|
@@ -303,8 +353,9 @@ export function resolveLocalModule(specifier, fromFile, options = {}) {
|
|
|
303
353
|
|
|
304
354
|
/**
|
|
305
355
|
* The file a re-export's specifier names, from the file that writes it: a
|
|
306
|
-
* relative path,
|
|
307
|
-
* its `
|
|
356
|
+
* relative path, the package that holds the file by its own name, or an
|
|
357
|
+
* installed package (its `exports` map honored, else its `module` or
|
|
358
|
+
* `main`), found through node_modules from that file. Only
|
|
308
359
|
* the icon-set readers follow packages; every other reader in this module
|
|
309
360
|
* uses {@link resolveLocalModule}, which follows relative paths alone.
|
|
310
361
|
* @param {unknown} specifier
|
|
@@ -317,6 +368,55 @@ function resolveModuleOrPackage(specifier, fromFile) {
|
|
|
317
368
|
return resolveLocalModule(specifier, fromFile);
|
|
318
369
|
}
|
|
319
370
|
|
|
371
|
+
/**
|
|
372
|
+
* A bare specifier split into its package name and its subpath (`.` or
|
|
373
|
+
* `./rest`).
|
|
374
|
+
* @param {string} specifier
|
|
375
|
+
*/
|
|
376
|
+
function splitPackageSpecifier(specifier) {
|
|
377
|
+
const parts = specifier.split('/');
|
|
378
|
+
const count = specifier.startsWith('@') ? 2 : 1;
|
|
379
|
+
const rest = parts.slice(count).join('/');
|
|
380
|
+
return {
|
|
381
|
+
name: parts.slice(0, count).join('/'),
|
|
382
|
+
subpath: rest ? `./${rest}` : '.',
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* How a bare specifier names the package that holds `fromFile`, as Node
|
|
388
|
+
* resolves it: the nearest package.json above the file is its package, and a
|
|
389
|
+
* package that declares `exports` imports itself by its own name through that
|
|
390
|
+
* map, before any node_modules lookup. Null when the specifier names another
|
|
391
|
+
* package; otherwise `target` is the file the map gives, or null when the map
|
|
392
|
+
* does not export that subpath.
|
|
393
|
+
* @param {string} specifier a bare package specifier, with an optional subpath
|
|
394
|
+
* @param {string} fromFile
|
|
395
|
+
* @returns {{target: string | null} | null}
|
|
396
|
+
*/
|
|
397
|
+
function resolveSelfReference(specifier, fromFile) {
|
|
398
|
+
if (specifier.startsWith('node:') || specifier.startsWith('/')) return null;
|
|
399
|
+
const {name, subpath} = splitPackageSpecifier(specifier);
|
|
400
|
+
let dir = path.dirname(fromFile);
|
|
401
|
+
for (;;) {
|
|
402
|
+
const manifest = path.join(dir, 'package.json');
|
|
403
|
+
if (isFileOnDisk(manifest)) {
|
|
404
|
+
/** @type {Record<string, any>} */
|
|
405
|
+
let pkg;
|
|
406
|
+
try {
|
|
407
|
+
pkg = JSON.parse(moduleText(manifest));
|
|
408
|
+
} catch {
|
|
409
|
+
return null;
|
|
410
|
+
}
|
|
411
|
+
if (pkg?.name !== name || pkg.exports === undefined) return null;
|
|
412
|
+
return {target: inspectPackageExport(pkg, dir, subpath).target};
|
|
413
|
+
}
|
|
414
|
+
const parent = path.dirname(dir);
|
|
415
|
+
if (parent === dir) return null;
|
|
416
|
+
dir = parent;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
320
420
|
/**
|
|
321
421
|
* @param {string} specifier a bare package specifier, with an optional subpath
|
|
322
422
|
* @param {string} fromFile
|
|
@@ -324,10 +424,10 @@ function resolveModuleOrPackage(specifier, fromFile) {
|
|
|
324
424
|
*/
|
|
325
425
|
function resolvePackageModule(specifier, fromFile) {
|
|
326
426
|
if (specifier.startsWith('node:') || specifier.startsWith('/')) return null;
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
const name =
|
|
330
|
-
const rest =
|
|
427
|
+
const self = resolveSelfReference(specifier, fromFile);
|
|
428
|
+
if (self) return self.target;
|
|
429
|
+
const {name, subpath} = splitPackageSpecifier(specifier);
|
|
430
|
+
const rest = subpath === '.' ? '' : subpath.slice(2);
|
|
331
431
|
// Node's own resolution: every ancestor's node_modules, no depth cap.
|
|
332
432
|
const packageDir = findInstalledPackage(
|
|
333
433
|
path.dirname(fromFile),
|
|
@@ -345,8 +445,7 @@ function resolvePackageModule(specifier, fromFile) {
|
|
|
345
445
|
return null;
|
|
346
446
|
}
|
|
347
447
|
if (pkg.exports !== undefined) {
|
|
348
|
-
return inspectPackageExport(pkg, packageDir,
|
|
349
|
-
.target;
|
|
448
|
+
return inspectPackageExport(pkg, packageDir, subpath).target;
|
|
350
449
|
}
|
|
351
450
|
const entry = rest || pkg.module || pkg.main || 'index';
|
|
352
451
|
const base = path.join(packageDir, entry);
|
|
@@ -375,13 +474,11 @@ function resolvePackageModule(specifier, fromFile) {
|
|
|
375
474
|
*/
|
|
376
475
|
export function moduleParseFailure(file) {
|
|
377
476
|
/** @type {Set<string>} */
|
|
378
|
-
const seen = new Set();
|
|
477
|
+
const seen = new Set([file]);
|
|
379
478
|
/** @type {string[]} */
|
|
380
479
|
const queue = [file];
|
|
381
|
-
|
|
382
|
-
const next =
|
|
383
|
-
if (seen.has(next)) continue;
|
|
384
|
-
seen.add(next);
|
|
480
|
+
for (let at = 0; at < queue.length; at++) {
|
|
481
|
+
const next = queue[at];
|
|
385
482
|
let ast;
|
|
386
483
|
try {
|
|
387
484
|
ast = parseModule(next);
|
|
@@ -398,7 +495,10 @@ export function moduleParseFailure(file) {
|
|
|
398
495
|
continue;
|
|
399
496
|
}
|
|
400
497
|
const target = resolveLocalModule(specifier, next);
|
|
401
|
-
if (target
|
|
498
|
+
if (target && !seen.has(target)) {
|
|
499
|
+
seen.add(target);
|
|
500
|
+
queue.push(target);
|
|
501
|
+
}
|
|
402
502
|
}
|
|
403
503
|
}
|
|
404
504
|
}
|
|
@@ -832,7 +932,7 @@ function exportOriginsOf(file, read) {
|
|
|
832
932
|
* only when every export the module writes was read and none binds it, and
|
|
833
933
|
* `unknown`, with the first reason, when some export could not be read: a
|
|
834
934
|
* re-export from another package or from a specifier that resolves to no
|
|
835
|
-
* file, a destructured binding, a namespace, an ambient or const enum
|
|
935
|
+
* file (the package's own name resolves through its `exports`), a destructured binding, a namespace, an ambient or const enum
|
|
836
936
|
* declaration, `export =`, CommonJS exports, or a file that does not parse.
|
|
837
937
|
* @param {string} file
|
|
838
938
|
* @param {string} exportName
|
|
@@ -879,13 +979,16 @@ export function moduleExportVerdict(file, exportName, seen = new Set()) {
|
|
|
879
979
|
* @returns {boolean} true when it proves the export
|
|
880
980
|
*/
|
|
881
981
|
const follow = (specifier, imported, what) => {
|
|
882
|
-
|
|
982
|
+
const self = specifier.startsWith('.')
|
|
983
|
+
? null
|
|
984
|
+
: resolveSelfReference(specifier, file);
|
|
985
|
+
if (!specifier.startsWith('.') && !self) {
|
|
883
986
|
unknown.push(
|
|
884
987
|
`${shown} re-exports ${what} from "${specifier}", another package this check does not read.`,
|
|
885
988
|
);
|
|
886
989
|
return false;
|
|
887
990
|
}
|
|
888
|
-
const target = resolveLocalModule(specifier, file);
|
|
991
|
+
const target = self ? self.target : resolveLocalModule(specifier, file);
|
|
889
992
|
if (!target) {
|
|
890
993
|
unknown.push(
|
|
891
994
|
`${shown} re-exports ${what} from "${specifier}", which resolves to no file this check can read.`,
|
|
@@ -19,6 +19,11 @@ export function templateRoots(integrations: Array<{
|
|
|
19
19
|
}>): string[];
|
|
20
20
|
/** Where the CLI's own topics live; its docs tree is the `tree` folder. */
|
|
21
21
|
export const BUILTIN_DOCS_DIR: string;
|
|
22
|
+
/**
|
|
23
|
+
* The section the project's icon set adds to the `icons` topic. The project
|
|
24
|
+
* reads it only where it has an icon set (config/project.mjs docs).
|
|
25
|
+
*/
|
|
26
|
+
export const INSTALLED_ICON_SET_DOC: string;
|
|
22
27
|
/**
|
|
23
28
|
* A built-in topic file: `{topic}.doc.mjs`. Anchored at both ends so a
|
|
24
29
|
* localization overlay (`{topic}.doc.zh.mjs`) is not read as a topic of its
|
|
@@ -25,6 +25,17 @@ import {CLI_ROOT} from '../fs/paths.mjs';
|
|
|
25
25
|
/** Where the CLI's own topics live; its docs tree is the `tree` folder. */
|
|
26
26
|
export const BUILTIN_DOCS_DIR = path.join(CLI_ROOT, 'assets', 'docs');
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* The section the project's icon set adds to the `icons` topic. The project
|
|
30
|
+
* reads it only where it has an icon set (config/project.mjs docs).
|
|
31
|
+
*/
|
|
32
|
+
export const INSTALLED_ICON_SET_DOC = path.join(
|
|
33
|
+
CLI_ROOT,
|
|
34
|
+
'assets',
|
|
35
|
+
'icons',
|
|
36
|
+
'installed-icon-set.doc.mjs',
|
|
37
|
+
);
|
|
38
|
+
|
|
28
39
|
/**
|
|
29
40
|
* A built-in topic file: `{topic}.doc.mjs`. Anchored at both ends so a
|
|
30
41
|
* localization overlay (`{topic}.doc.zh.mjs`) is not read as a topic of its
|
|
@@ -37,5 +37,6 @@ export const RUNNER_COMMAND_ALLOWLIST: Readonly<{
|
|
|
37
37
|
'packages/cli/assets/docs/tree/doc-syntax.doc.mjs': "shows what each doc token renders as, in every package manager";
|
|
38
38
|
'packages/cli/assets/docs/tree/add-a-topic.doc.mjs': "shows what a reader sees for a command token, with their runner";
|
|
39
39
|
'packages/cli/clients/cli/commands/upgrade.doc.mjs': "quotes the command upgrade prints when the CLI is older than Core, pinned to the matching release";
|
|
40
|
+
'packages/cli/assets/docs/working-with-ai.doc.mjs': "shows the MCP client entries, which start the CLI server with `npx @astryxdesign/cli mcp`";
|
|
40
41
|
}>;
|
|
41
42
|
}>;
|
|
@@ -53,5 +53,7 @@ export const RUNNER_COMMAND_ALLOWLIST = Object.freeze({
|
|
|
53
53
|
'shows what a reader sees for a command token, with their runner',
|
|
54
54
|
'packages/cli/clients/cli/commands/upgrade.doc.mjs':
|
|
55
55
|
'quotes the command upgrade prints when the CLI is older than Core, pinned to the matching release',
|
|
56
|
+
'packages/cli/assets/docs/working-with-ai.doc.mjs':
|
|
57
|
+
'shows the MCP client entries, which start the CLI server with `npx @astryxdesign/cli mcp`',
|
|
56
58
|
}),
|
|
57
59
|
});
|
|
@@ -375,7 +375,7 @@ export type TemplateDiscoveryError = {
|
|
|
375
375
|
template?: string | undefined;
|
|
376
376
|
message: string;
|
|
377
377
|
code?: string | undefined;
|
|
378
|
-
severity?: "
|
|
378
|
+
severity?: "error" | "warning" | undefined;
|
|
379
379
|
/**
|
|
380
380
|
* Core target whose replacement set is invalid
|
|
381
381
|
*/
|
|
@@ -11,14 +11,22 @@
|
|
|
11
11
|
* holds the root layout when that folder has none of its own; else, in an
|
|
12
12
|
* app with only the Pages Router, to the page file `pages/<id>.tsx` (or
|
|
13
13
|
* `src/pages/<id>.tsx`). A block goes beside the routes:
|
|
14
|
-
* `app/components/<id
|
|
15
|
-
* root `pages/` folder only, else
|
|
16
|
-
*
|
|
14
|
+
* `app/components/<id>.tsx` with a root `app/` folder,
|
|
15
|
+
* `components/<id>.tsx` with a root `pages/` folder only, else
|
|
16
|
+
* `src/components/<id>.tsx`. Every other project gets `src/pages/<id>.tsx`
|
|
17
|
+
* for a page and `src/components/<id>.tsx` for a block.
|
|
18
|
+
*
|
|
19
|
+
* Outside the App Router the path is the file the copy writes, so an import
|
|
20
|
+
* of that path finds it: a folder would hold a `page.tsx` that a bare import
|
|
21
|
+
* of the folder does not resolve.
|
|
17
22
|
*
|
|
18
23
|
* When that path exists, or another page already serves its URL (a page in
|
|
19
|
-
* a route group, a Pages Router file),
|
|
20
|
-
*
|
|
21
|
-
*
|
|
24
|
+
* a route group, a Pages Router file), or, for a file outside the App Router,
|
|
25
|
+
* an import of it already resolves to a module (a folder's index, or a file
|
|
26
|
+
* with another extension), the id becomes `<id>-2`, `<id>-3` and so on, the
|
|
27
|
+
* first one that is free, so the command runs as printed, the app still
|
|
28
|
+
* builds, an import of the path finds the new file, and nothing the app owns
|
|
29
|
+
* is written into.
|
|
22
30
|
*
|
|
23
31
|
* @param {string} projectDir the folder the command runs in
|
|
24
32
|
* @param {'page' | 'block'} type
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
pagesRouterPage,
|
|
21
21
|
sameUrlPage,
|
|
22
22
|
} from './next-routes.mjs';
|
|
23
|
+
import {resolveLocalModule} from './module-exports.mjs';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* The project-relative path to scaffold a template into, read from the
|
|
@@ -31,14 +32,22 @@ import {
|
|
|
31
32
|
* holds the root layout when that folder has none of its own; else, in an
|
|
32
33
|
* app with only the Pages Router, to the page file `pages/<id>.tsx` (or
|
|
33
34
|
* `src/pages/<id>.tsx`). A block goes beside the routes:
|
|
34
|
-
* `app/components/<id
|
|
35
|
-
* root `pages/` folder only, else
|
|
36
|
-
*
|
|
35
|
+
* `app/components/<id>.tsx` with a root `app/` folder,
|
|
36
|
+
* `components/<id>.tsx` with a root `pages/` folder only, else
|
|
37
|
+
* `src/components/<id>.tsx`. Every other project gets `src/pages/<id>.tsx`
|
|
38
|
+
* for a page and `src/components/<id>.tsx` for a block.
|
|
39
|
+
*
|
|
40
|
+
* Outside the App Router the path is the file the copy writes, so an import
|
|
41
|
+
* of that path finds it: a folder would hold a `page.tsx` that a bare import
|
|
42
|
+
* of the folder does not resolve.
|
|
37
43
|
*
|
|
38
44
|
* When that path exists, or another page already serves its URL (a page in
|
|
39
|
-
* a route group, a Pages Router file),
|
|
40
|
-
*
|
|
41
|
-
*
|
|
45
|
+
* a route group, a Pages Router file), or, for a file outside the App Router,
|
|
46
|
+
* an import of it already resolves to a module (a folder's index, or a file
|
|
47
|
+
* with another extension), the id becomes `<id>-2`, `<id>-3` and so on, the
|
|
48
|
+
* first one that is free, so the command runs as printed, the app still
|
|
49
|
+
* builds, an import of the path finds the new file, and nothing the app owns
|
|
50
|
+
* is written into.
|
|
42
51
|
*
|
|
43
52
|
* @param {string} projectDir the folder the command runs in
|
|
44
53
|
* @param {'page' | 'block'} type
|
|
@@ -56,7 +65,12 @@ export function templateDestination(projectDir, type, id) {
|
|
|
56
65
|
: routes.pages === 'pages' && !routes.app
|
|
57
66
|
? 'components'
|
|
58
67
|
: 'src/components';
|
|
59
|
-
return firstFree(
|
|
68
|
+
return firstFree(
|
|
69
|
+
projectDir,
|
|
70
|
+
id,
|
|
71
|
+
n => `${parent}/${n}.tsx`,
|
|
72
|
+
rel => moduleAt(projectDir, rel),
|
|
73
|
+
);
|
|
60
74
|
}
|
|
61
75
|
if (routes.app) {
|
|
62
76
|
const app = path.join(projectDir, routes.app);
|
|
@@ -80,7 +94,27 @@ export function templateDestination(projectDir, type, id) {
|
|
|
80
94
|
file => pagesRouterPage(projectDir, file.slice(pages.length + 1, -4)),
|
|
81
95
|
);
|
|
82
96
|
}
|
|
83
|
-
return firstFree(
|
|
97
|
+
return firstFree(
|
|
98
|
+
projectDir,
|
|
99
|
+
id,
|
|
100
|
+
n => `src/pages/${n}.tsx`,
|
|
101
|
+
rel => moduleAt(projectDir, rel),
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The module a bare import of `rel` without its extension already resolves
|
|
107
|
+
* to, as the app's bundler resolves it, or null: a new file there would
|
|
108
|
+
* shadow it, or be shadowed by it.
|
|
109
|
+
* @param {string} projectDir
|
|
110
|
+
* @param {string} rel a `.tsx` path
|
|
111
|
+
* @returns {string | null}
|
|
112
|
+
*/
|
|
113
|
+
function moduleAt(projectDir, rel) {
|
|
114
|
+
const stem = rel.slice(0, -'.tsx'.length);
|
|
115
|
+
return resolveLocalModule(`./${stem}`, path.join(projectDir, 'index.js'), {
|
|
116
|
+
bundler: true,
|
|
117
|
+
});
|
|
84
118
|
}
|
|
85
119
|
|
|
86
120
|
/**
|