@vltpkg/output 1.0.0-rc.32 → 1.0.0-rc.33

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/dist/index.d.ts CHANGED
@@ -2,12 +2,20 @@ export type Events = {
2
2
  request: {
3
3
  url: URL | string;
4
4
  state: 'start' | 'complete' | '304' | 'cache' | 'stale';
5
+ /** HTTP method for the request, when known. */
6
+ method?: string;
7
+ /** HTTP status code, set on `complete`/`304` completion events. */
8
+ statusCode?: number;
9
+ /** Wall-clock duration of the request in ms, set on completion. */
10
+ durationMs?: number;
5
11
  };
6
12
  graphStep: {
7
13
  step: 'build' | 'actual' | 'reify';
8
14
  state: 'start' | 'stop';
9
15
  };
10
16
  };
17
+ /** Optional diagnostic details attached to a `request` event. */
18
+ export type RequestDetails = Omit<Events['request'], 'url' | 'state'>;
11
19
  export declare class OutputEmitter {
12
20
  private emitter;
13
21
  emit<T extends keyof Events>(eventName: T, payload: Events[T]): void;
@@ -15,5 +23,5 @@ export declare class OutputEmitter {
15
23
  off<T extends keyof Events>(eventName: T, handler: (payload: Events[T]) => void): void;
16
24
  }
17
25
  export declare const emitter: OutputEmitter;
18
- export declare const logRequest: (url: URL | string, state: Events["request"]["state"]) => void;
26
+ export declare const logRequest: (url: URL | string, state: Events["request"]["state"], details?: RequestDetails) => void;
19
27
  export declare const graphStep: (step: Events["graphStep"]["step"]) => () => void;
package/dist/index.js CHANGED
@@ -14,8 +14,8 @@ export class OutputEmitter {
14
14
  // Exported event emitter to coordinate events.
15
15
  // There must be one version of output across the entire CLI.
16
16
  export const emitter = new OutputEmitter();
17
- export const logRequest = (url, state) => {
18
- emitter.emit('request', { url, state });
17
+ export const logRequest = (url, state, details = {}) => {
18
+ emitter.emit('request', { url, state, ...details });
19
19
  };
20
20
  export const graphStep = (step) => {
21
21
  emitter.emit('graphStep', { step, state: 'start' });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/output",
3
3
  "description": "Generate output from the vlt CLI",
4
- "version": "1.0.0-rc.32",
4
+ "version": "1.0.0-rc.33",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -13,7 +13,7 @@
13
13
  "url": "http://vlt.sh"
14
14
  },
15
15
  "dependencies": {
16
- "@vltpkg/types": "1.0.0-rc.32"
16
+ "@vltpkg/types": "1.0.0-rc.33"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@eslint/js": "^9.39.1",
@@ -61,5 +61,12 @@
61
61
  },
62
62
  "files": [
63
63
  "dist"
64
- ]
64
+ ],
65
+ "bugs": [
66
+ {
67
+ "type": "link",
68
+ "url": "https://github.com/vltpkg/vltpkg/issues"
69
+ }
70
+ ],
71
+ "homepage": "https://github.com/vltpkg/vltpkg/tree/main/src/output#readme"
65
72
  }