lack 1.3.1 → 1.3.4

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.
@@ -5,11 +5,11 @@ import { ParsedUrlQuery } from 'querystring';
5
5
  import { Socket } from 'net';
6
6
 
7
7
  declare global {
8
- namespace WhistleBase {
9
- class Request extends IncomingMessage {}
10
- class Response extends ServerResponse {}
11
- class HttpServer extends Server {}
12
- class Socks extends Socket {}
13
- type UrlQuery = ParsedUrlQuery;
14
- }
8
+ namespace WhistleBase {
9
+ class Request extends IncomingMessage {}
10
+ class Response extends ServerResponse {}
11
+ class HttpServer extends Server {}
12
+ class Socks extends Socket {}
13
+ type UrlQuery = ParsedUrlQuery;
14
+ }
15
15
  }
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @typescript-eslint/triple-slash-reference, @typescript-eslint/naming-convention */
2
+
1
3
  /// <reference path="base.d.ts" />
2
4
 
3
5
  declare module 'koa-onerror';
@@ -6,42 +8,42 @@ declare namespace Whistle {
6
8
  type Body = string | false;
7
9
 
8
10
  interface LRUOptions<K = any, V = any> {
9
- max?: number;
10
- maxAge?: number;
11
- length?(value: V, key?: K): number;
12
- dispose?(key: K, value: V): void;
13
- stale?: boolean;
14
- noDisposeOnSet?: boolean;
15
- }
11
+ max?: number;
12
+ maxAge?: number;
13
+ length?(value: V, key?: K): number;
14
+ dispose?(key: K, value: V): void;
15
+ stale?: boolean;
16
+ noDisposeOnSet?: boolean;
17
+ }
16
18
 
17
- interface LRUEntry<K, V> {
18
- k: K;
19
- v: V;
20
- e: number;
21
- }
19
+ interface LRUEntry<K, V> {
20
+ k: K;
21
+ v: V;
22
+ e: number;
23
+ }
22
24
 
23
- interface LRUCache<K = any, V = any> {
24
- new (options?: LRUOptions<K, V>): this;
25
- readonly length: number;
26
- readonly itemCount: number;
27
- allowStale: boolean;
28
- lengthCalculator(value: V): number;
29
- max: number;
30
- maxAge: number;
31
- set(key: K, value: V, maxAge?: number): boolean;
32
- get(key: K): V;
33
- peek(key: K): V;
34
- has(key: K): boolean;
35
- del(key: K): void;
36
- reset(): void;
37
- prune(): void;
38
- forEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
39
- rforEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
40
- keys(): K[];
41
- values(): V[];
42
- dump(): Array<LRUEntry<K, V>>;
43
- load(cacheEntries: ReadonlyArray<LRUEntry<K, V>>): void;
44
- }
25
+ interface LRUCache<K = any, V = any> {
26
+ new (options?: LRUOptions<K, V>): this;
27
+ readonly length: number;
28
+ readonly itemCount: number;
29
+ allowStale: boolean;
30
+ lengthCalculator(value: V): number;
31
+ max: number;
32
+ maxAge: number;
33
+ set(key: K, value: V, maxAge?: number): boolean;
34
+ get(key: K): V;
35
+ peek(key: K): V;
36
+ has(key: K): boolean;
37
+ del(key: K): void;
38
+ reset(): void;
39
+ prune(): void;
40
+ forEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
41
+ rforEach<T = this>(callbackFn: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): void;
42
+ keys(): K[];
43
+ values(): V[];
44
+ dump(): Array<LRUEntry<K, V>>;
45
+ load(cacheEntries: ReadonlyArray<LRUEntry<K, V>>): void;
46
+ }
45
47
 
46
48
  interface Frame {
47
49
  reqId: string;
@@ -266,6 +268,7 @@ declare namespace Whistle {
266
268
  commonName: string;
267
269
  realUrl: string;
268
270
  relativeUrl: string;
271
+ extraUrl: string;
269
272
  method: string;
270
273
  clientPort: string;
271
274
  globalValue: string;
@@ -303,10 +306,10 @@ declare namespace Whistle {
303
306
  }
304
307
 
305
308
  class PluginServerSocket extends WhistleBase.Socks {
306
- setReqRules: SetRules;
307
- setResRules: SetRules;
308
- disableTrailers?: boolean;
309
- }
309
+ setReqRules: SetRules;
310
+ setResRules: SetRules;
311
+ disableTrailers?: boolean;
312
+ }
310
313
  class PluginUIRequest extends WhistleBase.Request {
311
314
  clientIp: string;
312
315
  Storage: Storage;
package/bin/watch.js CHANGED
@@ -9,7 +9,7 @@ const touch = () => {
9
9
  };
10
10
 
11
11
  module.exports = (dirs) => {
12
- const watchList = ['index.js', 'rules.txt', '_rules.txt', 'reqRules.txt', 'resRules.txt', 'lib'];
12
+ const watchList = ['index.js', 'rules.txt', '_rules.txt', 'reqRules.txt', 'resRules.txt', 'lib', 'dist'];
13
13
  if (dirs && typeof dirs === 'string') {
14
14
  dirs.split(',').forEach((dir) => {
15
15
  dir = dir.trim();
@@ -19,7 +19,7 @@ module.exports = (dirs) => {
19
19
  });
20
20
  }
21
21
  let timer;
22
- console.log(`Watching: ${watchList.join()}`); // eslint-disable-line
22
+ console.log(`Watching the following files/folders changes:\n${watchList.join('\n')}\n`); // eslint-disable-line
23
23
  chokidar.watch(watchList, {
24
24
  ignored: /(^|[/\\])(\..|node_modules([/\\]|$))/,
25
25
  }).on('raw', (_, filename) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lack",
3
- "version": "1.3.1",
3
+ "version": "1.3.4",
4
4
  "description": "whistle extension tools",
5
5
  "author": "avenwu <avwu@qq.com>",
6
6
  "license": "MIT",