File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed
Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ export * from './node/config'
12export { createDevToolsContext } from './node/context'
23export { DevTools } from './node/plugins'
34export { createDevToolsMiddleware } from './node/server'
Original file line number Diff line number Diff line change 1+ import type { StartOptions } from './cli-commands'
2+ import { isObject } from './utils'
3+
4+ export interface DevToolsConfig extends Partial < StartOptions > {
5+ enabled : boolean
6+ /**
7+ * Disable client authentication.
8+ *
9+ * Beware that if you disable client authentication,
10+ * any browsers can connect to the devtools and access to your server and filesystem.
11+ * (including other devices, if you open server `host` option to LAN or WAN)
12+ *
13+ * @default true
14+ */
15+ clientAuth ?: boolean
16+ }
17+
18+ export interface ResolvedDevToolsConfig {
19+ config : Omit < DevToolsConfig , 'enabled' > & { host : string }
20+ enabled : boolean
21+ }
22+
23+ export function normalizeDevToolsConfig (
24+ config : DevToolsConfig | boolean | undefined ,
25+ host : string ,
26+ ) : ResolvedDevToolsConfig {
27+ return {
28+ enabled : config === true || ! ! ( config && config . enabled ) ,
29+ config : {
30+ ...( isObject ( config ) ? config : { } ) ,
31+ clientAuth : isObject ( config ) ? ( config . clientAuth ?? true ) : true ,
32+ host : isObject ( config ) ? ( config . host ?? host ) : host ,
33+ } ,
34+ }
35+ }
Original file line number Diff line number Diff line change 1+ export function isObject ( value : unknown ) : value is Record < string , any > {
2+ return Object . prototype . toString . call ( value ) === '[object Object]'
3+ }
Original file line number Diff line number Diff line change 22 createDevToolsContext : function
33 createDevToolsMiddleware : function
44 DevTools : function
5+ normalizeDevToolsConfig : function
56./cli-commands :
67 build : function
78 start : function
You can’t perform that action at this time.
0 commit comments