basalt-ui 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/MIGRATING.md +31 -12
- package/dist/cli/doctor-upgrade.d.ts +11 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +59 -32
- package/dist/cli/doctor.d.ts +2 -2
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +19 -36
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +27 -55
- package/dist/content/highlighter.d.ts.map +1 -1
- package/dist/content/highlighter.js +14 -2
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +6 -2
- package/dist/table/data-table.module.css +43 -0
- package/dist/table/data-table.module.css.d.ts +3 -0
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/src/cli/doctor-upgrade.ts +88 -37
- package/src/cli/doctor.ts +23 -45
- package/src/cli/index.ts +35 -66
- package/src/content/highlighter.ts +18 -2
- package/src/table/data-table.module.css +43 -0
- package/src/table/data-table.module.css.d.ts +3 -0
- package/src/table/data-table.tsx +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [2.0.5](https://github.com/jkrumm/basalt-ui/compare/v2.0.4...v2.0.5) (2026-10-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fail loudly on a missing subpath peer ([74593b1](https://github.com/jkrumm/basalt-ui/commit/74593b10672e9f294032126598765029600ad937))
|
|
7
|
+
|
|
8
|
+
## [2.0.4](https://github.com/jkrumm/basalt-ui/compare/v2.0.3...v2.0.4) (2026-10-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* assert the visible strip above the sticky header, not raw row overlap ([13b5a7e](https://github.com/jkrumm/basalt-ui/commit/13b5a7e736cfdf4be2c212b9894ea0ab6b1fd41e))
|
|
14
|
+
* seal the sticky table header under the app bar, keep narrow columns legible ([9046f21](https://github.com/jkrumm/basalt-ui/commit/9046f2174adaef3d9d71acacc216fe4663181ef5))
|
|
15
|
+
|
|
1
16
|
## [2.0.3](https://github.com/jkrumm/basalt-ui/compare/v2.0.2...v2.0.3) (2026-10-14)
|
|
2
17
|
|
|
3
18
|
|
package/MIGRATING.md
CHANGED
|
@@ -66,18 +66,18 @@ There is one row per SURFACE, not per export, and a surface earns a row once any
|
|
|
66
66
|
shipped lefthook preset both changed in 1.30.0 with no row that owned them — which is how a
|
|
67
67
|
consumer read this index, found nothing, and diffed a KPI row that had silently gone 4-up → 2-up.
|
|
68
68
|
|
|
69
|
-
| Surface | 1.27.0 | 1.28.0 | 1.29.0 | 1.30.0 | 1.30.1 | 1.30.2 | 1.31.0 | 1.32.0 | 1.32.1 | 1.33.0 | 1.34.0 | 1.34.1 | 1.35.0 | 1.36.0 | 1.36.1 | 1.37.0 | 1.37.1 | 1.38.0 | 1.38.1 | 1.39.0 | 1.40.0 | 1.40.1 | 1.40.2 | 1.40.3 | 1.41.0 | 2.0.0 | 2.0.1 | 2.0.2 | 2.0.3 | Unreleased |
|
|
70
|
-
| ----------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------- | ------ | ------ | -------------------------------------------------------------------------------------------- | ------ | ------ | ------ | ------ | ------ | ----------------------------------------------- | ------ | ------ | ------ | ------ | ------------------------------------------------------------ | ---------- | --- | --- | --- | --- | --- |
|
|
71
|
-
| **tokens** (`./tokens`) | — | `--vx-divider` → `rgba()` on both schemes (§ Shell) | `--vx-space-touch-target` added (§ Additions) | eight spacing numbers (§ Chrome) | — | — | `--vx-hit` replaces the touch vars; `SIZE_CLASSES` (§ 1.31.0) | — | `SIZE_CLASSES`/`CONTAINER_CLASSES` actually exported (§ Fixes) | `CONTAINER_GRID_BREAKPOINTS`; `raw-breakpoint` trusts it (§ 1.33.0) | `CONTAINER_KEYS` (§ 1.34.0) | — | — | — | — | — | — | — | | `appShellInset` 20 → 16 (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — |
|
|
72
|
-
| **charts** (`./charts`) | — | phone tier, `curve`, formatters, `state`, log axis (§ preamble) | `ChartState.empty: string`, `AxisBottomNumeric` (§ Additions) | responsive `height`, `legend.maxRows` (§ Charts) | `height` reaches the kinds; `maxRows` beats the `fill` fit (§ Charts) | — | container-class tier + `height` keys (§ 1.31.0) | — | `ResponsiveChartHeight` `sm` → key (§ Container recipes) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
73
|
-
| **shell** (`.`) | — | scrollport, region seams, **the brand left the sidebar** (§§ scrollport, brand, Shell) | `PageTitle`, `BasaltDevDock`, `useBreakpoint` (§ Additions) | More popover, aside pill, the responsive gutter, `useBasaltSpacing` (§ Chrome) | — | — | `theme.breakpoints` derived, `useSizeClass`, `data-basalt-host`, `useBreakpoint` on notice (§ 1.31.0) | `useBreakpoint` removal → 1.33.0; `useSizeClass` is shell-only (§ 1.32.0) | shell-less `shell/` gutter, `AppShell` breakpoints, `useSizeClass` for overlays (§§ Shell-less, `useSizeClass`) | — | `useBreakpoint` removed (§ 1.34.0) | — | — | `useCoarsePointer()` (§ `useCoarsePointer()`) | — | — | — | — | | content gutter 16, block 8 from `sm` (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — |
|
|
74
|
-
| **controls** (`./controls`) | `NumberFilter`, `field.number` (§ Controls) | sheet renders panel rows; `PanelRow`, `SliderControl` (§ `basalt-ui/controls`) | — | — | — | — | — | — | — | `NumberFilter clearable`; `createSearchStore` `resets` (§ State and controls) | — | — | — | `FormSection`/`FormRow`/`FormGroup`/`FormActions` move here (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
75
|
-
| **forms** (`./forms`) | — | `field` → `inputProps`, **`inputProps` drops `key`**, the layout tier (§ `inputProps`) | `field` DELETED — and the `--fix` recipe no longer works (§ Consolidation) | — | — | — | — | — | `FormGroup` row no longer stretches (§ Fixes) | — | — | — | — | the layout + `useForm`/`schemaResolver` deprecated, removed 1.37.0 (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
76
|
-
| **data** (`./data/table`) | — | root is a `<div>`, row selection, `getItemKey` required (§ `basalt-ui/data`) | `./data` + `./query` + `./connectivity` dropped (§ Consolidation) | — | — | — | — | — | `renderCard` documented (§ `renderCard`) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
77
|
-
| **dashboard** (`.`) | `StatCard`: `unit`, `breakdown`, delta format (§ `StatCard`) | `StatGroup`, `WidgetGrid`, query-aware `StatCard` — additive | — | **the column law keys on the CONTAINER; `cols={4}` is 2-up at `sm`** (§ Dashboard) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
78
|
-
| **toolchain** (`./configs/*`) | — | — | the shipped lefthook preset's `check-theme` BROKE — the CLI resolver stopped ascending (§ CLI) | the preset's default bin, and the `root:` recipe (§ Toolchain) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
79
|
-
| **CLI** (`basalt-ui`) | — | — | **resolver stops relocating; `doctor` loses 6 of 10 checks** (§ CLI) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | the managed block moves `CLAUDE.md` → `AGENTS.md` (§ 1.41.0) | — | — | — | — | — |
|
|
80
|
-
| **guards** | five rules → `error` (§ Guards) | six new ids at `warn` (§ preamble) | `query-dual-import` retired in 1.29.1 (§ Guards) | four rules → `error` (§ Guards) | — | — | — | `raw-breakpoint`: the container-grid answer, `error` at 1.33.0 (§ 1.32.0) | `FormRow`/`FormGroup` homes in both lanes; `basalt-main` dropped (§ Fixes) | C1 + breakpoint pairs → `error`; `unknown-vx-token` `warn` (§ Guards) | — | — | — | `unknown-vx-token` → `error`; the token factories throw (§ Guards) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
69
|
+
| Surface | 1.27.0 | 1.28.0 | 1.29.0 | 1.30.0 | 1.30.1 | 1.30.2 | 1.31.0 | 1.32.0 | 1.32.1 | 1.33.0 | 1.34.0 | 1.34.1 | 1.35.0 | 1.36.0 | 1.36.1 | 1.37.0 | 1.37.1 | 1.38.0 | 1.38.1 | 1.39.0 | 1.40.0 | 1.40.1 | 1.40.2 | 1.40.3 | 1.41.0 | 2.0.0 | 2.0.1 | 2.0.2 | 2.0.3 | 2.0.4 | 2.0.5 | Unreleased |
|
|
70
|
+
| ----------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------- | ------ | ------ | -------------------------------------------------------------------------------------------- | ------ | ------ | ------ | ------ | ------ | ----------------------------------------------- | ------ | ------ | ------ | ------ | ------------------------------------------------------------ | ---------- | --- | --- | --- | --- | --- | --- | --- |
|
|
71
|
+
| **tokens** (`./tokens`) | — | `--vx-divider` → `rgba()` on both schemes (§ Shell) | `--vx-space-touch-target` added (§ Additions) | eight spacing numbers (§ Chrome) | — | — | `--vx-hit` replaces the touch vars; `SIZE_CLASSES` (§ 1.31.0) | — | `SIZE_CLASSES`/`CONTAINER_CLASSES` actually exported (§ Fixes) | `CONTAINER_GRID_BREAKPOINTS`; `raw-breakpoint` trusts it (§ 1.33.0) | `CONTAINER_KEYS` (§ 1.34.0) | — | — | — | — | — | — | — | | `appShellInset` 20 → 16 (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
72
|
+
| **charts** (`./charts`) | — | phone tier, `curve`, formatters, `state`, log axis (§ preamble) | `ChartState.empty: string`, `AxisBottomNumeric` (§ Additions) | responsive `height`, `legend.maxRows` (§ Charts) | `height` reaches the kinds; `maxRows` beats the `fill` fit (§ Charts) | — | container-class tier + `height` keys (§ 1.31.0) | — | `ResponsiveChartHeight` `sm` → key (§ Container recipes) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
73
|
+
| **shell** (`.`) | — | scrollport, region seams, **the brand left the sidebar** (§§ scrollport, brand, Shell) | `PageTitle`, `BasaltDevDock`, `useBreakpoint` (§ Additions) | More popover, aside pill, the responsive gutter, `useBasaltSpacing` (§ Chrome) | — | — | `theme.breakpoints` derived, `useSizeClass`, `data-basalt-host`, `useBreakpoint` on notice (§ 1.31.0) | `useBreakpoint` removal → 1.33.0; `useSizeClass` is shell-only (§ 1.32.0) | shell-less `shell/` gutter, `AppShell` breakpoints, `useSizeClass` for overlays (§§ Shell-less, `useSizeClass`) | — | `useBreakpoint` removed (§ 1.34.0) | — | — | `useCoarsePointer()` (§ `useCoarsePointer()`) | — | — | — | — | | content gutter 16, block 8 from `sm` (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
74
|
+
| **controls** (`./controls`) | `NumberFilter`, `field.number` (§ Controls) | sheet renders panel rows; `PanelRow`, `SliderControl` (§ `basalt-ui/controls`) | — | — | — | — | — | — | — | `NumberFilter clearable`; `createSearchStore` `resets` (§ State and controls) | — | — | — | `FormSection`/`FormRow`/`FormGroup`/`FormActions` move here (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
75
|
+
| **forms** (`./forms`) | — | `field` → `inputProps`, **`inputProps` drops `key`**, the layout tier (§ `inputProps`) | `field` DELETED — and the `--fix` recipe no longer works (§ Consolidation) | — | — | — | — | — | `FormGroup` row no longer stretches (§ Fixes) | — | — | — | — | the layout + `useForm`/`schemaResolver` deprecated, removed 1.37.0 (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
76
|
+
| **data** (`./data/table`) | — | root is a `<div>`, row selection, `getItemKey` required (§ `basalt-ui/data`) | `./data` + `./query` + `./connectivity` dropped (§ Consolidation) | — | — | — | — | — | `renderCard` documented (§ `renderCard`) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
77
|
+
| **dashboard** (`.`) | `StatCard`: `unit`, `breakdown`, delta format (§ `StatCard`) | `StatGroup`, `WidgetGrid`, query-aware `StatCard` — additive | — | **the column law keys on the CONTAINER; `cols={4}` is 2-up at `sm`** (§ Dashboard) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
78
|
+
| **toolchain** (`./configs/*`) | — | — | the shipped lefthook preset's `check-theme` BROKE — the CLI resolver stopped ascending (§ CLI) | the preset's default bin, and the `root:` recipe (§ Toolchain) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
79
|
+
| **CLI** (`basalt-ui`) | — | — | **resolver stops relocating; `doctor` loses 6 of 10 checks** (§ CLI) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | the managed block moves `CLAUDE.md` → `AGENTS.md` (§ 1.41.0) | — | — | — | — | — | — | — |
|
|
80
|
+
| **guards** | five rules → `error` (§ Guards) | six new ids at `warn` (§ preamble) | `query-dual-import` retired in 1.29.1 (§ Guards) | four rules → `error` (§ Guards) | — | — | — | `raw-breakpoint`: the container-grid answer, `error` at 1.33.0 (§ 1.32.0) | `FormRow`/`FormGroup` homes in both lanes; `basalt-main` dropped (§ Fixes) | C1 + breakpoint pairs → `error`; `unknown-vx-token` `warn` (§ Guards) | — | — | — | `unknown-vx-token` → `error`; the token factories throw (§ Guards) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
81
81
|
|
|
82
82
|
---
|
|
83
83
|
|
|
@@ -992,6 +992,25 @@ optional, subpath-required peers.
|
|
|
992
992
|
_Nothing yet. Author the next section under this heading as `## Unreleased — <title>`; the
|
|
993
993
|
release renames it and opens a new one here._
|
|
994
994
|
|
|
995
|
+
## 2.0.5 — subpath peers
|
|
996
|
+
|
|
997
|
+
- `doctor` gains `subpath-peers`: when your source imports a basalt-ui subpath whose required peers
|
|
998
|
+
are not installed (e.g. `shiki`, `@shikijs/langs`, `@shikijs/themes` for `basalt-ui/content`) it
|
|
999
|
+
fails with the `bun add` line to run. Without them the build succeeded and the chunk threw
|
|
1000
|
+
"Could not resolve" at load. `CodeBlock` also warns once in dev when the highlighter cannot load.
|
|
1001
|
+
|
|
1002
|
+
## 2.0.4 — argo table and peer friction
|
|
1003
|
+
|
|
1004
|
+
- `BasaltDataTable` `stickyHeader` inside `BasaltShell` now pins flush under the app chrome. The
|
|
1005
|
+
header used to stick at `AppShell.Main`'s content edge, one block-padding below the band, so body
|
|
1006
|
+
rows scrolled through that strip. The default offset cancels the padding; a `stickyHeaderOffset`
|
|
1007
|
+
you pass still wins, so delete a hand-tuned offset that was compensating for the gap.
|
|
1008
|
+
- A `Badge` in a table cell keeps its whole label (`WORKING` no longer shrinks to `WOR…` beside
|
|
1009
|
+
wrapping prose). Narrow numeric headers (`Peak`) clip only if the column is given a `size`
|
|
1010
|
+
smaller than its label — that is a column width, not a table default.
|
|
1011
|
+
- The column-fold toggle column's header cell carries a visually hidden `Details` label instead of
|
|
1012
|
+
an empty `aria-hidden` cell.
|
|
1013
|
+
|
|
995
1014
|
## 2.0.3 — argo shell and CI friction
|
|
996
1015
|
|
|
997
1016
|
- `doctor`'s `app-wiring` follows the entry's relative imports (three deep): `createBasaltRouter`
|
|
@@ -40,4 +40,15 @@ export declare function unknownConfigKeysCheck(cwd: string): Check;
|
|
|
40
40
|
* that is not installed is not this check's business (optional peers are legitimately absent).
|
|
41
41
|
*/
|
|
42
42
|
export declare function exactPeersCheck(cwd: string, install: BasaltInstall): Check;
|
|
43
|
+
/**
|
|
44
|
+
* The peers a subpath needs installed: V2-SPEC § 1's subpath-required class plus `./content`'s
|
|
45
|
+
* shiki trio, which a bundler cannot resolve without them (argo friction row 15). The test pins it
|
|
46
|
+
* to `package.json` and `surfaces.ts`.
|
|
47
|
+
*/
|
|
48
|
+
export declare const SUBPATH_REQUIRED_PEERS: Readonly<Record<string, readonly string[]>>;
|
|
49
|
+
/**
|
|
50
|
+
* `subpath-peers`: every `basalt-ui/<subpath>` the app imports has its required peers installed. A
|
|
51
|
+
* missing one still builds, then throws "Could not resolve" when the chunk loads.
|
|
52
|
+
*/
|
|
53
|
+
export declare function subpathPeersCheck(cwd: string, cfg: BasaltConfig, install: BasaltInstall): Check;
|
|
43
54
|
//# sourceMappingURL=doctor-upgrade.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor-upgrade.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-upgrade.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"doctor-upgrade.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-upgrade.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAA;AA6B9D,wEAAwE;AACxE,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,KAAG,MACc,CAAA;AA+CvD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAqBpD;AA+CD,4FAA4F;AAC5F,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAsBhF;AAsDD,mGAAmG;AACnG,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,aAAa,GACrB,KAAK,CAsBP;AAUD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkC9D;AAgGD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAkCjD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAczD;AAkBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAgB1E;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAQ9E,CAAA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAsB/F"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { existsSync,
|
|
1
|
+
import { existsSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { dirname, relative, resolve } from "node:path";
|
|
4
4
|
import { BASALT_CONFIG_KEYS, RETIRED_CONFIG_KEYS } from "./config.js";
|
|
5
|
-
import { parseJsonc, readIfExists, scannableFiles } from "./index.js";
|
|
5
|
+
import { parseJsonc, readIfExists, readPackageJson, scannableFiles } from "./index.js";
|
|
6
6
|
const guarded = (id, run) => {
|
|
7
7
|
try {
|
|
8
8
|
return run();
|
|
@@ -10,6 +10,10 @@ const guarded = (id, run) => {
|
|
|
10
10
|
return { skip: `${id}: cannot run (${error.message}).` };
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
+
const withInstall = (id, install, reads, run) => {
|
|
14
|
+
const { dir } = install;
|
|
15
|
+
return dir === null ? { skip: `${id}: basalt-ui does not resolve, so its ${reads} cannot be read.` } : guarded(id, () => run(dir));
|
|
16
|
+
};
|
|
13
17
|
const TSCONFIG_PRESET = /(?:^|\/)basalt-ui\/configs\/tsconfig\.(?:base|react-app)\.json$/;
|
|
14
18
|
const TSCONFIG_PRESET_ID = "basalt-ui/configs/tsconfig.react-app.json";
|
|
15
19
|
const TSCONFIG_FIX = `"extends": "${TSCONFIG_PRESET_ID}" (tsconfig.base.json for a package without a DOM)`;
|
|
@@ -104,10 +108,7 @@ function basaltRuleIds(file, seen = /* @__PURE__ */ new Set()) {
|
|
|
104
108
|
}
|
|
105
109
|
function retiredLintRulesCheck(cwd, install) {
|
|
106
110
|
const id = "retired-lint-rules";
|
|
107
|
-
|
|
108
|
-
if (dir === null)
|
|
109
|
-
return { skip: `${id}: basalt-ui does not resolve, so its plugin cannot be read.` };
|
|
110
|
-
return guarded(id, () => {
|
|
111
|
+
return withInstall(id, install, "plugin", (dir) => {
|
|
111
112
|
const ids = [...new Set(basaltRuleIds(resolve(cwd, ".oxlintrc.json")))];
|
|
112
113
|
if (ids.length === 0) return null;
|
|
113
114
|
const pluginPath = resolve(dir, "configs/oxlint-plugin.js");
|
|
@@ -146,26 +147,23 @@ function basaltImports(src) {
|
|
|
146
147
|
const { code, inLiteral } = tokenize(src);
|
|
147
148
|
return [...code.matchAll(SUBPATH_IMPORT)].filter((m) => !inLiteral(m.index)).map((m) => [m[2], code.slice(0, m.index + m[0].length).split("\n").length]);
|
|
148
149
|
}
|
|
150
|
+
const appImports = (cwd, cfg) => scannableFiles(cwd, cfg).filter((f) => /\.(?:[cm]?[jt]sx?|vue|astro)$/.test(f)).flatMap(
|
|
151
|
+
(rel) => basaltImports(readIfExists(resolve(cwd, rel)) ?? "").map(
|
|
152
|
+
([sub, line]) => [sub, rel, line]
|
|
153
|
+
)
|
|
154
|
+
);
|
|
149
155
|
function droppedSubpathsCheck(cwd, cfg, install) {
|
|
150
156
|
const id = "dropped-subpaths";
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const keys = Object.keys(pkg.exports);
|
|
157
|
+
return withInstall(id, install, "exports", (dir) => {
|
|
158
|
+
const pkg = readPackageJson(dir);
|
|
159
|
+
if (pkg === null) throw new Error(`${dir}/package.json is unreadable`);
|
|
160
|
+
const exportsMap = pkg.exports;
|
|
161
|
+
if (exportsMap === void 0) return null;
|
|
162
|
+
const keys = Object.keys(exportsMap);
|
|
158
163
|
const has = (sub) => keys.some(
|
|
159
164
|
(k) => k === `./${sub}` || k.endsWith("*") && `./${sub}`.startsWith(k.slice(0, -1))
|
|
160
165
|
);
|
|
161
|
-
const hits = [];
|
|
162
|
-
for (const rel of scannableFiles(cwd, cfg).filter(
|
|
163
|
-
(f) => /\.(?:[cm]?[jt]sx?|vue|astro)$/.test(f)
|
|
164
|
-
)) {
|
|
165
|
-
for (const [sub, line] of basaltImports(readIfExists(resolve(cwd, rel)) ?? "")) {
|
|
166
|
-
if (!has(sub)) hits.push(`${rel}:${line} imports basalt-ui/${sub}`);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
166
|
+
const hits = appImports(cwd, cfg).filter(([sub]) => !has(sub)).map(([sub, rel, line]) => `${rel}:${line} imports basalt-ui/${sub}`);
|
|
169
167
|
if (hits.length === 0) return null;
|
|
170
168
|
const more = hits.length > 10 ? ` (+${hits.length - 10} more)` : "";
|
|
171
169
|
return {
|
|
@@ -297,8 +295,7 @@ function appWiringCheck(cwd) {
|
|
|
297
295
|
}
|
|
298
296
|
function unknownConfigKeysCheck(cwd) {
|
|
299
297
|
return guarded("config-keys", () => {
|
|
300
|
-
const
|
|
301
|
-
const block = raw === null ? null : JSON.parse(raw).basalt;
|
|
298
|
+
const block = readPackageJson(cwd)?.basalt;
|
|
302
299
|
if (typeof block !== "object" || block === null || Array.isArray(block)) return null;
|
|
303
300
|
const known = new Set(BASALT_CONFIG_KEYS);
|
|
304
301
|
const unknown = Object.keys(block).filter((k) => !known.has(k));
|
|
@@ -311,23 +308,21 @@ function unknownConfigKeysCheck(cwd) {
|
|
|
311
308
|
};
|
|
312
309
|
});
|
|
313
310
|
}
|
|
311
|
+
function peerRanges(dir) {
|
|
312
|
+
return readPackageJson(dir)?.peerDependencies ?? {};
|
|
313
|
+
}
|
|
314
314
|
const EXACT_VERSION = /^\d+\.\d+\.\d+$/;
|
|
315
315
|
function installedVersion(cwd, pkg) {
|
|
316
316
|
for (let dir = cwd; ; dir = dirname(dir)) {
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
317
|
+
const manifest = readPackageJson(resolve(dir, "node_modules", pkg));
|
|
318
|
+
if (manifest !== null) return manifest.version ?? null;
|
|
319
319
|
if (dirname(dir) === dir) return null;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
function exactPeersCheck(cwd, install) {
|
|
323
323
|
const id = "exact-peers";
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
const dir = install.dir;
|
|
327
|
-
return guarded(id, () => {
|
|
328
|
-
const raw = readIfExists(resolve(dir, "package.json"));
|
|
329
|
-
const peers = (raw === null ? {} : JSON.parse(raw).peerDependencies) ?? {};
|
|
330
|
-
const off = Object.entries(peers).filter(([, range]) => EXACT_VERSION.test(range)).flatMap(([pkg, pin]) => {
|
|
324
|
+
return withInstall(id, install, "peers", (dir) => {
|
|
325
|
+
const off = Object.entries(peerRanges(dir)).filter(([, range]) => EXACT_VERSION.test(range)).flatMap(([pkg, pin]) => {
|
|
331
326
|
const have = installedVersion(cwd, pkg);
|
|
332
327
|
return have === null || have === pin ? [] : [`${pkg}@${have} (basalt-ui pins ${pin}): \`bun add ${pkg}@${pin}\``];
|
|
333
328
|
});
|
|
@@ -337,12 +332,44 @@ function exactPeersCheck(cwd, install) {
|
|
|
337
332
|
};
|
|
338
333
|
});
|
|
339
334
|
}
|
|
335
|
+
const SUBPATH_REQUIRED_PEERS = {
|
|
336
|
+
agent: ["ai", "@ai-sdk/provider", "motion"],
|
|
337
|
+
charts: ["@tanstack/charts", "d3-scale"],
|
|
338
|
+
commands: ["@tanstack/react-hotkeys"],
|
|
339
|
+
content: ["react-markdown", "shiki", "@shikijs/langs", "@shikijs/themes"],
|
|
340
|
+
"controls-dates": ["@mantine/dates", "dayjs"],
|
|
341
|
+
forms: ["@mantine/form"],
|
|
342
|
+
table: ["@tanstack/react-table"]
|
|
343
|
+
};
|
|
344
|
+
function subpathPeersCheck(cwd, cfg, install) {
|
|
345
|
+
const id = "subpath-peers";
|
|
346
|
+
return withInstall(id, install, "peers", (dir) => {
|
|
347
|
+
const missing = /* @__PURE__ */ new Map();
|
|
348
|
+
for (const [sub, file] of new Map(
|
|
349
|
+
appImports(cwd, cfg).toReversed().map(([s, f]) => [s, f])
|
|
350
|
+
)) {
|
|
351
|
+
for (const peer of SUBPATH_REQUIRED_PEERS[sub] ?? []) {
|
|
352
|
+
if (installedVersion(cwd, peer) !== null) continue;
|
|
353
|
+
missing.set(peer, [...missing.get(peer) ?? [], `basalt-ui/${sub} (${file})`]);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (missing.size === 0) return null;
|
|
357
|
+
const ranges = peerRanges(dir);
|
|
358
|
+
const named = [...missing].map(([peer, by]) => `${peer} for ${by.join(", ")}`);
|
|
359
|
+
const add = [...missing.keys()].map((peer) => ranges[peer] ? `${peer}@${ranges[peer]}` : peer);
|
|
360
|
+
return {
|
|
361
|
+
fail: `${id}: peers a used basalt-ui subpath requires are not installed: ${named.join("; ")}. Fix: \`bun add ${add.join(" ")}\`.`
|
|
362
|
+
};
|
|
363
|
+
});
|
|
364
|
+
}
|
|
340
365
|
export {
|
|
366
|
+
SUBPATH_REQUIRED_PEERS,
|
|
341
367
|
appWiringCheck,
|
|
342
368
|
droppedSubpathsCheck,
|
|
343
369
|
exactPeersCheck,
|
|
344
370
|
retiredLintRulesCheck,
|
|
345
371
|
seedTsconfigExtends,
|
|
372
|
+
subpathPeersCheck,
|
|
346
373
|
tsconfigBaseCheck,
|
|
347
374
|
tsconfigFile,
|
|
348
375
|
unknownConfigKeysCheck
|
package/dist/cli/doctor.d.ts
CHANGED
|
@@ -22,8 +22,8 @@ export type DoctorResult = {
|
|
|
22
22
|
* 4. `oxlint-preset`: `.oxlintrc.json` extends the shipped preset AND that path resolves.
|
|
23
23
|
* 7. `ai-major-parity`: the `ai` major agrees across this package.json's dependency fields
|
|
24
24
|
* (exempt via `basalt.aiMajorSkewReason`; a stale reason warns).
|
|
25
|
-
* 8-
|
|
26
|
-
* `config-keys` (./doctor-upgrade);
|
|
25
|
+
* 8-14. `tsconfig-base`, `retired-lint-rules`, `dropped-subpaths`, `app-wiring`, `exact-peers`,
|
|
26
|
+
* `subpath-peers`, `config-keys` (./doctor-upgrade);
|
|
27
27
|
* a check that cannot run is SKIPPED and exits non-zero.
|
|
28
28
|
*
|
|
29
29
|
* Warning (non-fatal):
|
package/dist/cli/doctor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AA0DA,MAAM,MAAM,YAAY,GAAG;IACzB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AA2BD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,aAAa,GAAE,MAAsB,EAAE,KAAK,GAAE,MAAM,EAAO,GAAG,MAAM,CAkU1F"}
|
package/dist/cli/doctor.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
readBasaltConfig,
|
|
20
20
|
readIfExists,
|
|
21
21
|
readManifest,
|
|
22
|
+
readPackageJson,
|
|
22
23
|
resolveAppDir,
|
|
23
24
|
resolveProjectDir,
|
|
24
25
|
ROUTER_SEED_DESTS,
|
|
@@ -33,6 +34,7 @@ import {
|
|
|
33
34
|
droppedSubpathsCheck,
|
|
34
35
|
exactPeersCheck,
|
|
35
36
|
retiredLintRulesCheck,
|
|
37
|
+
subpathPeersCheck,
|
|
36
38
|
tsconfigBaseCheck,
|
|
37
39
|
unknownConfigKeysCheck
|
|
38
40
|
} from "./doctor-upgrade.js";
|
|
@@ -51,27 +53,13 @@ function majorOf(range) {
|
|
|
51
53
|
}
|
|
52
54
|
const AI_MAJOR_FIELDS = ["dependencies", "devDependencies", "peerDependencies"];
|
|
53
55
|
function aiMajorsAt(dir) {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
for (const field of AI_MAJOR_FIELDS) {
|
|
60
|
-
const major = majorOf(pkg[field]?.["ai"]);
|
|
61
|
-
if (major !== null) out[field] = major;
|
|
62
|
-
}
|
|
63
|
-
return out;
|
|
64
|
-
} catch {
|
|
65
|
-
return {};
|
|
56
|
+
const pkg = readPackageJson(dir) ?? {};
|
|
57
|
+
const out = {};
|
|
58
|
+
for (const field of AI_MAJOR_FIELDS) {
|
|
59
|
+
const major = majorOf(pkg[field]?.["ai"]);
|
|
60
|
+
if (major !== null) out[field] = major;
|
|
66
61
|
}
|
|
67
|
-
|
|
68
|
-
function resolveAiMajorSkewReason(cfg) {
|
|
69
|
-
const raw = cfg.aiMajorSkewReason;
|
|
70
|
-
if (raw === void 0) return { reason: null, presentButInvalid: false };
|
|
71
|
-
if (typeof raw === "string" && raw.trim().length > 0) {
|
|
72
|
-
return { reason: raw, presentButInvalid: false };
|
|
73
|
-
}
|
|
74
|
-
return { reason: null, presentButInvalid: true };
|
|
62
|
+
return out;
|
|
75
63
|
}
|
|
76
64
|
function doctor(invocationCwd = process.cwd(), flags = []) {
|
|
77
65
|
if (conflictingProfileFlags("doctor", flags)) return 1;
|
|
@@ -87,21 +75,10 @@ function doctor(invocationCwd = process.cwd(), flags = []) {
|
|
|
87
75
|
const lines = [`
|
|
88
76
|
basalt-ui doctor \u2014 ${cwd}
|
|
89
77
|
`];
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
lines.push(` \u26A0 ${msg}`);
|
|
95
|
-
result.warnings++;
|
|
96
|
-
}
|
|
97
|
-
function fail(msg) {
|
|
98
|
-
lines.push(` \u2716 ${msg}`);
|
|
99
|
-
result.hardFailures++;
|
|
100
|
-
}
|
|
101
|
-
function skip(msg) {
|
|
102
|
-
lines.push(` ? SKIPPED ${msg}`);
|
|
103
|
-
result.skipped++;
|
|
104
|
-
}
|
|
78
|
+
const pass = (msg) => lines.push(` \u2713 ${msg}`);
|
|
79
|
+
const warn = (msg) => lines.push(` \u26A0 ${msg}`) && result.warnings++;
|
|
80
|
+
const fail = (msg) => lines.push(` \u2716 ${msg}`) && result.hardFailures++;
|
|
81
|
+
const skip = (msg) => lines.push(` ? SKIPPED ${msg}`) && result.skipped++;
|
|
105
82
|
if (project.relocatedFrom !== null) {
|
|
106
83
|
lines.push(` \u2192 BASALT_CWD relocated from ${project.relocatedFrom} to ${cwd}.
|
|
107
84
|
`);
|
|
@@ -243,7 +220,9 @@ basalt-ui doctor \u2014 ${cwd}
|
|
|
243
220
|
const aiEntries = AI_MAJOR_FIELDS.filter((field) => aiMajors[field] !== void 0).map(
|
|
244
221
|
(field) => ({ field, major: aiMajors[field] })
|
|
245
222
|
);
|
|
246
|
-
const
|
|
223
|
+
const rawSkewReason = cfg.aiMajorSkewReason;
|
|
224
|
+
const aiMajorSkewReason = typeof rawSkewReason === "string" && rawSkewReason.trim().length > 0 ? rawSkewReason : null;
|
|
225
|
+
const aiMajorSkewReasonInvalid = aiMajorSkewReason === null && rawSkewReason !== void 0;
|
|
247
226
|
if (aiEntries.length > 0) {
|
|
248
227
|
const distinctMajors = new Set(aiEntries.map((entry) => entry.major));
|
|
249
228
|
if (distinctMajors.size > 1) {
|
|
@@ -294,6 +273,10 @@ basalt-ui doctor \u2014 ${cwd}
|
|
|
294
273
|
appWiringCheck(appDir)
|
|
295
274
|
],
|
|
296
275
|
["exact-peers: installed exact-pinned peers match basalt-ui", exactPeersCheck(cwd, install)],
|
|
276
|
+
[
|
|
277
|
+
"subpath-peers: every imported basalt-ui subpath has its required peers installed",
|
|
278
|
+
subpathPeersCheck(cwd, cfg, install)
|
|
279
|
+
],
|
|
297
280
|
[
|
|
298
281
|
"config-keys: the basalt config block sets only keys basalt-ui reads",
|
|
299
282
|
unknownConfigKeysCheck(cwd)
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -162,6 +162,8 @@ export declare const AGENTS_MD = "AGENTS.md";
|
|
|
162
162
|
export declare const LEGACY_BLOCK_HOST = "CLAUDE.md";
|
|
163
163
|
export declare function sha256(text: string): string;
|
|
164
164
|
export declare function readIfExists(abs: string): string | null;
|
|
165
|
+
/** `<dir>/package.json` parsed as `T`; null when absent or not JSON. */
|
|
166
|
+
export declare function readPackageJson<T>(dir: string): T | null;
|
|
165
167
|
/** Read a shipped source asset from the package root; null if the sibling hasn't authored it yet. */
|
|
166
168
|
export declare function readSource(pkgRoot: string, source: string): string | null;
|
|
167
169
|
/** The framework's own published version, read from the package root package.json. */
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,WAAW,EAA4B,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AA+B5C,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,WAAW,CAiBzF;AAwBD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,EAAE,CAEzD;AAED,eAAO,MAAM,IAAI,QAAyC,CAAA;AAC1D,mGAAmG;AACnG,eAAO,MAAM,qBAAqB,QAA6B,CAAA;AA8B/D;qGACqG;AACrG,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,WAAW,EAA4B,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,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W,EAAE,CAAA;AAClC,YAAY,EAAE,WAAW,EAAE,CAAA;AAI3B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,uBAAuB,EAAE,SAAS,EAAE,CAAA;AAClG,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/cli/index.js
CHANGED
|
@@ -91,20 +91,10 @@ function sanitizeSeverity(cfg) {
|
|
|
91
91
|
return { ...cfg, severity: kept };
|
|
92
92
|
}
|
|
93
93
|
function hasBasaltKey(cwd) {
|
|
94
|
-
|
|
95
|
-
try {
|
|
96
|
-
return raw !== null && JSON.parse(raw).basalt !== void 0;
|
|
97
|
-
} catch {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
94
|
+
return readPackageJson(cwd)?.basalt !== void 0;
|
|
100
95
|
}
|
|
101
96
|
function readBasaltConfig(cwd) {
|
|
102
|
-
|
|
103
|
-
const pkg = JSON.parse(readFileSync(resolve(cwd, "package.json"), "utf8"));
|
|
104
|
-
return sanitizeSeverity(pkg.basalt ?? {});
|
|
105
|
-
} catch {
|
|
106
|
-
return {};
|
|
107
|
-
}
|
|
97
|
+
return sanitizeSeverity(readPackageJson(cwd)?.basalt ?? {});
|
|
108
98
|
}
|
|
109
99
|
const SCANNABLE_EXT = /\.(?:tsx?|jsx|[cm][jt]s|astro|vue|css|html?|webmanifest)$/;
|
|
110
100
|
function walkSourceFiles(dir, out = []) {
|
|
@@ -136,14 +126,11 @@ function relativePosix(fromDir, toPath) {
|
|
|
136
126
|
const UNRESOLVED_INSTALL = { dir: null, version: null, how: null };
|
|
137
127
|
function basaltInstallAt(dir) {
|
|
138
128
|
const installDir = resolve(dir, "node_modules", "basalt-ui");
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
} catch {
|
|
145
|
-
return { dir: installDir, version: null };
|
|
146
|
-
}
|
|
129
|
+
if (readIfExists(resolve(installDir, "package.json")) === null) return null;
|
|
130
|
+
return {
|
|
131
|
+
dir: installDir,
|
|
132
|
+
version: readPackageJson(installDir)?.version ?? null
|
|
133
|
+
};
|
|
147
134
|
}
|
|
148
135
|
function findBasaltInstall(cwd) {
|
|
149
136
|
const own = basaltInstallAt(cwd);
|
|
@@ -244,24 +231,24 @@ function readIfExists(abs) {
|
|
|
244
231
|
return null;
|
|
245
232
|
}
|
|
246
233
|
}
|
|
234
|
+
function readPackageJson(dir) {
|
|
235
|
+
const raw = readIfExists(resolve(dir, "package.json"));
|
|
236
|
+
try {
|
|
237
|
+
return raw === null ? null : JSON.parse(raw);
|
|
238
|
+
} catch {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
247
242
|
function readSource(pkgRoot, source) {
|
|
248
243
|
return readIfExists(resolve(pkgRoot, source));
|
|
249
244
|
}
|
|
250
245
|
function readPackageName(cwd) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (pkg.name && pkg.name.length > 0) return pkg.name;
|
|
254
|
-
} catch {
|
|
255
|
-
}
|
|
246
|
+
const name = readPackageJson(cwd)?.name;
|
|
247
|
+
if (name && name.length > 0) return name;
|
|
256
248
|
return cwd.split("/").filter(Boolean).pop() ?? "app";
|
|
257
249
|
}
|
|
258
250
|
function readFrameworkVersion(pkgRoot) {
|
|
259
|
-
|
|
260
|
-
const pkg = JSON.parse(readFileSync(resolve(pkgRoot, "package.json"), "utf8"));
|
|
261
|
-
return pkg.version ?? "0.0.0";
|
|
262
|
-
} catch {
|
|
263
|
-
return "0.0.0";
|
|
264
|
-
}
|
|
251
|
+
return readPackageJson(pkgRoot)?.version ?? "0.0.0";
|
|
265
252
|
}
|
|
266
253
|
function basaltBinCommand(install, cwd) {
|
|
267
254
|
if (install.dir === null) return "bunx basalt-ui";
|
|
@@ -397,14 +384,10 @@ function resolveAppDir(root) {
|
|
|
397
384
|
};
|
|
398
385
|
}
|
|
399
386
|
function hasDependency(cwd, pkgName) {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
);
|
|
405
|
-
} catch {
|
|
406
|
-
return false;
|
|
407
|
-
}
|
|
387
|
+
const pkg = readPackageJson(cwd);
|
|
388
|
+
return Boolean(
|
|
389
|
+
pkg?.dependencies?.[pkgName] ?? pkg?.devDependencies?.[pkgName] ?? pkg?.peerDependencies?.[pkgName]
|
|
390
|
+
);
|
|
408
391
|
}
|
|
409
392
|
const ROOT_PLACEMENT = {
|
|
410
393
|
isPackageRepoRoot: true,
|
|
@@ -694,14 +677,8 @@ function renderContext(cwd) {
|
|
|
694
677
|
function patchPackageJson(cwd, mutate) {
|
|
695
678
|
const abs = resolve(cwd, "package.json");
|
|
696
679
|
const raw = readIfExists(abs);
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
try {
|
|
700
|
-
pkg = JSON.parse(raw);
|
|
701
|
-
} catch {
|
|
702
|
-
return false;
|
|
703
|
-
}
|
|
704
|
-
if (!mutate(pkg)) return false;
|
|
680
|
+
const pkg = readPackageJson(cwd);
|
|
681
|
+
if (raw === null || pkg === null || !mutate(pkg)) return false;
|
|
705
682
|
const indent = /\n([ \t]+)"/.exec(raw)?.[1] ?? " ";
|
|
706
683
|
writeFileSync(abs, JSON.stringify(pkg, null, indent) + (raw.endsWith("\n") ? "\n" : ""));
|
|
707
684
|
return true;
|
|
@@ -926,14 +903,8 @@ function expandWorkspaceGlobs(cwd, patterns) {
|
|
|
926
903
|
return dirs;
|
|
927
904
|
}
|
|
928
905
|
function collectWorkspacePackages(cwd) {
|
|
929
|
-
const
|
|
930
|
-
if (
|
|
931
|
-
let parsed;
|
|
932
|
-
try {
|
|
933
|
-
parsed = JSON.parse(raw);
|
|
934
|
-
} catch {
|
|
935
|
-
return { packages: [], hasWorkspacesField: false };
|
|
936
|
-
}
|
|
906
|
+
const parsed = readPackageJson(cwd);
|
|
907
|
+
if (parsed === null) return { packages: [], hasWorkspacesField: false };
|
|
937
908
|
const patterns = isStringArray(parsed.workspaces) ? parsed.workspaces : parsed.workspaces !== null && typeof parsed.workspaces === "object" && isStringArray(parsed.workspaces.packages) ? parsed.workspaces.packages : null;
|
|
938
909
|
if (patterns === null) return { packages: [], hasWorkspacesField: false };
|
|
939
910
|
const rootName = parsed.name && parsed.name.length > 0 ? `${parsed.name} (root)` : "(root)";
|
|
@@ -1048,6 +1019,7 @@ export {
|
|
|
1048
1019
|
readFrameworkVersion,
|
|
1049
1020
|
readIfExists,
|
|
1050
1021
|
readManifest,
|
|
1022
|
+
readPackageJson,
|
|
1051
1023
|
readSource,
|
|
1052
1024
|
reconcileRoots,
|
|
1053
1025
|
relativePosix,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlighter.d.ts","sourceRoot":"","sources":["../../src/content/highlighter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"highlighter.d.ts","sourceRoot":"","sources":["../../src/content/highlighter.ts"],"names":[],"mappings":"AAkHA;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkBtF"}
|
|
@@ -37,6 +37,14 @@ const LANG_ALIASES = {
|
|
|
37
37
|
docker: "dockerfile"
|
|
38
38
|
};
|
|
39
39
|
let highlighterPromise = null;
|
|
40
|
+
let warnedMissingPeer = false;
|
|
41
|
+
function warnMissingPeer(error) {
|
|
42
|
+
if (warnedMissingPeer || process.env["NODE_ENV"] === "production") return;
|
|
43
|
+
warnedMissingPeer = true;
|
|
44
|
+
console.warn(
|
|
45
|
+
`[basalt] CodeBlock: syntax highlighting is off \u2014 a peer of basalt-ui/content did not load (${error instanceof Error ? error.message : String(error)}). Code renders unhighlighted. Install them with: bun add shiki @shikijs/langs @shikijs/themes`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
40
48
|
async function loadHighlighter() {
|
|
41
49
|
const [{ createHighlighterCore }, { createJavaScriptRegexEngine }] = await Promise.all([
|
|
42
50
|
import("shiki/core"),
|
|
@@ -49,7 +57,10 @@ async function loadHighlighter() {
|
|
|
49
57
|
});
|
|
50
58
|
}
|
|
51
59
|
function getHighlighter() {
|
|
52
|
-
highlighterPromise ??= loadHighlighter().catch(() =>
|
|
60
|
+
highlighterPromise ??= loadHighlighter().catch((error) => {
|
|
61
|
+
warnMissingPeer(error);
|
|
62
|
+
return null;
|
|
63
|
+
});
|
|
53
64
|
return highlighterPromise;
|
|
54
65
|
}
|
|
55
66
|
async function ensureLanguage(highlighter, lang) {
|
|
@@ -59,7 +70,8 @@ async function ensureLanguage(highlighter, lang) {
|
|
|
59
70
|
try {
|
|
60
71
|
await highlighter.loadLanguage(loadLang());
|
|
61
72
|
return true;
|
|
62
|
-
} catch {
|
|
73
|
+
} catch (error) {
|
|
74
|
+
warnMissingPeer(error);
|
|
63
75
|
return false;
|
|
64
76
|
}
|
|
65
77
|
}
|