basalt-ui 2.8.0 → 2.9.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 +2 -2
- package/CHANGELOG.md +209 -189
- package/MIGRATING.md +98 -28
- package/README.md +7 -8
- package/agent/rules/basalt-controls.md +1 -1
- package/agent/rules/basalt-state.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/templates/AGENTS-block.md.tpl +2 -2
- package/configs/oxlint-plugin.js +25 -68
- package/configs/oxlint-plugin.test.ts +19 -27
- package/dist/charts/BandStrip.d.ts +1 -1
- package/dist/charts/BandStrip.d.ts.map +1 -1
- package/dist/charts/BandStrip.js +1 -10
- package/dist/charts/MirroredBars.d.ts.map +1 -1
- package/dist/charts/MirroredBars.js +2 -9
- package/dist/charts/band-fold.d.ts +15 -0
- package/dist/charts/band-fold.d.ts.map +1 -0
- package/dist/charts/band-fold.js +19 -0
- package/dist/charts/index.d.ts +1 -0
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/index.js +3 -1
- package/dist/cli/audit-allows.d.ts.map +1 -1
- package/dist/cli/audit-allows.js +1 -1
- package/dist/cli/check-theme.d.ts.map +1 -1
- package/dist/cli/check-theme.js +4 -1
- package/dist/cli/config.d.ts +4 -4
- package/dist/cli/doctor-upgrade.d.ts +5 -4
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +23 -99
- package/dist/cli/doctor.d.ts +2 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +23 -25
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +2 -3
- package/dist/cli/index.d.ts +15 -6
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +16 -27
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +9 -6
- package/dist/cli/install-root.d.ts +10 -0
- package/dist/cli/install-root.d.ts.map +1 -0
- package/dist/cli/install-root.js +32 -0
- package/dist/cli/router-wiring.d.ts +37 -0
- package/dist/cli/router-wiring.d.ts.map +1 -0
- package/dist/cli/router-wiring.js +116 -0
- package/dist/cli/source-text.d.ts +12 -0
- package/dist/cli/source-text.d.ts.map +1 -0
- package/dist/cli/source-text.js +46 -0
- package/dist/cli/sync.d.ts +0 -2
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +23 -21
- package/dist/cli/tokens-css.d.ts.map +1 -1
- package/dist/cli/tokens-css.js +1 -6
- package/dist/common/errors.d.ts +1 -6
- package/dist/common/errors.d.ts.map +1 -1
- package/dist/common/errors.js +0 -7
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -9
- package/dist/common/props.d.ts +2 -2
- package/dist/common/vx-family.d.ts +1 -1
- package/dist/content/code-block.d.ts.map +1 -1
- package/dist/content/code-block.js +36 -27
- package/dist/content/code-block.module.css +19 -1
- package/dist/content/mermaid-sanitize.d.ts +15 -0
- package/dist/content/mermaid-sanitize.d.ts.map +1 -0
- package/dist/content/mermaid-sanitize.js +28 -0
- package/dist/content/mermaid.d.ts +6 -0
- package/dist/content/mermaid.d.ts.map +1 -1
- package/dist/content/mermaid.js +3 -1
- package/dist/content/toc-click-pin.d.ts +45 -0
- package/dist/content/toc-click-pin.d.ts.map +1 -0
- package/dist/content/toc-click-pin.js +111 -0
- package/dist/content/toc-spy.d.ts +25 -0
- package/dist/content/toc-spy.d.ts.map +1 -0
- package/dist/content/toc-spy.js +43 -0
- package/dist/content/toc.d.ts +1 -4
- package/dist/content/toc.d.ts.map +1 -1
- package/dist/content/toc.js +38 -49
- package/dist/controls/number-filter.d.ts.map +1 -1
- package/dist/controls/number-filter.js +1 -1
- package/dist/dashboard/index.d.ts +1 -1
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +1 -3
- package/dist/dashboard/section.d.ts +10 -2
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +20 -3
- package/dist/dashboard/stat-card.d.ts +2 -8
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +1 -1
- package/dist/guard/index.d.ts +13 -9
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +74 -37
- package/dist/guard/types.d.ts +8 -7
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/guard/vx-names.d.ts +1 -1
- package/dist/guard/vx-names.d.ts.map +1 -1
- package/dist/guard/vx-names.js +1 -33
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +3 -2
- package/dist/router-tanstack/search-store.d.ts +1 -11
- package/dist/router-tanstack/search-store.d.ts.map +1 -1
- package/dist/router-tanstack/search-store.js +1 -2
- package/dist/shell/index.d.ts +1 -0
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +3 -0
- package/dist/shell/nav-types.d.ts +1 -1
- package/dist/shell/page-bar.d.ts +6 -0
- package/dist/shell/page-bar.d.ts.map +1 -1
- package/dist/shell/page-bar.js +12 -2
- package/dist/state/fields.d.ts +1 -1
- package/dist/state/fields.d.ts.map +1 -1
- package/dist/state/fields.js +3 -1
- package/dist/surfaces.d.ts +1 -1
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +5 -11
- package/dist/table/data-table.d.ts +2 -2
- package/dist/tokens/core.d.ts +0 -10
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +6 -44
- package/dist/vite-boot.d.ts +25 -0
- package/dist/vite-boot.d.ts.map +1 -0
- package/dist/vite-boot.js +36 -0
- package/dist/vite.d.ts +24 -3
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +7 -16
- package/llms.txt +26 -9
- package/package.json +8 -5
- package/src/charts/BandStrip.tsx +4 -16
- package/src/charts/MirroredBars.tsx +2 -11
- package/src/charts/band-fold.ts +26 -0
- package/src/charts/index.ts +1 -0
- package/src/cli/audit-allows.ts +1 -3
- package/src/cli/check-theme.ts +7 -1
- package/src/cli/config.ts +4 -4
- package/src/cli/doctor-upgrade.ts +29 -145
- package/src/cli/doctor.ts +25 -31
- package/src/cli/help.ts +1 -4
- package/src/cli/index.ts +27 -43
- package/src/cli/init.ts +9 -6
- package/src/cli/install-root.ts +40 -0
- package/src/cli/router-wiring.ts +185 -0
- package/src/cli/source-text.ts +62 -0
- package/src/cli/sync.ts +26 -22
- package/src/cli/tokens-css.ts +0 -5
- package/src/common/errors.ts +1 -18
- package/src/common/index.ts +1 -8
- package/src/common/props.ts +2 -2
- package/src/common/vx-family.ts +1 -1
- package/src/content/code-block.module.css +19 -1
- package/src/content/code-block.tsx +7 -2
- package/src/content/mermaid-sanitize.ts +49 -0
- package/src/content/mermaid.tsx +3 -2
- package/src/content/toc-click-pin.ts +156 -0
- package/src/content/toc-spy.ts +61 -0
- package/src/content/toc.tsx +47 -95
- package/src/controls/form-layout.tsx +1 -1
- package/src/controls/number-filter.tsx +6 -1
- package/src/dashboard/index.ts +1 -6
- package/src/dashboard/section.tsx +39 -8
- package/src/dashboard/stat-card.tsx +4 -11
- package/src/guard/index.ts +114 -89
- package/src/guard/types.ts +8 -7
- package/src/guard/vx-names.ts +1 -33
- package/src/index.ts +1 -2
- package/src/provider/index.tsx +6 -3
- package/src/router-tanstack/search-store.ts +2 -14
- package/src/shell/index.tsx +2 -0
- package/src/shell/nav-types.ts +1 -1
- package/src/shell/page-bar.tsx +21 -2
- package/src/state/fields.ts +7 -2
- package/src/surfaces.ts +5 -11
- package/src/table/data-table.tsx +2 -2
- package/src/tokens/core.ts +6 -67
- package/src/vite-boot.ts +109 -0
- package/src/vite.ts +32 -61
- package/dist/tokens.css +0 -331
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MirroredBars.d.ts","sourceRoot":"","sources":["../../src/charts/MirroredBars.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"MirroredBars.d.ts","sourceRoot":"","sources":["../../src/charts/MirroredBars.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAUzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,EAAW,MAAM,SAAS,CAAA;AAEhF,4BAA4B;AAC5B,MAAM,MAAM,eAAe,GAAG;IAC5B;8EAC0E;IAC1E,GAAG,EAAE,MAAM,CAAA;IACX,+FAA+F;IAC/F,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IACjC,sGAAsG;IACtG,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,2DAA2D;IAC3D,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CAC9B,CAAA;AAED,oGAAoG;AACpG,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,IAAI,CACtC,WAAW,CAAC,CAAC,CAAC,EACd,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAChG,CAAA;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAChE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EACvB,WAAW,GACX,MAAM,GACN,GAAG,GACH,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,aAAa,GACb,SAAS,GACT,WAAW,GACX,OAAO,CACV,GAAG;IACF,qEAAqE;IACrE,MAAM,EAAE,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAA;IACxC,gCAAgC;IAChC,EAAE,EAAE,eAAe,CAAA;IACnB,gCAAgC;IAChC,IAAI,EAAE,eAAe,CAAA;IACrB,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,2FAA2F;IAC3F,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;IAClD,6FAA6F;IAC7F,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;IAC9C;;;OAGG;IACH,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;KAAE,GAAG,SAAS,CAAA;IAC/E,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAAA;CAC7E,CAAA;AAsCD,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EACvD,KAAK,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC7B,YAAY,CA0Kd"}
|
|
@@ -10,6 +10,7 @@ import { defaultFormatX, defaultNumberFormat, seriesRow, visibleSeries } from ".
|
|
|
10
10
|
import { barMark, emphasis } from "./marks.js";
|
|
11
11
|
import { PanelRung, chartHeightOf, paneX, paneY, rowsOf } from "./panel.js";
|
|
12
12
|
import { xScaleFor } from "./scales.js";
|
|
13
|
+
import { foldBands } from "./band-fold.js";
|
|
13
14
|
import { rowX } from "./types.js";
|
|
14
15
|
const DEFAULT_UP_FRACTION = 0.35;
|
|
15
16
|
const DEFAULT_PANE_TICKS = 3;
|
|
@@ -17,14 +18,6 @@ const DEFAULT_MIN_BAND_PX = 3;
|
|
|
17
18
|
const BAR_OPACITY = 1;
|
|
18
19
|
const BAND_FILL = 0.8;
|
|
19
20
|
const clamp01 = (v) => v === void 0 || !Number.isFinite(v) ? 0 : Math.min(Math.max(v, 0), 1);
|
|
20
|
-
function fold(data, cap, merge) {
|
|
21
|
-
if (cap <= 0) return [];
|
|
22
|
-
if (data.length <= cap) return [...data];
|
|
23
|
-
const size = Math.ceil(data.length / cap);
|
|
24
|
-
const out = [];
|
|
25
|
-
for (let i = 0; i < data.length; i += size) out.push(merge(data.slice(i, i + size)));
|
|
26
|
-
return out;
|
|
27
|
-
}
|
|
28
21
|
function paneMax(pane, s, data, on) {
|
|
29
22
|
if (pane.max !== void 0 && pane.max !== "auto") return pane.max || 1;
|
|
30
23
|
if (!on) return 1;
|
|
@@ -55,7 +48,7 @@ function MirroredBars(props) {
|
|
|
55
48
|
({ hidden, highlighted, width }) => {
|
|
56
49
|
const upSeries = assertPaneKey("up", up.key, bars);
|
|
57
50
|
const downSeries = assertPaneKey("down", down.key, bars);
|
|
58
|
-
const drawn = foldConfig ?
|
|
51
|
+
const drawn = foldConfig ? foldBands(
|
|
59
52
|
data,
|
|
60
53
|
Math.floor(width / (foldConfig.minBandPx ?? DEFAULT_MIN_BAND_PX)),
|
|
61
54
|
foldConfig.merge
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** A run of adjacent slots drawn as one band; `items` are the source data it stands for. */
|
|
2
|
+
export type Group<T> = {
|
|
3
|
+
start: number;
|
|
4
|
+
items: T[];
|
|
5
|
+
};
|
|
6
|
+
/** Adjacent data in groups of equal size, the last possibly shorter, at most `cap` groups. */
|
|
7
|
+
export declare function groupsOf<T>(data: readonly T[], cap: number): Group<T>[];
|
|
8
|
+
/**
|
|
9
|
+
* The width-driven fold `BandStrip` and `MirroredBars` run: at most `cap` slots, adjacent data
|
|
10
|
+
* merged in equal runs by the consumer's `merge` (a lone datum passes through unmerged). Exported
|
|
11
|
+
* so a consumer can test its `merge` against the real grouping; `cap` is
|
|
12
|
+
* `floor(width / minBandPx)`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function foldBands<T>(data: readonly T[], cap: number, merge: (group: T[]) => T): T[];
|
|
15
|
+
//# sourceMappingURL=band-fold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"band-fold.d.ts","sourceRoot":"","sources":["../../src/charts/band-fold.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,CAAA;AAEpD,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CASvE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAI3F"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function groupsOf(data, cap) {
|
|
2
|
+
const size = Math.max(1, Math.ceil(data.length / Math.max(cap, 1)));
|
|
3
|
+
const out = [];
|
|
4
|
+
data.forEach((d, i) => {
|
|
5
|
+
const last = out.at(-1);
|
|
6
|
+
if (last && last.items.length < size) last.items.push(d);
|
|
7
|
+
else out.push({ start: i, items: [d] });
|
|
8
|
+
});
|
|
9
|
+
return out;
|
|
10
|
+
}
|
|
11
|
+
function foldBands(data, cap, merge) {
|
|
12
|
+
if (cap <= 0) return [];
|
|
13
|
+
if (data.length <= cap) return [...data];
|
|
14
|
+
return groupsOf(data, cap).map((g) => merge(g.items));
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
foldBands,
|
|
18
|
+
groupsOf
|
|
19
|
+
};
|
package/dist/charts/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { Bars, type BarsProps, type BarsBar, type BarsLine } from './Bars.js';
|
|
|
11
11
|
export { StackedArea, type StackedAreaProps, type StackedAreaBand } from './StackedArea.js';
|
|
12
12
|
export { Sparkline, type SparklineProps } from './Sparkline.js';
|
|
13
13
|
export { BandStrip, type BandStripProps, type BandStripSeries, type BandSpan, type BandFold, } from './BandStrip.js';
|
|
14
|
+
export { foldBands } from './band-fold.js';
|
|
14
15
|
export { Donut, type DonutProps, type DonutDatum } from './Donut.js';
|
|
15
16
|
export { Heatmap, type HeatmapProps } from './Heatmap.js';
|
|
16
17
|
export { DualPanel, type DualPanelProps, type DualPanelLine, type DualPanelBar } from './DualPanel.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/charts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AACxF,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACnG,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAA;AACrD,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,QAAQ,GACT,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/charts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AACxF,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACnG,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAA;AACrD,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,QAAQ,GACT,MAAM,SAAS,CAAA"}
|
package/dist/charts/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Sparkline } from "./Sparkline.js";
|
|
|
6
6
|
import {
|
|
7
7
|
BandStrip
|
|
8
8
|
} from "./BandStrip.js";
|
|
9
|
+
import { foldBands } from "./band-fold.js";
|
|
9
10
|
import { Donut } from "./Donut.js";
|
|
10
11
|
import { Heatmap } from "./Heatmap.js";
|
|
11
12
|
import { DualPanel } from "./DualPanel.js";
|
|
@@ -28,5 +29,6 @@ export {
|
|
|
28
29
|
Sparkline,
|
|
29
30
|
StackedArea,
|
|
30
31
|
chartCursor,
|
|
31
|
-
chartCurve
|
|
32
|
+
chartCurve,
|
|
33
|
+
foldBands
|
|
32
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-allows.d.ts","sourceRoot":"","sources":["../../src/cli/audit-allows.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAW,WAAW,EAAa,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,UAAU,CAAA;AA2I7D;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,YAAY,EACjB,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,MAAM,EAAE,GAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"audit-allows.d.ts","sourceRoot":"","sources":["../../src/cli/audit-allows.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAW,WAAW,EAAa,MAAM,UAAU,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,UAAU,CAAA;AA2I7D;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,YAAY,EACjB,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,MAAM,EAAE,GAChB,MAAM,CAoLR"}
|
package/dist/cli/audit-allows.js
CHANGED
|
@@ -135,7 +135,7 @@ basalt-ui check-theme --audit-allows \u2014 ${cwd}
|
|
|
135
135
|
slot: waiverLines.length,
|
|
136
136
|
rel,
|
|
137
137
|
line: site.line,
|
|
138
|
-
reach:
|
|
138
|
+
reach: `scoped to ${site.oxlintRules.join(", ")}, which oxlint judges`,
|
|
139
139
|
site: label,
|
|
140
140
|
suffix
|
|
141
141
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-theme.d.ts","sourceRoot":"","sources":["../../src/cli/check-theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check-theme.d.ts","sourceRoot":"","sources":["../../src/cli/check-theme.ts"],"names":[],"mappings":"AAmFA;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,aAAa,GAAE,MAAsB,EACrC,KAAK,GAAE,SAAS,MAAM,EAAO,GAC5B,MAAM,CAkJR"}
|
package/dist/cli/check-theme.js
CHANGED
|
@@ -3,6 +3,7 @@ import { dirname, resolve } from "node:path";
|
|
|
3
3
|
import {
|
|
4
4
|
checkSource,
|
|
5
5
|
guardKindRemedy,
|
|
6
|
+
REMOVED_VX_NAMES,
|
|
6
7
|
TOKENS_ONLY_DISABLED_KINDS,
|
|
7
8
|
unmatchedExemptPatterns
|
|
8
9
|
} from "../guard/index.js";
|
|
@@ -112,7 +113,9 @@ function checkTheme(invocationCwd = process.cwd(), flags = []) {
|
|
|
112
113
|
for (const [file, vs] of [...byFile].toSorted()) {
|
|
113
114
|
console.error(file);
|
|
114
115
|
for (const v of vs.toSorted((a, b) => a.line - b.line)) {
|
|
115
|
-
|
|
116
|
+
const replacement = v.kind === "unknown-vx-token" ? REMOVED_VX_NAMES[v.token] : void 0;
|
|
117
|
+
const hint = replacement === void 0 ? "" : ` [${v.token} \u2192 ${replacement ?? "deleted, no replacement"}]`;
|
|
118
|
+
console.error(` ${String(v.line).padStart(4)} ${v.kind.padEnd(22)} ${v.text}${hint}`);
|
|
116
119
|
}
|
|
117
120
|
console.error("");
|
|
118
121
|
}
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -127,8 +127,8 @@ export type BasaltConfig = {
|
|
|
127
127
|
seriesModulePath?: string;
|
|
128
128
|
/**
|
|
129
129
|
* Per-rule, per-path exemptions, complementing whole-file `exempt`. A pattern is matched against a
|
|
130
|
-
* finding's relative path: a path
|
|
131
|
-
* `src/agenting.ts`),
|
|
130
|
+
* finding's relative path: a relative path (`'public/site.webmanifest'`), a
|
|
131
|
+
* directory prefix (`'src/agent'` matches `src/agent/x.tsx`, not `src/agenting.ts`), or a glob (`*` stops at `/`, `**` does
|
|
132
132
|
* not; a slash-free glob also matches the basename). An entry that suppresses nothing is reported
|
|
133
133
|
* and `check-theme --audit-allows` exits 1 on it. Default: `{}`.
|
|
134
134
|
*
|
|
@@ -136,9 +136,9 @@ export type BasaltConfig = {
|
|
|
136
136
|
* `.webmanifest` finding's only escape is this key), which `--audit-allows` prints.
|
|
137
137
|
*
|
|
138
138
|
* @example
|
|
139
|
-
* { exemptRules: { 'inline-display': ['agent'] } } // inline-display never fires under src/agent/**
|
|
139
|
+
* { exemptRules: { 'inline-display': ['src/agent'] } } // inline-display never fires under src/agent/**
|
|
140
140
|
* @example
|
|
141
|
-
* { exemptRules: { 'raw-hex': { paths: ['site.webmanifest'],
|
|
141
|
+
* { exemptRules: { 'raw-hex': { paths: ['public/site.webmanifest'],
|
|
142
142
|
* reason: 'a PWA manifest theme_color MUST be a literal hex — JSON cannot reference a CSS var' } } }
|
|
143
143
|
*/
|
|
144
144
|
exemptRules?: Partial<Record<GuardKind, ExemptRuleEntry>>;
|
|
@@ -33,10 +33,11 @@ export declare function seedTsconfigExtends(cwd: string): string | null;
|
|
|
33
33
|
export declare function startWiringWarnings(cwd: string): string[];
|
|
34
34
|
/**
|
|
35
35
|
* `app-wiring`: the entry module `index.html` loads (default src/main.tsx) mounts `BasaltProvider`
|
|
36
|
-
* on a `createBasaltRouter` router (called in the entry or a module it imports), and the router tree
|
|
37
|
-
* binding imported from `@tanstack/router-plugin`
|
|
38
|
-
* beside the entry (or in src/)
|
|
39
|
-
*
|
|
36
|
+
* on a `createBasaltRouter` router (called in the entry or a module it imports), and the router tree
|
|
37
|
+
* exists: the vite config calls a binding imported from `@tanstack/router-plugin` (after its
|
|
38
|
+
* `plugins` key), a `routeTree.gen.*` sits beside the entry (or in src/), or the app is code-routed
|
|
39
|
+
* (`isCodeRoutedApp`, the same predicate `init` and `sync` use). `basaltViteConfig` does not
|
|
40
|
+
* register the plugin, so naming it proves nothing.
|
|
40
41
|
*/
|
|
41
42
|
export declare function appWiringCheck(cwd: string): Check;
|
|
42
43
|
/**
|
|
@@ -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;
|
|
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;AAW5C,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;AA2DD,mGAAmG;AACnG,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,aAAa,GACrB,KAAK,CAyBP;AAiBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAUnD;AAUD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkC9D;AAkED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBzD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CA8BjD;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,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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, routerSeedDest, scannableFiles } from "./index.js";
|
|
5
6
|
import {
|
|
7
|
+
appEntry,
|
|
8
|
+
hasRouteTree,
|
|
9
|
+
hasRouter,
|
|
10
|
+
isCodeRoutedApp,
|
|
6
11
|
isStartApp,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
routerSeedDest,
|
|
11
|
-
scannableFiles
|
|
12
|
-
} from "./index.js";
|
|
12
|
+
routeTreeDirs
|
|
13
|
+
} from "./router-wiring.js";
|
|
14
|
+
import { readIfExists, readPackageJson, tokenize } from "./source-text.js";
|
|
13
15
|
const guarded = (id, run) => {
|
|
14
16
|
try {
|
|
15
17
|
return run();
|
|
@@ -133,23 +135,7 @@ function retiredLintRulesCheck(cwd, install) {
|
|
|
133
135
|
};
|
|
134
136
|
});
|
|
135
137
|
}
|
|
136
|
-
const TOKEN = /("(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`)|\/\/[^\n]*|\/\*[\s\S]*?\*\//g;
|
|
137
138
|
const SUBPATH_IMPORT = /(?:(?:^|;)[ \t]*(?:(?:import|export)\b[^'"`;]*?\bfrom|import)\s*|(?<![.\w$])(?:import|require)\s*\(\s*)(['"])basalt-ui\/([^'"]+)\1/gm;
|
|
138
|
-
function tokenize(src) {
|
|
139
|
-
const literals = [];
|
|
140
|
-
const code = src.replace(TOKEN, (m, literal, at) => {
|
|
141
|
-
if (literal === void 0) return m.replace(/[^\n]/g, " ");
|
|
142
|
-
if (!literal.startsWith("`")) {
|
|
143
|
-
literals.push([at, at + m.length]);
|
|
144
|
-
return m;
|
|
145
|
-
}
|
|
146
|
-
return m.replace(
|
|
147
|
-
/(\$\{[^}]*\})|[^\n`]/g,
|
|
148
|
-
(c, interpolation) => interpolation ?? " "
|
|
149
|
-
);
|
|
150
|
-
});
|
|
151
|
-
return { code, inLiteral: (at) => literals.some(([from, to]) => at >= from && at < to) };
|
|
152
|
-
}
|
|
153
139
|
function basaltImports(src) {
|
|
154
140
|
const { code, inLiteral } = tokenize(src);
|
|
155
141
|
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]);
|
|
@@ -259,70 +245,8 @@ function seedTsconfigExtends(cwd) {
|
|
|
259
245
|
writeFileSync(target, `${text.slice(0, at)}${key}${text.slice(at)}`);
|
|
260
246
|
return `added "extends": "${TSCONFIG_PRESET_ID}" to ${name}.`;
|
|
261
247
|
}
|
|
262
|
-
const VITE_CONFIGS = ["ts", "mts", "cts", "js", "mjs", "cjs"].map((e) => `vite.config.${e}`);
|
|
263
248
|
const SEED_HINT = "node_modules/basalt-ui/agent/templates/main.tpl";
|
|
264
|
-
const ROUTER_PLUGIN_FIX = "Fix: `bun add -D @tanstack/router-plugin`, add `tanstackRouter({ target: 'react', autoCodeSplitting: true })` from '@tanstack/router-plugin/vite' to `plugins` in vite.config.ts (before react()), then run vite once to generate src/routeTree.gen.ts.";
|
|
265
|
-
function htmlEntry(html) {
|
|
266
|
-
for (const [, attrs = ""] of html.replace(/<!--[\s\S]*?-->/g, "").matchAll(/<script\b([^>]*)>/gi)) {
|
|
267
|
-
const src = /\bsrc\s*=\s*["']?([^"'\s>]+)/i.exec(attrs)?.[1];
|
|
268
|
-
if (/\btype\s*=\s*["']?module\b/i.test(attrs) && src !== void 0 && !/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(src)) {
|
|
269
|
-
return src;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return void 0;
|
|
273
|
-
}
|
|
274
|
-
function registersRouterPlugin(src) {
|
|
275
|
-
const { code, inLiteral } = tokenize(src);
|
|
276
|
-
const pluginsAt = [...code.matchAll(/\bplugins\b/g)].find((m) => !inLiteral(m.index))?.index;
|
|
277
|
-
if (pluginsAt === void 0) return false;
|
|
278
|
-
const imports = code.matchAll(
|
|
279
|
-
/(?:^|;)[ \t]*import\s+(?:type\s+)?([^'"`;]*?)\s*from\s*(['"])@tanstack\/router-plugin(?:\/[^'"]*)?\2/gm
|
|
280
|
-
);
|
|
281
|
-
return [...imports].some((m) => {
|
|
282
|
-
if (inLiteral(m.index)) return false;
|
|
283
|
-
const names = (m[1] ?? "").replace(/[{}]/g, "").split(",").map((part) => part.trim()).filter((part) => part !== "" && !/^type\s/.test(part)).map((part) => part.split(/\s+as\s+/).pop());
|
|
284
|
-
return names.some(
|
|
285
|
-
(name) => [
|
|
286
|
-
...code.matchAll(
|
|
287
|
-
new RegExp(`(?<![.\\w$])${name.replace(/\$/g, "\\$")}(?:\\.\\w+)?\\s*\\(`, "g")
|
|
288
|
-
)
|
|
289
|
-
].some((call) => call.index > pluginsAt && !inLiteral(call.index))
|
|
290
|
-
);
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
const RELATIVE_IMPORT = /(?:\b(?:import|export)\b[^'";]*?\bfrom|\bimport)\s*['"](\.{1,2}\/[^'"]+)['"]/g;
|
|
294
|
-
function resolveRelative(from, spec) {
|
|
295
|
-
const base = resolve(dirname(from), spec.replace(/\.[jt]sx?$/, ""));
|
|
296
|
-
return [
|
|
297
|
-
resolve(dirname(from), spec),
|
|
298
|
-
`${base}.ts`,
|
|
299
|
-
`${base}.tsx`,
|
|
300
|
-
`${base}/index.ts`,
|
|
301
|
-
`${base}/index.tsx`
|
|
302
|
-
].find((f) => /\.[jt]sx?$/.test(f) && existsSync(f)) ?? null;
|
|
303
|
-
}
|
|
304
|
-
function routerCreatedInImports(cwd, entry) {
|
|
305
|
-
const seen = /* @__PURE__ */ new Set([resolve(cwd, entry)]);
|
|
306
|
-
let frontier = [...seen];
|
|
307
|
-
for (let depth = 0; depth < 3 && frontier.length > 0; depth++) {
|
|
308
|
-
const next = [];
|
|
309
|
-
for (const file of frontier) {
|
|
310
|
-
for (const m of (readIfExists(file) ?? "").matchAll(RELATIVE_IMPORT)) {
|
|
311
|
-
const dep = resolveRelative(file, m[1] ?? "");
|
|
312
|
-
if (dep === null || seen.has(dep)) continue;
|
|
313
|
-
seen.add(dep);
|
|
314
|
-
const { code, inLiteral } = tokenize(readIfExists(dep) ?? "");
|
|
315
|
-
const called = [...code.matchAll(/\bcreateBasaltRouter\b/g)].some(
|
|
316
|
-
(c) => !inLiteral(c.index)
|
|
317
|
-
);
|
|
318
|
-
if (called) return true;
|
|
319
|
-
next.push(dep);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
frontier = next;
|
|
323
|
-
}
|
|
324
|
-
return false;
|
|
325
|
-
}
|
|
249
|
+
const ROUTER_PLUGIN_FIX = "Fix: `bun add -D @tanstack/router-plugin`, add `tanstackRouter({ target: 'react', autoCodeSplitting: true })` from '@tanstack/router-plugin/vite' to `plugins` in vite.config.ts (before react()), then run vite once to generate src/routeTree.gen.ts \u2014 or define the tree in code (`createRootRoute` + `createRoute`), drop the routeTree.gen import and pass the tree to createBasaltRouter.";
|
|
326
250
|
function isSpreadAt(code, i) {
|
|
327
251
|
const spread = /\{\s*\.\.\./y;
|
|
328
252
|
spread.lastIndex = i;
|
|
@@ -377,29 +301,29 @@ function startWiringWarnings(cwd) {
|
|
|
377
301
|
function appWiringCheck(cwd) {
|
|
378
302
|
return guarded("app-wiring", () => {
|
|
379
303
|
if (isStartApp(cwd, "")) return startWiring(cwd);
|
|
380
|
-
const entry = (
|
|
304
|
+
const entry = appEntry(cwd);
|
|
381
305
|
const text = readIfExists(resolve(cwd, entry));
|
|
382
306
|
if (text === null) {
|
|
383
307
|
return { fail: `app-wiring: ${entry} does not exist. Fix: make it match ${SEED_HINT}.` };
|
|
384
308
|
}
|
|
385
|
-
const
|
|
386
|
-
const
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
|
|
309
|
+
const tokens = tokenize(text);
|
|
310
|
+
const { code, inLiteral } = tokens;
|
|
311
|
+
const wired = [
|
|
312
|
+
[
|
|
313
|
+
"BasaltProvider",
|
|
314
|
+
[...code.matchAll(/\bBasaltProvider\b/g)].some((m) => !inLiteral(m.index))
|
|
315
|
+
],
|
|
316
|
+
["createBasaltRouter", hasRouter(cwd, entry, tokens)]
|
|
317
|
+
];
|
|
318
|
+
const missing = wired.filter(([, present]) => !present).map(([name]) => name);
|
|
390
319
|
if (missing.length > 0) {
|
|
391
320
|
return {
|
|
392
321
|
fail: `app-wiring: ${entry} does not use ${missing.join(" or ")}. Fix: make it match ${SEED_HINT} (\`init\` seeds it only when the file is absent).`
|
|
393
322
|
};
|
|
394
323
|
}
|
|
395
|
-
|
|
396
|
-
const dirs = [.../* @__PURE__ */ new Set([dirname(entry), "src"])];
|
|
397
|
-
const generated = dirs.some(
|
|
398
|
-
(d) => ["ts", "tsx", "js"].some((e) => existsSync(resolve(cwd, d, `routeTree.gen.${e}`)))
|
|
399
|
-
);
|
|
400
|
-
if (generated || registersRouterPlugin(vite)) return null;
|
|
324
|
+
if (hasRouteTree(cwd, entry) || isCodeRoutedApp(cwd, "")) return null;
|
|
401
325
|
return {
|
|
402
|
-
fail: `app-wiring: no vite.config calls the TanStack router plugin and ${
|
|
326
|
+
fail: `app-wiring: the entry imports a generated route tree but no vite.config calls the TanStack router plugin and ${routeTreeDirs(entry).join(" or ")}/routeTree.gen.ts does not exist. ${ROUTER_PLUGIN_FIX}`
|
|
403
327
|
};
|
|
404
328
|
});
|
|
405
329
|
}
|
package/dist/cli/doctor.d.ts
CHANGED
|
@@ -23,7 +23,8 @@ export type DoctorResult = {
|
|
|
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
25
|
* 8-14. `tsconfig-base`, `retired-lint-rules`, `dropped-subpaths`, `app-wiring`, `exact-peers`,
|
|
26
|
-
* `subpath-peers`, `config-keys` (./doctor-upgrade
|
|
26
|
+
* `subpath-peers`, `config-keys` (./doctor-upgrade; a tokens-only consumer runs only
|
|
27
|
+
* `dropped-subpaths` of these — it imports CSS subpaths, where `tokens.css` was);
|
|
27
28
|
* a check that cannot run is SKIPPED and exits non-zero.
|
|
28
29
|
*
|
|
29
30
|
* 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":"AA6DA,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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CAAC,aAAa,GAAE,MAAsB,EAAE,KAAK,GAAE,MAAM,EAAO,GAAG,MAAM,CA4T1F"}
|
package/dist/cli/doctor.js
CHANGED
|
@@ -3,6 +3,7 @@ import { relative, resolve } from "node:path";
|
|
|
3
3
|
import {
|
|
4
4
|
AGENTS_MD,
|
|
5
5
|
LEGACY_BLOCK_HOST,
|
|
6
|
+
scanBlock,
|
|
6
7
|
MANIFEST_PATH,
|
|
7
8
|
basaltBinCommand,
|
|
8
9
|
basaltPresetEntry,
|
|
@@ -25,7 +26,6 @@ import {
|
|
|
25
26
|
ROUTER_SEED_DESTS,
|
|
26
27
|
sameFile,
|
|
27
28
|
scannableFiles,
|
|
28
|
-
scanBlock,
|
|
29
29
|
shippedAssetPath
|
|
30
30
|
} from "./index.js";
|
|
31
31
|
import { resolveRoots } from "./config.js";
|
|
@@ -40,7 +40,8 @@ import {
|
|
|
40
40
|
tsconfigBaseCheck,
|
|
41
41
|
unknownConfigKeysCheck
|
|
42
42
|
} from "./doctor-upgrade.js";
|
|
43
|
-
import { findManifestAbove,
|
|
43
|
+
import { findManifestAbove, installRootAbove } from "./install-root.js";
|
|
44
|
+
import { parentInstallAdvice } from "./sync.js";
|
|
44
45
|
function isSameFile(a, b) {
|
|
45
46
|
try {
|
|
46
47
|
return sameFile(a, b);
|
|
@@ -66,12 +67,9 @@ function aiMajorsAt(dir) {
|
|
|
66
67
|
function doctor(invocationCwd = process.cwd(), flags = []) {
|
|
67
68
|
if (conflictingProfileFlags("doctor", flags)) return 1;
|
|
68
69
|
const project = resolveProjectDir(invocationCwd);
|
|
69
|
-
const aboveRoot = project.relocatedFrom === null
|
|
70
|
-
const insideApp = aboveRoot !== null
|
|
71
|
-
|
|
72
|
-
return !("error" in app2) && app2.dir === project.dir;
|
|
73
|
-
})();
|
|
74
|
-
const cwd = insideApp && aboveRoot !== null ? aboveRoot : project.dir;
|
|
70
|
+
const aboveRoot = project.relocatedFrom === null ? installRootAbove(project.dir) : null;
|
|
71
|
+
const insideApp = aboveRoot !== null;
|
|
72
|
+
const cwd = aboveRoot ?? project.dir;
|
|
75
73
|
const cfg = readBasaltConfig(cwd);
|
|
76
74
|
const result = { hardFailures: 0, warnings: 0, skipped: 0 };
|
|
77
75
|
const lines = [`
|
|
@@ -206,10 +204,6 @@ basalt-ui doctor \u2014 ${cwd}
|
|
|
206
204
|
const issues = [];
|
|
207
205
|
if (scan.problem !== null) {
|
|
208
206
|
issues.push(`has a malformed basalt block (${scan.problem}) \u2014 fix it by hand, then \`sync\``);
|
|
209
|
-
} else if (scan.region !== null) {
|
|
210
|
-
issues.push(
|
|
211
|
-
`still carries a stale basalt block \u2014 delete it by hand; \`sync\` keeps ${AGENTS_MD} current`
|
|
212
|
-
);
|
|
213
207
|
}
|
|
214
208
|
if (!importsAgentsMd(legacy)) {
|
|
215
209
|
issues.push(
|
|
@@ -255,24 +249,33 @@ basalt-ui doctor \u2014 ${cwd}
|
|
|
255
249
|
} else {
|
|
256
250
|
pass("ai-major-parity: this package.json declares no ai dependency \u2014 nothing to compare");
|
|
257
251
|
}
|
|
252
|
+
const droppedCheck = [
|
|
253
|
+
"dropped-subpaths: no import of a basalt-ui subpath the install lacks",
|
|
254
|
+
droppedSubpathsCheck(appDir, cfg, install)
|
|
255
|
+
];
|
|
256
|
+
const runChecks = (checks) => {
|
|
257
|
+
for (const [ok, check] of checks) {
|
|
258
|
+
if (check === null) pass(ok);
|
|
259
|
+
else if ("fail" in check) fail(check.fail);
|
|
260
|
+
else skip(check.skip);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
258
263
|
if (profile === "tokens-only") {
|
|
259
264
|
pass(
|
|
260
|
-
"tsconfig-base / retired-lint-rules /
|
|
265
|
+
"tsconfig-base / retired-lint-rules / oxlint-floor / app-wiring / exact-peers / subpath-peers / config-keys: n/a \u2014 a tokens-only consumer"
|
|
261
266
|
);
|
|
267
|
+
runChecks([droppedCheck]);
|
|
262
268
|
} else {
|
|
263
|
-
|
|
269
|
+
runChecks([
|
|
264
270
|
["tsconfig-base: tsconfig.json extends the shipped preset", tsconfigBaseCheck(appDir)],
|
|
265
271
|
[
|
|
266
272
|
"retired-lint-rules: .oxlintrc.json sets no retired basalt/* rule",
|
|
267
273
|
retiredLintRulesCheck(cwd, install)
|
|
268
274
|
],
|
|
269
|
-
|
|
270
|
-
"dropped-subpaths: no import of a basalt-ui subpath the install lacks",
|
|
271
|
-
droppedSubpathsCheck(appDir, cfg, install)
|
|
272
|
-
],
|
|
275
|
+
droppedCheck,
|
|
273
276
|
["oxlint-floor: the installed oxlint parses the shipped preset", oxlintFloorCheck(cwd)],
|
|
274
277
|
[
|
|
275
|
-
"app-wiring: the entry mounts BasaltProvider and the router tree
|
|
278
|
+
"app-wiring: the entry mounts BasaltProvider and the router tree exists",
|
|
276
279
|
appWiringCheck(appDir)
|
|
277
280
|
],
|
|
278
281
|
["exact-peers: installed exact-pinned peers match basalt-ui", exactPeersCheck(cwd, install)],
|
|
@@ -284,12 +287,7 @@ basalt-ui doctor \u2014 ${cwd}
|
|
|
284
287
|
"config-keys: the basalt config block sets only keys basalt-ui reads",
|
|
285
288
|
unknownConfigKeysCheck(cwd)
|
|
286
289
|
]
|
|
287
|
-
];
|
|
288
|
-
for (const [ok, check] of upgrade) {
|
|
289
|
-
if (check === null) pass(ok);
|
|
290
|
-
else if ("fail" in check) fail(check.fail);
|
|
291
|
-
else skip(check.skip);
|
|
292
|
-
}
|
|
290
|
+
]);
|
|
293
291
|
for (const line of startWiringWarnings(appDir)) warn(line);
|
|
294
292
|
}
|
|
295
293
|
lines.push("");
|
package/dist/cli/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,CAAC,CA+B1F,CAAA;AAED;yCACyC;AACzC,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAWhF;AAED,0GAA0G;AAC1G,eAAO,MAAM,KAAK,QAkC0E,CAAA"}
|
package/dist/cli/help.js
CHANGED
|
@@ -27,8 +27,7 @@ const COMMAND_OPTIONS = {
|
|
|
27
27
|
"light-value": { type: "string" },
|
|
28
28
|
"default-scheme": { type: "string" },
|
|
29
29
|
"media-fallback": { type: "boolean" },
|
|
30
|
-
only: { type: "string" }
|
|
31
|
-
"no-legacy-aliases": { type: "boolean" }
|
|
30
|
+
only: { type: "string" }
|
|
32
31
|
},
|
|
33
32
|
"fonts:css": { out: { type: "string" }, check: { type: "boolean" } }
|
|
34
33
|
};
|
|
@@ -44,7 +43,7 @@ function unknownFlag(cmd, flags) {
|
|
|
44
43
|
return match?.[1] ?? flags.find((f) => f.startsWith("-")) ?? flags[0] ?? null;
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
|
-
const USAGE = "Usage: basalt-ui <--version | init [--no-merge-lint] |\n sync [--force] [--check] [--verbose] [--tokens-only|--framework] |\n check-theme [--audit-allows] |\n doctor [--tokens-only|--framework] | guard-hook | tokens:css | fonts:css | help>\n\ncheck-theme [--tokens-only|--framework] [--audit-allows]\n --audit-allows reports instead of scanning: every `theme-allow` annotation and every\n `basalt.exemptRules` entry, with what each one still suppresses \u2014 proved by re-running the\n guard with that one waiver neutralized, not by reading its text. Exits 1 on a waiver that\n suppresses nothing (dead), which is what makes it usable as a CI gate.\n\ntokens:css [--out <path>] [--check] [--selector-attribute <attr> | --selector-class <class>]\n [--light-class <class>] [--dark-value <v>] [--light-value <v>]\n [--default-scheme <dark|light|none>] [--media-fallback] [--only <core|all>]\n
|
|
46
|
+
const USAGE = "Usage: basalt-ui <--version | init [--no-merge-lint] |\n sync [--force] [--check] [--verbose] [--tokens-only|--framework] |\n check-theme [--audit-allows] |\n doctor [--tokens-only|--framework] | guard-hook | tokens:css | fonts:css | help>\n\ncheck-theme [--tokens-only|--framework] [--audit-allows]\n --audit-allows reports instead of scanning: every `theme-allow` annotation and every\n `basalt.exemptRules` entry, with what each one still suppresses \u2014 proved by re-running the\n guard with that one waiver neutralized, not by reading its text. Exits 1 on a waiver that\n suppresses nothing (dead), which is what makes it usable as a CI gate.\n\ntokens:css [--out <path>] [--check] [--selector-attribute <attr> | --selector-class <class>]\n [--light-class <class>] [--dark-value <v>] [--light-value <v>]\n [--default-scheme <dark|light|none>] [--media-fallback] [--only <core|all>]\n Emit the --vx-* stylesheet (stdout unless --out). Defaults emit the stock identity; commit the output as your tokens file.\n --selector-class emits `:root.dark` instead of an attribute selector (the Tailwind convention).\n --check writes nothing and exits 1 when --out differs from what would be emitted (a CI gate).\n\nfonts:css [--out <path>] [--check]\n Emit the shipped --basalt-font-* stacks as plain CSS \u2014 the typeface half of the token layer,\n otherwise reachable only by importing styles.css.\n\ndoctor [--tokens-only|--framework]\n Checks THIS project only: the manifest exists, the oxlint preset is wired, the pre-commit\n hook runs check-theme (via `lefthook dump`), and the ai package major is consistent within\n this package.json. Profile is DECLARED, same as check-theme \u2014 never inferred.\n\nsync [--force] [--check] [--verbose] [--tokens-only|--framework]\n Refreshes an EXISTING install; it never creates one (that is init). A tokens-only consumer\n has no scaffold to reconcile, so sync reports n/a and exits 0 there \u2014 as doctor does.\n --check prints the permanent placement skips as a COUNT; --verbose spells them out again.\n\ncheck-theme / doctor / sync all resolve their project the same way: BASALT_CWD, else the\ninvocation cwd \u2014 nothing inferred, nothing ascended or descended into.\n--tokens-only and --framework are alternatives; passing both is an error.\n\nEvery subcommand accepts --help / -h to print this message and exit without running.\n--version / -v prints the resolved package version and exits 0 \u2014 the one command that proves\nWHICH basalt-ui ran, which a `bunx` cache can otherwise make a lie. An unknown command or an\nunrecognized flag exits 1 and names what it did not understand; neither is ever ignored.";
|
|
48
47
|
export {
|
|
49
48
|
COMMAND_OPTIONS,
|
|
50
49
|
USAGE,
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { doctor } from './doctor.js';
|
|
|
5
5
|
import { guardHook } from './guard-hook.js';
|
|
6
6
|
import { init } from './init.js';
|
|
7
7
|
import { sync } from './sync.js';
|
|
8
|
+
import type { RouterSeedSkip } from './router-wiring.js';
|
|
8
9
|
import { fontsCss, normalizeColorFunctions, tokensCss } from './tokens-css.js';
|
|
9
10
|
import type { BasaltConfig } from './config.js';
|
|
10
11
|
export declare function resolveGuardConfig(cfg: BasaltConfig, profile: DoctorProfile): GuardConfig;
|
|
@@ -161,9 +162,6 @@ export declare const AGENTS_MD = "AGENTS.md";
|
|
|
161
162
|
/** A `CLAUDE.md` shadows {@link AGENTS_MD} unless it imports it — `doctor` warns on one. */
|
|
162
163
|
export declare const LEGACY_BLOCK_HOST = "CLAUDE.md";
|
|
163
164
|
export declare function sha256(text: string): string;
|
|
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;
|
|
167
165
|
/** Read a shipped source asset from the package root; null if the sibling hasn't authored it yet. */
|
|
168
166
|
export declare function readSource(pkgRoot: string, source: string): string | null;
|
|
169
167
|
/** The framework's own published version, read from the package root package.json. */
|
|
@@ -213,9 +211,17 @@ export declare const ROUTER_SEED_DESTS: {
|
|
|
213
211
|
export declare function routerSeedDest(appRel: string, seed: keyof typeof ROUTER_SEED_DESTS): string;
|
|
214
212
|
/** The router seeds' dests for an app dir (`main.tsx`, `nav.tsx`, `__root.tsx`). */
|
|
215
213
|
export declare function routerSeedDests(appRel: string): string[];
|
|
216
|
-
/** A TanStack Start app owns its router, so its router seeds give way to an in-tree `<BasaltProvider>`. */
|
|
217
|
-
export declare function isStartApp(cwd: string, appRel: string): boolean;
|
|
218
214
|
export declare const START_APP_NOTE: string;
|
|
215
|
+
/**
|
|
216
|
+
* The router seeds an app does not get, for `init` and `sync`: why (`start` | `code-routed` | null)
|
|
217
|
+
* and which dests. A tokens-only consumer gets none of them either.
|
|
218
|
+
*/
|
|
219
|
+
export declare function routerSeedPlan(cwd: string, appRel: string, tokensOnly?: boolean): {
|
|
220
|
+
skip: RouterSeedSkip;
|
|
221
|
+
skipped: Set<string>;
|
|
222
|
+
};
|
|
223
|
+
/** The note `init` prints for a router-seed skip, or null when nothing was skipped. */
|
|
224
|
+
export declare function seedSkipNote(skip: RouterSeedSkip): string | null;
|
|
219
225
|
/** The app directory a command's app-scoped half targets: `rel` is '' when it is the install root. */
|
|
220
226
|
export type AppResolution = {
|
|
221
227
|
dir: string;
|
|
@@ -348,7 +354,8 @@ export declare function writeUnit(file: ManagedFile, cwd: string, desired: strin
|
|
|
348
354
|
* - missing : absent on disk → recreate.
|
|
349
355
|
* - current : on disk == desired → nothing to do.
|
|
350
356
|
* - unchanged: on disk matches a KNOWN-SHIPPED rendering (raw manifest hash, normalized manifest
|
|
351
|
-
* hash, or
|
|
357
|
+
* hash, or — with or without a manifest entry — normalized == normalized desired,
|
|
358
|
+
* the format-only difference a formatter pass leaves) → safe overwrite.
|
|
352
359
|
* - drifted : matches none of them (a real local edit) → skip unless --force.
|
|
353
360
|
*/
|
|
354
361
|
export declare function classify(state: UnitState, manifestHash: string | undefined): Classification;
|
|
@@ -463,6 +470,8 @@ export declare function isStringArray(value: unknown): value is string[];
|
|
|
463
470
|
* The `guard-hook` subcommand is async (reads stdin); all others are synchronous.
|
|
464
471
|
*/
|
|
465
472
|
export declare function run(argv: string[], cwd?: string): number | Promise<number>;
|
|
473
|
+
export { isStartApp } from './router-wiring.js';
|
|
474
|
+
export { readIfExists, readPackageJson } from './source-text.js';
|
|
466
475
|
export { RULE_NAMES, SKILL_NAMES };
|
|
467
476
|
export type { ManagedFile };
|
|
468
477
|
export { checkTheme, doctor, guardHook, init, sync, fontsCss, normalizeColorFunctions, tokensCss };
|