dslinter 0.1.2 β 0.1.4
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 +14 -0
- package/README.md +14 -2
- package/bin/dslinter.mjs +1 -1
- package/bin/modes/init.mjs +35 -7
- package/dashboard-dist/assets/{index-BN-Qjczl.js β index-DGUG_3SK.js} +23 -23
- package/dashboard-dist/index.html +1 -1
- package/index.cjs +52 -52
- package/package.json +6 -6
- package/src/components/ComponentInspectPane.tsx +26 -10
- package/src/components/DashboardCommandPalette.tsx +1 -1
- package/src/components/PlaygroundA11yAndCode.tsx +3 -3
- package/src/components/PlaygroundControlField.tsx +4 -4
- package/src/components/PlaygroundControls.tsx +1 -1
- package/src/components/PlaygroundVariantMatrix.tsx +1 -1
- package/src/components/Sidebar.tsx +2 -2
- package/src/dashboard/ComponentCatalog.tsx +2 -2
- package/src/dashboard/ComponentUsageDetails.tsx +2 -2
- package/src/dashboard/DashboardBody.tsx +1 -1
- package/src/dashboard/FindingsList.tsx +3 -3
- package/src/dashboard/ScannedTokenWall.tsx +1 -1
- package/src/dashboard/mergeTokenCatalog.ts +1 -1
- package/src/index.ts +1 -0
- package/src/playground/buildPlaygroundEntriesFromReport.ts +1 -0
- package/src/playground/createPlaygroundRegistry.ts +16 -3
- package/src/playground/playgroundJoin.test.ts +8 -0
- package/src/playground/playgroundJoin.ts +33 -4
- package/src/shell/DashboardLayout.tsx +1 -1
- package/templates/playground/buildRegistry.laravel.ts +26 -0
- package/templates/vite.dslint-scan-alias.snippet.ts +14 -0
- package/templates/vite.dslinter.snippet.ts +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.1.4
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/jrmybtlr/DSLinter/compare/v0.1.3...v0.1.4)
|
|
6
|
+
|
|
7
|
+
## Unreleased
|
|
8
|
+
|
|
9
|
+
### π©Ή Fixes
|
|
10
|
+
|
|
11
|
+
- Remove `@/` path aliases from published `src/` so host apps with their own `@/*` Vite alias (Laravel/Inertia, etc.) no longer resolve dslinter UI imports to the wrong tree. Consumers need only the official vite snippet (proxy, react dedupe, `optimizeDeps.exclude`).
|
|
12
|
+
|
|
13
|
+
## v0.1.3
|
|
14
|
+
|
|
15
|
+
[compare changes](https://github.com/jrmybtlr/DSLinter/compare/v0.1.2...v0.1.3)
|
|
16
|
+
|
|
3
17
|
## v0.1.2
|
|
4
18
|
|
|
5
19
|
[compare changes](https://github.com/jrmybtlr/DSLinter/compare/v0.1.1...v0.1.2)
|
package/README.md
CHANGED
|
@@ -55,7 +55,19 @@ npx dslinter --report --output public/dslint-report.json
|
|
|
55
55
|
npx dslinter --watch --output public/dslint-report.json
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
Set `DSLINT_SERVE_PORT` to override the default scanner port (`7878`). Your Vite config should proxy `/dslint-report.json` and `/events` to that port in `serve` mode (see repo `demo/vite.config.ts`
|
|
58
|
+
Set `DSLINT_SERVE_PORT` to override the default scanner port (`7878`). Your Vite config should proxy `/dslint-report.json` and `/events` to that port in `serve` mode. Merge `templates/vite.dslinter.snippet.ts` (copied by `npx dslinter init`) or see repo `demo/vite.config.ts` for a linked-workspace example.
|
|
59
|
+
|
|
60
|
+
### Consumer Vite (Laravel, Inertia, existing `@/*` aliases)
|
|
61
|
+
|
|
62
|
+
Published `dslinter` source uses **relative imports only** β no `@/components/...` paths inside `node_modules/dslinter/src`. Your app's `@/*` alias (for example Laravel `@/*` β `resources/js/*`) will not hijack dslinter's internal UI imports.
|
|
63
|
+
|
|
64
|
+
After `npx dslinter init --laravel`, merge only the official snippet into `vite.config.ts`:
|
|
65
|
+
|
|
66
|
+
- `resolve.dedupe`: `["react", "react-dom"]`
|
|
67
|
+
- `optimizeDeps.exclude`: `["dslinter"]` (source-first package; transpile from `node_modules`)
|
|
68
|
+
- `server.proxy` for `/dslint-report.json` and `/events` β `DSLINT_SERVE_PORT`
|
|
69
|
+
|
|
70
|
+
You do **not** need alias overrides such as `@/components` β `node_modules/dslinter/src/components`.
|
|
59
71
|
|
|
60
72
|
## Styles (Tailwind v4)
|
|
61
73
|
|
|
@@ -76,7 +88,7 @@ Set `DSLINT_SERVE_PORT` to override the default scanner port (`7878`). Your Vite
|
|
|
76
88
|
|
|
77
89
|
If the dashboard shows **βScan snapshot β no live previewβ** for a component that appears in the catalog, the scanner found the file but Vite did not load it. Wire previews in three steps:
|
|
78
90
|
|
|
79
|
-
1. **Scaffold** (optional): `npx dslinter init` β
|
|
91
|
+
1. **Scaffold** (optional): `npx dslinter init` β `src/playground/buildRegistry.ts`; for Inertia/Laravel (`resources/js/β¦`) use `npx dslinter init --laravel`
|
|
80
92
|
2. **Glob** must cover nested paths, e.g. `import.meta.glob("../components/**/*.{tsx,jsx}", { eager: true })`
|
|
81
93
|
3. **App**: pass `playgroundEntries` and `playgroundJoinSkips` from the registry into `DashboardLayout`
|
|
82
94
|
|
package/bin/dslinter.mjs
CHANGED
package/bin/modes/init.mjs
CHANGED
|
@@ -5,17 +5,38 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), "../..");
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @param {
|
|
8
|
+
* @param {string} targetDir
|
|
9
|
+
* @returns {"laravel" | "default"}
|
|
10
|
+
*/
|
|
11
|
+
function detectInitLayout(targetDir) {
|
|
12
|
+
if (existsSync(join(targetDir, "resources", "js"))) return "laravel";
|
|
13
|
+
return "default";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {{ targetDir?: string; layout?: "laravel" | "default"; argv?: string[] }} opts
|
|
9
18
|
*/
|
|
10
19
|
export function runInitMode(opts = {}) {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
20
|
+
const argv = opts.argv ?? [];
|
|
21
|
+
const forceLaravel = argv.includes("--laravel") || argv.includes("--resources-js");
|
|
22
|
+
const targetDir = resolve(
|
|
23
|
+
opts.targetDir ?? argv.find((a) => !a.startsWith("-")) ?? process.cwd(),
|
|
24
|
+
);
|
|
25
|
+
const layout =
|
|
26
|
+
opts.layout ?? (forceLaravel ? "laravel" : detectInitLayout(targetDir));
|
|
27
|
+
|
|
28
|
+
const registryDir =
|
|
29
|
+
layout === "laravel"
|
|
30
|
+
? join(targetDir, "resources", "js", "playground")
|
|
31
|
+
: join(targetDir, "src", "playground");
|
|
13
32
|
const registryPath = join(registryDir, "buildRegistry.ts");
|
|
33
|
+
const templateName =
|
|
34
|
+
layout === "laravel" ? "buildRegistry.laravel.ts" : "buildRegistry.ts";
|
|
14
35
|
const templatePath = join(
|
|
15
36
|
packageRoot,
|
|
16
37
|
"templates",
|
|
17
38
|
"playground",
|
|
18
|
-
|
|
39
|
+
templateName,
|
|
19
40
|
);
|
|
20
41
|
|
|
21
42
|
if (existsSync(registryPath)) {
|
|
@@ -46,7 +67,9 @@ export function runInitMode(opts = {}) {
|
|
|
46
67
|
"",
|
|
47
68
|
" import { useMemo } from 'react';",
|
|
48
69
|
" import { DashboardLayout, useWorkspaceReport } from 'dslinter';",
|
|
49
|
-
|
|
70
|
+
layout === "laravel"
|
|
71
|
+
? " import { buildPlaygroundEntries } from './playground/buildRegistry'; // adjust relative path from your entry file"
|
|
72
|
+
: " import { buildPlaygroundEntries } from './playground/buildRegistry';",
|
|
50
73
|
"",
|
|
51
74
|
" const dslinterReport = useWorkspaceReport({ reportUrl: '/dslint-report.json', watchUrl: '/events' });",
|
|
52
75
|
" const playgroundEntries = useMemo(() => buildPlaygroundEntries(dslinterReport.report), [dslinterReport.report]);",
|
|
@@ -63,9 +86,14 @@ export function runInitMode(opts = {}) {
|
|
|
63
86
|
"dslinter init: wrote playground registry",
|
|
64
87
|
` ${registryPath}`,
|
|
65
88
|
"",
|
|
89
|
+
`Layout: ${layout}`,
|
|
90
|
+
"",
|
|
66
91
|
"Next:",
|
|
67
|
-
|
|
68
|
-
" 2. Merge vite.dslinter.snippet.ts into vite.config.ts (proxy
|
|
92
|
+
` 1. Import buildPlaygroundEntries in your App (see ${registryDir}/README.txt)`,
|
|
93
|
+
" 2. Merge vite.dslinter.snippet.ts into vite.config.ts (proxy, react dedupe, optimizeDeps.exclude)",
|
|
94
|
+
layout === "laravel"
|
|
95
|
+
? " No extra @ alias remapping is required β dslinter UI uses relative imports."
|
|
96
|
+
: " No @ alias overrides needed for dslinter internal UI.",
|
|
69
97
|
" 3. Run npx dslinter . from the project root",
|
|
70
98
|
"",
|
|
71
99
|
].join("\n"),
|