diff --git a/docs/errors/RDDT0002.md b/docs/errors/RDDT0002.md index c611603a..5c6f5d05 100644 --- a/docs/errors/RDDT0002.md +++ b/docs/errors/RDDT0002.md @@ -2,15 +2,15 @@ outline: deep --- -# RDDT0002: JSON Parse Stream Bad Line +# RDDT0002: Rolldown Log Reader Bad Line ## Message -> JSON parse stream skip bad line {line}: {error} +> Rolldown log reader skipped bad line {line}: {error} ## Cause -Rolldown writes its build logs as newline-delimited JSON (NDJSON). When the devtools plugin reads these files, it parses each line individually using `JSON.parse`. If a line cannot be parsed as valid JSON, this warning is emitted and the line is skipped. +Rolldown writes its build logs as newline-delimited JSON (NDJSON). When the devtools plugin reads these files, it parses each line individually. If a line cannot be parsed as a valid Rolldown debug event, this warning is emitted and the line is skipped. Common reasons a line might fail to parse: @@ -30,4 +30,4 @@ This warning is non-fatal -- the bad line is skipped and processing continues wi ## Source -- [`packages/rolldown/src/node/utils/json-parse-stream.ts`](https://github.com/vitejs/devtools/blob/main/packages/rolldown/src/node/utils/json-parse-stream.ts) — the NDJSON line parser logs `RDDT0002` (with the line number, error message, and a 256-char preview) and skips the line when `JSON.parse` throws. +- [`packages/rolldown/src/node/rolldown/events-reader.ts`](https://github.com/vitejs/devtools/blob/main/packages/rolldown/src/node/rolldown/events-reader.ts) — `readEventLines()` logs `RDDT0002` with the line number, error message, and a 256-character preview when parsing a log line fails. diff --git a/docs/errors/index.md b/docs/errors/index.md index 274b4712..4be298bb 100644 --- a/docs/errors/index.md +++ b/docs/errors/index.md @@ -47,4 +47,4 @@ Emitted by `@vitejs/devtools-rolldown`. | Code | Level | Title | |------|-------|-------| | [RDDT0001](./RDDT0001) | warn | Rolldown Logs Directory Not Found | -| [RDDT0002](./RDDT0002) | warn | JSON Parse Stream Bad Line | +| [RDDT0002](./RDDT0002) | warn | Rolldown Log Reader Bad Line | diff --git a/packages/rolldown/package.json b/packages/rolldown/package.json index 66ec90de..83ff641d 100644 --- a/packages/rolldown/package.json +++ b/packages/rolldown/package.json @@ -51,7 +51,6 @@ "p-limit": "catalog:deps", "pathe": "catalog:deps", "publint": "catalog:deps", - "split2": "catalog:deps", "tinyglobby": "catalog:deps", "unconfig": "catalog:deps", "unstorage": "catalog:deps", @@ -59,7 +58,6 @@ "ws": "catalog:deps" }, "devDependencies": { - "@types/split2": "catalog:types", "@types/splitpanes": "catalog:types", "@unocss/nuxt": "catalog:build", "@vueuse/components": "catalog:frontend", @@ -115,6 +113,7 @@ "read-yaml-file": "2.1.0", "semver": "7.8.0", "signal-exit": "4.1.0", + "split2": "4.2.0", "strip-bom": "4.0.0", "strip-comments-strings": "1.2.0", "write-file-atomic": "5.0.1", diff --git a/packages/rolldown/src/app/components/assets/Folder.vue b/packages/rolldown/src/app/components/assets/Folder.vue index 55953c5a..6cab1344 100644 --- a/packages/rolldown/src/app/components/assets/Folder.vue +++ b/packages/rolldown/src/app/components/assets/Folder.vue @@ -2,6 +2,7 @@ import type { ModuleDest, RolldownAssetInfo, SessionContext } from '~~/shared/types' import { computed } from 'vue' import { toTree } from '../../utils/format' +import DisplayVirtualTree from '../display/VirtualTree.vue' const props = defineProps<{ assets: RolldownAssetInfo[] @@ -19,26 +20,30 @@ const assetTree = computed(() => { }) const assetsMap = computed(() => new Map(props.assets.map(a => [a.filename, a]))) + +const assetTreeRoots = computed(() => [ + { + key: 'assets', + node: assetTree.value, + icon: 'i-catppuccin:folder-dist catppuccin', + iconOpen: 'i-catppuccin:folder-dist-open catppuccin', + }, +]) diff --git a/packages/rolldown/src/app/components/panel/SessionSelector.vue b/packages/rolldown/src/app/components/panel/SessionSelector.vue index 45fdcf0e..6d515d56 100644 --- a/packages/rolldown/src/app/components/panel/SessionSelector.vue +++ b/packages/rolldown/src/app/components/panel/SessionSelector.vue @@ -17,7 +17,8 @@ const emit = defineEmits<{ }>() function parseEntryPath(session: BuildInfo) { - return parseReadablePath(session.meta.inputs[0]?.filename ?? '', session.meta.cwd).path + const input = session.meta.inputs?.[0] + return input ? parseReadablePath(input.filename, session.meta.cwd).path : '' } const selectedSessionEntry = computed(() => { @@ -25,6 +26,15 @@ const selectedSessionEntry = computed(() => { return session ? parseEntryPath(session) : '' }) +const sessionItems = computed(() => props.sessions.map((session) => { + const inputs = session.meta.inputs ?? [] + return { + session, + primaryInput: inputs[0], + additionalInputCount: Math.max(inputs.length - 1, 0), + } +})) + function checkIsDifferentEntry(session: BuildInfo) { return selectedSessionEntry.value && selectedSessionEntry.value !== parseEntryPath(session) } @@ -38,7 +48,7 @@ function select(session: BuildInfo) {