basalt-ui 3.0.0 → 3.1.0
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/AGENTS.md +1 -0
- package/CHANGELOG.md +72 -39
- package/MIGRATING.md +44 -2
- package/README.md +39 -12
- package/agent/rules/basalt-tokens.md +1 -1
- package/agent/rules/basalt-ui.md +3 -3
- package/agent/skills/basalt-app/references/live.md +4 -4
- package/agent/skills/basalt-app/references/migrate.md +2 -2
- package/agent/skills/basalt-app/references/setup.md +17 -8
- package/agent/skills/basalt-app/references/testing.md +8 -6
- package/agent/skills/basalt-design/SKILL.md +2 -1
- package/agent/skills/basalt-design/references/controls.md +1 -0
- package/agent/skills/basalt-design/references/parts.md +5 -1
- package/agent/templates/AGENTS-block.md.tpl +6 -23
- package/agent/templates/AGENTS-block.site.md.tpl +5 -18
- package/agent/templates/AGENTS-block.tokens.md.tpl +3 -7
- package/agent/templates/DESIGN.md.tpl +1 -1
- package/agent/templates/_app-error.i18n.tpl +8 -32
- package/agent/templates/_app-error.tpl +8 -32
- package/agent/templates/_app-pending.i18n.tpl +5 -3
- package/agent/templates/_app-pending.tpl +5 -4
- package/agent/templates/main.i18n.tpl +8 -3
- package/agent/templates/main.tpl +8 -3
- package/agent/templates/router.start.tpl +8 -3
- package/agent/templates/seed-messages.json +0 -30
- package/configs/oxlint-app.json +9 -1
- package/configs/oxlint-bridge.json +3 -1
- package/configs/oxlint-parts.json +9 -1
- package/configs/oxlint-site.json +3 -1
- package/dist/astro/shiki.d.ts +3 -2
- package/dist/astro/shiki.d.ts.map +1 -1
- package/dist/cards/bar-list.d.ts.map +1 -1
- package/dist/cards/bar-list.js +2 -1
- package/dist/cards/chain-view.d.ts +37 -8
- package/dist/cards/chain-view.d.ts.map +1 -1
- package/dist/cards/chain-view.js +105 -38
- package/dist/cards/contract.d.ts +8 -1
- package/dist/cards/contract.d.ts.map +1 -1
- package/dist/cards/data-panel.d.ts.map +1 -1
- package/dist/cards/data-panel.js +1 -0
- package/dist/cards/event-list.d.ts.map +1 -1
- package/dist/cards/event-list.js +3 -2
- package/dist/cards/index.d.ts +1 -1
- package/dist/cards/index.d.ts.map +1 -1
- package/dist/cards/row-list.d.ts.map +1 -1
- package/dist/cards/row-list.js +2 -1
- package/dist/cards/stat-card-parts.d.ts +3 -3
- package/dist/cards/stat-card-parts.d.ts.map +1 -1
- package/dist/cards/stat-card-parts.js +8 -2
- package/dist/cards/stat-card.d.ts.map +1 -1
- package/dist/cards/stat-card.js +34 -9
- package/dist/charts/core/compile.d.ts +2 -0
- package/dist/charts/core/compile.d.ts.map +1 -1
- package/dist/charts/core/compile.js +16 -8
- package/dist/charts/core/cursor.d.ts +2 -1
- package/dist/charts/core/cursor.d.ts.map +1 -1
- package/dist/charts/core/cursor.js +8 -1
- package/dist/charts/core/tooltip-said.d.ts +16 -0
- package/dist/charts/core/tooltip-said.d.ts.map +1 -0
- package/dist/charts/core/tooltip-said.js +39 -0
- package/dist/charts/focus.d.ts.map +1 -1
- package/dist/charts/focus.js +1 -1
- package/dist/charts/parts/chart-card.d.ts.map +1 -1
- package/dist/charts/parts/chart-card.js +1 -0
- package/dist/cli/agent-note.d.ts +3 -3
- package/dist/cli/agent-note.d.ts.map +1 -1
- package/dist/cli/agent-note.js +5 -5
- package/dist/cli/budget/index.d.ts +7 -0
- package/dist/cli/budget/index.d.ts.map +1 -1
- package/dist/cli/budget/index.js +11 -5
- package/dist/cli/config.d.ts +1 -1
- package/dist/cli/doctor/app.d.ts.map +1 -1
- package/dist/cli/doctor/app.js +53 -24
- package/dist/cli/doctor/eject.d.ts.map +1 -1
- package/dist/cli/doctor/eject.js +16 -9
- package/dist/cli/doctor/guards.d.ts.map +1 -1
- package/dist/cli/doctor/guards.js +11 -8
- package/dist/cli/doctor/hook.js +1 -1
- package/dist/cli/doctor/install.d.ts.map +1 -1
- package/dist/cli/doctor/install.js +46 -22
- package/dist/cli/doctor/translations.d.ts.map +1 -1
- package/dist/cli/doctor/translations.js +11 -4
- package/dist/cli/doctor/types.d.ts +2 -2
- package/dist/cli/doctor/types.d.ts.map +1 -1
- package/dist/cli/doctor/types.js +1 -1
- package/dist/cli/doctor/wiring.d.ts.map +1 -1
- package/dist/cli/doctor/wiring.js +26 -15
- package/dist/cli/eject/dropped-slots.d.ts +6 -0
- package/dist/cli/eject/dropped-slots.d.ts.map +1 -0
- package/dist/cli/eject/dropped-slots.js +9 -0
- package/dist/cli/eject/index.d.ts.map +1 -1
- package/dist/cli/eject/index.js +9 -8
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +7 -2
- package/dist/cli/index.d.ts +6 -5
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +38 -7
- package/dist/cli/init/index.d.ts +10 -0
- package/dist/cli/init/index.d.ts.map +1 -1
- package/dist/cli/init/index.js +61 -10
- package/dist/cli/init/locales.d.ts +7 -0
- package/dist/cli/init/locales.d.ts.map +1 -1
- package/dist/cli/init/locales.js +21 -6
- package/dist/cli/init/router-seeds.d.ts.map +1 -1
- package/dist/cli/init/router-seeds.js +16 -3
- package/dist/cli/init/steps.d.ts +36 -3
- package/dist/cli/init/steps.d.ts.map +1 -1
- package/dist/cli/init/steps.js +201 -34
- package/dist/cli/lint/baseline.d.ts +27 -0
- package/dist/cli/lint/baseline.d.ts.map +1 -0
- package/dist/cli/lint/baseline.js +96 -0
- package/dist/cli/lint/engine.d.ts +2 -0
- package/dist/cli/lint/engine.d.ts.map +1 -1
- package/dist/cli/lint/engine.js +18 -8
- package/dist/cli/lint/hook.d.ts.map +1 -1
- package/dist/cli/lint/hook.js +8 -3
- package/dist/cli/lint/index.d.ts +3 -0
- package/dist/cli/lint/index.d.ts.map +1 -1
- package/dist/cli/lint/index.js +67 -8
- package/dist/cli/manifest.d.ts +46 -3
- package/dist/cli/manifest.d.ts.map +1 -1
- package/dist/cli/manifest.js +71 -1
- package/dist/cli/migrate/census.d.ts +6 -0
- package/dist/cli/migrate/census.d.ts.map +1 -1
- package/dist/cli/migrate/census.js +22 -1
- package/dist/cli/migrate/index.d.ts +5 -0
- package/dist/cli/migrate/index.d.ts.map +1 -1
- package/dist/cli/migrate/index.js +36 -3
- package/dist/cli/migrate/lost-classes.d.ts +20 -0
- package/dist/cli/migrate/lost-classes.d.ts.map +1 -0
- package/dist/cli/migrate/lost-classes.js +145 -0
- package/dist/cli/migrate/rows.d.ts +10 -0
- package/dist/cli/migrate/rows.d.ts.map +1 -1
- package/dist/cli/migrate/rows.js +15 -0
- package/dist/cli/package-manager.d.ts.map +1 -1
- package/dist/cli/package-manager.js +2 -1
- package/dist/cli/peers.d.ts +2 -0
- package/dist/cli/peers.d.ts.map +1 -1
- package/dist/cli/peers.js +7 -0
- package/dist/cli/presets.d.ts.map +1 -1
- package/dist/cli/presets.js +27 -11
- package/dist/cli/resolver.d.ts +13 -4
- package/dist/cli/resolver.d.ts.map +1 -1
- package/dist/cli/resolver.js +39 -5
- package/dist/cli/router-wiring.d.ts +1 -0
- package/dist/cli/router-wiring.d.ts.map +1 -1
- package/dist/cli/router-wiring.js +1 -1
- package/dist/cli/sync/engine.d.ts +8 -1
- package/dist/cli/sync/engine.d.ts.map +1 -1
- package/dist/cli/sync/engine.js +25 -14
- package/dist/cli/sync/index.d.ts.map +1 -1
- package/dist/cli/sync/index.js +7 -4
- package/dist/cli/sync/render.d.ts.map +1 -1
- package/dist/cli/sync/render.js +21 -28
- package/dist/cli/tokens-css.d.ts +2 -0
- package/dist/cli/tokens-css.d.ts.map +1 -1
- package/dist/cli/tokens-css.js +28 -6
- package/dist/controls/contract.d.ts +2 -1
- package/dist/controls/contract.d.ts.map +1 -1
- package/dist/controls/control-home.d.ts +4 -1
- package/dist/controls/control-home.d.ts.map +1 -1
- package/dist/controls/control-home.js +5 -3
- package/dist/controls/local-control.d.ts +28 -1
- package/dist/controls/local-control.d.ts.map +1 -1
- package/dist/controls/local-control.js +14 -2
- package/dist/core/cn.d.ts.map +1 -1
- package/dist/core/cn.js +6 -5
- package/dist/core/frame-figure.d.ts +2 -0
- package/dist/core/frame-figure.d.ts.map +1 -1
- package/dist/core/frame-figure.js +5 -2
- package/dist/core/frame-head.d.ts +3 -1
- package/dist/core/frame-head.d.ts.map +1 -1
- package/dist/core/frame-head.js +28 -7
- package/dist/core/frame-regions.d.ts +1 -1
- package/dist/core/frame-regions.d.ts.map +1 -1
- package/dist/core/frame-regions.js +18 -8
- package/dist/core/info-hint.d.ts +5 -0
- package/dist/core/info-hint.d.ts.map +1 -1
- package/dist/core/info-hint.js +22 -1
- package/dist/core/mark-tone.d.ts +6 -2
- package/dist/core/mark-tone.d.ts.map +1 -1
- package/dist/core/mark-tone.js +1 -1
- package/dist/core/mark-types.d.ts +4 -2
- package/dist/core/mark-types.d.ts.map +1 -1
- package/dist/core/messages/chain.d.ts +2 -1
- package/dist/core/messages/chain.d.ts.map +1 -1
- package/dist/core/messages/chain.js +1 -0
- package/dist/core/messages/index.d.ts +2 -1
- package/dist/core/messages/index.d.ts.map +1 -1
- package/dist/core/messages/index.js +2 -0
- package/dist/core/messages/runs.d.ts +20 -0
- package/dist/core/messages/runs.d.ts.map +1 -0
- package/dist/core/messages/runs.js +18 -0
- package/dist/core/phase.d.ts +25 -2
- package/dist/core/phase.d.ts.map +1 -1
- package/dist/core/ports.d.ts +4 -1
- package/dist/core/ports.d.ts.map +1 -1
- package/dist/core/provider.d.ts +3 -1
- package/dist/core/provider.d.ts.map +1 -1
- package/dist/core/provider.js +5 -3
- package/dist/core/scheme.d.ts +2 -1
- package/dist/core/scheme.d.ts.map +1 -1
- package/dist/core/scheme.js +1 -0
- package/dist/core/spark/mini-bars.d.ts +6 -4
- package/dist/core/spark/mini-bars.d.ts.map +1 -1
- package/dist/core/spark/mini-bars.js +36 -11
- package/dist/core/spark/sparkline.d.ts +2 -2
- package/dist/core/spark/sparkline.d.ts.map +1 -1
- package/dist/core/spark/sparkline.js +21 -2
- package/dist/css/bridge.css +63 -0
- package/dist/css/generate.d.ts +2 -2
- package/dist/css/generate.d.ts.map +1 -1
- package/dist/css/generate.js +25 -0
- package/dist/data/live/live-query.d.ts +2 -2
- package/dist/data/live/live-query.d.ts.map +1 -1
- package/dist/data/live/live-query.js +2 -1
- package/dist/lint/preset.d.ts +12 -3
- package/dist/lint/preset.d.ts.map +1 -1
- package/dist/lint/preset.js +30 -10
- package/dist/lint/rules/class/table.d.ts.map +1 -1
- package/dist/lint/rules/class/table.js +3 -1
- package/dist/lint/rules/structure/control-home.js +1 -1
- package/dist/lint/rules/structure/import-boundary.d.ts.map +1 -1
- package/dist/lint/rules/structure/import-boundary.js +2 -0
- package/dist/lint/rules/structure/label-literal.d.ts.map +1 -1
- package/dist/lint/rules/structure/label-literal.js +1 -1
- package/dist/lint/shadcn.d.ts +562 -0
- package/dist/lint/shadcn.d.ts.map +1 -0
- package/dist/lint/shadcn.js +52 -0
- package/dist/lint/stylelint/render.d.ts +3 -1
- package/dist/lint/stylelint/render.d.ts.map +1 -1
- package/dist/lint/stylelint/render.js +23 -2
- package/dist/lint/stylelint/rules.d.ts +3 -2
- package/dist/lint/stylelint/rules.d.ts.map +1 -1
- package/dist/lint/stylelint/rules.js +11 -6
- package/dist/lint/weakened.d.ts +8 -0
- package/dist/lint/weakened.d.ts.map +1 -1
- package/dist/lint/weakened.js +44 -1
- package/dist/messages/de.d.ts.map +1 -1
- package/dist/messages/de.js +15 -0
- package/dist/messages/es.d.ts.map +1 -1
- package/dist/messages/es.js +15 -0
- package/dist/messages/fr.d.ts.map +1 -1
- package/dist/messages/fr.js +15 -0
- package/dist/messages/zh-hans.d.ts.map +1 -1
- package/dist/messages/zh-hans.js +15 -0
- package/dist/page/bar-title.d.ts +25 -0
- package/dist/page/bar-title.d.ts.map +1 -0
- package/dist/page/bar-title.js +10 -0
- package/dist/page/contract.d.ts +11 -1
- package/dist/page/contract.d.ts.map +1 -1
- package/dist/page/empty-state.d.ts +5 -2
- package/dist/page/empty-state.d.ts.map +1 -1
- package/dist/page/empty-state.js +14 -3
- package/dist/page/facts.d.ts +19 -2
- package/dist/page/facts.d.ts.map +1 -1
- package/dist/page/facts.js +26 -5
- package/dist/page/index.d.ts +8 -0
- package/dist/page/index.d.ts.map +1 -1
- package/dist/page/index.js +9 -0
- package/dist/page/page-bar.d.ts.map +1 -1
- package/dist/page/page-bar.js +2 -7
- package/dist/page/page-summary.d.ts +2 -1
- package/dist/page/page-summary.d.ts.map +1 -1
- package/dist/page/page-summary.js +1 -1
- package/dist/page/run-button.d.ts +26 -0
- package/dist/page/run-button.d.ts.map +1 -0
- package/dist/page/run-button.js +31 -0
- package/dist/page/run-list.d.ts +28 -0
- package/dist/page/run-list.d.ts.map +1 -0
- package/dist/page/run-list.js +88 -0
- package/dist/page/run-queue.d.ts +78 -0
- package/dist/page/run-queue.d.ts.map +1 -0
- package/dist/page/run-queue.js +93 -0
- package/dist/page/section.d.ts +6 -1
- package/dist/page/section.d.ts.map +1 -1
- package/dist/page/section.js +34 -16
- package/dist/shell/commands/command-palette.d.ts.map +1 -1
- package/dist/shell/commands/command-palette.js +5 -1
- package/dist/shell/parts/header.js +1 -1
- package/dist/surfaces.d.ts +15 -1
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +19 -2
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +3 -0
- package/dist/testing/pseudo-locale.d.ts +41 -0
- package/dist/testing/pseudo-locale.d.ts.map +1 -0
- package/dist/testing/pseudo-locale.js +74 -0
- package/dist/testing/quality.d.ts +6 -0
- package/dist/testing/quality.d.ts.map +1 -1
- package/dist/testing/quality.js +139 -1
- package/dist/tokens/bridge-sheet.d.ts +21 -0
- package/dist/tokens/bridge-sheet.d.ts.map +1 -0
- package/dist/tokens/bridge-sheet.js +68 -0
- package/dist/tokens/emit.d.ts +6 -1
- package/dist/tokens/emit.d.ts.map +1 -1
- package/dist/tokens/emit.js +26 -1
- package/dist/ui/accordion.js +1 -1
- package/dist/ui/card.d.ts +32 -4
- package/dist/ui/card.d.ts.map +1 -1
- package/dist/ui/card.js +26 -3
- package/dist/ui/collapsible.d.ts +4 -2
- package/dist/ui/collapsible.d.ts.map +1 -1
- package/dist/ui/collapsible.js +1 -1
- package/dist/ui/combobox.js +1 -1
- package/dist/ui/meter.d.ts +34 -3
- package/dist/ui/meter.d.ts.map +1 -1
- package/dist/ui/meter.guard.d.ts +2 -0
- package/dist/ui/meter.guard.d.ts.map +1 -1
- package/dist/ui/meter.guard.js +20 -0
- package/dist/ui/meter.js +23 -7
- package/dist/ui/primitive.contract.d.ts.map +1 -1
- package/dist/ui/primitive.contract.js +7 -0
- package/dist/ui/remote-pad.d.ts +62 -0
- package/dist/ui/remote-pad.d.ts.map +1 -0
- package/dist/ui/remote-pad.guard.d.ts +21 -0
- package/dist/ui/remote-pad.guard.d.ts.map +1 -0
- package/dist/ui/remote-pad.guard.js +6 -0
- package/dist/ui/remote-pad.js +148 -0
- package/dist/ui/segmented.d.ts.map +1 -1
- package/dist/ui/segmented.js +4 -0
- package/dist/ui/skeleton.d.ts +9 -4
- package/dist/ui/skeleton.d.ts.map +1 -1
- package/dist/ui/skeleton.guard.d.ts +6 -2
- package/dist/ui/skeleton.guard.d.ts.map +1 -1
- package/dist/ui/skeleton.guard.js +4 -0
- package/dist/ui/skeleton.js +2 -1
- package/dist/ui/slots.d.ts +2 -1
- package/dist/ui/slots.d.ts.map +1 -1
- package/dist/ui/slots.js +2 -1
- package/dist/vite/allotment.d.ts +1 -1
- package/dist/vite/allotment.d.ts.map +1 -1
- package/dist/vite/allotment.js +15 -1
- package/dist/vite/doc.d.ts +1 -1
- package/dist/vite/doc.d.ts.map +1 -1
- package/dist/vite/doc.js +12 -2
- package/dist/vite/head.d.ts +4 -3
- package/dist/vite/head.d.ts.map +1 -1
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +4 -1
- package/dist/vite/shell-worker.d.ts +6 -0
- package/dist/vite/shell-worker.d.ts.map +1 -0
- package/dist/vite/shell-worker.js +92 -0
- package/docs/astro.md +19 -4
- package/docs/bar-list.md +3 -2
- package/docs/bar-title.md +33 -0
- package/docs/basalt-provider.md +2 -1
- package/docs/card.md +24 -4
- package/docs/chain-view.md +12 -7
- package/docs/chart-card.md +3 -2
- package/docs/collapsible.md +4 -2
- package/docs/control-home.md +4 -2
- package/docs/create-run-queue.md +40 -0
- package/docs/data-panel.md +3 -2
- package/docs/de.md +1 -1
- package/docs/empty-state.md +3 -1
- package/docs/es.md +1 -1
- package/docs/event-list.md +3 -2
- package/docs/fact.md +6 -1
- package/docs/facts.md +5 -1
- package/docs/fr.md +1 -1
- package/docs/live-query.md +1 -1
- package/docs/meter.md +17 -13
- package/docs/mini-bars.md +7 -5
- package/docs/pseudo-basalt-messages.md +30 -0
- package/docs/pseudo-messages.md +27 -0
- package/docs/quality.md +2 -1
- package/docs/recipes/localise-app.md +2 -2
- package/docs/remote-pad.md +40 -0
- package/docs/row-list.md +3 -2
- package/docs/run-button.md +45 -0
- package/docs/run-list.md +71 -0
- package/docs/section.md +7 -1
- package/docs/set-scheme.md +2 -2
- package/docs/skeleton.md +4 -3
- package/docs/slots.md +1 -1
- package/docs/sparkline.md +5 -2
- package/docs/stat-card.md +6 -4
- package/docs/testing.md +64 -0
- package/docs/use-local-control.md +8 -1
- package/docs/use-runs.md +32 -0
- package/docs/vite.md +12 -2
- package/docs/zh-hans.md +1 -1
- package/llms.txt +88 -21
- package/migrations/areas/shadcn.json +338 -0
- package/package.json +9 -2
- package/src/astro/shiki.ts +3 -1
- package/src/cards/bar-list.tsx +2 -1
- package/src/cards/chain-view.tsx +167 -55
- package/src/cards/contract.ts +8 -1
- package/src/cards/data-panel.tsx +1 -0
- package/src/cards/event-list.tsx +2 -1
- package/src/cards/index.ts +1 -0
- package/src/cards/row-list.tsx +2 -1
- package/src/cards/stat-card-parts.tsx +9 -7
- package/src/cards/stat-card.tsx +39 -12
- package/src/charts/core/compile.ts +31 -19
- package/src/charts/core/cursor.ts +11 -3
- package/src/charts/core/tooltip-said.ts +55 -0
- package/src/charts/focus.tsx +4 -1
- package/src/charts/parts/chart-card.tsx +1 -0
- package/src/cli/agent-note.ts +12 -5
- package/src/cli/budget/index.ts +22 -5
- package/src/cli/config.ts +1 -1
- package/src/cli/doctor/app.ts +75 -23
- package/src/cli/doctor/eject.ts +30 -10
- package/src/cli/doctor/guards.ts +11 -8
- package/src/cli/doctor/hook.ts +1 -1
- package/src/cli/doctor/install.ts +61 -24
- package/src/cli/doctor/translations.ts +13 -4
- package/src/cli/doctor/types.ts +2 -3
- package/src/cli/doctor/wiring.ts +30 -16
- package/src/cli/eject/dropped-slots.ts +11 -0
- package/src/cli/eject/index.ts +13 -9
- package/src/cli/help.ts +34 -10
- package/src/cli/index.ts +56 -14
- package/src/cli/init/index.ts +64 -5
- package/src/cli/init/locales.ts +41 -8
- package/src/cli/init/router-seeds.ts +17 -3
- package/src/cli/init/steps.ts +308 -41
- package/src/cli/lint/baseline.ts +141 -0
- package/src/cli/lint/engine.ts +33 -10
- package/src/cli/lint/hook.ts +11 -3
- package/src/cli/lint/index.ts +77 -12
- package/src/cli/manifest.ts +132 -4
- package/src/cli/migrate/census.ts +35 -1
- package/src/cli/migrate/index.ts +46 -3
- package/src/cli/migrate/lost-classes.ts +203 -0
- package/src/cli/migrate/rows.ts +21 -0
- package/src/cli/package-manager.ts +4 -1
- package/src/cli/peers.ts +11 -0
- package/src/cli/presets.ts +32 -11
- package/src/cli/resolver.ts +58 -10
- package/src/cli/router-wiring.ts +3 -1
- package/src/cli/sync/engine.ts +30 -14
- package/src/cli/sync/index.ts +7 -4
- package/src/cli/sync/render.ts +29 -37
- package/src/cli/tokens-css.ts +42 -5
- package/src/controls/contract.ts +2 -0
- package/src/controls/control-home.tsx +15 -4
- package/src/controls/local-control.ts +49 -3
- package/src/core/cn.ts +9 -5
- package/src/core/frame-figure.tsx +7 -1
- package/src/core/frame-head.tsx +32 -6
- package/src/core/frame-regions.tsx +18 -8
- package/src/core/info-hint.tsx +26 -0
- package/src/core/mark-tone.ts +10 -3
- package/src/core/mark-types.ts +4 -2
- package/src/core/messages/chain.ts +2 -1
- package/src/core/messages/index.ts +4 -0
- package/src/core/messages/runs.ts +40 -0
- package/src/core/phase.ts +22 -2
- package/src/core/ports.ts +13 -1
- package/src/core/provider.tsx +7 -3
- package/src/core/scheme.ts +6 -2
- package/src/core/spark/mini-bars.tsx +59 -15
- package/src/core/spark/sparkline.tsx +26 -4
- package/src/css/bridge.css +63 -0
- package/src/css/generate.ts +40 -3
- package/src/data/live/live-query.ts +4 -3
- package/src/lint/preset.ts +52 -13
- package/src/lint/rules/class/table.ts +3 -1
- package/src/lint/rules/structure/control-home.ts +1 -1
- package/src/lint/rules/structure/import-boundary.ts +2 -0
- package/src/lint/rules/structure/label-literal.ts +3 -1
- package/src/lint/shadcn.ts +91 -0
- package/src/lint/stylelint/render.ts +31 -1
- package/src/lint/stylelint/rules.ts +19 -7
- package/src/lint/weakened.ts +59 -1
- package/src/messages/de.ts +20 -0
- package/src/messages/es.ts +20 -0
- package/src/messages/fr.ts +20 -0
- package/src/messages/zh-hans.ts +20 -0
- package/src/page/bar-title.tsx +35 -0
- package/src/page/contract.ts +11 -1
- package/src/page/empty-state.tsx +18 -8
- package/src/page/facts.tsx +43 -5
- package/src/page/index.ts +8 -0
- package/src/page/page-bar.tsx +2 -9
- package/src/page/page-summary.tsx +4 -3
- package/src/page/run-button.tsx +52 -0
- package/src/page/run-list.tsx +151 -0
- package/src/page/run-queue.ts +185 -0
- package/src/page/section.tsx +30 -5
- package/src/shell/commands/command-palette.tsx +10 -1
- package/src/shell/parts/header.tsx +1 -1
- package/src/surfaces.ts +18 -1
- package/src/testing/index.ts +1 -0
- package/src/testing/pseudo-locale.ts +149 -0
- package/src/testing/quality.ts +188 -0
- package/src/tokens/bridge-sheet.ts +80 -0
- package/src/tokens/emit.ts +45 -6
- package/src/ui/accordion.tsx +1 -1
- package/src/ui/card.tsx +56 -6
- package/src/ui/collapsible.tsx +5 -3
- package/src/ui/combobox.tsx +1 -1
- package/src/ui/meter.guard.ts +23 -0
- package/src/ui/meter.tsx +76 -27
- package/src/ui/no-restyle.generated.json +8 -0
- package/src/ui/primitive.contract.ts +7 -0
- package/src/ui/remote-pad.guard.ts +24 -0
- package/src/ui/remote-pad.tsx +249 -0
- package/src/ui/segmented.tsx +6 -0
- package/src/ui/skeleton.guard.ts +7 -2
- package/src/ui/skeleton.tsx +10 -4
- package/src/ui/slots.ts +2 -1
- package/src/vite/allotment.ts +15 -1
- package/src/vite/doc.ts +12 -2
- package/src/vite/head.ts +4 -3
- package/src/vite/index.ts +4 -1
- package/src/vite/shell-worker.ts +115 -0
package/dist/cli/init/steps.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SOURCES_PATH } from "../../vite/sources.js";
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
4
|
-
import { BUDGET_PATH, seedBudget, writeBudget } from "../budget/index.js";
|
|
4
|
+
import { BUDGET_PATH, readBudget, seedBudget, writeBudget } from "../budget/index.js";
|
|
5
|
+
import { cleanRoot, PROFILE_RANK } from "../doctor/types.js";
|
|
5
6
|
import { detectHarnesses, placedDirs, placementFor } from "../harness.js";
|
|
6
|
-
import { readManifest, writeManifest } from "../manifest.js";
|
|
7
|
+
import { DESIGN_FILE, readManifest, writeManifest } from "../manifest.js";
|
|
7
8
|
import {
|
|
8
9
|
OXLINT_PRESET_FILE,
|
|
9
10
|
presetFilesFor,
|
|
@@ -12,12 +13,13 @@ import {
|
|
|
12
13
|
} from "../presets.js";
|
|
13
14
|
import { lintSettingsUnits } from "../lint-settings.js";
|
|
14
15
|
import { addCommand, packageManager } from "../package-manager.js";
|
|
15
|
-
import { BUILD_PEERS, RUNTIME_PEERS, satisfiesRange } from "../peers.js";
|
|
16
|
+
import { aboveRange, BUILD_PEERS, peerAddLine, RUNTIME_PEERS, satisfiesRange } from "../peers.js";
|
|
16
17
|
import { INVOKERS, LINT_INVOCATION } from "../doctor/wiring.js";
|
|
17
18
|
import { parseJsonc, readIfExists } from "../source-text.js";
|
|
18
|
-
import { findRepoRoot, resolveAppDir } from "../index.js";
|
|
19
|
+
import { collectWorkspacePackages, findRepoRoot, readBasaltConfig, resolveAppDir } from "../index.js";
|
|
19
20
|
import { ROUTER_PLUGIN_OPTIONS } from "../route-tree.js";
|
|
20
|
-
import {
|
|
21
|
+
import { VITE_CONFIGS } from "../router-wiring.js";
|
|
22
|
+
import { isSiblingApp, peerHome, unplacedPeers } from "../resolver.js";
|
|
21
23
|
import { sync } from "../sync/index.js";
|
|
22
24
|
import { claimPrefix } from "../sync/sibling.js";
|
|
23
25
|
import { tokensCss } from "../tokens-css.js";
|
|
@@ -38,6 +40,7 @@ import {
|
|
|
38
40
|
LOCALE_DEV,
|
|
39
41
|
LOCALE_GATE,
|
|
40
42
|
LOCALE_RUNTIME,
|
|
43
|
+
keptCatalogs,
|
|
41
44
|
translatedInstall
|
|
42
45
|
} from "./locales.js";
|
|
43
46
|
const say = (line) => console.log(line);
|
|
@@ -50,6 +53,15 @@ function translatedApp(ctx) {
|
|
|
50
53
|
read === null || "error" in read ? null : read.manifest
|
|
51
54
|
);
|
|
52
55
|
}
|
|
56
|
+
function appCatalogs(ctx) {
|
|
57
|
+
const read = readManifest(ctx.root);
|
|
58
|
+
const app = resolveAppDir(ctx.root);
|
|
59
|
+
return keptCatalogs(
|
|
60
|
+
read === null || "error" in read ? void 0 : read.manifest.catalogs,
|
|
61
|
+
"error" in app ? "" : app.rel
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
const scaffoldsCatalog = (ctx) => translatedApp(ctx) && appCatalogs(ctx) === void 0;
|
|
53
65
|
const written = /* @__PURE__ */ new Set();
|
|
54
66
|
const forgetWritten = () => written.clear();
|
|
55
67
|
const writtenPaths = () => [...written];
|
|
@@ -68,6 +80,18 @@ function installRoot(dir) {
|
|
|
68
80
|
if (dirname(at) === at) return dir;
|
|
69
81
|
}
|
|
70
82
|
}
|
|
83
|
+
function belowRootRefusal(cwd, root) {
|
|
84
|
+
let pkg = resolve(cwd);
|
|
85
|
+
while (pkg !== resolve(root) && !existsSync(join(pkg, "package.json"))) pkg = dirname(pkg);
|
|
86
|
+
if (pkg === resolve(root) || pkg.length < resolve(root).length) return null;
|
|
87
|
+
if (isSiblingApp(pkg)) {
|
|
88
|
+
return `${pkg} declares \`basalt.sibling\`, so its install lives there: run init from ${pkg}. Nothing was written.`;
|
|
89
|
+
}
|
|
90
|
+
const member = collectWorkspacePackages(root).packages.some(({ dir }) => resolve(dir) === pkg);
|
|
91
|
+
const rootApp = readBasaltConfig(root).app;
|
|
92
|
+
if (member || rootApp !== void 0 && resolve(root, rootApp) === pkg) return null;
|
|
93
|
+
return `${pkg} is a package below the repo root ${root} that is not one of its workspace packages, so init would install at the repo root. To give this package its own install, add \`"basalt": { "sibling": true }\` to its package.json and run init again; to install at the repo root, run init there. Nothing was written.`;
|
|
94
|
+
}
|
|
71
95
|
function isStrictJson(text) {
|
|
72
96
|
try {
|
|
73
97
|
JSON.parse(text);
|
|
@@ -112,6 +136,8 @@ function generateTokens(ctx) {
|
|
|
112
136
|
}
|
|
113
137
|
return true;
|
|
114
138
|
}
|
|
139
|
+
const higher = (a, b) => PROFILE_RANK[b] > PROFILE_RANK[a] ? b : a;
|
|
140
|
+
const lower = (a, b) => PROFILE_RANK[b] < PROFILE_RANK[a] ? b : a;
|
|
115
141
|
function declareManifest(ctx, legacy = false) {
|
|
116
142
|
const read = readManifest(ctx.root);
|
|
117
143
|
if (read !== null && "error" in read && !legacy) return { error: read.error };
|
|
@@ -130,19 +156,28 @@ function declareManifest(ctx, legacy = false) {
|
|
|
130
156
|
};
|
|
131
157
|
const rows = tokenRows(ctx.args);
|
|
132
158
|
const declared = new Set(rows.map((r) => r.out));
|
|
159
|
+
const merged = { ...base.roots, ...Object.fromEntries(roots.map((r) => [r, profile])) };
|
|
133
160
|
const manifest = {
|
|
134
161
|
...base,
|
|
135
|
-
profile
|
|
136
|
-
|
|
162
|
+
// The default profile is the highest declared one: a second root below it never replaces it.
|
|
163
|
+
profile: Object.values(merged).reduce(higher, profile),
|
|
164
|
+
roots: merged,
|
|
137
165
|
tokens: [...base.tokens.filter((t) => !declared.has(t.out)), ...rows],
|
|
138
166
|
harnesses: ctx.args.harnesses ?? base.harnesses ?? detectHarnesses(ctx.root, findRepoRoot(ctx.root)),
|
|
139
|
-
...ctx.args.locales
|
|
167
|
+
...localeKeys(ctx.args.locales, base.partialLocales),
|
|
168
|
+
...ctx.args.agents === void 0 ? {} : { agents: ctx.args.agents },
|
|
169
|
+
...ctx.args.design === void 0 ? {} : { design: ctx.args.design },
|
|
170
|
+
...ctx.args.catalogs === void 0 ? {} : { catalogs: ctx.args.catalogs },
|
|
140
171
|
...extra === void 0 ? {} : { extra },
|
|
141
172
|
...isSiblingApp(ctx.root) ? { sibling: base.sibling ?? claimPrefix(ctx.root) } : {}
|
|
142
173
|
};
|
|
143
174
|
writeManifest(ctx.root, manifest);
|
|
144
175
|
return null;
|
|
145
176
|
}
|
|
177
|
+
function localeKeys(locales, partial = []) {
|
|
178
|
+
if (locales === void 0) return {};
|
|
179
|
+
return { locales, partialLocales: partial.filter((l) => locales.indexOf(l) > 0) };
|
|
180
|
+
}
|
|
146
181
|
const readPackage = (dir) => {
|
|
147
182
|
const text = readIfExists(resolve(dir, "package.json"));
|
|
148
183
|
try {
|
|
@@ -151,8 +186,24 @@ const readPackage = (dir) => {
|
|
|
151
186
|
return null;
|
|
152
187
|
}
|
|
153
188
|
};
|
|
189
|
+
const OXFMT_OTHER_CONFIGS = [
|
|
190
|
+
"oxfmt.config.ts",
|
|
191
|
+
"oxfmt.config.mts",
|
|
192
|
+
"oxfmt.config.cts",
|
|
193
|
+
"oxfmt.config.js",
|
|
194
|
+
"oxfmt.config.mjs",
|
|
195
|
+
"oxfmt.config.cjs",
|
|
196
|
+
".oxfmtrc.jsonc"
|
|
197
|
+
];
|
|
198
|
+
function otherOxfmtConfig(root) {
|
|
199
|
+
for (const dir of isSiblingApp(root) ? [root, findRepoRoot(root)] : [root]) {
|
|
200
|
+
const name = OXFMT_OTHER_CONFIGS.find((file) => readText(dir, file) !== null);
|
|
201
|
+
if (name !== void 0) return { dir, name };
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
154
205
|
function formatsWithPrettier(root) {
|
|
155
|
-
return readText(root, ".oxfmtrc.json") === null && (readText(root, ".prettierignore") !== null || readPackage(root)?.devDependencies?.["prettier"] !== void 0);
|
|
206
|
+
return readText(root, ".oxfmtrc.json") === null && otherOxfmtConfig(root) === null && (readText(root, ".prettierignore") !== null || readPackage(root)?.devDependencies?.["prettier"] !== void 0);
|
|
156
207
|
}
|
|
157
208
|
const SCAFFOLD_DEPS = {
|
|
158
209
|
app: { "lucide-react": "^1.74.0" },
|
|
@@ -218,12 +269,56 @@ function peerPlan(pkgRoot, profile, oxfmt, translated = false) {
|
|
|
218
269
|
return { runtime, dev, ranges };
|
|
219
270
|
}
|
|
220
271
|
const installCommand = (root, specs, dev = true) => addCommand(root, specs, dev);
|
|
272
|
+
function savesExact(home, root) {
|
|
273
|
+
return [home, root].some(
|
|
274
|
+
(dir) => /^\s*exact\s*=\s*true\b/m.test(readText(dir, "bunfig.toml") ?? "") || /^\s*save-exact\s*=\s*true\b/m.test(readText(dir, ".npmrc") ?? "")
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
function pinResolved(home, root, names) {
|
|
278
|
+
const path = resolve(home, "package.json");
|
|
279
|
+
let text = readIfExists(path);
|
|
280
|
+
if (text === null) return;
|
|
281
|
+
for (const name of names) {
|
|
282
|
+
let installed = null;
|
|
283
|
+
for (let at = home; installed === null; at = dirname(at)) {
|
|
284
|
+
installed = readIfExists(resolve(at, "node_modules", name, "package.json"));
|
|
285
|
+
if (at === root || at === dirname(at)) break;
|
|
286
|
+
}
|
|
287
|
+
const version = installed === null ? void 0 : JSON.parse(installed).version;
|
|
288
|
+
if (version === void 0) continue;
|
|
289
|
+
const escaped = name.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
|
|
290
|
+
const entry = new RegExp(`("${escaped}"\\s*:\\s*")[~^][^"]*(")`, "g");
|
|
291
|
+
text = text.replace(
|
|
292
|
+
/"(?:dev)?[dD]ependencies"\s*:\s*\{[^}]*\}/g,
|
|
293
|
+
(block) => block.replace(entry, `$1${version}$2`)
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
if (text !== readIfExists(path)) writeFileSync(path, text);
|
|
297
|
+
}
|
|
298
|
+
const ROOT_LINT_TOOLS = ["oxlint", "@shadcn/lint", "oxfmt"];
|
|
299
|
+
function rootLintTodo(ctx, home, plan, own) {
|
|
300
|
+
if (home === ctx.root || plan.dev["oxlint"] === void 0) return;
|
|
301
|
+
const root = readPackage(ctx.root);
|
|
302
|
+
const declared = { ...root?.dependencies, ...root?.devDependencies };
|
|
303
|
+
const appBasalt = own?.dependencies?.["basalt-ui"] ?? own?.devDependencies?.["basalt-ui"] ?? own?.peerDependencies?.["basalt-ui"];
|
|
304
|
+
const tools = ROOT_LINT_TOOLS.filter((name) => plan.dev[name] !== void 0).map(
|
|
305
|
+
(name) => [name, plan.dev[name]]
|
|
306
|
+
);
|
|
307
|
+
const wanted = [["basalt-ui", appBasalt], ...tools];
|
|
308
|
+
const missing = wanted.filter(([name]) => declared[name] === void 0);
|
|
309
|
+
if (missing.length === 0) return;
|
|
310
|
+
ctx.todo.push(
|
|
311
|
+
`the workspace root loads the lint config, so it needs these devDependencies too: ${peerAddLine(ctx.root, missing, true)}`
|
|
312
|
+
);
|
|
313
|
+
}
|
|
221
314
|
function installPeers(ctx) {
|
|
222
|
-
const translated =
|
|
315
|
+
const translated = scaffoldsCatalog(ctx);
|
|
223
316
|
const plan = peerPlan(ctx.pkgRoot, ctx.args.profile, !formatsWithPrettier(ctx.root), translated);
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
const
|
|
317
|
+
const home = peerHome(ctx.root, ctx.args.roots);
|
|
318
|
+
const own = readPackage(home);
|
|
319
|
+
const base = home;
|
|
320
|
+
const shared = isSiblingApp(ctx.root) || !collectWorkspacePackages(ctx.root).packages.some((pkg) => pkg.dir === home);
|
|
321
|
+
const root = shared ? readPackage(isSiblingApp(ctx.root) ? findRepoRoot(ctx.root) : ctx.root) : null;
|
|
227
322
|
const rootTs = { ...root?.dependencies, ...root?.devDependencies }["typescript"];
|
|
228
323
|
const have = {
|
|
229
324
|
...rootTs === void 0 ? {} : { typescript: rootTs },
|
|
@@ -234,19 +329,32 @@ function installPeers(ctx) {
|
|
|
234
329
|
const declared = have[name];
|
|
235
330
|
if (declared === void 0) return false;
|
|
236
331
|
if (name === "typescript" && ctx.args.profile === "site") {
|
|
237
|
-
const major = /\d+/.exec(declared)?.[0];
|
|
238
|
-
if (major
|
|
332
|
+
const major = Number(/\d+/.exec(declared)?.[0] ?? 0);
|
|
333
|
+
if (major < 5) return false;
|
|
334
|
+
if (major > 6) {
|
|
335
|
+
say(
|
|
336
|
+
`peers: typescript ${declared} kept: a site's \`astro check\` needs 5 or 6, and init never lowers a major`
|
|
337
|
+
);
|
|
338
|
+
}
|
|
239
339
|
}
|
|
240
340
|
if (name === "typescript" || name in (SCAFFOLD_DEPS[ctx.args.profile] ?? {}) || name in (SCAFFOLD_DEV[ctx.args.profile] ?? {}) || translated && (name in LOCALE_RUNTIME || name in LOCALE_DEV)) {
|
|
241
341
|
return true;
|
|
242
342
|
}
|
|
343
|
+
const range = plan.ranges[name] ?? spec;
|
|
344
|
+
if (aboveRange(declared.replace(/^(?:\^|~|>=?)\s*/, ""), range)) {
|
|
345
|
+
say(
|
|
346
|
+
`peers: ${name} ${declared} is above what basalt-ui supports (${range}); kept, init never lowers a major`
|
|
347
|
+
);
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
243
350
|
const version = /^[~^]?(\d+\.\d+\.\d+)$/.exec(declared)?.[1];
|
|
244
351
|
if (version === void 0) return !/^\d+\.\d+\.\d+$/.test(spec);
|
|
245
|
-
return satisfiesRange(version,
|
|
352
|
+
return satisfiesRange(version, range);
|
|
246
353
|
};
|
|
247
354
|
const missing = (group) => Object.entries(group).filter(([name, spec]) => !met(name, spec)).map(([name, spec]) => `${name}@${spec}`);
|
|
248
355
|
const runtime = missing(plan.runtime);
|
|
249
356
|
const dev = missing(plan.dev);
|
|
357
|
+
rootLintTodo(ctx, home, plan, own);
|
|
250
358
|
for (const spec of [...runtime, ...dev]) {
|
|
251
359
|
const name = spec.slice(0, spec.lastIndexOf("@"));
|
|
252
360
|
const declared = have[name];
|
|
@@ -261,15 +369,24 @@ function installPeers(ctx) {
|
|
|
261
369
|
...dev.length > 0 ? [installCommand(base, dev)] : []
|
|
262
370
|
];
|
|
263
371
|
if (commands.length === 0) return say("peers: already at their pins.");
|
|
372
|
+
const at = relative(ctx.root, home);
|
|
373
|
+
const where = at === "" ? "" : `in ${at}: `;
|
|
374
|
+
const unplaced = unplacedPeers(ctx.root, home);
|
|
264
375
|
for (const command of commands) {
|
|
265
|
-
if (own === null || ctx.run === void 0) {
|
|
266
|
-
const why = own === null ? `no package.json at ${ctx.root}` : "--no-install";
|
|
267
|
-
|
|
376
|
+
if (own === null || ctx.run === void 0 || unplaced !== null) {
|
|
377
|
+
const why = own === null ? `no package.json at ${ctx.root}` : unplaced !== null ? `run it in the app package; ${unplaced}` : "--no-install";
|
|
378
|
+
const shown = unplaced === null ? command : command.filter((arg) => arg !== "-w");
|
|
379
|
+
ctx.todo.push(`install the peers (${why}): ${where}${shown.join(" ")}`);
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
say(`peers: ${where}${command.join(" ")}`);
|
|
383
|
+
if (!ctx.run(command, home)) {
|
|
384
|
+
ctx.problems.push(`the peer install failed: ${where}${command.join(" ")}`);
|
|
268
385
|
continue;
|
|
269
386
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
387
|
+
if (savesExact(home, ctx.root)) {
|
|
388
|
+
const ranged = command.filter((arg) => /^@?[^@]+@[~^]/.test(arg)).map((arg) => arg.slice(0, arg.lastIndexOf("@")));
|
|
389
|
+
pinResolved(home, ctx.root, ranged);
|
|
273
390
|
}
|
|
274
391
|
}
|
|
275
392
|
}
|
|
@@ -286,10 +403,35 @@ function placeManaged(ctx) {
|
|
|
286
403
|
);
|
|
287
404
|
if (code !== 0) ctx.problems.push("sync could not place the managed files");
|
|
288
405
|
}
|
|
406
|
+
function floorFor(root, profile, floors) {
|
|
407
|
+
return Object.entries(floors).filter(([outer]) => outer === "." || root.startsWith(`${outer}/`)).reduce((floor, [, own]) => higher(floor, own), profile);
|
|
408
|
+
}
|
|
289
409
|
function seedBudgetFile(ctx) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
410
|
+
const exists = existsSync(resolve(ctx.root, BUDGET_PATH));
|
|
411
|
+
const read = exists ? readBudget(ctx.root) : null;
|
|
412
|
+
if (read !== null && "error" in read) return;
|
|
413
|
+
const { profile } = ctx.args;
|
|
414
|
+
const before = Object.entries(ctx.previousRoots).map(([root, own]) => [
|
|
415
|
+
cleanRoot(root),
|
|
416
|
+
own
|
|
417
|
+
]);
|
|
418
|
+
const budget = read?.budget ?? seedBudget(before.reduce((floor, [, own]) => lower(floor, own), profile));
|
|
419
|
+
const floors = {
|
|
420
|
+
// A root the budget has no entry for was declared at the manifest's profile, never below the floor.
|
|
421
|
+
...Object.fromEntries(before.map(([root, own]) => [root, higher(own, budget.profileFloor)])),
|
|
422
|
+
...budget.rootFloors
|
|
423
|
+
};
|
|
424
|
+
const added = ctx.args.roots.map(cleanRoot).filter((root) => floors[root] === void 0);
|
|
425
|
+
if (exists && added.length === 0) return;
|
|
426
|
+
for (const root of added) floors[root] = floorFor(root, profile, floors);
|
|
427
|
+
const profileFloor = added.reduce(
|
|
428
|
+
(floor, root) => lower(floor, floors[root] ?? profile),
|
|
429
|
+
budget.profileFloor
|
|
430
|
+
);
|
|
431
|
+
writeBudget(ctx.root, { ...budget, profileFloor, rootFloors: floors });
|
|
432
|
+
say(
|
|
433
|
+
exists ? `${BUDGET_PATH}: profile floor ${added.map((root) => `${root} ${floors[root]}`).join(", ")}` : `wrote ${BUDGET_PATH} (the eject ceiling)`
|
|
434
|
+
);
|
|
293
435
|
}
|
|
294
436
|
const SIBLING_SKIPS = [
|
|
295
437
|
["lefthook.yml", "the root install owns the hook runner"],
|
|
@@ -335,7 +477,7 @@ function rootFormatterSettings(ctx) {
|
|
|
335
477
|
function ignoreFile(ctx) {
|
|
336
478
|
const ignored = [
|
|
337
479
|
...formatterIgnore(ctx.root),
|
|
338
|
-
...generatedTreeIgnores(ctx.args,
|
|
480
|
+
...generatedTreeIgnores(ctx.args, scaffoldsCatalog(ctx))
|
|
339
481
|
];
|
|
340
482
|
const missing = (text) => ignored.filter((p) => !text.split("\n").some((line) => line.trim() === p));
|
|
341
483
|
const prettier = readText(ctx.root, ".prettierignore");
|
|
@@ -350,6 +492,15 @@ function ignoreFile(ctx) {
|
|
|
350
492
|
`);
|
|
351
493
|
return say(`.prettierignore: ignores ${add2.join(", ")}`);
|
|
352
494
|
}
|
|
495
|
+
const other = oxfmt === null ? otherOxfmtConfig(ctx.root) : null;
|
|
496
|
+
if (other !== null) {
|
|
497
|
+
const text = readText(other.dir, other.name) ?? "";
|
|
498
|
+
const add2 = ignored.filter((p) => !text.includes(p));
|
|
499
|
+
if (add2.length === 0) return;
|
|
500
|
+
return void ctx.todo.push(
|
|
501
|
+
`add to ignorePatterns in ${relative(ctx.root, join(other.dir, other.name))} (init writes no second oxfmt config): ${add2.join(", ")}`
|
|
502
|
+
);
|
|
503
|
+
}
|
|
353
504
|
if (oxfmt === null) {
|
|
354
505
|
const settings = rootFormatterSettings(ctx);
|
|
355
506
|
if (settings === null)
|
|
@@ -384,7 +535,7 @@ function oxlintExtends(ctx) {
|
|
|
384
535
|
const line = `./${OXLINT_PRESET_FILE}`;
|
|
385
536
|
const text = readText(ctx.root, ".oxlintrc.json");
|
|
386
537
|
if (text === null) {
|
|
387
|
-
const ignorePatterns = generatedTreeIgnores(ctx.args,
|
|
538
|
+
const ignorePatterns = generatedTreeIgnores(ctx.args, scaffoldsCatalog(ctx));
|
|
388
539
|
const fresh = { extends: [line], ...ignorePatterns.length > 0 ? { ignorePatterns } : {} };
|
|
389
540
|
writeText(ctx.root, ".oxlintrc.json", `${JSON.stringify(fresh, null, 2)}
|
|
390
541
|
`);
|
|
@@ -399,7 +550,7 @@ function oxlintExtends(ctx) {
|
|
|
399
550
|
if (rule !== void 0 && !stock)
|
|
400
551
|
ctx.todo.push("delete react/only-export-components from .oxlintrc.json");
|
|
401
552
|
const listed = Array.isArray(config?.["ignorePatterns"]) ? config["ignorePatterns"] : [];
|
|
402
|
-
const trees = generatedTreeIgnores(ctx.args,
|
|
553
|
+
const trees = generatedTreeIgnores(ctx.args, scaffoldsCatalog(ctx)).filter(
|
|
403
554
|
(p) => !listed.includes(p)
|
|
404
555
|
);
|
|
405
556
|
if (hasExtends && !stock && trees.length === 0) return;
|
|
@@ -449,6 +600,9 @@ function wireLintScript(ctx) {
|
|
|
449
600
|
return void ctx.todo.push("run `basalt-ui lint` from a package script, lefthook or make check");
|
|
450
601
|
}
|
|
451
602
|
const lint = pkg.scripts?.["lint"];
|
|
603
|
+
if (lint === void 0 && ownsGate(ctx.root, pkg)) {
|
|
604
|
+
return void ctx.todo.push("run `basalt-ui lint` from the Makefile or the check script");
|
|
605
|
+
}
|
|
452
606
|
if (lint !== void 0 && lint !== "oxlint" && lint !== "eslint .") return;
|
|
453
607
|
const scripts = {
|
|
454
608
|
...pkg.scripts,
|
|
@@ -461,10 +615,15 @@ function wireLintScript(ctx) {
|
|
|
461
615
|
}
|
|
462
616
|
function wireFormatScript(ctx) {
|
|
463
617
|
if (ctx.args.profile === "tokens" || formatsWithPrettier(ctx.root)) return;
|
|
618
|
+
if (ownsGate(ctx.root, readPackage(ctx.root))) return;
|
|
464
619
|
if (addScript(ctx, "package.json", "format", "oxfmt .")) {
|
|
465
620
|
say("package.json: the format script runs oxfmt");
|
|
466
621
|
}
|
|
467
622
|
}
|
|
623
|
+
function ownsGate(root, pkg) {
|
|
624
|
+
const makefiles = isSiblingApp(root) ? [root, findRepoRoot(root)] : [root];
|
|
625
|
+
return makefiles.some((dir) => readText(dir, "Makefile") !== null) || pkg?.scripts?.["check"] !== void 0;
|
|
626
|
+
}
|
|
468
627
|
function addScript(ctx, rel, name, command) {
|
|
469
628
|
const text = readText(ctx.root, rel);
|
|
470
629
|
const pkg = readPackage(dirname(resolve(ctx.root, rel)));
|
|
@@ -528,8 +687,11 @@ function wireCheckScript(ctx) {
|
|
|
528
687
|
}
|
|
529
688
|
function seedDesign(ctx) {
|
|
530
689
|
if (ctx.args.profile === "tokens") return;
|
|
690
|
+
const read = readManifest(ctx.root);
|
|
691
|
+
const design = ctx.args.design ?? (read === null || "error" in read ? void 0 : read.manifest.design);
|
|
531
692
|
const homes = [".", ...ctx.args.roots, ...ctx.args.roots.map((r) => dirname(r))];
|
|
532
|
-
|
|
693
|
+
const seen = design === void 0 ? homes.some((dir) => existsSync(resolve(ctx.root, dir, DESIGN_FILE))) : existsSync(resolve(ctx.root, design));
|
|
694
|
+
if (seen) return;
|
|
533
695
|
const template = readIfExists(resolve(ctx.pkgRoot, "agent/templates/DESIGN.md.tpl"));
|
|
534
696
|
if (template === null) return void ctx.problems.push(`${ctx.pkgRoot} ships no DESIGN.md.tpl`);
|
|
535
697
|
const [first = "."] = ctx.args.roots;
|
|
@@ -541,8 +703,8 @@ function seedDesign(ctx) {
|
|
|
541
703
|
SERIES_MODULE_PATH: series
|
|
542
704
|
};
|
|
543
705
|
const text = template.replace(/\{\{(\w+)\}\}/g, (all, key) => vars[key] ?? all);
|
|
544
|
-
writeText(ctx.root,
|
|
545
|
-
say(
|
|
706
|
+
writeText(ctx.root, design ?? DESIGN_FILE, text);
|
|
707
|
+
say(`wrote ${design ?? DESIGN_FILE}`);
|
|
546
708
|
}
|
|
547
709
|
const VIEWPORT_TAG = '<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />';
|
|
548
710
|
const STOCK_VIEWPORT = '<meta name="viewport" content="width=device-width, initial-scale=1.0" />';
|
|
@@ -572,7 +734,6 @@ function appName(root) {
|
|
|
572
734
|
const name = readPackage(root)?.name;
|
|
573
735
|
return name !== void 0 && name !== "" ? name : basename(root);
|
|
574
736
|
}
|
|
575
|
-
const VITE_CONFIGS = ["vite.config.ts", "vite.config.mts", "vite.config.js", "vite.config.mjs"];
|
|
576
737
|
const CSS_ENTRIES = ["index.css", "styles.css", "main.css", "app.css", "globals.css"];
|
|
577
738
|
const BASALT_IMPORT = "import { basalt } from 'basalt-ui/vite'";
|
|
578
739
|
const ROUTER_IMPORT = "import { tanstackRouter } from '@tanstack/router-plugin/vite'";
|
|
@@ -729,10 +890,11 @@ function wireApp(ctx) {
|
|
|
729
890
|
const first = ctx.args.start ? START_FIRST : ctx.routerPlugin === true ? ROUTER_FIRST : null;
|
|
730
891
|
const vite = dirs.flatMap((d) => VITE_CONFIGS.map((f) => join(d, f))).find((f) => existsSync(resolve(ctx.root, f)));
|
|
731
892
|
if (vite !== void 0) {
|
|
732
|
-
ignoreGenerated(ctx, dirname(vite),
|
|
893
|
+
ignoreGenerated(ctx, dirname(vite), scaffoldsCatalog(ctx) ? [`src/${COMPILED_GLOB}`] : []);
|
|
733
894
|
const text2 = readText(ctx.root, vite) ?? "";
|
|
734
895
|
if (isStock("vite.config", text2) || isRenderedVite(text2)) {
|
|
735
|
-
|
|
896
|
+
const lingui = ctx.localeScaffold === true || text2.includes("@lingui/vite-plugin");
|
|
897
|
+
if (writeText(ctx.root, vite, renderViteConfig(first, lingui)))
|
|
736
898
|
say(`${vite}: added the Vite plugins`);
|
|
737
899
|
} else {
|
|
738
900
|
say(`kept ${vite}: not the stock create-vite config; doctor names the plugins it needs`);
|
|
@@ -757,7 +919,9 @@ export {
|
|
|
757
919
|
SHOTS_IGNORE,
|
|
758
920
|
SIBLING_SKIPS,
|
|
759
921
|
addScript,
|
|
922
|
+
appCatalogs,
|
|
760
923
|
appName,
|
|
924
|
+
belowRootRefusal,
|
|
761
925
|
declareManifest,
|
|
762
926
|
defaultExtra,
|
|
763
927
|
extraCssOut,
|
|
@@ -769,11 +933,14 @@ export {
|
|
|
769
933
|
installCommand,
|
|
770
934
|
installPeers,
|
|
771
935
|
installRoot,
|
|
936
|
+
otherOxfmtConfig,
|
|
772
937
|
peerPlan,
|
|
773
938
|
placeManaged,
|
|
774
939
|
placeViewportMeta,
|
|
775
940
|
readPackage,
|
|
941
|
+
savesExact,
|
|
776
942
|
say,
|
|
943
|
+
scaffoldsCatalog,
|
|
777
944
|
seedBudgetFile,
|
|
778
945
|
seedDesign,
|
|
779
946
|
seedSeries,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Finding } from './engine.js';
|
|
2
|
+
export declare const BASELINE_PATH = ".basalt/baseline.json";
|
|
3
|
+
/** Install-relative file -> rule id -> findings tolerated. */
|
|
4
|
+
export type Baseline = Record<string, Record<string, number>>;
|
|
5
|
+
export declare function parseBaseline(text: string): {
|
|
6
|
+
baseline: Baseline;
|
|
7
|
+
} | {
|
|
8
|
+
error: string;
|
|
9
|
+
};
|
|
10
|
+
/** The install's baseline, or null when it has none; a broken file throws, so no run reads past it. */
|
|
11
|
+
export declare function readBaseline(dir: string): Baseline | null;
|
|
12
|
+
/** The findings a baseline may hold, counted. */
|
|
13
|
+
export declare function countFindings(findings: readonly Finding[]): Baseline;
|
|
14
|
+
export declare const baselineSize: (baseline: Baseline) => number;
|
|
15
|
+
/** Writes the canonical bytes, or removes the file when nothing is left; true when it changed. */
|
|
16
|
+
export declare function writeBaseline(dir: string, baseline: Baseline): boolean;
|
|
17
|
+
/** The findings to report: all of a file's rule once it holds more than its count, else none. */
|
|
18
|
+
export declare function applyBaseline(findings: readonly Finding[], baseline: Baseline | null): {
|
|
19
|
+
reported: Finding[];
|
|
20
|
+
held: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The baseline a full scan's `findings` leave: each count lowered to what is there, none raised. A
|
|
24
|
+
* file a scanner could not read (or with a dead directive) keeps its counts until it is clean of that.
|
|
25
|
+
*/
|
|
26
|
+
export declare function lowerBaseline(baseline: Baseline, findings: readonly Finding[]): Baseline;
|
|
27
|
+
//# sourceMappingURL=baseline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../src/cli/lint/baseline.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEvC,eAAO,MAAM,aAAa,0BAA0B,CAAA;AAcpD,8DAA8D;AAC9D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAQ7D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAYtF;AAED,uGAAuG;AACvG,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAWzD;AAED,iDAAiD;AACjD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,QAAQ,CAQpE;AAED,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,KAAG,MAGf,CAAA;AAKnC,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAmBtE;AAED,iGAAiG;AACjG,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,QAAQ,EAAE,QAAQ,GAAG,IAAI,GACxB;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAYvC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,QAAQ,CAaxF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
const BASELINE_PATH = ".basalt/baseline.json";
|
|
4
|
+
const isNever = (id) => id === "basalt/waiver-needs-reason" || id === "oxlint/unused-directive" || id === "stylelint/parse-error" || id === "stylelint/CssSyntaxError" || id.startsWith("stylelint/--report-");
|
|
5
|
+
const isCounts = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.values(value).every((n) => Number.isInteger(n) && n > 0);
|
|
6
|
+
function parseBaseline(text) {
|
|
7
|
+
const bad = {
|
|
8
|
+
error: `${BASELINE_PATH} does not parse as { "<file>": { "<rule>": <count> } }: restore it from git`
|
|
9
|
+
};
|
|
10
|
+
let parsed;
|
|
11
|
+
try {
|
|
12
|
+
parsed = JSON.parse(text);
|
|
13
|
+
} catch {
|
|
14
|
+
return bad;
|
|
15
|
+
}
|
|
16
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return bad;
|
|
17
|
+
return Object.values(parsed).every(isCounts) ? { baseline: parsed } : bad;
|
|
18
|
+
}
|
|
19
|
+
function readBaseline(dir) {
|
|
20
|
+
let text;
|
|
21
|
+
try {
|
|
22
|
+
text = readFileSync(resolve(dir, BASELINE_PATH), "utf8");
|
|
23
|
+
} catch (error) {
|
|
24
|
+
if (error.code === "ENOENT") return null;
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
const read = parseBaseline(text);
|
|
28
|
+
if ("error" in read) throw new Error(read.error);
|
|
29
|
+
return read.baseline;
|
|
30
|
+
}
|
|
31
|
+
function countFindings(findings) {
|
|
32
|
+
const counts = {};
|
|
33
|
+
for (const { file, id } of findings) {
|
|
34
|
+
if (isNever(id)) continue;
|
|
35
|
+
const rules = counts[file] ??= {};
|
|
36
|
+
rules[id] = (rules[id] ?? 0) + 1;
|
|
37
|
+
}
|
|
38
|
+
return counts;
|
|
39
|
+
}
|
|
40
|
+
const baselineSize = (baseline) => Object.values(baseline).flatMap((rules) => Object.values(rules)).reduce((sum, n) => sum + n, 0);
|
|
41
|
+
const sortedEntries = (record) => Object.entries(record).toSorted(([a], [b]) => a.localeCompare(b));
|
|
42
|
+
function writeBaseline(dir, baseline) {
|
|
43
|
+
const path = resolve(dir, BASELINE_PATH);
|
|
44
|
+
const rows = sortedEntries(baseline).map(
|
|
45
|
+
([file, rules]) => [file, Object.fromEntries(sortedEntries(rules))]
|
|
46
|
+
);
|
|
47
|
+
const next = rows.length === 0 ? null : `${JSON.stringify(Object.fromEntries(rows), null, 2)}
|
|
48
|
+
`;
|
|
49
|
+
let current = null;
|
|
50
|
+
try {
|
|
51
|
+
current = readFileSync(path, "utf8");
|
|
52
|
+
} catch {
|
|
53
|
+
}
|
|
54
|
+
if (current === next) return false;
|
|
55
|
+
if (next === null) rmSync(path, { force: true });
|
|
56
|
+
else {
|
|
57
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
58
|
+
writeFileSync(path, next, "utf8");
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
function applyBaseline(findings, baseline) {
|
|
63
|
+
if (baseline === null) return { reported: [...findings], held: 0 };
|
|
64
|
+
const counts = countFindings(findings);
|
|
65
|
+
const reported = findings.flatMap((f) => {
|
|
66
|
+
const allowed = isNever(f.id) ? void 0 : baseline[f.file]?.[f.id];
|
|
67
|
+
if (allowed === void 0) return [f];
|
|
68
|
+
const found = counts[f.file]?.[f.id] ?? 0;
|
|
69
|
+
return found <= allowed ? [] : [{ ...f, message: `${f.message} (${found} in this file, ${allowed} baselined)` }];
|
|
70
|
+
});
|
|
71
|
+
return { reported, held: findings.length - reported.length };
|
|
72
|
+
}
|
|
73
|
+
function lowerBaseline(baseline, findings) {
|
|
74
|
+
const counts = countFindings(findings);
|
|
75
|
+
const unread = new Set(findings.filter((f) => isNever(f.id)).map((f) => f.file));
|
|
76
|
+
return Object.fromEntries(
|
|
77
|
+
Object.entries(baseline).flatMap(([file, rules]) => {
|
|
78
|
+
if (unread.has(file)) return [[file, rules]];
|
|
79
|
+
const left = Object.entries(rules).flatMap(([id, n]) => {
|
|
80
|
+
const now = Math.min(n, counts[file]?.[id] ?? 0);
|
|
81
|
+
return now > 0 ? [[id, now]] : [];
|
|
82
|
+
});
|
|
83
|
+
return left.length > 0 ? [[file, Object.fromEntries(left)]] : [];
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
BASELINE_PATH,
|
|
89
|
+
applyBaseline,
|
|
90
|
+
baselineSize,
|
|
91
|
+
countFindings,
|
|
92
|
+
lowerBaseline,
|
|
93
|
+
parseBaseline,
|
|
94
|
+
readBaseline,
|
|
95
|
+
writeBaseline
|
|
96
|
+
};
|
|
@@ -38,6 +38,8 @@ export declare function runStylelint(project: Project, files: readonly string[])
|
|
|
38
38
|
export declare function extraNames(project: Project): string[];
|
|
39
39
|
/** `checkTokens` over every lintable file, as findings. */
|
|
40
40
|
export declare function runCheckTokens(project: Project, files: readonly string[]): Finding[];
|
|
41
|
+
/** Why oxlint would run none of the preset's rules over `files`; empty when no file goes to oxlint. */
|
|
42
|
+
export declare function presetProblems(project: Project, files: readonly string[]): string[];
|
|
41
43
|
/** The class rules over the `.astro`, `.mdx` and `.html` templates oxlint cannot parse. */
|
|
42
44
|
export declare function runTemplateClasses(project: Project, files: readonly string[]): Finding[];
|
|
43
45
|
/** The scanners over install-relative `files`; oxlint and the template scan skip a root declared at `tokens`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../src/cli/lint/engine.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,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,OAAO,GAAG,MAAM,CAOvD"}
|
package/dist/cli/lint/engine.js
CHANGED
|
@@ -12,7 +12,7 @@ import { filesUnder, rootsOf, SKIPPED_DIRS } from "../doctor/types.js";
|
|
|
12
12
|
import { findBin, STYLELINT_IGNORE_ARGS } from "../../lint/bin.js";
|
|
13
13
|
import { dropMisreadDirectives } from "../../lint/rules/structure/waiver-needs-reason.js";
|
|
14
14
|
import { valueListMessage } from "../../lint/stylelint/rules.js";
|
|
15
|
-
import { PRESET_FILE } from "../../lint/weakened.js";
|
|
15
|
+
import { ignoreMatcher, PRESET_FILE, presetLoadProblems } from "../../lint/weakened.js";
|
|
16
16
|
import { TEMPLATE_FILE, templateClassFindings } from "./template-classes.js";
|
|
17
17
|
const JS_FILE = /\.[cm]?[jt]sx?$/;
|
|
18
18
|
const STYLE_FILE = /\.(?:css|astro|mdx|html)$/;
|
|
@@ -168,23 +168,32 @@ function runCheckTokens(project, files) {
|
|
|
168
168
|
message: `${f.name} is not a token.${f.nearest === void 0 ? "" : ` Did you mean ${f.nearest}?`} Use a name from basalt-ui/tokens, or declare it in the --extra file.`
|
|
169
169
|
}));
|
|
170
170
|
}
|
|
171
|
-
function enabledIds(
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
function enabledIds(preset, file) {
|
|
172
|
+
const levels = new Map(Object.entries(preset.rules ?? {}));
|
|
173
|
+
for (const block of preset.overrides ?? []) {
|
|
174
|
+
if (!(block.files ?? []).some((glob) => ignoreMatcher(glob)(file))) continue;
|
|
175
|
+
for (const [id, level] of Object.entries(block.rules ?? {})) levels.set(id, level);
|
|
176
|
+
}
|
|
175
177
|
return new Set(
|
|
176
|
-
|
|
178
|
+
[...levels].filter(
|
|
177
179
|
([id, level]) => id.startsWith("basalt/") && (Array.isArray(level) ? level[0] : level) !== "off"
|
|
178
180
|
).map(([id]) => id.slice("basalt/".length))
|
|
179
181
|
);
|
|
180
182
|
}
|
|
183
|
+
function presetProblems(project, files) {
|
|
184
|
+
return files.some((f) => JS_FILE.test(f) && profileOf(project, f) !== "tokens") ? presetLoadProblems(project.root) : [];
|
|
185
|
+
}
|
|
181
186
|
function runTemplateClasses(project, files) {
|
|
182
187
|
const templates = files.filter((f) => TEMPLATE_FILE.test(f) && profileOf(project, f) !== "tokens");
|
|
183
188
|
if (templates.length === 0) return [];
|
|
184
|
-
const
|
|
189
|
+
const path = resolve(project.root, PRESET_FILE);
|
|
190
|
+
const preset = existsSync(path) ? JSON.parse(readFileSync(path, "utf8")) : {};
|
|
185
191
|
return templates.flatMap((file) => {
|
|
186
192
|
const text = readFileSync(resolve(project.root, file), "utf8");
|
|
187
|
-
return templateClassFindings(text,
|
|
193
|
+
return templateClassFindings(text, enabledIds(preset, file)).map((f) => ({
|
|
194
|
+
file: posix(file),
|
|
195
|
+
...f
|
|
196
|
+
}));
|
|
188
197
|
});
|
|
189
198
|
}
|
|
190
199
|
function scan(project, files) {
|
|
@@ -244,6 +253,7 @@ export {
|
|
|
244
253
|
inRoots,
|
|
245
254
|
isScanned,
|
|
246
255
|
loadProject,
|
|
256
|
+
presetProblems,
|
|
247
257
|
rootFiles,
|
|
248
258
|
runCheckTokens,
|
|
249
259
|
runOxlint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/cli/lint/hook.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/cli/lint/hook.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAMhD,eAAO,MAAM,WAAW,4CAA6C,CAAA;AACrE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAExD;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG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