@astryxdesign/cli 0.7.16 → 0.7.17-canary.g16fe6a8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -86
- package/api/build/_adapter.d.mts +12 -0
- package/api/build/_adapter.mjs +51 -34
- package/api/build/blocks/blocks.d.mts +7 -5
- package/api/build/blocks/blocks.mjs +113 -26
- package/api/build/build.doc.mjs +4 -3
- package/api/build/build.type.d.mts +2 -2
- package/api/build/build.type.mjs +3 -3
- package/api/build/kit/kind.d.mts +2 -1
- package/api/build/kit/kind.mjs +199 -10
- package/api/build/kit/kit.mjs +6 -4
- package/api/build/kit/rank.d.mts +4 -2
- package/api/build/kit/rank.mjs +125 -24
- package/api/build/kit/start.d.mts +5 -4
- package/api/build/kit/start.mjs +12 -8
- package/api/build/kit/weights.d.mts +39 -3
- package/api/build/kit/weights.json +1 -1
- package/api/build/kit/weights.mjs +340 -43
- package/api/build/kit/word-model.d.mts +23 -0
- package/api/build/kit/word-model.mjs +46 -0
- package/api/build/kit/words.d.mts +48 -0
- package/api/build/kit/words.mjs +90 -1
- package/api/component/__fixtures__/resolutions/modules.txt +4 -5
- package/api/component/list/list.d.mts +1 -1
- package/api/component/list/list.mjs +48 -6
- package/api/discover/_adapter.d.mts +1 -1
- package/api/discover/search/search.mjs +3 -2
- package/api/docs/_adapter.d.mts +28 -2
- package/api/docs/_adapter.mjs +249 -10
- package/api/docs/docs.d.mts +3 -0
- package/api/docs/docs.doc.mjs +7 -1
- package/api/docs/docs.mjs +12 -0
- package/api/docs/docs.type.d.mts +5 -0
- package/api/docs/docs.type.mjs +2 -0
- package/api/docs/node/node.mjs +1 -1
- package/api/doctor/_adapter.d.mts +27 -5
- package/api/doctor/_adapter.mjs +83 -10
- package/api/doctor/built-checks.mjs +40 -14
- package/api/doctor/doctor.d.mts +4 -3
- package/api/doctor/doctor.mjs +14 -7
- package/api/doctor/theme-checks.mjs +121 -17
- package/api/icon/_records.mjs +2 -1
- package/api/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/integration/_adapter.d.mts +44 -0
- package/api/integration/_adapter.mjs +77 -1
- package/api/integration/authoring-checks.mjs +6 -6
- package/api/integration/example-scope.d.mts +14 -0
- package/api/integration/example-scope.mjs +44 -0
- package/api/integration/example-scope.type.d.mts +29 -0
- package/api/integration/example-scope.type.mjs +25 -0
- package/api/integration/integrationExampleScope.doc.d.mts +11 -0
- package/api/integration/integrationExampleScope.doc.mjs +59 -0
- package/api/integration/validate-integration.mjs +19 -1
- package/api/integration/validate-integration.type.d.mts +9 -0
- package/api/integration/validate-integration.type.mjs +1 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.mjs +591 -195
- package/api/render/render.doc.mjs +11 -3
- package/api/render/render.type.d.mts +52 -0
- package/api/render/render.type.mjs +31 -1
- package/api/search/ORDERING.md +1 -1
- package/api/search/_adapter.d.mts +9 -0
- package/api/search/_adapter.mjs +85 -0
- package/api/search/_candidate-score.mjs +51 -32
- package/api/search/_fit-order.mjs +3 -3
- package/api/search/_gather-components.d.mts +3 -2
- package/api/search/_gather-components.mjs +12 -3
- package/api/search/_lexical.d.mts +5 -0
- package/api/search/_lexical.mjs +8 -2
- package/api/search/_result.d.mts +11 -9
- package/api/search/_result.mjs +4 -4
- package/api/search/_score.d.mts +6 -1
- package/api/search/_score.mjs +15 -3
- package/api/search/search-index.mjs +7 -1
- package/api/search/search.d.mts +1 -1
- package/api/theme/_adapter.mjs +12 -1
- package/api/theme/build/build.d.mts +132 -1
- package/api/theme/build/build.mjs +482 -157
- package/api/theme/build/core-interception.d.mts +10 -0
- package/api/theme/build/core-interception.mjs +10 -0
- package/api/theme/build/font-warning.d.mts +44 -5
- package/api/theme/build/font-warning.mjs +118 -10
- package/api/theme/build/icon-imports.mjs +51 -9
- package/api/theme/theme.type.d.mts +10 -0
- package/api/theme/theme.type.mjs +7 -1
- package/api/theme-edit/_adapter.d.mts +115 -4
- package/api/theme-edit/_adapter.mjs +997 -83
- package/api/theme-edit/_catalog.d.mts +20 -2
- package/api/theme-edit/_catalog.mjs +50 -10
- package/api/theme-edit/_check.d.mts +75 -24
- package/api/theme-edit/_check.mjs +2672 -422
- package/api/theme-edit/_color.d.mts +10 -0
- package/api/theme-edit/_color.mjs +54 -1
- package/api/theme-edit/_compiler.d.mts +1 -0
- package/api/theme-edit/_compiler.mjs +133 -15
- package/api/theme-edit/_context.d.mts +14 -3
- package/api/theme-edit/_context.mjs +225 -65
- package/api/theme-edit/_css.d.mts +14 -0
- package/api/theme-edit/_css.mjs +46 -1
- package/api/theme-edit/_edit.d.mts +54 -4
- package/api/theme-edit/_edit.mjs +2966 -286
- package/api/theme-edit/_how-commands.d.mts +72 -1
- package/api/theme-edit/_how-commands.mjs +770 -9
- package/api/theme-edit/_how-question.d.mts +82 -5
- package/api/theme-edit/_how-question.mjs +6983 -701
- package/api/theme-edit/_how.d.mts +2 -1
- package/api/theme-edit/_how.mjs +237 -41
- package/api/theme-edit/_importers.d.mts +38 -0
- package/api/theme-edit/_importers.mjs +188 -0
- package/api/theme-edit/_marks.d.mts +31 -5
- package/api/theme-edit/_marks.mjs +57 -5
- package/api/theme-edit/_name-rule.d.mts +11 -0
- package/api/theme-edit/_name-rule.mjs +12 -0
- package/api/theme-edit/_normal.d.mts +303 -0
- package/api/theme-edit/_normal.mjs +1517 -0
- package/api/theme-edit/_palette.d.mts +12 -0
- package/api/theme-edit/_palette.mjs +37 -4
- package/api/theme-edit/_part-words.d.mts +31 -0
- package/api/theme-edit/_part-words.mjs +126 -0
- package/api/theme-edit/_parts.d.mts +28 -2
- package/api/theme-edit/_parts.mjs +267 -31
- package/api/theme-edit/_preview-app.d.mts +7 -13
- package/api/theme-edit/_preview-app.mjs +814 -406
- package/api/theme-edit/_preview.d.mts +116 -16
- package/api/theme-edit/_preview.mjs +649 -152
- package/api/theme-edit/_project.d.mts +22 -1
- package/api/theme-edit/_project.mjs +83 -3
- package/api/theme-edit/_settings.d.mts +467 -42
- package/api/theme-edit/_settings.mjs +3527 -468
- package/api/theme-edit/_tables.d.mts +21 -0
- package/api/theme-edit/_tables.mjs +97 -3
- package/api/theme-edit/_vet.d.mts +31 -0
- package/api/theme-edit/_vet.mjs +114 -8
- package/api/theme-edit/theme-edit.type.d.mts +16 -2
- package/api/theme-edit/theme-edit.type.mjs +6 -3
- package/api/theme-edit/themeEditHow.doc.mjs +1 -1
- package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
- package/api/theme-edit/themeEditNew.doc.mjs +7 -4
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
- package/api/upgrade/run/run.mjs +4 -3
- package/assets/codemods/integration-discovery.mjs +2 -1
- package/assets/codemods/run-codemod.mjs +87 -7
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
- package/assets/component-list.generated.json +1 -0
- package/assets/docs/author-a-theme.doc.mjs +1 -0
- package/assets/docs/theme.doc.dense.mjs +2 -2
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
- package/assets/docs/tree/checks.doc.mjs +1 -1
- package/assets/docs/tree/cli-command.doc.mjs +2 -3
- package/assets/docs/tree/render-pages.doc.mjs +44 -3
- package/assets/docs/tree/share-a-page.doc.mjs +157 -0
- package/assets/docs/tree/single-component.doc.mjs +4 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/search-catalog.generated.json +2 -0
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
- package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
- package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +5 -1
- package/assets/templates/pages/blank/template.doc.mjs +1 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
- package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
- package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
- package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
- package/assets/templates/pages/documentation/template.doc.mjs +4 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
- package/assets/templates/pages/editor/template.doc.mjs +2 -8
- package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
- package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
- package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
- package/assets/templates/pages/ide/page.tsx +24 -2
- package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
- package/assets/templates/pages/library/template.doc.mjs +4 -1
- package/assets/templates/pages/login/template.doc.mjs +2 -1
- package/assets/templates/pages/login-card/template.doc.mjs +2 -1
- package/assets/templates/pages/login-split/template.doc.mjs +2 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
- package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
- package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
- package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
- package/assets/templates/pages/table-page/template.doc.mjs +5 -4
- package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
- package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
- package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
- package/assets/theme.template.ts +6 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +3 -3
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/component/categories.d.mts +37 -0
- package/authoring/doctypes/component/categories.mjs +54 -0
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +9 -0
- package/authoring/example/example.doc.d.mts +12 -0
- package/authoring/example/example.doc.mjs +69 -0
- package/authoring/example/preview.d.mts +92 -0
- package/authoring/example/preview.mjs +994 -0
- package/authoring/example/type.ts +102 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +12 -0
- package/authoring/index.mjs +3 -1
- package/clients/cli/bin/astryx.mjs +6 -9
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/component.mjs +22 -3
- package/clients/cli/commands/docs.doc.mjs +7 -1
- package/clients/cli/commands/docs.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +32 -14
- package/clients/cli/commands/experimental/render.mjs +42 -1
- package/clients/cli/commands/experimental/theme.mjs +573 -119
- package/clients/cli/commands/experimental-render.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
- package/clients/cli/commands/experimental-theme.doc.mjs +5 -1
- package/clients/cli/commands/search.doc.mjs +2 -1
- package/clients/cli/commands/search.mjs +6 -1
- package/clients/cli/commands/template.mjs +4 -2
- package/clients/cli/commands/theme-build.doc.mjs +5 -1
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +718 -438
- package/clients/cli/commands/upgrade.mjs +42 -7
- package/clients/cli/index.mjs +1 -1
- package/clients/cli/lib/cli-error.mjs +2 -1
- package/clients/cli/lib/component-format.mjs +205 -98
- package/clients/cli/lib/hook-format.mjs +9 -19
- package/clients/cli/lib/json-shim.mjs +132 -24
- package/clients/cli/lib/manifest.mjs +3 -2
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/config/theme-state.d.mts +13 -1
- package/foundation/config/theme-state.mjs +47 -7
- package/foundation/discovery/authoring-self-docs.mjs +1 -0
- package/foundation/discovery/component-discovery.d.mts +11 -0
- package/foundation/discovery/component-discovery.mjs +56 -8
- package/foundation/discovery/component-replacement.mjs +130 -1
- package/foundation/discovery/copied-passages.mjs +2 -1
- package/foundation/discovery/core-component-docs.d.mts +29 -0
- package/foundation/discovery/core-component-docs.mjs +83 -0
- package/foundation/discovery/doc-types.mjs +4 -3
- package/foundation/discovery/entry-name-files.d.mts +43 -0
- package/foundation/discovery/entry-name-files.mjs +264 -0
- package/foundation/discovery/hook-discovery.d.mts +8 -2
- package/foundation/discovery/hook-discovery.mjs +22 -8
- package/foundation/discovery/icon-definition-discovery.mjs +2 -1
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.mjs +2 -1
- package/foundation/discovery/integration-doc-files.mjs +2 -1
- package/foundation/discovery/package-exports.d.mts +10 -0
- package/foundation/discovery/package-exports.mjs +56 -3
- package/foundation/discovery/prop-drift.mjs +9 -9
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/stored-component-list.d.mts +43 -0
- package/foundation/discovery/stored-component-list.mjs +90 -0
- package/foundation/discovery/stored-search-catalog.d.mts +115 -0
- package/foundation/discovery/stored-search-catalog.mjs +297 -0
- package/foundation/discovery/stored-self-audit.d.mts +26 -10
- package/foundation/discovery/stored-self-audit.mjs +38 -18
- package/foundation/discovery/template-adapter.d.mts +53 -1
- package/foundation/discovery/template-adapter.mjs +176 -12
- package/foundation/discovery/template-icons.mjs +2 -1
- package/foundation/discovery/theme-discovery.mjs +31 -4
- package/foundation/discovery/theme-imports.d.mts +14 -0
- package/foundation/discovery/theme-imports.mjs +43 -1
- package/foundation/discovery/theming-targets.d.mts +6 -5
- package/foundation/discovery/theming-targets.mjs +31 -47
- package/foundation/doc-compiler/import.mjs +7 -1
- package/foundation/doc-compiler/inputs.mjs +3 -2
- package/foundation/doc-compiler/parse-readable.mjs +4 -1
- package/foundation/doc-compiler/stored-docs.d.mts +22 -0
- package/foundation/doc-compiler/stored-docs.mjs +49 -0
- package/foundation/env/semver.mjs +3 -1
- package/foundation/fonts/font-stylesheet.d.mts +38 -0
- package/foundation/fonts/font-stylesheet.mjs +141 -0
- package/foundation/fs/cache-eviction.d.mts +21 -0
- package/foundation/fs/cache-eviction.mjs +73 -0
- package/foundation/fs/exact-codec.d.mts +12 -2
- package/foundation/fs/exact-codec.mjs +23 -6
- package/foundation/fs/file-protection.mjs +4 -3
- package/foundation/fs/gather-cache.d.mts +62 -4
- package/foundation/fs/gather-cache.mjs +517 -91
- package/foundation/fs/jiti-cache.d.mts +19 -1
- package/foundation/fs/jiti-cache.mjs +130 -6
- package/foundation/fs/kept-tree.d.mts +60 -0
- package/foundation/fs/kept-tree.mjs +154 -0
- package/foundation/fs/listing-cache.d.mts +7 -0
- package/foundation/fs/listing-cache.mjs +10 -0
- package/foundation/fs/module-loader.d.mts +24 -2
- package/foundation/fs/module-loader.mjs +94 -21
- package/foundation/fs/paths.d.mts +18 -0
- package/foundation/fs/paths.mjs +15 -2
- package/foundation/fs/read-record.d.mts +9 -0
- package/foundation/fs/read-record.mjs +19 -11
- package/foundation/fs/stop-cleanup.d.mts +12 -0
- package/foundation/fs/stop-cleanup.mjs +66 -0
- package/foundation/identity/provider-identity.d.mts +6 -0
- package/foundation/identity/provider-identity.mjs +10 -1
- package/foundation/integrations/contribution-inventory.mjs +4 -3
- package/foundation/integrations/example-code.d.mts +63 -0
- package/foundation/integrations/example-code.mjs +416 -0
- package/foundation/integrations/public-imports.d.mts +9 -0
- package/foundation/integrations/public-imports.mjs +3 -2
- package/foundation/integrations/validate-contributions.mjs +17 -45
- package/foundation/render/embedded-files.d.mts +6 -0
- package/foundation/render/embedded-files.mjs +25 -5
- package/foundation/render/embedded-imports.d.mts +39 -7
- package/foundation/render/embedded-imports.mjs +66 -27
- package/foundation/render/file-header.d.mts +66 -0
- package/foundation/render/file-header.mjs +118 -0
- package/foundation/render/host-answer.d.mts +18 -0
- package/foundation/render/host-answer.mjs +46 -0
- package/foundation/render/host-exit.d.mts +1 -0
- package/foundation/render/host-exit.mjs +6 -1
- package/foundation/render/html-reader.d.mts +55 -2
- package/foundation/render/html-reader.mjs +145 -26
- package/foundation/render/markup-edits.d.mts +57 -0
- package/foundation/render/markup-edits.mjs +182 -0
- package/foundation/render/page-host.mjs +29 -12
- package/foundation/render/page-worker.mjs +121 -13
- package/foundation/render/picture-chrome.d.mts +4 -0
- package/foundation/render/picture-chrome.mjs +185 -0
- package/foundation/render/picture-playwright.d.mts +4 -0
- package/foundation/render/picture-playwright.mjs +34 -0
- package/foundation/render/rebuild.mjs +2 -1
- package/foundation/render/render-page.d.mts +35 -3
- package/foundation/render/render-page.mjs +641 -96
- package/foundation/render/source-block.d.mts +85 -6
- package/foundation/render/source-block.mjs +211 -20
- package/foundation/render/ts-paths.d.mts +69 -6
- package/foundation/render/ts-paths.mjs +326 -40
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +1 -0
- package/foundation/response/error-codes.doc.mjs +12 -1
- package/foundation/response/error-codes.mjs +11 -1
- package/foundation/response/response-types.doc.mjs +2 -2
- package/foundation/text/compare-text.d.mts +14 -0
- package/foundation/text/compare-text.mjs +68 -0
- package/foundation/text/css-escape.d.mts +18 -0
- package/foundation/text/css-escape.mjs +35 -0
- package/foundation/text/string-utils.d.mts +3 -2
- package/foundation/text/string-utils.mjs +18 -4
- package/foundation/text/suggest-order.d.mts +9 -0
- package/foundation/text/suggest-order.mjs +15 -1
- package/foundation/xle/expand.mjs +2 -1
- package/host/index.mjs +8 -6
- package/package.json +7 -6
|
@@ -30,7 +30,12 @@ import {
|
|
|
30
30
|
text,
|
|
31
31
|
} from '../../formatters/index.mjs';
|
|
32
32
|
import {cliError} from '../../lib/cli-error.mjs';
|
|
33
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
editorMissingArgument,
|
|
35
|
+
setEditorFreeName,
|
|
36
|
+
setEditorThemeList,
|
|
37
|
+
setUnknownOptionReader,
|
|
38
|
+
} from '../../lib/json-shim.mjs';
|
|
34
39
|
import {AstryxError} from '../../../../api/error.mjs';
|
|
35
40
|
import {defineCommand} from '../../lib/define-command.mjs';
|
|
36
41
|
import {
|
|
@@ -48,7 +53,22 @@ import {
|
|
|
48
53
|
builtInThemes,
|
|
49
54
|
dialValueFits,
|
|
50
55
|
newFlagList,
|
|
56
|
+
editorCheckedLine,
|
|
57
|
+
editorCheckedNewLines,
|
|
58
|
+
booleanWord,
|
|
51
59
|
editorCompileProblem,
|
|
60
|
+
editorFollowCompile,
|
|
61
|
+
editorThemesAt,
|
|
62
|
+
editorFreeName,
|
|
63
|
+
typoNear,
|
|
64
|
+
typoOf,
|
|
65
|
+
editorAfterBuild,
|
|
66
|
+
editorFontHelp,
|
|
67
|
+
editorInstall,
|
|
68
|
+
editorSourcePath,
|
|
69
|
+
editorBuildExtra,
|
|
70
|
+
editorLoadedFonts,
|
|
71
|
+
editorColorModes,
|
|
52
72
|
editorThemeHold,
|
|
53
73
|
editorThemeRefusal,
|
|
54
74
|
editorMissingSource,
|
|
@@ -106,7 +126,6 @@ const cmd = line => {
|
|
|
106
126
|
.join(stem);
|
|
107
127
|
};
|
|
108
128
|
/** The project's invocation of a command line (cmd, under a name an action's own `cmd` parameter does not hide). */
|
|
109
|
-
const cliLine = (/** @type {string} */ line) => cmd(line);
|
|
110
129
|
|
|
111
130
|
/**
|
|
112
131
|
* Print blocks, a blank line between them, with this project's run prefix
|
|
@@ -412,12 +431,12 @@ function newSettings(o, themeName = '<theme>') {
|
|
|
412
431
|
}
|
|
413
432
|
|
|
414
433
|
/**
|
|
415
|
-
* The
|
|
416
|
-
*
|
|
417
|
-
* @param {any} o
|
|
418
|
-
* @returns {string}
|
|
434
|
+
* The settings flags of options as commander read them (camelCase keys),
|
|
435
|
+
* by the flag name `new` takes.
|
|
436
|
+
* @param {Record<string, any>} o
|
|
437
|
+
* @returns {Record<string, string | string[]>}
|
|
419
438
|
*/
|
|
420
|
-
function
|
|
439
|
+
function newSettingsGiven(o) {
|
|
421
440
|
/** @type {Record<string, string | string[]>} */
|
|
422
441
|
const settings = {};
|
|
423
442
|
for (const opt of newDoc.options ?? []) {
|
|
@@ -426,6 +445,17 @@ function newFlagLine(o) {
|
|
|
426
445
|
const value = o[flag.replace(/-([a-z])/g, (_, c) => c.toUpperCase())];
|
|
427
446
|
if (value != null) settings[flag] = value;
|
|
428
447
|
}
|
|
448
|
+
return settings;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* The options a `new` was given, as flags for a suggested command, so a
|
|
453
|
+
* corrected command makes the theme that was asked for.
|
|
454
|
+
* @param {any} o
|
|
455
|
+
* @returns {string}
|
|
456
|
+
*/
|
|
457
|
+
function newFlagLine(o) {
|
|
458
|
+
const settings = newSettingsGiven(o);
|
|
429
459
|
const parts = newFlagList(
|
|
430
460
|
o.like == null ? undefined : String(o.like),
|
|
431
461
|
settings,
|
|
@@ -484,7 +514,16 @@ function flagValues(name) {
|
|
|
484
514
|
*/
|
|
485
515
|
function changeBlocks(r) {
|
|
486
516
|
const d = r.data;
|
|
487
|
-
|
|
517
|
+
// The status line names the value as saved, with a quote or space mark
|
|
518
|
+
// the text output would fold written as its CSS escape (\201C), so the
|
|
519
|
+
// text and the JSON name the same value.
|
|
520
|
+
const s = {
|
|
521
|
+
...d.setting,
|
|
522
|
+
value: String(d.setting.value).replace(
|
|
523
|
+
/[\u00A0\u00AB\u00BB\u2000-\u200B\u2018-\u201F\u2039\u203A\u202F\u3000\u300C-\u300F]/g,
|
|
524
|
+
c => `\\${c.codePointAt(0)?.toString(16).toUpperCase()} `,
|
|
525
|
+
),
|
|
526
|
+
};
|
|
488
527
|
const status =
|
|
489
528
|
d.was != null
|
|
490
529
|
? `[ok] ${d.theme}: ${s.thing} ${d.was} -> ${s.value}`
|
|
@@ -618,10 +657,11 @@ function lookupBlocks(d) {
|
|
|
618
657
|
* unknown options so a design token (`--color-accent`) can be the thing
|
|
619
658
|
* they name; a `--` word anywhere else is a mistyped option.
|
|
620
659
|
* @param {string} command the subcommand, for the suggestion
|
|
660
|
+
* @param {import('@astryxdesign/cli/authoring').CommandDoc} doc the command's doc, which lists its options
|
|
621
661
|
* @param {Array<string | undefined>} rest the operands after the thing
|
|
622
662
|
* @returns {ReturnType<typeof cliError> | null}
|
|
623
663
|
*/
|
|
624
|
-
function strayOption(command, rest) {
|
|
664
|
+
function strayOption(command, doc, rest) {
|
|
625
665
|
// A scope flag given twice would keep only the last one without a word.
|
|
626
666
|
for (const flag of ['on', 'when', 'state', 'mode']) {
|
|
627
667
|
const all = flagValues(flag);
|
|
@@ -639,38 +679,317 @@ function strayOption(command, rest) {
|
|
|
639
679
|
},
|
|
640
680
|
);
|
|
641
681
|
}
|
|
642
|
-
|
|
682
|
+
// A value pasted with a token's label (`'--color-accent: #e11d48'`) is
|
|
683
|
+
// a value, read by the label reader, not an option.
|
|
684
|
+
const word = rest.find(
|
|
685
|
+
w =>
|
|
686
|
+
typeof w === 'string' &&
|
|
687
|
+
w.startsWith('--') &&
|
|
688
|
+
!/^--[a-z0-9-]+\s*:\s*\S/i.test(w),
|
|
689
|
+
);
|
|
643
690
|
if (word == null) return null;
|
|
644
|
-
return
|
|
645
|
-
|
|
646
|
-
|
|
691
|
+
return strayRefusal(command, doc, `${EDITOR} ${command}`, {
|
|
692
|
+
option: word,
|
|
693
|
+
note: 'a design token (such as --color-accent) is the thing a change names, before its value',
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* What a theme command answers for an option it does not take, or for
|
|
699
|
+
* words past what it takes: the one stray reader every editor and preview
|
|
700
|
+
* command uses. It names the options the command takes; it offers the same
|
|
701
|
+
* command without the stray words only when that is safe to run
|
|
702
|
+
* (`safeLine`: show reads and changes nothing; a preview remove without its
|
|
703
|
+
* option would remove the whole preview), and always the command's help.
|
|
704
|
+
* @param {string} command the command's words after the group (`set`, `preview remove`)
|
|
705
|
+
* @param {import('@astryxdesign/cli/authoring').CommandDoc} doc the command's doc, which lists its options
|
|
706
|
+
* @param {string} head the command line's start, as the project runs it
|
|
707
|
+
* @param {{option?: string, extra?: string[], note?: string}} stray an option it does not take, or words past what it takes, and a sentence about them
|
|
708
|
+
* @param {string | null} [safeLine] the command without them, when it is safe to run
|
|
709
|
+
* @returns {{message: string, suggestions: Array<{name: string, reason: string}>, code: string}}
|
|
710
|
+
*/
|
|
711
|
+
function strayAnswer(command, doc, head, stray, safeLine = null) {
|
|
712
|
+
const takes = [
|
|
713
|
+
...(doc.options ?? []).flatMap(o =>
|
|
714
|
+
String(o.flag)
|
|
715
|
+
.split(/[\s,]+/)
|
|
716
|
+
.filter(w => w.startsWith('--')),
|
|
717
|
+
),
|
|
718
|
+
'--json',
|
|
719
|
+
].filter((w, i, all) => all.indexOf(w) === i);
|
|
720
|
+
const list =
|
|
721
|
+
takes.length > 1
|
|
722
|
+
? `${takes.slice(0, -1).join(', ')} and ${takes.at(-1)}`
|
|
723
|
+
: takes.join('');
|
|
724
|
+
const message = stray.option
|
|
725
|
+
? `unknown option '${stray.option}': ${command} takes ${list}${stray.note ? `; ${stray.note}` : ''}.`
|
|
726
|
+
: `${command} does not take "${(stray.extra ?? []).join(' ')}"${stray.note ? `; ${stray.note}` : ''}.`;
|
|
727
|
+
return {
|
|
728
|
+
message,
|
|
729
|
+
suggestions: [
|
|
730
|
+
...(safeLine ? [{name: cmd(safeLine), reason: 'do this instead'}] : []),
|
|
731
|
+
{
|
|
732
|
+
name: cmd(`${head} --help`),
|
|
733
|
+
reason: stray.option ? 'every option it takes' : 'what it takes',
|
|
734
|
+
},
|
|
735
|
+
],
|
|
736
|
+
code: stray.option
|
|
737
|
+
? ERROR_CODES.ERR_INVALID_OPTION
|
|
738
|
+
: ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* {@link strayAnswer} as the refusal the command prints.
|
|
744
|
+
* @param {string} command
|
|
745
|
+
* @param {import('@astryxdesign/cli/authoring').CommandDoc} doc
|
|
746
|
+
* @param {string} head
|
|
747
|
+
* @param {{option?: string, extra?: string[], note?: string}} stray
|
|
748
|
+
* @param {string | null} [safeLine]
|
|
749
|
+
*/
|
|
750
|
+
function strayRefusal(command, doc, head, stray, safeLine = null) {
|
|
751
|
+
const a = strayAnswer(command, doc, head, stray, safeLine);
|
|
752
|
+
return cliError(a.message, {suggestions: a.suggestions, code: a.code});
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Read the options of an editor command as written, the one reading every
|
|
757
|
+
* editor command gives them: an option in other letters, with one dash or
|
|
758
|
+
* a typed dash (`--On`, `-only`, `\u2014only`) or within the one typo limit
|
|
759
|
+
* of an option the command takes (`--olny`) is that option; a boolean
|
|
760
|
+
* option written with a value (`--png=false`, `--only true`) takes none,
|
|
761
|
+
* and its value is read by the one yes/no reader (booleanWord). Null when
|
|
762
|
+
* every option is written as the command takes it; else the reason, and
|
|
763
|
+
* the command as meant (the option as the command takes it; a boolean as
|
|
764
|
+
* itself for yes, left out for no), or no command when a boolean's value
|
|
765
|
+
* reads as neither.
|
|
766
|
+
* @param {string} command the subcommand (`set`, `undo`, `new`, `show`, how's word; `add` under preview)
|
|
767
|
+
* @param {import('@astryxdesign/cli/authoring').CommandDoc} doc the command's doc, which lists its options
|
|
768
|
+
* @param {{group: string, head: string}} [where] the group word the subcommand follows (`editor`, `preview`) and the command line's start
|
|
769
|
+
* @returns {{why: string, line: string | null} | null}
|
|
770
|
+
*/
|
|
771
|
+
function optionsAsWritten(
|
|
772
|
+
command,
|
|
773
|
+
doc,
|
|
774
|
+
where = {group: 'editor', head: `${EDITOR} ${command}`},
|
|
775
|
+
) {
|
|
776
|
+
const flags = (doc.options ?? []).map(opt => String(opt.flag));
|
|
777
|
+
const names = (/** @type {(f: string) => boolean} */ keep) =>
|
|
778
|
+
flags
|
|
779
|
+
.filter(keep)
|
|
780
|
+
.flatMap(f => f.split(/[\s,]+/).filter(w => w.startsWith('--')));
|
|
781
|
+
const booleans = ['--json', ...names(f => !/[<[]/.test(f))];
|
|
782
|
+
const all = [...booleans, ...names(f => /[<[]/.test(f))];
|
|
783
|
+
/** The option a word names, as the command takes it, or null. @param {string} word */
|
|
784
|
+
const meant = word => {
|
|
785
|
+
const w = word.toLowerCase();
|
|
786
|
+
if (all.includes(`--${w}`)) return `--${w}`;
|
|
787
|
+
const near = all.filter(o => typoNear(w, o.slice(2)));
|
|
788
|
+
return near.length === 1 ? near[0] : null;
|
|
789
|
+
};
|
|
790
|
+
const argv = process.argv;
|
|
791
|
+
const at = argv.indexOf(command, argv.indexOf(where.group) + 1);
|
|
792
|
+
if (at < 0) return null;
|
|
793
|
+
/** @type {string[]} */
|
|
794
|
+
const words = [];
|
|
795
|
+
/** @type {string | null} */
|
|
796
|
+
let why = null;
|
|
797
|
+
let unread = false;
|
|
798
|
+
for (let i = at + 1; i < argv.length; i += 1) {
|
|
799
|
+
const a = argv[i];
|
|
800
|
+
if (a === '--') {
|
|
801
|
+
words.push(...argv.slice(i));
|
|
802
|
+
break;
|
|
803
|
+
}
|
|
804
|
+
const m = /^(--?|[\u2013\u2014]-?)([A-Za-z][A-Za-z-]*)(?:=(.*))?$/.exec(a);
|
|
805
|
+
const flag = m ? meant(m[2]) : null;
|
|
806
|
+
if (!m || !flag) {
|
|
807
|
+
if (a !== '--json') words.push(a);
|
|
808
|
+
continue;
|
|
809
|
+
}
|
|
810
|
+
const written = m[3] == null ? `${m[1]}${m[2]}` : a.split('=')[0];
|
|
811
|
+
if (written !== flag)
|
|
812
|
+
why ??= `unknown option '${written}' (did you mean ${flag}?)`;
|
|
813
|
+
const next = argv[i + 1];
|
|
814
|
+
if (booleans.includes(flag)) {
|
|
815
|
+
// A value after a boolean option, joined by `=` or as the next word
|
|
816
|
+
// when that word is a yes or a no.
|
|
817
|
+
const value = m[3] ?? (booleanWord(next) != null ? String(next) : null);
|
|
818
|
+
if (value != null) {
|
|
819
|
+
if (m[3] == null) i += 1;
|
|
820
|
+
const read = booleanWord(value);
|
|
821
|
+
const shown = m[3] == null ? `${a} ${value}` : a;
|
|
822
|
+
if (read == null) unread = true;
|
|
823
|
+
why ??=
|
|
824
|
+
read == null
|
|
825
|
+
? `${flag} takes no value ("${shown}"), and "${value}" reads as neither yes nor no: give ${flag} alone for yes, or leave it out`
|
|
826
|
+
: `${flag} takes no value ("${shown}"): give it alone for yes, or leave it out`;
|
|
827
|
+
if (read === true && flag !== '--json') words.push(flag);
|
|
828
|
+
continue;
|
|
829
|
+
}
|
|
830
|
+
if (flag !== '--json') words.push(flag);
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
// An option that takes a value, given none, is left out of the line.
|
|
834
|
+
if (m[3] == null && (next == null || /^-/.test(next))) continue;
|
|
835
|
+
words.push(flag);
|
|
836
|
+
if (m[3] != null) words.push(m[3]);
|
|
837
|
+
}
|
|
838
|
+
if (!why) return null;
|
|
839
|
+
return {
|
|
840
|
+
why,
|
|
841
|
+
line: unread
|
|
842
|
+
? null
|
|
843
|
+
: `${where.head} ${words.map(w => (/^--[a-z]/.test(w) && all.includes(w) ? w : quoteCommandArgument(w))).join(' ')}`.trim(),
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
* An option a theme command does not take, as the one option reader reads
|
|
849
|
+
* it (the json shim asks, for the options commander refuses: preview's
|
|
850
|
+
* subcommands): the option meant with the command that works, else what
|
|
851
|
+
* the command takes and its help. Undefined for any other command.
|
|
852
|
+
* @param {any} c the command commander refused
|
|
853
|
+
* @returns {{message: string, suggestions: Array<{name: string, reason: string}>} | undefined}
|
|
854
|
+
*/
|
|
855
|
+
function unknownThemeOption(c) {
|
|
856
|
+
const sub = c?.name?.();
|
|
857
|
+
const doc =
|
|
858
|
+
/** @type {Record<string, import('@astryxdesign/cli/authoring').CommandDoc>} */ ({
|
|
859
|
+
add: previewAddDoc,
|
|
860
|
+
app: previewAppDoc,
|
|
861
|
+
list: previewListDoc,
|
|
862
|
+
remove: previewRemoveDoc,
|
|
863
|
+
})[sub];
|
|
864
|
+
if (!doc || c.parent?.name?.() !== 'preview') return undefined;
|
|
865
|
+
const head = `${PREFIX} preview ${sub}`;
|
|
866
|
+
const help = {name: cmd(`${head} --help`), reason: 'every option it takes'};
|
|
867
|
+
const read = optionsAsWritten(sub, doc, {group: 'preview', head});
|
|
868
|
+
if (read)
|
|
869
|
+
return {
|
|
870
|
+
message: `${read.why}.`,
|
|
647
871
|
suggestions: [
|
|
648
|
-
|
|
649
|
-
name: cmd(
|
|
650
|
-
|
|
651
|
-
|
|
872
|
+
...(read.line
|
|
873
|
+
? [{name: cmd(read.line), reason: 'do this instead'}]
|
|
874
|
+
: []),
|
|
875
|
+
help,
|
|
652
876
|
],
|
|
653
|
-
|
|
877
|
+
};
|
|
878
|
+
const takes = (doc.options ?? []).flatMap(o =>
|
|
879
|
+
String(o.flag)
|
|
880
|
+
.split(/[\s,]+/)
|
|
881
|
+
.filter(w => w.startsWith('--')),
|
|
882
|
+
);
|
|
883
|
+
const argv = process.argv;
|
|
884
|
+
const from = argv.indexOf(sub, argv.indexOf('preview') + 1);
|
|
885
|
+
const stray = argv
|
|
886
|
+
.slice(from + 1)
|
|
887
|
+
.find(
|
|
888
|
+
(w, i, rest) =>
|
|
889
|
+
w.startsWith('-') &&
|
|
890
|
+
!rest.slice(0, i).includes('--') &&
|
|
891
|
+
![...takes, '--json', '--help', '-h'].includes(w.split('=')[0]),
|
|
892
|
+
);
|
|
893
|
+
// A folder name that starts with "-" reads as an option: it goes after
|
|
894
|
+
// --, and that line is the safe one.
|
|
895
|
+
const folder =
|
|
896
|
+
sub === 'app' && stray && /^-[^-]/.test(stray) && stray.length > 2;
|
|
897
|
+
const a = strayAnswer(
|
|
898
|
+
`preview ${sub}`,
|
|
899
|
+
doc,
|
|
900
|
+
head,
|
|
901
|
+
{
|
|
902
|
+
option: stray ?? '',
|
|
903
|
+
...(folder
|
|
904
|
+
? {note: 'a folder name that starts with "-" goes after --'}
|
|
905
|
+
: {}),
|
|
654
906
|
},
|
|
907
|
+
folder ? `${head} -- ${stray}` : null,
|
|
655
908
|
);
|
|
909
|
+
return {message: a.message, suggestions: a.suggestions};
|
|
656
910
|
}
|
|
657
911
|
|
|
658
912
|
/**
|
|
659
|
-
*
|
|
660
|
-
*
|
|
913
|
+
* The refusal of options not written as the command takes them, with the
|
|
914
|
+
* command as meant when there is one.
|
|
661
915
|
* @param {string} command
|
|
662
|
-
* @param {string
|
|
916
|
+
* @param {{why: string, line: string | null}} read
|
|
663
917
|
*/
|
|
664
|
-
function
|
|
665
|
-
|
|
666
|
-
return cliError(`${command} does not take "${extra.join(' ')}".`, {
|
|
918
|
+
function optionsRefusal(command, read) {
|
|
919
|
+
return cliError(`${read.why}.`, {
|
|
667
920
|
suggestions: [
|
|
668
|
-
{name: cmd(
|
|
921
|
+
...(read.line ? [{name: cmd(read.line), reason: 'do this instead'}] : []),
|
|
922
|
+
{
|
|
923
|
+
name: cmd(`${EDITOR} ${command} --help`),
|
|
924
|
+
reason: 'every option it takes',
|
|
925
|
+
},
|
|
669
926
|
],
|
|
670
|
-
code: ERROR_CODES.
|
|
927
|
+
code: ERROR_CODES.ERR_INVALID_OPTION,
|
|
671
928
|
});
|
|
672
929
|
}
|
|
673
930
|
|
|
931
|
+
/**
|
|
932
|
+
* {@link optionsAsWritten} as a refusal, or null.
|
|
933
|
+
* @param {string} command
|
|
934
|
+
* @param {import('@astryxdesign/cli/authoring').CommandDoc} doc
|
|
935
|
+
*/
|
|
936
|
+
function readOptions(command, doc) {
|
|
937
|
+
const read = optionsAsWritten(command, doc);
|
|
938
|
+
return read ? optionsRefusal(command, read) : null;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* {@link readOptions} for `set` and `undo`, whose line is checked as every
|
|
943
|
+
* offered line is (the command's own check, a repair it offers folded in):
|
|
944
|
+
* a line set or undo refuses with no repair is not offered.
|
|
945
|
+
* @param {'set' | 'undo'} command
|
|
946
|
+
* @param {import('@astryxdesign/cli/authoring').CommandDoc} doc
|
|
947
|
+
*/
|
|
948
|
+
async function readOptionsChecked(command, doc) {
|
|
949
|
+
const read = optionsAsWritten(command, doc);
|
|
950
|
+
if (!read) return null;
|
|
951
|
+
const line = read.line
|
|
952
|
+
? await editorCheckedLine(command, read.line, process.cwd())
|
|
953
|
+
: null;
|
|
954
|
+
return optionsRefusal(command, {...read, line});
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Refuse an option `show` does not take with a show that works: the same
|
|
959
|
+
* show without it, and its help (an option the one reader names, and one
|
|
960
|
+
* written with a value, are read first by {@link readOptions}). Null when
|
|
961
|
+
* there is none.
|
|
962
|
+
* @param {string} name
|
|
963
|
+
* @param {unknown[]} rest the words after the theme
|
|
964
|
+
* @param {{png?: boolean, section?: string}} o the options read
|
|
965
|
+
*/
|
|
966
|
+
function showStray(name, rest, o) {
|
|
967
|
+
const stray = rest.map(String).find(w => w.startsWith('-'));
|
|
968
|
+
if (stray == null) return null;
|
|
969
|
+
// An option the one reader names never comes here (readOptions reads
|
|
970
|
+
// it first): this one is none show takes, so the show it offers leaves it
|
|
971
|
+
// out and names no guess.
|
|
972
|
+
return strayRefusal(
|
|
973
|
+
'show',
|
|
974
|
+
showDoc,
|
|
975
|
+
`${EDITOR} show`,
|
|
976
|
+
{option: stray},
|
|
977
|
+
`${EDITOR} show ${name}${o.section ? ` --section ${o.section}` : ''}${o.png ? ' --png' : ''}`,
|
|
978
|
+
);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* A refusal for words after what a command takes, which would otherwise be
|
|
983
|
+
* dropped without a word (the one stray reader); null when there are none.
|
|
984
|
+
* @param {string} command
|
|
985
|
+
* @param {import('@astryxdesign/cli/authoring').CommandDoc} doc
|
|
986
|
+
* @param {string[]} extra
|
|
987
|
+
*/
|
|
988
|
+
function extraWords(command, doc, extra) {
|
|
989
|
+
if (!extra.length) return null;
|
|
990
|
+
return strayRefusal(command, doc, `${EDITOR} ${command}`, {extra});
|
|
991
|
+
}
|
|
992
|
+
|
|
674
993
|
/**
|
|
675
994
|
* Help that explains exactly what a subcommand does: its whole description
|
|
676
995
|
* under the usage line, while the group's list keeps the one-line summary.
|
|
@@ -727,18 +1046,24 @@ function defineGroup(parent, doc) {
|
|
|
727
1046
|
if (extras.length > 0) {
|
|
728
1047
|
const word = String(extras[0]).toLowerCase();
|
|
729
1048
|
const group = doc.name.split(' ').at(-1) ?? '';
|
|
730
|
-
const moved =
|
|
731
|
-
MOVED[group]?.[word] ??
|
|
732
|
-
// `preview <theme>`: the pages for a theme.
|
|
733
|
-
(group === 'preview' && /^[a-z][a-z0-9-]*$/.test(word)
|
|
734
|
-
? `add --theme ${word}`
|
|
735
|
-
: null);
|
|
736
1049
|
const ranked = (cmd.commands ?? [])
|
|
737
1050
|
.map(command => command.name())
|
|
738
1051
|
.sort(
|
|
739
1052
|
(a, b) =>
|
|
740
1053
|
levenshteinDistance(word, a) - levenshteinDistance(word, b),
|
|
741
1054
|
);
|
|
1055
|
+
// A typo of a subcommand (lst, remve) is that subcommand; any
|
|
1056
|
+
// other word after `preview` that names an editor theme here asks
|
|
1057
|
+
// for that theme's pages.
|
|
1058
|
+
const typo = typoOf(word, ranked[0] ?? '') ? ranked[0] : null;
|
|
1059
|
+
const moved =
|
|
1060
|
+
MOVED[group]?.[word] ??
|
|
1061
|
+
(typo
|
|
1062
|
+
? null
|
|
1063
|
+
: group === 'preview' &&
|
|
1064
|
+
editorThemesAt(process.cwd()).includes(word)
|
|
1065
|
+
? `add --theme ${word}`
|
|
1066
|
+
: null);
|
|
742
1067
|
return cliError(
|
|
743
1068
|
`unknown subcommand '${doc.name} ${String(extras[0])}'${moved ? `; it is ${here} ${moved}` : ''}`,
|
|
744
1069
|
{
|
|
@@ -777,12 +1102,34 @@ function defineGroup(parent, doc) {
|
|
|
777
1102
|
return cmd;
|
|
778
1103
|
}
|
|
779
1104
|
|
|
1105
|
+
/**
|
|
1106
|
+
* A preview command's result, once it is in: this client owns its process,
|
|
1107
|
+
* so a stop that lands while the result is printed is held, and a printed
|
|
1108
|
+
* ok never ends with exit 130. The API itself leaves no listener behind.
|
|
1109
|
+
* @template T
|
|
1110
|
+
* @param {Promise<T>} result
|
|
1111
|
+
* @returns {Promise<T>}
|
|
1112
|
+
*/
|
|
1113
|
+
async function resultStands(result) {
|
|
1114
|
+
const r = await result;
|
|
1115
|
+
for (const sig of /** @type {const} */ (['SIGINT', 'SIGTERM']))
|
|
1116
|
+
if (!process.listeners(sig).includes(heldStop)) process.on(sig, heldStop);
|
|
1117
|
+
return r;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/** A stop after a preview command finished: its result stands. */
|
|
1121
|
+
function heldStop() {}
|
|
1122
|
+
|
|
780
1123
|
/**
|
|
781
1124
|
* Register `theme` and its subcommands under the `experimental` group.
|
|
782
1125
|
* @param {import('commander').Command} group the `experimental` command
|
|
783
1126
|
* @param {import('commander').Command} program the root program
|
|
784
1127
|
*/
|
|
785
1128
|
export function registerExperimentalTheme(group, program) {
|
|
1129
|
+
// A command run with no theme names the app's only theme.
|
|
1130
|
+
setEditorThemeList(editorThemesAt);
|
|
1131
|
+
setEditorFreeName(editorFreeName);
|
|
1132
|
+
setUnknownOptionReader(unknownThemeOption);
|
|
786
1133
|
const theme = defineGroup(group, groupDoc);
|
|
787
1134
|
explained(theme, groupDoc);
|
|
788
1135
|
theme.addHelpText(
|
|
@@ -804,9 +1151,13 @@ export function registerExperimentalTheme(group, program) {
|
|
|
804
1151
|
/** @type {any} */ o,
|
|
805
1152
|
/** @type {any} */ cmd,
|
|
806
1153
|
) =>
|
|
1154
|
+
// An option given a value is refused before the run, as for every
|
|
1155
|
+
// other editor command: a refusal inside run is thrown, never
|
|
1156
|
+
// printed there.
|
|
1157
|
+
readOptions('new', newDoc) ??
|
|
807
1158
|
run(
|
|
808
1159
|
program,
|
|
809
|
-
() => {
|
|
1160
|
+
async () => {
|
|
810
1161
|
// An option new does not take (--force, --dry-run, -t) is refused
|
|
811
1162
|
// with new's help, as every editor command's unknown option is.
|
|
812
1163
|
const takes = new Set(
|
|
@@ -824,55 +1175,139 @@ export function registerExperimentalTheme(group, program) {
|
|
|
824
1175
|
(/** @type {string} */ w) =>
|
|
825
1176
|
/^-/.test(w) && !takes.has(w.split('=')[0]),
|
|
826
1177
|
);
|
|
1178
|
+
// `--base` is the dial new takes as --like.
|
|
1179
|
+
if (stray && stray.split('=')[0] === '--base') {
|
|
1180
|
+
const args = (cmd?.args ?? []).slice(1).map(String);
|
|
1181
|
+
const at = args.indexOf(stray);
|
|
1182
|
+
const value = stray.includes('=')
|
|
1183
|
+
? stray.slice(stray.indexOf('=') + 1)
|
|
1184
|
+
: args[at + 1];
|
|
1185
|
+
// Thrown, as every refusal inside run is: run prints it once
|
|
1186
|
+
// (a refusal printed here and then caught again by run would
|
|
1187
|
+
// print twice where exit does not end the process).
|
|
1188
|
+
throw new AstryxError(
|
|
1189
|
+
`new takes the base theme as --like, not --base.`,
|
|
1190
|
+
value
|
|
1191
|
+
? [
|
|
1192
|
+
{
|
|
1193
|
+
name: `${EDITOR} new ${quoteCommandArgument(name)}${newFlagLine({...o, like: value})}`,
|
|
1194
|
+
reason: 'do this instead',
|
|
1195
|
+
},
|
|
1196
|
+
]
|
|
1197
|
+
: [
|
|
1198
|
+
{
|
|
1199
|
+
name: `${EDITOR} new --help`,
|
|
1200
|
+
reason: 'every option it takes',
|
|
1201
|
+
},
|
|
1202
|
+
],
|
|
1203
|
+
ERROR_CODES.ERR_INVALID_OPTION,
|
|
1204
|
+
);
|
|
1205
|
+
}
|
|
827
1206
|
if (stray)
|
|
828
|
-
|
|
829
|
-
|
|
1207
|
+
throw new AstryxError(
|
|
1208
|
+
`unknown option '${stray}'.`,
|
|
1209
|
+
[
|
|
830
1210
|
{
|
|
831
|
-
name:
|
|
1211
|
+
name: `${EDITOR} new --help`,
|
|
832
1212
|
reason: 'every option it takes',
|
|
833
1213
|
},
|
|
834
1214
|
],
|
|
835
|
-
|
|
836
|
-
|
|
1215
|
+
ERROR_CODES.ERR_INVALID_OPTION,
|
|
1216
|
+
);
|
|
837
1217
|
// A word after the name is never dropped without a word.
|
|
838
1218
|
const extra = (cmd?.args ?? []).slice(1);
|
|
839
1219
|
if (extra.length) {
|
|
840
1220
|
// Words after `--` that are `--<option> <value>` pairs new
|
|
841
1221
|
// takes become options; the other words were most likely
|
|
842
1222
|
// part of the name. The options given stay in the suggestion.
|
|
843
|
-
/** @type {Record<string,
|
|
1223
|
+
/** @type {Record<string, any>} */
|
|
844
1224
|
const given = {...o};
|
|
845
1225
|
/** @type {string[]} */
|
|
846
1226
|
const words = [];
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
1227
|
+
// Each word in the order typed: one that follows an option's
|
|
1228
|
+
// value with no option between is more of that value, read as
|
|
1229
|
+
// set reads it (`--font Open Sans` is the family Open Sans).
|
|
1230
|
+
const valueFlags = new Set(
|
|
1231
|
+
(newDoc.options ?? [])
|
|
1232
|
+
.filter(opt => /</.test(String(opt.flag)))
|
|
1233
|
+
.map(opt => String(opt.flag).split(' ')[0]),
|
|
1234
|
+
);
|
|
1235
|
+
const camel = (/** @type {string} */ f) =>
|
|
1236
|
+
f.slice(2).replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
1237
|
+
const argv = process.argv;
|
|
1238
|
+
const from = argv.indexOf('new', argv.indexOf('editor') + 1);
|
|
1239
|
+
/** @type {string | null} */
|
|
1240
|
+
let open = null;
|
|
1241
|
+
let named = false;
|
|
1242
|
+
for (let i = from + 1; from >= 0 && i < argv.length; i++) {
|
|
1243
|
+
const w = argv[i];
|
|
1244
|
+
if (w === '--') {
|
|
1245
|
+
// After `--`, `--<option> <value>` pairs new takes.
|
|
1246
|
+
for (let j = i + 1; j < argv.length; j++) {
|
|
1247
|
+
const x = argv[j];
|
|
1248
|
+
if (x.startsWith('--')) {
|
|
1249
|
+
if (argv[j + 1] != null && given[camel(x)] == null)
|
|
1250
|
+
given[camel(x)] = argv[++j];
|
|
1251
|
+
} else words.push(x);
|
|
1252
|
+
}
|
|
1253
|
+
break;
|
|
1254
|
+
}
|
|
1255
|
+
if (w.startsWith('-')) {
|
|
1256
|
+
const flag = w.split('=')[0];
|
|
1257
|
+
open = valueFlags.has(flag) ? camel(flag) : null;
|
|
1258
|
+
if (open && !w.includes('=')) i += 1;
|
|
1259
|
+
continue;
|
|
1260
|
+
}
|
|
1261
|
+
// The name ends the value of an option typed before it: a
|
|
1262
|
+
// word after the name is never more of that value.
|
|
1263
|
+
if (!named) {
|
|
1264
|
+
named = true;
|
|
1265
|
+
open = null;
|
|
1266
|
+
continue;
|
|
1267
|
+
}
|
|
1268
|
+
if (open) {
|
|
1269
|
+
const had = given[open];
|
|
1270
|
+
given[open] = Array.isArray(had)
|
|
1271
|
+
? [...had.slice(0, -1), `${had.at(-1)} ${w}`]
|
|
1272
|
+
: `${had} ${w}`;
|
|
855
1273
|
continue;
|
|
856
1274
|
}
|
|
857
1275
|
words.push(w);
|
|
858
1276
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
const
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1277
|
+
// A built-in theme among the words (after a `like` word, or
|
|
1278
|
+
// typed as the name with the real name after it) is the base,
|
|
1279
|
+
// as --like; every other word is part of the name.
|
|
1280
|
+
const all = [String(name), ...words];
|
|
1281
|
+
const baseAt = all.findIndex(
|
|
1282
|
+
(w, i) =>
|
|
1283
|
+
builtInThemes().includes(w.toLowerCase()) &&
|
|
1284
|
+
(i > 0 || all.length > 1),
|
|
1285
|
+
);
|
|
1286
|
+
if (baseAt >= 0 && given.like == null)
|
|
1287
|
+
given.like = all[baseAt].toLowerCase();
|
|
1288
|
+
const nameWords = all.filter(
|
|
1289
|
+
(w, i) =>
|
|
1290
|
+
i !== baseAt &&
|
|
1291
|
+
!(baseAt >= 0 && /^like$/i.test(w) && i === baseAt - 1),
|
|
1292
|
+
);
|
|
1293
|
+
const fixed = nameWords
|
|
1294
|
+
.join('-')
|
|
1295
|
+
.toLowerCase()
|
|
1296
|
+
.replace(/[^a-z0-9-]+/g, '-');
|
|
1297
|
+
// The line is checked as every new line is offered.
|
|
1298
|
+
const read = Object.keys(given).some(k => given[k] !== o[k]);
|
|
868
1299
|
throw new AstryxError(
|
|
869
|
-
`new takes one theme name; "${extra.join(' ')}" is extra. For a base theme, use --like. Nothing was changed.`,
|
|
870
|
-
|
|
1300
|
+
`new takes one theme name; "${extra.join(' ')}" is extra.${read ? ' A value of more than one word goes in quotes.' : ''} For a base theme, use --like. Nothing was changed.`,
|
|
1301
|
+
await editorCheckedNewLines(
|
|
1302
|
+
`${EDITOR} new ${quoteCommandArgument(fixed)}${newFlagLine(given)}`,
|
|
1303
|
+
fixed,
|
|
871
1304
|
{
|
|
872
|
-
|
|
873
|
-
|
|
1305
|
+
cwd: process.cwd(),
|
|
1306
|
+
like: given.like,
|
|
1307
|
+
png: given.png ?? false,
|
|
1308
|
+
settings: newSettingsGiven(given),
|
|
874
1309
|
},
|
|
875
|
-
|
|
1310
|
+
),
|
|
876
1311
|
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
877
1312
|
);
|
|
878
1313
|
}
|
|
@@ -908,10 +1343,17 @@ export function registerExperimentalTheme(group, program) {
|
|
|
908
1343
|
// A declaration pasted as one argument (`--color-accent: #e11d48`,
|
|
909
1344
|
// or `--color-accent:#e11d48`) is the token and its value; with no
|
|
910
1345
|
// value otherwise, the missing-argument error the parser gives.
|
|
1346
|
+
// A pasted JSON object of settings goes to the editor whole, which
|
|
1347
|
+
// gives one set line per entry.
|
|
1348
|
+
if (!value.length && /^\s*\{/.test(thing)) value = [''];
|
|
911
1349
|
if (!value.length) {
|
|
912
1350
|
// Any thing, a token or a dial, with `:` or `=` (`accent: red`,
|
|
913
1351
|
// `--color-accent=#e11d48`).
|
|
914
|
-
|
|
1352
|
+
// A thing and its value in one word (`'corners pill'`) are the
|
|
1353
|
+
// same as given apart.
|
|
1354
|
+
const pasted =
|
|
1355
|
+
/^(\S+?)\s*[:=]\s*(.+?);?\s*$/.exec(thing) ??
|
|
1356
|
+
/^\s*(\S+)\s+(.+?)\s*$/.exec(thing);
|
|
915
1357
|
if (!pasted)
|
|
916
1358
|
return missingSetValue(
|
|
917
1359
|
editor.commands.find(c => c.name() === 'set'),
|
|
@@ -919,14 +1361,20 @@ export function registerExperimentalTheme(group, program) {
|
|
|
919
1361
|
thing = pasted[1];
|
|
920
1362
|
value = [pasted[2]];
|
|
921
1363
|
}
|
|
922
|
-
return (
|
|
923
|
-
|
|
1364
|
+
return (async () =>
|
|
1365
|
+
(await readOptionsChecked('set', setDoc)) ??
|
|
1366
|
+
// A token typed after its value (`set t 4px --radius-element`)
|
|
1367
|
+
// is no option: the set reads the two in the other order.
|
|
1368
|
+
(value.length === 1 &&
|
|
1369
|
+
/^--[a-z0-9-]+$/i.test(value[0]) &&
|
|
1370
|
+
!thing.startsWith('-')
|
|
1371
|
+
? null
|
|
1372
|
+
: strayOption('set', setDoc, value)) ??
|
|
924
1373
|
run(
|
|
925
1374
|
program,
|
|
926
1375
|
() => themeEditSet(name, thing, value.join(' '), changeOptions(o)),
|
|
927
1376
|
changeBlocks,
|
|
928
|
-
)
|
|
929
|
-
);
|
|
1377
|
+
))();
|
|
930
1378
|
},
|
|
931
1379
|
}),
|
|
932
1380
|
setDoc,
|
|
@@ -941,7 +1389,9 @@ export function registerExperimentalTheme(group, program) {
|
|
|
941
1389
|
/** @type {any} */ o,
|
|
942
1390
|
/** @type {any} */ c,
|
|
943
1391
|
) =>
|
|
944
|
-
|
|
1392
|
+
readOptions('show', showDoc) ??
|
|
1393
|
+
showStray(name, (c?.args ?? []).slice(1), o) ??
|
|
1394
|
+
extraWords('show', showDoc, (c?.args ?? []).slice(1)) ??
|
|
945
1395
|
// The sheet is limited to one section (the docs say so): a second
|
|
946
1396
|
// --section is refused, never kept over the first in silence.
|
|
947
1397
|
(new Set(flagValues('section')).size > 1
|
|
@@ -974,6 +1424,8 @@ export function registerExperimentalTheme(group, program) {
|
|
|
974
1424
|
),
|
|
975
1425
|
}),
|
|
976
1426
|
showDoc,
|
|
1427
|
+
// An unknown option reaches the action, which names a show that works.
|
|
1428
|
+
{tokens: true},
|
|
977
1429
|
);
|
|
978
1430
|
|
|
979
1431
|
explained(
|
|
@@ -986,27 +1438,31 @@ export function registerExperimentalTheme(group, program) {
|
|
|
986
1438
|
/** @type {any} */ o,
|
|
987
1439
|
/** @type {import('commander').Command} */ c,
|
|
988
1440
|
) =>
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
(
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
r
|
|
1441
|
+
(async () =>
|
|
1442
|
+
(await readOptionsChecked('undo', undoDoc)) ??
|
|
1443
|
+
strayOption('undo', undoDoc, [which, ...(c?.args ?? []).slice(3)]) ??
|
|
1444
|
+
extraWords('undo', undoDoc, (c?.args ?? []).slice(3)) ??
|
|
1445
|
+
run(
|
|
1446
|
+
program,
|
|
1447
|
+
() =>
|
|
1448
|
+
themeEditUndo(name, {
|
|
1449
|
+
...changeOptions(o),
|
|
1450
|
+
...(thing == null ? {} : {thing, value: which}),
|
|
1451
|
+
}),
|
|
1452
|
+
r =>
|
|
1453
|
+
r.data.action === 'step'
|
|
1454
|
+
? [
|
|
1455
|
+
// What was undone is in the headline, so a tail of
|
|
1456
|
+
// the output keeps it.
|
|
1457
|
+
`[ok] ${r.data.theme}: undid ${/** @type {any} */ (r.data).undid ?? 'the last change'}${/** @type {any} */ (r.data).refusedBefore ? ` (${/** @type {any} */ (r.data).refusedBefore})` : ''}`,
|
|
1458
|
+
...project(/** @type {any} */ (r.data)),
|
|
1459
|
+
]
|
|
1460
|
+
: changeBlocks(
|
|
1461
|
+
/** @type {import('../../../../api/theme-edit/theme-edit.type.mjs').ThemeEditChangeResponse} */ (
|
|
1462
|
+
r
|
|
1463
|
+
),
|
|
1007
1464
|
),
|
|
1008
|
-
|
|
1009
|
-
),
|
|
1465
|
+
))(),
|
|
1010
1466
|
}),
|
|
1011
1467
|
undoDoc,
|
|
1012
1468
|
{tokens: true},
|
|
@@ -1026,13 +1482,15 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1026
1482
|
program,
|
|
1027
1483
|
() =>
|
|
1028
1484
|
previewFlagsOnce('add', ['theme', 'template', 'top', 'path']) ??
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1485
|
+
resultStands(
|
|
1486
|
+
themeEditPreviewAdd([words ?? []].flat().join(' ') || undefined, {
|
|
1487
|
+
cwd: process.cwd(),
|
|
1488
|
+
theme: o.theme,
|
|
1489
|
+
template: o.template,
|
|
1490
|
+
top: o.top,
|
|
1491
|
+
path: o.path,
|
|
1492
|
+
}),
|
|
1493
|
+
),
|
|
1036
1494
|
r => {
|
|
1037
1495
|
const {matched, skipped, ...rest} = r.data;
|
|
1038
1496
|
return [
|
|
@@ -1073,10 +1531,12 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1073
1531
|
program,
|
|
1074
1532
|
() =>
|
|
1075
1533
|
previewFlagsOnce('app', ['theme']) ??
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1534
|
+
resultStands(
|
|
1535
|
+
themeEditPreviewApp(dir, {
|
|
1536
|
+
cwd: process.cwd(),
|
|
1537
|
+
theme: o.theme,
|
|
1538
|
+
}),
|
|
1539
|
+
),
|
|
1080
1540
|
r => [
|
|
1081
1541
|
`[ok] new app in ${r.data.folder} with the theme preview`,
|
|
1082
1542
|
...project(/** @type {any} */ (r.data)),
|
|
@@ -1085,25 +1545,6 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1085
1545
|
}).allowExcessArguments(false),
|
|
1086
1546
|
previewAppDoc,
|
|
1087
1547
|
);
|
|
1088
|
-
{
|
|
1089
|
-
// A folder name that starts with "-" reads as an option: say how to
|
|
1090
|
-
// pass it.
|
|
1091
|
-
const app = /** @type {any} */ (
|
|
1092
|
-
preview.commands.find(
|
|
1093
|
-
(/** @type {any} */ x) =>
|
|
1094
|
-
x.name() === previewAppDoc.name.split(' ').pop(),
|
|
1095
|
-
)
|
|
1096
|
-
);
|
|
1097
|
-
const unknown = app?.unknownOption?.bind(app);
|
|
1098
|
-
if (app && unknown)
|
|
1099
|
-
app.unknownOption = (/** @type {string} */ flag) =>
|
|
1100
|
-
/^-[^-]/.test(flag) && flag.length > 2
|
|
1101
|
-
? app.error(
|
|
1102
|
-
`error: unknown option '${flag}'. A folder name that starts with "-" goes after --: ${PREFIX} preview app -- ${flag}`,
|
|
1103
|
-
{code: 'commander.unknownOption'},
|
|
1104
|
-
)
|
|
1105
|
-
: unknown(flag);
|
|
1106
|
-
}
|
|
1107
1548
|
|
|
1108
1549
|
explained(
|
|
1109
1550
|
defineCommand(preview, previewListDoc, {
|
|
@@ -1157,7 +1598,9 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1157
1598
|
program,
|
|
1158
1599
|
() =>
|
|
1159
1600
|
previewFlagsOnce('remove', ['path']) ??
|
|
1160
|
-
|
|
1601
|
+
resultStands(
|
|
1602
|
+
themeEditPreviewRemove(page, {cwd: process.cwd(), path: o.path}),
|
|
1603
|
+
),
|
|
1161
1604
|
r => [
|
|
1162
1605
|
r.data.pages.length
|
|
1163
1606
|
? `[ok] removed ${page} from the theme preview`
|
|
@@ -1256,7 +1699,10 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1256
1699
|
// question); a picture is told by its extension here only to keep
|
|
1257
1700
|
// option words after it for the count.
|
|
1258
1701
|
const picture = /\.png$/i.test(rest[0] ?? '');
|
|
1259
|
-
const stray = picture
|
|
1702
|
+
const stray = picture
|
|
1703
|
+
? null
|
|
1704
|
+
: (readOptions(howDoc.name.split(' ').pop() ?? 'how', howDoc) ??
|
|
1705
|
+
strayOption('how', howDoc, rest.slice(1)));
|
|
1260
1706
|
if (stray) return stray;
|
|
1261
1707
|
return run(
|
|
1262
1708
|
program,
|
|
@@ -1303,9 +1749,17 @@ export function registerExperimentalTheme(group, program) {
|
|
|
1303
1749
|
build: 'compile',
|
|
1304
1750
|
explain: editorThemeRefusal,
|
|
1305
1751
|
preflight: editorCompileProblem,
|
|
1752
|
+
follow: editorFollowCompile,
|
|
1306
1753
|
missingSource: editorMissingSource,
|
|
1307
1754
|
template: editorThemeTemplate,
|
|
1308
1755
|
hold: editorThemeHold,
|
|
1756
|
+
loadedFonts: editorLoadedFonts,
|
|
1757
|
+
extraData: editorBuildExtra,
|
|
1758
|
+
afterBuild: editorAfterBuild,
|
|
1759
|
+
sourcePath: editorSourcePath,
|
|
1760
|
+
fontHelp: editorFontHelp,
|
|
1761
|
+
install: editorInstall,
|
|
1762
|
+
colorModes: editorColorModes,
|
|
1309
1763
|
},
|
|
1310
1764
|
);
|
|
1311
1765
|
}
|