@rsdoctor/types 1.5.15 → 1.5.17

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.
@@ -32,7 +32,7 @@ export interface RsdoctorWebpackPluginFeatures {
32
32
  */
33
33
  lite?: boolean;
34
34
  }
35
- export interface RsdoctorPluginOptionsNormalized<Rules extends LinterType.ExtendRuleData[] = []> extends Common.DeepRequired<Omit<RsdoctorWebpackPluginOptions<Rules>, 'sdkInstance' | 'linter' | 'output' | 'supports' | 'port' | 'brief' | 'mode'>> {
35
+ export interface RsdoctorPluginOptionsNormalized<Rules extends LinterType.ExtendRuleData[] = []> extends Common.DeepRequired<Omit<RsdoctorWebpackPluginOptions<Rules>, 'sdkInstance' | 'linter' | 'output' | 'supports' | 'port' | 'brief' | 'mode' | 'server'>> {
36
36
  features: Common.DeepRequired<RsdoctorWebpackPluginFeatures>;
37
37
  linter: Required<LinterType.Options<Rules, InternalRules>>;
38
38
  sdkInstance?: SDK.RsdoctorBuilderSDKInstance;
@@ -43,6 +43,7 @@ export interface RsdoctorPluginOptionsNormalized<Rules extends LinterType.Extend
43
43
  options: Config.BriefModeOptions | Config.NormalModeOptions;
44
44
  };
45
45
  port?: number;
46
+ server: SDK.RsdoctorServerConfig;
46
47
  supports: ISupport;
47
48
  }
48
49
  interface ISupport {
@@ -116,6 +117,10 @@ export interface RsdoctorWebpackPluginOptions<Rules extends LinterType.ExtendRul
116
117
  * The port of the Rsdoctor server.
117
118
  */
118
119
  port?: number;
120
+ /**
121
+ * Configure the Rsdoctor report server.
122
+ */
123
+ server?: SDK.RsdoctorServerConfig;
119
124
  /**
120
125
  * Options to control the log printing.
121
126
  */
@@ -32,7 +32,7 @@ export interface RsdoctorWebpackPluginFeatures {
32
32
  */
33
33
  lite?: boolean;
34
34
  }
35
- export interface RsdoctorPluginOptionsNormalized<Rules extends LinterType.ExtendRuleData[] = []> extends Common.DeepRequired<Omit<RsdoctorWebpackPluginOptions<Rules>, 'sdkInstance' | 'linter' | 'output' | 'supports' | 'port' | 'brief' | 'mode'>> {
35
+ export interface RsdoctorPluginOptionsNormalized<Rules extends LinterType.ExtendRuleData[] = []> extends Common.DeepRequired<Omit<RsdoctorWebpackPluginOptions<Rules>, 'sdkInstance' | 'linter' | 'output' | 'supports' | 'port' | 'brief' | 'mode' | 'server'>> {
36
36
  features: Common.DeepRequired<RsdoctorWebpackPluginFeatures>;
37
37
  linter: Required<LinterType.Options<Rules, InternalRules>>;
38
38
  sdkInstance?: SDK.RsdoctorBuilderSDKInstance;
@@ -43,6 +43,7 @@ export interface RsdoctorPluginOptionsNormalized<Rules extends LinterType.Extend
43
43
  options: Config.BriefModeOptions | Config.NormalModeOptions;
44
44
  };
45
45
  port?: number;
46
+ server: SDK.RsdoctorServerConfig;
46
47
  supports: ISupport;
47
48
  }
48
49
  interface ISupport {
@@ -116,6 +117,10 @@ export interface RsdoctorWebpackPluginOptions<Rules extends LinterType.ExtendRul
116
117
  * The port of the Rsdoctor server.
117
118
  */
118
119
  port?: number;
120
+ /**
121
+ * Configure the Rsdoctor report server.
122
+ */
123
+ server?: SDK.RsdoctorServerConfig;
119
124
  /**
120
125
  * Options to control the log printing.
121
126
  */
@@ -97,6 +97,34 @@ export interface RsdoctorSDKInstance {
97
97
  export interface IPrintLog {
98
98
  serverUrls: boolean;
99
99
  }
100
+ export type RsdoctorServerCorsStaticOrigin = boolean | string | RegExp | Array<boolean | string | RegExp>;
101
+ export type RsdoctorServerCorsOrigin = RsdoctorServerCorsStaticOrigin | ((requestOrigin: string | undefined, callback: (err: Error | null, origin?: RsdoctorServerCorsStaticOrigin) => void) => void);
102
+ export interface RsdoctorServerCorsOptions {
103
+ origin?: RsdoctorServerCorsOrigin;
104
+ methods?: string | string[];
105
+ allowedHeaders?: string | string[];
106
+ exposedHeaders?: string | string[];
107
+ credentials?: boolean;
108
+ maxAge?: number;
109
+ preflightContinue?: boolean;
110
+ optionsSuccessStatus?: number;
111
+ }
112
+ export interface RsdoctorServerConfig {
113
+ /**
114
+ * The port of the Rsdoctor report server.
115
+ */
116
+ port?: number;
117
+ /**
118
+ * Configure CORS for the Rsdoctor report server.
119
+ *
120
+ * - `false`: disable CORS middleware
121
+ * - `true`: use the cors middleware defaults
122
+ * - object: pass options to the cors middleware
123
+ *
124
+ * By default, Rsdoctor only allows local origins.
125
+ */
126
+ cors?: boolean | RsdoctorServerCorsOptions;
127
+ }
100
128
  export type SDKOptionsType = {
101
129
  innerClientPath?: string;
102
130
  disableClientServer?: boolean;
@@ -107,4 +135,5 @@ export type SDKOptionsType = {
107
135
  features?: {
108
136
  treeShaking?: boolean;
109
137
  };
138
+ server?: RsdoctorServerConfig;
110
139
  };
@@ -97,6 +97,34 @@ export interface RsdoctorSDKInstance {
97
97
  export interface IPrintLog {
98
98
  serverUrls: boolean;
99
99
  }
100
+ export type RsdoctorServerCorsStaticOrigin = boolean | string | RegExp | Array<boolean | string | RegExp>;
101
+ export type RsdoctorServerCorsOrigin = RsdoctorServerCorsStaticOrigin | ((requestOrigin: string | undefined, callback: (err: Error | null, origin?: RsdoctorServerCorsStaticOrigin) => void) => void);
102
+ export interface RsdoctorServerCorsOptions {
103
+ origin?: RsdoctorServerCorsOrigin;
104
+ methods?: string | string[];
105
+ allowedHeaders?: string | string[];
106
+ exposedHeaders?: string | string[];
107
+ credentials?: boolean;
108
+ maxAge?: number;
109
+ preflightContinue?: boolean;
110
+ optionsSuccessStatus?: number;
111
+ }
112
+ export interface RsdoctorServerConfig {
113
+ /**
114
+ * The port of the Rsdoctor report server.
115
+ */
116
+ port?: number;
117
+ /**
118
+ * Configure CORS for the Rsdoctor report server.
119
+ *
120
+ * - `false`: disable CORS middleware
121
+ * - `true`: use the cors middleware defaults
122
+ * - object: pass options to the cors middleware
123
+ *
124
+ * By default, Rsdoctor only allows local origins.
125
+ */
126
+ cors?: boolean | RsdoctorServerCorsOptions;
127
+ }
100
128
  export type SDKOptionsType = {
101
129
  innerClientPath?: string;
102
130
  disableClientServer?: boolean;
@@ -107,4 +135,5 @@ export type SDKOptionsType = {
107
135
  features?: {
108
136
  treeShaking?: boolean;
109
137
  };
138
+ server?: RsdoctorServerConfig;
110
139
  };
@@ -11,6 +11,11 @@ export interface RsdoctorServerInstance {
11
11
  readonly app: connect.Server;
12
12
  readonly port: number;
13
13
  readonly origin: string;
14
+ readonly socketUrl: {
15
+ port: number;
16
+ socketUrl: string;
17
+ token: string;
18
+ };
14
19
  innerClientPath?: string;
15
20
  get(route: string, cb: (...args: Parameters<connect.NextHandleFunction>) => string | PlainObject): connect.Server;
16
21
  post(route: string, cb: (...args: Parameters<connect.NextHandleFunction>) => string | PlainObject): connect.Server;
@@ -11,6 +11,11 @@ export interface RsdoctorServerInstance {
11
11
  readonly app: connect.Server;
12
12
  readonly port: number;
13
13
  readonly origin: string;
14
+ readonly socketUrl: {
15
+ port: number;
16
+ socketUrl: string;
17
+ token: string;
18
+ };
14
19
  innerClientPath?: string;
15
20
  get(route: string, cb: (...args: Parameters<connect.NextHandleFunction>) => string | PlainObject): connect.Server;
16
21
  post(route: string, cb: (...args: Parameters<connect.NextHandleFunction>) => string | PlainObject): connect.Server;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/types",
3
- "version": "1.5.15",
3
+ "version": "1.5.17",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",