@utoo/pack-shared 1.5.9 → 1.5.10

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/cjs/config.d.ts CHANGED
@@ -125,6 +125,8 @@ export interface ProxyRule {
125
125
  secure?: boolean;
126
126
  }
127
127
  export type DevServerProxy = ProxyRule[];
128
+ /** Browser console levels forwarded to the development terminal. */
129
+ export type BrowserToTerminal = boolean | "error" | "warn";
128
130
  /** Object style proxy options without `context`. */
129
131
  export type ProxyOptions = Omit<ProxyRule, "context">;
130
132
  export interface ResolveOptions {
@@ -168,6 +170,12 @@ export interface DevServerConfig {
168
170
  host?: string;
169
171
  /** Use HTTPS; when true without a certificate, a self-signed cert may be generated. */
170
172
  https?: boolean;
173
+ /**
174
+ * Forward browser console output to the terminal.
175
+ * `"error"` forwards errors, `"warn"` adds warnings, and `true` forwards all
176
+ * supported console output. Defaults to `false` when omitted.
177
+ */
178
+ browserToTerminal?: BrowserToTerminal;
171
179
  /** HTTP proxy rules for Hono dev server (HTTP only; no generic WS proxy in this layer). */
172
180
  proxy?: DevServerProxy;
173
181
  }
package/cjs/hmr.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * Shared HMR (Hot Module Replacement) types for utoopack.
3
3
  * Used by both NAPI (Node.js) and browser-based implementations.
4
4
  */
5
+ import type { BrowserToTerminal } from "./config";
5
6
  export interface ResourceIdentifier {
6
7
  path: string;
7
8
  headers?: unknown;
@@ -92,8 +93,20 @@ export interface TurbopackConnectedAction {
92
93
  action: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED;
93
94
  data: {
94
95
  sessionId: number;
96
+ browserToTerminal?: BrowserToTerminal;
95
97
  };
96
98
  }
99
+ export type BrowserLogMethod = "assert" | "debug" | "dir" | "dirxml" | "error" | "group" | "groupCollapsed" | "groupEnd" | "info" | "log" | "table" | "trace" | "warn";
100
+ export interface BrowserLogEntry {
101
+ method: BrowserLogMethod;
102
+ kind: "console" | "uncaught-error" | "unhandled-rejection";
103
+ args: string[];
104
+ stack?: string;
105
+ }
106
+ export interface BrowserLogsMessage {
107
+ event: "browser-logs";
108
+ entries: BrowserLogEntry[];
109
+ }
97
110
  export interface BuildingAction {
98
111
  action: HMR_ACTIONS_SENT_TO_BROWSER.BUILDING;
99
112
  }
@@ -134,7 +147,7 @@ export interface TurbopackUnsubscribeMessage {
134
147
  type: "turbopack-unsubscribe";
135
148
  path: string;
136
149
  }
137
- export type HmrClientMessage = TurbopackSubscribeMessage | TurbopackUnsubscribeMessage | {
150
+ export type HmrClientMessage = TurbopackSubscribeMessage | TurbopackUnsubscribeMessage | BrowserLogsMessage | {
138
151
  event: string;
139
152
  [key: string]: unknown;
140
153
  };
package/esm/config.d.ts CHANGED
@@ -125,6 +125,8 @@ export interface ProxyRule {
125
125
  secure?: boolean;
126
126
  }
127
127
  export type DevServerProxy = ProxyRule[];
128
+ /** Browser console levels forwarded to the development terminal. */
129
+ export type BrowserToTerminal = boolean | "error" | "warn";
128
130
  /** Object style proxy options without `context`. */
129
131
  export type ProxyOptions = Omit<ProxyRule, "context">;
130
132
  export interface ResolveOptions {
@@ -168,6 +170,12 @@ export interface DevServerConfig {
168
170
  host?: string;
169
171
  /** Use HTTPS; when true without a certificate, a self-signed cert may be generated. */
170
172
  https?: boolean;
173
+ /**
174
+ * Forward browser console output to the terminal.
175
+ * `"error"` forwards errors, `"warn"` adds warnings, and `true` forwards all
176
+ * supported console output. Defaults to `false` when omitted.
177
+ */
178
+ browserToTerminal?: BrowserToTerminal;
171
179
  /** HTTP proxy rules for Hono dev server (HTTP only; no generic WS proxy in this layer). */
172
180
  proxy?: DevServerProxy;
173
181
  }
package/esm/hmr.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * Shared HMR (Hot Module Replacement) types for utoopack.
3
3
  * Used by both NAPI (Node.js) and browser-based implementations.
4
4
  */
5
+ import type { BrowserToTerminal } from "./config";
5
6
  export interface ResourceIdentifier {
6
7
  path: string;
7
8
  headers?: unknown;
@@ -92,8 +93,20 @@ export interface TurbopackConnectedAction {
92
93
  action: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED;
93
94
  data: {
94
95
  sessionId: number;
96
+ browserToTerminal?: BrowserToTerminal;
95
97
  };
96
98
  }
99
+ export type BrowserLogMethod = "assert" | "debug" | "dir" | "dirxml" | "error" | "group" | "groupCollapsed" | "groupEnd" | "info" | "log" | "table" | "trace" | "warn";
100
+ export interface BrowserLogEntry {
101
+ method: BrowserLogMethod;
102
+ kind: "console" | "uncaught-error" | "unhandled-rejection";
103
+ args: string[];
104
+ stack?: string;
105
+ }
106
+ export interface BrowserLogsMessage {
107
+ event: "browser-logs";
108
+ entries: BrowserLogEntry[];
109
+ }
97
110
  export interface BuildingAction {
98
111
  action: HMR_ACTIONS_SENT_TO_BROWSER.BUILDING;
99
112
  }
@@ -134,7 +147,7 @@ export interface TurbopackUnsubscribeMessage {
134
147
  type: "turbopack-unsubscribe";
135
148
  path: string;
136
149
  }
137
- export type HmrClientMessage = TurbopackSubscribeMessage | TurbopackUnsubscribeMessage | {
150
+ export type HmrClientMessage = TurbopackSubscribeMessage | TurbopackUnsubscribeMessage | BrowserLogsMessage | {
138
151
  event: string;
139
152
  [key: string]: unknown;
140
153
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack-shared",
3
- "version": "1.5.9",
3
+ "version": "1.5.10",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "types": "esm/index.d.ts",