lack 1.3.7 → 1.3.9
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/assets/ts/src/types/global.d.ts +17 -1
- package/bin/watch.js +2 -2
- package/package.json +1 -1
|
@@ -213,7 +213,23 @@ declare namespace Whistle {
|
|
|
213
213
|
type GetSession = (cb: (session: Session | '') => void) => void;
|
|
214
214
|
type GetFrame = (cb: (Frames: Frame[] | '') => void) => void;
|
|
215
215
|
type SetRules = (rules: string) => boolean;
|
|
216
|
-
|
|
216
|
+
interface PluginDecoder {
|
|
217
|
+
getBuffer: (cb: (err: any, buf?: Buffer | null) => void) => void;
|
|
218
|
+
getText: (cb: (err: any, text?: string) => void, encoding?: string) => void;
|
|
219
|
+
getJson: (cb: (err: any, json?: any) => void, encoding?: string) => void;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
type PluginReqCtx = PluginDecoder & PluginRequest;
|
|
223
|
+
type PluginResCtx = PluginDecoder & WhistleBase.Request;
|
|
224
|
+
type PluginNextResult = {
|
|
225
|
+
rules?: string | null | undefined;
|
|
226
|
+
body?: any;
|
|
227
|
+
};
|
|
228
|
+
type PluginReqHandler = (buffer: Buffer | null, next: (result?: PluginNextResult) => void, ctx?: PluginReqCtx) => void;
|
|
229
|
+
type PluginResHandler = (buffer: Buffer | null, next: (result?: PluginNextResult) => void, ctx?: PluginResCtx) => void;
|
|
230
|
+
type PassThroughReq = PluginReqHandler | { [key: string]: any } | null | undefined;
|
|
231
|
+
type PassThroughRes = PluginResHandler | { [key: string]: any } | null | undefined;
|
|
232
|
+
type PassThrough = (uri?: PassThroughReq, trailers?: PassThroughRes) => void;
|
|
217
233
|
|
|
218
234
|
interface WriteHead {
|
|
219
235
|
(code: string | number, msg?: string, headers?: any): void;
|
package/bin/watch.js
CHANGED
|
@@ -6,7 +6,7 @@ const fse = require('fs-extra');
|
|
|
6
6
|
/* eslint-disable no-sync */
|
|
7
7
|
const HOME_DIR_RE = /^[~~]\//;
|
|
8
8
|
const PLUGIN_NAME_RE = /^(?:@[\w-]+\/)?(whistle\.[a-z\d_-]+)$/;
|
|
9
|
-
const REL_RE =
|
|
9
|
+
const REL_RE = /^\.\.[\\/]+/;
|
|
10
10
|
|
|
11
11
|
const getWhistlePath = () => {
|
|
12
12
|
const dir = process.env.WHISTLE_PATH;
|
|
@@ -98,7 +98,7 @@ module.exports = (dirs) => {
|
|
|
98
98
|
const len = paths.length;
|
|
99
99
|
const inWatchList = (filename) => {
|
|
100
100
|
for (let i = 0; i < len; i++) {
|
|
101
|
-
if (REL_RE.test(path.relative(
|
|
101
|
+
if (!REL_RE.test(path.relative(paths[i], filename))) {
|
|
102
102
|
return true;
|
|
103
103
|
}
|
|
104
104
|
}
|