@rollipop/rolldown-debug 1.0.27 → 1.0.28
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/README.md +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,11 +5,13 @@ Utilities and generated TypeScript types for reading Rolldown devtools output.
|
|
|
5
5
|
When `devtools` is enabled, Rolldown writes JSON-lines files to:
|
|
6
6
|
|
|
7
7
|
```text
|
|
8
|
-
node_modules/.rolldown/<session_id>/
|
|
8
|
+
<cwd>/node_modules/.rolldown/<session_id>/
|
|
9
9
|
meta.json
|
|
10
10
|
logs.json
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
`<cwd>` is the build's `InputOptions#cwd`, which defaults to the working directory the build ran from. Resolve the files against it rather than your own working directory, which may differ.
|
|
14
|
+
|
|
13
15
|
`logs.json` is complete after `await bundle.close()` resolves.
|
|
14
16
|
|
|
15
17
|
## Parse Events
|
|
@@ -18,7 +20,7 @@ node_modules/.rolldown/<session_id>/
|
|
|
18
20
|
import fs from 'node:fs';
|
|
19
21
|
import { parseToEvents, type Event, type StringRef } from '@rollipop/rolldown-debug';
|
|
20
22
|
|
|
21
|
-
const data = fs.readFileSync('node_modules/.rolldown/<session_id>/logs.json', 'utf8');
|
|
23
|
+
const data = fs.readFileSync('<cwd>/node_modules/.rolldown/<session_id>/logs.json', 'utf8');
|
|
22
24
|
const events = parseToEvents(data.trim());
|
|
23
25
|
|
|
24
26
|
type ActionEvent = Exclude<Event, StringRef> & { build_id: string };
|
|
@@ -41,7 +43,7 @@ function isActionEvent(event: Event): event is ActionEvent {
|
|
|
41
43
|
return 'build_id' in event;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
const data = fs.readFileSync('node_modules/.rolldown/<session_id>/logs.json', 'utf8');
|
|
46
|
+
const data = fs.readFileSync('<cwd>/node_modules/.rolldown/<session_id>/logs.json', 'utf8');
|
|
45
47
|
const actionEvents = parseToEvents(data.trim()).filter(isActionEvent);
|
|
46
48
|
const buildId = actionEvents.at(-1)?.build_id;
|
|
47
49
|
|