dslinter 0.1.5 → 0.2.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/CHANGELOG.md +112 -0
- package/README.md +54 -27
- package/bin/dslinter.mjs +26 -5
- package/bin/lib/config-hide-component.mjs +44 -0
- package/bin/lib/config-hide-component.test.mjs +33 -0
- package/bin/lib/constants.mjs +20 -0
- package/bin/lib/dev-banner.mjs +16 -51
- package/bin/lib/dev-banner.test.mjs +20 -18
- package/bin/lib/enrich-playgrounds-from-ts.mjs +201 -0
- package/bin/lib/enrich-playgrounds-from-ts.test.mjs +74 -0
- package/bin/lib/enrich-report-cli.mjs +14 -0
- package/bin/lib/env.mjs +20 -0
- package/bin/lib/infer-prop-types-from-ts.mjs +381 -0
- package/bin/lib/infer-prop-types-from-ts.test.mjs +174 -0
- package/bin/lib/parse-args.mjs +13 -1
- package/bin/lib/parse-args.test.mjs +7 -1
- package/bin/lib/paths.mjs +8 -0
- package/bin/lib/project-root.mjs +92 -24
- package/bin/lib/project-root.test.mjs +52 -0
- package/bin/lib/prompt.mjs +31 -0
- package/bin/lib/resolve-project.mjs +78 -0
- package/bin/lib/resolve-project.test.mjs +74 -0
- package/bin/lib/run-scanner.mjs +40 -6
- package/bin/lib/scaffold-config.mjs +163 -0
- package/bin/lib/scaffold-config.test.mjs +43 -0
- package/bin/lib/scan-host.mjs +44 -0
- package/bin/lib/scan-host.test.mjs +41 -0
- package/bin/lib/setup-readiness.mjs +153 -0
- package/bin/lib/setup-readiness.test.mjs +32 -0
- package/bin/modes/build.mjs +31 -6
- package/bin/modes/dev.mjs +56 -13
- package/bin/modes/init.mjs +35 -47
- package/bin/modes/init.test.mjs +16 -0
- package/bin/modes/mcp.mjs +49 -0
- package/bin/modes/report.mjs +29 -4
- package/bin/modes/watch.mjs +85 -0
- package/dashboard-dist/assets/DashboardLayoutAuto-Bja3BuZZ.css +1 -0
- package/dashboard-dist/assets/DashboardLayoutAuto-h0gP_iKd.js +1 -0
- package/dashboard-dist/assets/axe-DDaE9JTN.js +20 -0
- package/dashboard-dist/assets/index-B9sZ6wHm.css +1 -0
- package/dashboard-dist/assets/index-DIDBt5ed.js +218 -0
- package/dashboard-dist/index.html +2 -2
- package/index.cjs +53 -52
- package/index.d.ts +3 -0
- package/package.json +18 -12
- package/shared/env.ts +15 -0
- package/shared/paths.ts +8 -0
- package/shared/reportPath.test.ts +19 -0
- package/shared/reportPath.ts +12 -0
- package/shared/servePort.ts +16 -0
- package/src/components/ComponentInspectPane.tsx +67 -19
- package/src/components/ComponentPlaygroundPane.tsx +262 -113
- package/src/components/DashboardCommandPalette.tsx +6 -11
- package/src/components/GovernancePane.tsx +2 -2
- package/src/components/HideFromCatalogButton.tsx +44 -0
- package/src/components/OpenInEditorButton.tsx +36 -0
- package/src/components/PlaygroundA11yAndCode.tsx +53 -53
- package/src/components/PlaygroundAppThemeWrapper.tsx +82 -0
- package/src/components/PlaygroundControls.tsx +5 -11
- package/src/components/PlaygroundPreviewErrorBoundary.tsx +54 -0
- package/src/components/PlaygroundUsageCode.tsx +6 -4
- package/src/components/PlaygroundVariantMatrix.tsx +101 -34
- package/src/components/Section.tsx +5 -2
- package/src/components/Sidebar.tsx +131 -46
- package/src/components/TruncatedPath.tsx +44 -0
- package/src/components/controlApiTable.test.ts +29 -0
- package/src/components/controlApiTable.ts +3 -0
- package/src/components/playgroundUsageHighlight.ts +14 -3
- package/src/components/ui/badge.tsx +1 -1
- package/src/components/ui/table.tsx +2 -2
- package/src/dashboard/ComponentCatalog.tsx +16 -23
- package/src/dashboard/ComponentUsageDetails.tsx +6 -15
- package/src/dashboard/DashboardBody.tsx +0 -35
- package/src/dashboard/FindingsList.tsx +65 -55
- package/src/dashboard/ScannedTokenWall.tsx +3 -3
- package/src/dashboard/aggregate.test.ts +74 -0
- package/src/dashboard/aggregate.ts +145 -21
- package/src/dashboard/catalogVisibility.test.ts +93 -0
- package/src/dashboard/catalogVisibility.ts +108 -0
- package/src/dashboard/editorLink.test.ts +57 -0
- package/src/dashboard/editorLink.ts +71 -0
- package/src/dashboard/paths.test.ts +49 -0
- package/src/dashboard/paths.ts +51 -3
- package/src/dashboard/updateDslintConfig.ts +22 -0
- package/src/dashboard/useWorkspaceReport.ts +21 -17
- package/src/index.ts +26 -0
- package/src/mcp/agent-context.ts +148 -0
- package/src/mcp/agent-query.test.ts +89 -0
- package/src/mcp/agent-query.ts +373 -0
- package/src/mcp/config.ts +53 -0
- package/src/mcp/index.ts +18 -0
- package/src/mcp/normalize-paths.ts +65 -0
- package/src/mcp/report-cache.ts +209 -0
- package/src/mcp/rule-catalog.json +156 -0
- package/src/mcp/rule-catalog.ts +33 -0
- package/src/mcp/schemas.ts +54 -0
- package/src/mcp/server.test.ts +44 -0
- package/src/mcp/server.ts +343 -0
- package/src/mcp/start.ts +29 -0
- package/src/mcp/verify-loop.test.ts +49 -0
- package/src/mcp/verify-loop.ts +149 -0
- package/src/playground/appPreviewTheme.test.ts +148 -0
- package/src/playground/appPreviewTheme.ts +137 -0
- package/src/playground/buildCompoundPlaygroundEntries.test.ts +348 -0
- package/src/playground/buildCompoundPlaygroundEntries.ts +625 -0
- package/src/playground/buildPlaygroundEntriesFromReport.test.ts +420 -6
- package/src/playground/buildPlaygroundEntriesFromReport.ts +206 -285
- package/src/playground/catalogIdFromPlaygroundExport.test.ts +15 -0
- package/src/playground/catalogIdFromPlaygroundExport.ts +8 -0
- package/src/playground/collectDefinedPlaygrounds.test.ts +59 -0
- package/src/playground/collectDefinedPlaygrounds.ts +68 -0
- package/src/playground/controls.ts +177 -0
- package/src/playground/createPlaygroundRegistry.ts +1 -1
- package/src/playground/definePlayground.tsx +88 -16
- package/src/playground/definePlaygroundFromKit.ts +17 -0
- package/src/playground/embedGlobKey.ts +8 -0
- package/src/playground/enrichKitControls.test.ts +25 -0
- package/src/playground/enrichKitControls.ts +197 -0
- package/src/playground/expandPlaygroundControls.test.ts +50 -0
- package/src/playground/expandPlaygroundControls.ts +97 -0
- package/src/playground/inferKitJsx.test.ts +77 -0
- package/src/playground/inferKitJsx.ts +165 -0
- package/src/playground/inferKitParams.test.ts +41 -0
- package/src/playground/inferKitParams.ts +113 -0
- package/src/playground/inferPropTypesFromTs.d.mts +47 -0
- package/src/playground/inferPropTypesFromTs.mjs +343 -0
- package/src/playground/inferPropTypesFromTs.test.ts +227 -0
- package/src/playground/inferPropTypesFromTs.ts +17 -0
- package/src/playground/mergePlaygroundEntries.test.ts +32 -0
- package/src/playground/mergePlaygroundEntries.ts +28 -0
- package/src/playground/playgroundJoin.test.ts +79 -19
- package/src/playground/playgroundJoin.ts +47 -22
- package/src/playground/playgroundModuleExport.test.ts +42 -0
- package/src/playground/playgroundModuleExport.ts +22 -0
- package/src/playground/playgroundSpecsKey.ts +8 -0
- package/src/playground/propCoerce.ts +91 -0
- package/src/playground/scanVariantA11y.test.ts +46 -0
- package/src/playground/scanVariantA11y.ts +107 -0
- package/src/playground/snippet.ts +83 -0
- package/src/playground/usePlaygroundFromReport.test.ts +18 -8
- package/src/playground/usePlaygroundFromReport.ts +3 -1
- package/src/report/a11yForModule.ts +2 -7
- package/src/report/a11yScoring.test.ts +24 -0
- package/src/report/a11yScoring.ts +17 -0
- package/src/report/index.ts +6 -0
- package/src/shell/DashboardLayout.tsx +71 -45
- package/src/shell/DashboardLayoutAuto.tsx +0 -4
- package/src/shell/hashRoute.test.ts +7 -15
- package/src/shell/hashRoute.ts +31 -31
- package/src/shell/useHashRoute.ts +38 -13
- package/src/styles/dashboard-theme.css +18 -7
- package/src/types/controls.ts +11 -0
- package/src/types/playground.ts +4 -0
- package/src/types/report.ts +32 -9
- package/templates/playground/buildRegistry.ts +1 -1
- package/templates/vite.dslinter.snippet.ts +15 -4
- package/vite/collectScanModules.test.ts +51 -3
- package/vite/collectScanModules.ts +85 -29
- package/vite/consumer.config.mjs +6 -3
- package/vite/consumerAlias.test.ts +47 -0
- package/vite/consumerAlias.ts +114 -0
- package/vite/embedTailwindSources.test.ts +74 -0
- package/vite/embedTailwindSources.ts +97 -0
- package/vite/loadConsumerAliases.test.ts +131 -0
- package/vite/loadConsumerAliases.ts +155 -0
- package/vite/openFileInEditor.mjs +196 -0
- package/vite/openFileInEditor.test.mjs +87 -0
- package/vite/plugin.resolve.test.ts +72 -0
- package/vite/plugin.ts +216 -19
- package/vite/reportPath.test.ts +19 -0
- package/vite/resolveWayfinderImport.ts +56 -0
- package/vite/shims/inertia-react.tsx +85 -0
- package/vite/shims/wayfinder-actions.ts +33 -0
- package/vite/shims/wayfinder-routes.ts +30 -0
- package/vite/shims/ziggy-js.ts +12 -0
- package/dashboard-dist/assets/DashboardLayoutAuto-BPPtPsYh.css +0 -1
- package/dashboard-dist/assets/DashboardLayoutAuto-Dp3bAQxH.js +0 -1
- package/dashboard-dist/assets/index-DsjwnDdX.js +0 -206
- package/dashboard-dist/assets/index-jaCmZJlW.css +0 -1
- package/src/components/playgroundUsageTwoslash.ts +0 -69
- package/templates/vite.dslint-scan-alias.snippet.ts +0 -4
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>DSLinter</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DIDBt5ed.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B9sZ6wHm.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body class="bg-background antialiased">
|
|
11
11
|
<div id="root"></div>
|
package/index.cjs
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@dslinter/binding-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@dslinter/binding-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
80
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@dslinter/binding-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@dslinter/binding-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
96
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@dslinter/binding-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@dslinter/binding-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
117
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@dslinter/binding-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@dslinter/binding-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
133
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@dslinter/binding-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@dslinter/binding-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
150
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@dslinter/binding-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@dslinter/binding-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
166
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@dslinter/binding-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@dslinter/binding-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
185
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@dslinter/binding-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@dslinter/binding-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
201
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@dslinter/binding-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@dslinter/binding-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
217
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@dslinter/binding-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@dslinter/binding-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
237
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@dslinter/binding-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@dslinter/binding-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
253
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@dslinter/binding-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@dslinter/binding-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
274
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@dslinter/binding-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@dslinter/binding-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
290
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@dslinter/binding-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@dslinter/binding-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
308
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@dslinter/binding-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@dslinter/binding-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
324
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@dslinter/binding-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@dslinter/binding-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
342
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@dslinter/binding-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@dslinter/binding-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
358
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@dslinter/binding-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@dslinter/binding-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
376
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@dslinter/binding-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@dslinter/binding-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
392
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@dslinter/binding-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@dslinter/binding-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
410
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@dslinter/binding-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@dslinter/binding-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
426
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@dslinter/binding-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@dslinter/binding-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
443
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@dslinter/binding-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@dslinter/binding-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
459
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@dslinter/binding-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@dslinter/binding-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
479
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@dslinter/binding-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@dslinter/binding-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
495
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@dslinter/binding-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@dslinter/binding-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
511
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -577,3 +577,4 @@ if (!nativeBinding) {
|
|
|
577
577
|
|
|
578
578
|
module.exports = nativeBinding
|
|
579
579
|
module.exports.runCli = nativeBinding.runCli
|
|
580
|
+
module.exports.scanWorkspaceJson = nativeBinding.scanWorkspaceJson
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export declare function runCli(args: Array<string>): number
|
|
4
|
+
|
|
5
|
+
/** Scan a workspace and return the full report as a JSON string (for MCP / programmatic use). */
|
|
6
|
+
export declare function scanWorkspaceJson(root: string, parallel?: boolean | undefined | null): string
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dslinter",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "DSLinter dashboard UI: playground shell, token wall, and governance panels (consumes
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "DSLinter dashboard UI: playground shell, token wall, and governance panels (consumes dslinter-report.json).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
@@ -65,6 +65,10 @@
|
|
|
65
65
|
"./playground-modules": {
|
|
66
66
|
"types": "./src/playground/scanPlaygroundModules.ts",
|
|
67
67
|
"default": "./src/playground/scanPlaygroundModules.ts"
|
|
68
|
+
},
|
|
69
|
+
"./mcp": {
|
|
70
|
+
"types": "./src/mcp/start.ts",
|
|
71
|
+
"default": "./src/mcp/start.ts"
|
|
68
72
|
}
|
|
69
73
|
},
|
|
70
74
|
"types": "./src/index.ts",
|
|
@@ -74,6 +78,7 @@
|
|
|
74
78
|
"index.cjs",
|
|
75
79
|
"index.d.ts",
|
|
76
80
|
"src",
|
|
81
|
+
"shared",
|
|
77
82
|
"vite",
|
|
78
83
|
"templates",
|
|
79
84
|
"components.json",
|
|
@@ -82,14 +87,14 @@
|
|
|
82
87
|
"CHANGELOG.md"
|
|
83
88
|
],
|
|
84
89
|
"dependencies": {
|
|
90
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
85
91
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
86
92
|
"@radix-ui/react-label": "^2.1.8",
|
|
87
93
|
"@radix-ui/react-select": "^2.2.6",
|
|
88
94
|
"@radix-ui/react-slot": "^1.2.4",
|
|
89
95
|
"@shikijs/langs": "^4.0.2",
|
|
90
96
|
"@shikijs/themes": "^4.0.2",
|
|
91
|
-
"
|
|
92
|
-
"@shikijs/types": "^4.0.2",
|
|
97
|
+
"axe-core": "^4.11.4",
|
|
93
98
|
"class-variance-authority": "^0.7.1",
|
|
94
99
|
"clsx": "^2.1.1",
|
|
95
100
|
"cmdk": "^1.1.1",
|
|
@@ -97,9 +102,11 @@
|
|
|
97
102
|
"shadcn": "^4.7.0",
|
|
98
103
|
"shiki": "^4.0.2",
|
|
99
104
|
"tailwind-merge": "^3.6.0",
|
|
105
|
+
"tsx": "^4.22.4",
|
|
100
106
|
"tw-animate-css": "^1.4.0",
|
|
101
|
-
"
|
|
102
|
-
"usemods": "^1.16.0"
|
|
107
|
+
"typescript": "~6.0.3",
|
|
108
|
+
"usemods": "^1.16.0",
|
|
109
|
+
"zod": "^4.4.3"
|
|
103
110
|
},
|
|
104
111
|
"peerDependencies": {
|
|
105
112
|
"react": "^19.0.0",
|
|
@@ -113,16 +120,15 @@
|
|
|
113
120
|
"react": "^19.2.6",
|
|
114
121
|
"react-dom": "^19.2.6",
|
|
115
122
|
"tailwindcss": "^4.1.0",
|
|
116
|
-
"typescript": "~6.0.3",
|
|
117
123
|
"vite": "^7.3.3",
|
|
118
124
|
"vitest": "^3.2.4"
|
|
119
125
|
},
|
|
120
126
|
"optionalDependencies": {
|
|
121
|
-
"@dslinter/binding-darwin-arm64": "0.
|
|
122
|
-
"@dslinter/binding-darwin-x64": "0.
|
|
123
|
-
"@dslinter/binding-linux-arm64-gnu": "0.
|
|
124
|
-
"@dslinter/binding-linux-x64-gnu": "0.
|
|
125
|
-
"@dslinter/binding-win32-x64-msvc": "0.
|
|
127
|
+
"@dslinter/binding-darwin-arm64": "0.2.0",
|
|
128
|
+
"@dslinter/binding-darwin-x64": "0.2.0",
|
|
129
|
+
"@dslinter/binding-linux-arm64-gnu": "0.2.0",
|
|
130
|
+
"@dslinter/binding-linux-x64-gnu": "0.2.0",
|
|
131
|
+
"@dslinter/binding-win32-x64-msvc": "0.2.0"
|
|
126
132
|
},
|
|
127
133
|
"scripts": {
|
|
128
134
|
"build:napi": "napi build --platform --release --cwd ../.. --output-dir packages/dashboard --package-json-path packages/dashboard/package.json --js-package-name @dslinter/binding --js index.cjs --no-default-features --features napi",
|
package/shared/env.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Read `DSLINTER_*` environment variables. */
|
|
2
|
+
export function readEnv(
|
|
3
|
+
name: string,
|
|
4
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
5
|
+
): string | undefined {
|
|
6
|
+
return env[`DSLINTER_${name}`]?.trim() || undefined;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function envIs(
|
|
10
|
+
name: string,
|
|
11
|
+
value = "1",
|
|
12
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
13
|
+
): boolean {
|
|
14
|
+
return readEnv(name, env) === value;
|
|
15
|
+
}
|
package/shared/paths.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const REPORT_FILE_NAME = "dslinter-report.json";
|
|
2
|
+
export const REPORT_URL_PATH = "/dslinter-report.json";
|
|
3
|
+
|
|
4
|
+
export const CONFIG_FILE_NAMES = [".dslinter.json", "dslinter.json"] as const;
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_CONFIG_FILE_NAME = ".dslinter.json";
|
|
7
|
+
|
|
8
|
+
export const IGNORE_FILE_NAME = ".dslinterignore";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { resolveReportFilePath } from "./reportPath";
|
|
4
|
+
|
|
5
|
+
describe("resolveReportFilePath", () => {
|
|
6
|
+
it("defaults to public/dslinter-report.json under scan root", () => {
|
|
7
|
+
const root = "/app/demo-inertia";
|
|
8
|
+
expect(resolveReportFilePath(root, {})).toBe(
|
|
9
|
+
resolve(root, "public", "dslinter-report.json"),
|
|
10
|
+
);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("uses DSLINTER_REPORT_PATH when set", () => {
|
|
14
|
+
const custom = join("/tmp", "custom-report.json");
|
|
15
|
+
expect(
|
|
16
|
+
resolveReportFilePath("/app", { DSLINTER_REPORT_PATH: custom }),
|
|
17
|
+
).toBe(resolve(custom));
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { REPORT_FILE_NAME } from "./paths";
|
|
3
|
+
|
|
4
|
+
/** Resolve on-disk report path for embed/consumer dev servers. */
|
|
5
|
+
export function resolveReportFilePath(
|
|
6
|
+
scanRoot: string,
|
|
7
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
8
|
+
): string {
|
|
9
|
+
const fromEnv = env.DSLINTER_REPORT_PATH?.trim();
|
|
10
|
+
if (fromEnv) return resolve(fromEnv);
|
|
11
|
+
return resolve(scanRoot, "public", REPORT_FILE_NAME);
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { readEnv } from "./env";
|
|
2
|
+
|
|
3
|
+
/** Default scanner HTTP port when `DSLINTER_SERVE_PORT` is unset. */
|
|
4
|
+
export const DEFAULT_SERVE_PORT = 7878;
|
|
5
|
+
|
|
6
|
+
/** Resolve scanner HTTP port from `DSLINTER_SERVE_PORT` or {@link DEFAULT_SERVE_PORT}. */
|
|
7
|
+
export function resolveServePort(
|
|
8
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
9
|
+
): number {
|
|
10
|
+
const fromEnv = readEnv("SERVE_PORT", env);
|
|
11
|
+
if (fromEnv) {
|
|
12
|
+
const n = Number.parseInt(fromEnv, 10);
|
|
13
|
+
if (Number.isFinite(n) && n > 0 && n <= 65535) return n;
|
|
14
|
+
}
|
|
15
|
+
return DEFAULT_SERVE_PORT;
|
|
16
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import { Button } from "./ui/button";
|
|
3
2
|
import {
|
|
4
3
|
Table,
|
|
5
4
|
TableBody,
|
|
@@ -11,6 +10,7 @@ import {
|
|
|
11
10
|
import {
|
|
12
11
|
aggregateDeclaredProps,
|
|
13
12
|
aggregateDefinitions,
|
|
13
|
+
componentCatalogFamilyForName,
|
|
14
14
|
} from "../dashboard/aggregate";
|
|
15
15
|
import {
|
|
16
16
|
buildUnusedPropSetForComponent,
|
|
@@ -23,7 +23,9 @@ import { findingsForComponent } from "../report/findingsForComponent";
|
|
|
23
23
|
import type { WorkspaceReport } from "../types/report";
|
|
24
24
|
import type { PlaygroundJoinSkip } from "../playground/playgroundJoin";
|
|
25
25
|
import { findPlaygroundSpec } from "../playground/playgroundJoin";
|
|
26
|
+
import { HideFromCatalogButton } from "./HideFromCatalogButton";
|
|
26
27
|
import { Section } from "./Section";
|
|
28
|
+
import { TruncatedPath } from "./TruncatedPath";
|
|
27
29
|
|
|
28
30
|
type Props = {
|
|
29
31
|
componentId: string;
|
|
@@ -33,6 +35,8 @@ type Props = {
|
|
|
33
35
|
/** When the report row exists but Vite could not load the module/export. */
|
|
34
36
|
playgroundJoinSkip?: PlaygroundJoinSkip;
|
|
35
37
|
onBackToGovernance: () => void;
|
|
38
|
+
onOpenComponent: (componentId: string) => void;
|
|
39
|
+
onHideFromCatalog?: (componentId: string) => void;
|
|
36
40
|
};
|
|
37
41
|
|
|
38
42
|
export function ComponentInspectPane({
|
|
@@ -41,7 +45,8 @@ export function ComponentInspectPane({
|
|
|
41
45
|
reportReady,
|
|
42
46
|
hasPlaygroundSpec,
|
|
43
47
|
playgroundJoinSkip,
|
|
44
|
-
|
|
48
|
+
onOpenComponent,
|
|
49
|
+
onHideFromCatalog,
|
|
45
50
|
}: Props) {
|
|
46
51
|
const playgroundSpec = findPlaygroundSpec(workspaceReport, componentId);
|
|
47
52
|
const definitions = useMemo(() => {
|
|
@@ -67,22 +72,36 @@ export function ComponentInspectPane({
|
|
|
67
72
|
() => findingsForComponent(workspaceReport, componentId),
|
|
68
73
|
[workspaceReport, componentId],
|
|
69
74
|
);
|
|
75
|
+
const family = useMemo(
|
|
76
|
+
() => componentCatalogFamilyForName(workspaceReport, componentId),
|
|
77
|
+
[workspaceReport, componentId],
|
|
78
|
+
);
|
|
79
|
+
const childComponents = family?.parent === componentId ? family.children : [];
|
|
70
80
|
|
|
71
81
|
const previewNote = hasPlaygroundSpec
|
|
72
82
|
? "A preview was expected for this component but the module could not be loaded in the dashboard bundle (check the file path, export name, or that npx dslinter was run from the project root)."
|
|
73
|
-
: "No playable component definition was found
|
|
83
|
+
: "No playable component definition was found";
|
|
74
84
|
|
|
75
85
|
const joinDetail = (() => {
|
|
76
86
|
if (playgroundJoinSkip?.reason === "module_not_found") {
|
|
77
87
|
const { globKey, rel_path } = playgroundJoinSkip;
|
|
78
|
-
|
|
88
|
+
const subdirHint = !rel_path.includes("/")
|
|
89
|
+
? " This usually means the scanner was run from a subdirectory. Re-run from the project root: npx dslinter ."
|
|
90
|
+
: "";
|
|
91
|
+
if (globKey.startsWith("@dslinter-scan/")) {
|
|
79
92
|
return [
|
|
80
93
|
`Expected module key "${globKey}" but the dslinter Vite plugin did not load it.`,
|
|
81
94
|
`Use <DashboardLayout autoPlayground /> and run via npx dslinter (zero vite.config changes), or add plugins: [dslinter()] from dslinter/vite to vite.config.ts.`,
|
|
82
|
-
`Run the scanner from the project root so rel_path "${rel_path}" matches files under
|
|
95
|
+
`Run the scanner from the project root so rel_path "${rel_path}" matches files under DSLINTER_SCAN_ROOT.`,
|
|
83
96
|
].join(" ");
|
|
84
97
|
}
|
|
85
|
-
return
|
|
98
|
+
return [
|
|
99
|
+
`Vite glob is missing key "${globKey}" for report path "${rel_path}".`,
|
|
100
|
+
`Prefer <DashboardLayout autoPlayground /> with plugins: [dslinter()] from dslinter/vite, or run npx dslinter init for a custom buildRegistry.ts glob.`,
|
|
101
|
+
subdirHint,
|
|
102
|
+
]
|
|
103
|
+
.filter(Boolean)
|
|
104
|
+
.join("");
|
|
86
105
|
}
|
|
87
106
|
if (playgroundJoinSkip?.reason === "export_not_found") {
|
|
88
107
|
return `Module loaded but named export "${playgroundJoinSkip.export_name}" was not found. Use export function ${playgroundJoinSkip.export_name}(…) in ${playgroundJoinSkip.rel_path}.`;
|
|
@@ -106,7 +125,7 @@ export function ComponentInspectPane({
|
|
|
106
125
|
{componentId}
|
|
107
126
|
</h1>
|
|
108
127
|
<p className="mt-2 max-w-2xl text-sm text-muted-foreground">
|
|
109
|
-
|
|
128
|
+
{previewNote}
|
|
110
129
|
</p>
|
|
111
130
|
{joinDetail ? (
|
|
112
131
|
<p className="mt-2 max-w-2xl font-mono text-xs text-muted-foreground">
|
|
@@ -114,9 +133,14 @@ export function ComponentInspectPane({
|
|
|
114
133
|
</p>
|
|
115
134
|
) : null}
|
|
116
135
|
</div>
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
136
|
+
<div className="flex shrink-0 flex-wrap items-center gap-2">
|
|
137
|
+
{onHideFromCatalog ? (
|
|
138
|
+
<HideFromCatalogButton
|
|
139
|
+
componentName={componentId}
|
|
140
|
+
onHidden={onHideFromCatalog}
|
|
141
|
+
/>
|
|
142
|
+
) : null}
|
|
143
|
+
</div>
|
|
120
144
|
</div>
|
|
121
145
|
</header>
|
|
122
146
|
|
|
@@ -137,13 +161,16 @@ export function ComponentInspectPane({
|
|
|
137
161
|
</TableHeader>
|
|
138
162
|
<TableBody>
|
|
139
163
|
{definitions.map((site) => (
|
|
140
|
-
<TableRow
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
164
|
+
<TableRow key={`${site.path}:${site.line}:${site.kind}`}>
|
|
165
|
+
<TableCell className="min-w-0 font-mono text-xs">
|
|
166
|
+
<TruncatedPath
|
|
167
|
+
path={
|
|
168
|
+
workspaceReport
|
|
169
|
+
? shortPath(workspaceReport.root, site.path)
|
|
170
|
+
: site.path
|
|
171
|
+
}
|
|
172
|
+
className="text-xs"
|
|
173
|
+
/>
|
|
147
174
|
</TableCell>
|
|
148
175
|
<TableCell>{site.line}</TableCell>
|
|
149
176
|
<TableCell className="text-muted-foreground">
|
|
@@ -155,12 +182,33 @@ export function ComponentInspectPane({
|
|
|
155
182
|
</Table>
|
|
156
183
|
) : (
|
|
157
184
|
<p className="text-sm text-muted-foreground">
|
|
158
|
-
No definition sites recorded — this name may appear only from
|
|
159
|
-
usage.
|
|
185
|
+
No definition sites recorded — this name may appear only from
|
|
186
|
+
JSX usage.
|
|
160
187
|
</p>
|
|
161
188
|
)}
|
|
162
189
|
</Section>
|
|
163
190
|
|
|
191
|
+
{childComponents.length > 0 ? (
|
|
192
|
+
<Section
|
|
193
|
+
id="subcomponents"
|
|
194
|
+
title="Subcomponents"
|
|
195
|
+
description="Related exports detected in the same compound component module."
|
|
196
|
+
>
|
|
197
|
+
<div className="grid gap-2 sm:grid-cols-2">
|
|
198
|
+
{childComponents.map((child) => (
|
|
199
|
+
<button
|
|
200
|
+
key={child}
|
|
201
|
+
type="button"
|
|
202
|
+
onClick={() => onOpenComponent(child)}
|
|
203
|
+
className="rounded-md border border-border bg-card px-3 py-2 text-left text-sm font-medium text-foreground transition hover:bg-accent hover:text-accent-foreground"
|
|
204
|
+
>
|
|
205
|
+
{child}
|
|
206
|
+
</button>
|
|
207
|
+
))}
|
|
208
|
+
</div>
|
|
209
|
+
</Section>
|
|
210
|
+
) : null}
|
|
211
|
+
|
|
164
212
|
<Section
|
|
165
213
|
id="props"
|
|
166
214
|
title="Props"
|