webpack-dev-service 0.13.2 → 0.14.0
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/README.md +9 -8
- package/cjs/client/client.cjs +24 -9
- package/cjs/client/client.d.cts +14 -0
- package/cjs/client/events.cjs +1 -1
- package/cjs/client/events.d.cts +28 -0
- package/cjs/client/hot.cjs +19 -21
- package/cjs/client/hot.d.cts +16 -0
- package/cjs/client/index.cjs +1 -1
- package/cjs/client/index.d.cts +4 -0
- package/cjs/client/main.cjs +4 -3
- package/cjs/client/main.d.cts +4 -0
- package/cjs/client/ui/Overlay.cjs +1 -1
- package/cjs/client/ui/Overlay.d.cts +12 -0
- package/cjs/client/ui/Progress.cjs +1 -1
- package/cjs/client/ui/Progress.d.cts +12 -0
- package/cjs/client/ui/utils.cjs +1 -1
- package/cjs/client/ui/utils.d.cts +15 -0
- package/cjs/server/compose.cjs +13 -12
- package/cjs/server/compose.d.cts +18 -0
- package/cjs/server/dev/ReadStream.cjs +1 -1
- package/cjs/server/dev/ReadStream.d.cts +43 -0
- package/cjs/server/dev/Service.cjs +1 -1
- package/cjs/server/dev/Service.d.cts +48 -0
- package/cjs/server/dev/index.cjs +1 -1
- package/cjs/server/dev/index.d.cts +8 -0
- package/cjs/server/dev/interface.d.cts +38 -0
- package/cjs/server/dev/middleware.cjs +1 -1
- package/cjs/server/dev/middleware.d.cts +6 -0
- package/cjs/server/dev/utils/fs.cjs +1 -1
- package/cjs/server/dev/utils/fs.d.cts +24 -0
- package/cjs/server/dev/utils/hash.cjs +1 -1
- package/cjs/server/dev/utils/hash.d.cts +9 -0
- package/cjs/server/dev/utils/http.cjs +1 -1
- package/cjs/server/dev/utils/http.d.cts +37 -0
- package/cjs/server/dev/utils/path.cjs +1 -1
- package/cjs/server/dev/utils/path.d.cts +22 -0
- package/cjs/server/dev/utils/paths.cjs +1 -1
- package/cjs/server/dev/utils/paths.d.cts +7 -0
- package/cjs/server/dev/utils/ready.cjs +1 -1
- package/cjs/server/dev/utils/ready.d.cts +5 -0
- package/cjs/server/dev/utils/setupHooks.cjs +2 -5
- package/cjs/server/dev/utils/setupHooks.d.cts +5 -0
- package/cjs/server/dev/utils/setupOutputFileSystem.cjs +1 -1
- package/cjs/server/dev/utils/setupOutputFileSystem.d.cts +5 -0
- package/cjs/server/dev/utils/setupWatching.cjs +1 -1
- package/cjs/server/dev/utils/setupWatching.d.cts +5 -0
- package/cjs/server/dev/utils/setupWriteToDisk.cjs +2 -2
- package/cjs/server/dev/utils/setupWriteToDisk.d.cts +5 -0
- package/cjs/server/hot/Message.d.cts +49 -0
- package/cjs/server/hot/Socket.cjs +109 -97
- package/cjs/server/hot/Socket.d.cts +11 -0
- package/cjs/server/hot/index.cjs +3 -10
- package/cjs/server/hot/index.d.cts +8 -0
- package/cjs/server/hot/interface.d.cts +22 -0
- package/cjs/server/hot/utils.cjs +11 -36
- package/cjs/server/hot/utils.d.cts +12 -0
- package/cjs/server/index.cjs +8 -2
- package/cjs/server/index.d.cts +17 -0
- package/cjs/server/interface.d.cts +14 -0
- package/cjs/server/schema.cjs +1 -1
- package/cjs/server/schema.d.cts +7 -0
- package/cjs/server/utils.cjs +1 -5
- package/cjs/server/utils.d.cts +11 -0
- package/esm/client/client.d.ts +14 -0
- package/esm/client/client.js +25 -10
- package/esm/client/events.d.ts +28 -0
- package/esm/client/events.js +1 -1
- package/esm/client/hot.d.ts +16 -0
- package/esm/client/hot.js +19 -19
- package/esm/client/index.d.ts +4 -0
- package/esm/client/index.js +1 -1
- package/esm/client/main.d.ts +4 -0
- package/esm/client/main.js +4 -3
- package/esm/client/ui/Overlay.d.ts +12 -0
- package/esm/client/ui/Overlay.js +1 -1
- package/esm/client/ui/Progress.d.ts +12 -0
- package/esm/client/ui/Progress.js +1 -1
- package/esm/client/ui/utils.d.ts +15 -0
- package/esm/client/ui/utils.js +1 -1
- package/esm/server/compose.d.ts +18 -0
- package/esm/server/compose.js +13 -12
- package/esm/server/dev/ReadStream.d.ts +43 -0
- package/esm/server/dev/ReadStream.js +1 -1
- package/esm/server/dev/Service.d.ts +48 -0
- package/esm/server/dev/Service.js +1 -1
- package/esm/server/dev/index.d.ts +8 -0
- package/esm/server/dev/index.js +1 -1
- package/esm/server/dev/interface.d.ts +38 -0
- package/esm/server/dev/middleware.d.ts +6 -0
- package/esm/server/dev/middleware.js +1 -1
- package/esm/server/dev/utils/fs.d.ts +24 -0
- package/esm/server/dev/utils/fs.js +1 -1
- package/esm/server/dev/utils/hash.d.ts +9 -0
- package/esm/server/dev/utils/hash.js +1 -1
- package/esm/server/dev/utils/http.d.ts +37 -0
- package/esm/server/dev/utils/http.js +1 -1
- package/esm/server/dev/utils/path.d.ts +22 -0
- package/esm/server/dev/utils/path.js +1 -1
- package/esm/server/dev/utils/paths.d.ts +7 -0
- package/esm/server/dev/utils/paths.js +1 -1
- package/esm/server/dev/utils/ready.d.ts +5 -0
- package/esm/server/dev/utils/ready.js +1 -1
- package/esm/server/dev/utils/setupHooks.d.ts +5 -0
- package/esm/server/dev/utils/setupHooks.js +2 -5
- package/esm/server/dev/utils/setupOutputFileSystem.d.ts +5 -0
- package/esm/server/dev/utils/setupOutputFileSystem.js +1 -1
- package/esm/server/dev/utils/setupWatching.d.ts +5 -0
- package/esm/server/dev/utils/setupWatching.js +1 -1
- package/esm/server/dev/utils/setupWriteToDisk.d.ts +5 -0
- package/esm/server/dev/utils/setupWriteToDisk.js +2 -2
- package/{types/client → esm/server/hot}/Message.d.ts +15 -7
- package/esm/server/hot/Socket.d.ts +11 -0
- package/esm/server/hot/Socket.js +110 -98
- package/esm/server/hot/index.d.ts +8 -0
- package/esm/server/hot/index.js +3 -10
- package/esm/server/hot/interface.d.ts +22 -0
- package/esm/server/hot/utils.d.ts +12 -0
- package/esm/server/hot/utils.js +12 -38
- package/esm/server/index.d.ts +17 -0
- package/esm/server/index.js +8 -2
- package/esm/server/interface.d.ts +14 -0
- package/esm/server/schema.d.ts +7 -0
- package/esm/server/schema.js +1 -1
- package/esm/server/utils.d.ts +11 -0
- package/esm/server/utils.js +2 -5
- package/global.d.ts +2 -0
- package/package.json +20 -19
- package/types/client/client.d.ts +2 -1
- package/types/client/events.d.ts +2 -9
- package/types/client/hot.d.ts +3 -14
- package/types/server/compose.d.ts +2 -2
- package/types/server/dev/index.d.ts +1 -1
- package/types/server/dev/interface.d.ts +2 -2
- package/types/server/dev/utils/fs.d.ts +2 -4
- package/types/server/dev/utils/paths.d.ts +1 -1
- package/types/server/dev/utils/ready.d.ts +1 -1
- package/types/server/dev/utils/setupHooks.d.ts +1 -1
- package/types/server/dev/utils/setupOutputFileSystem.d.ts +1 -1
- package/types/server/dev/utils/setupWatching.d.ts +1 -1
- package/types/server/dev/utils/setupWriteToDisk.d.ts +1 -1
- package/types/server/hot/Message.d.ts +49 -0
- package/types/server/hot/Socket.d.ts +1 -4
- package/types/server/hot/index.d.ts +4 -4
- package/types/server/hot/interface.d.ts +8 -6
- package/types/server/hot/utils.d.ts +4 -4
- package/types/server/index.d.ts +6 -26
- package/types/server/interface.d.ts +3 -0
- package/types/server/utils.d.ts +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ReadStream
|
|
3
|
+
*/
|
|
4
|
+
import { PathLike } from 'node:fs';
|
|
5
|
+
import { Range } from './utils/http.js';
|
|
6
|
+
import { FileSystem } from './utils/fs.js';
|
|
7
|
+
import { Readable, ReadableOptions } from 'node:stream';
|
|
8
|
+
export interface Options extends Pick<ReadableOptions, 'highWaterMark'> {
|
|
9
|
+
fs: FileSystem;
|
|
10
|
+
}
|
|
11
|
+
interface Callback {
|
|
12
|
+
(error?: Error | null): void;
|
|
13
|
+
}
|
|
14
|
+
export declare class ReadStream extends Readable {
|
|
15
|
+
#private;
|
|
16
|
+
/**
|
|
17
|
+
* @constructor
|
|
18
|
+
* @param path The file path.
|
|
19
|
+
* @param ranges The ranges to read.
|
|
20
|
+
* @param options The stream options.
|
|
21
|
+
*/
|
|
22
|
+
constructor(path: PathLike, ranges: Range[], options: Options);
|
|
23
|
+
/**
|
|
24
|
+
* @override
|
|
25
|
+
* @method _construct
|
|
26
|
+
* @param callback The callback.
|
|
27
|
+
*/
|
|
28
|
+
_construct(callback: Callback): void;
|
|
29
|
+
/**
|
|
30
|
+
* @override
|
|
31
|
+
* @method _read
|
|
32
|
+
* @param size The number of bytes to read.
|
|
33
|
+
*/
|
|
34
|
+
_read(size: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* @override
|
|
37
|
+
* @method _destroy
|
|
38
|
+
* @param error The error.
|
|
39
|
+
* @param callback The callback.
|
|
40
|
+
*/
|
|
41
|
+
_destroy(error: Error | null, callback: Callback): void;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Service
|
|
3
|
+
*/
|
|
4
|
+
import { Context } from 'koa';
|
|
5
|
+
import { Stats } from 'node:fs';
|
|
6
|
+
import { FileSystem } from './utils/fs.js';
|
|
7
|
+
interface IgnoreFunction {
|
|
8
|
+
(path: string): boolean;
|
|
9
|
+
}
|
|
10
|
+
interface Headers {
|
|
11
|
+
[key: string]: string | string[];
|
|
12
|
+
}
|
|
13
|
+
type FileStats = Stats | null | undefined;
|
|
14
|
+
interface HeadersFunction {
|
|
15
|
+
(path: string, stats: FileStats): Promise<Headers | void> | Headers | void;
|
|
16
|
+
}
|
|
17
|
+
export interface Options {
|
|
18
|
+
fs: FileSystem;
|
|
19
|
+
etag?: boolean;
|
|
20
|
+
acceptRanges?: boolean;
|
|
21
|
+
lastModified?: boolean;
|
|
22
|
+
highWaterMark?: number;
|
|
23
|
+
ignore?: IgnoreFunction;
|
|
24
|
+
headers?: Headers | HeadersFunction;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @class Service
|
|
28
|
+
*/
|
|
29
|
+
export declare class Service {
|
|
30
|
+
#private;
|
|
31
|
+
/**
|
|
32
|
+
* @constructor
|
|
33
|
+
* @description Create file service.
|
|
34
|
+
* @param root The file service root.
|
|
35
|
+
* @param options The file service options.
|
|
36
|
+
*/
|
|
37
|
+
constructor(root: string, options: Options);
|
|
38
|
+
/**
|
|
39
|
+
* @public
|
|
40
|
+
* @method respond
|
|
41
|
+
* @description Respond file.
|
|
42
|
+
* @param pathname The pathname.
|
|
43
|
+
* @param context The koa context.
|
|
44
|
+
* @param publicPath The public path.
|
|
45
|
+
*/
|
|
46
|
+
respond(pathname: string, context: Context, publicPath: string): Promise<boolean>;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module index
|
|
3
|
+
*/
|
|
4
|
+
import { Middleware } from 'koa';
|
|
5
|
+
import { UnionCompiler } from '../interface.js';
|
|
6
|
+
import { Expose, Options } from './interface.js';
|
|
7
|
+
export { Expose, Options };
|
|
8
|
+
export declare function dev(compiler: UnionCompiler, options: Options): Middleware & Expose;
|
package/esm/server/dev/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module interface
|
|
3
|
+
*/
|
|
4
|
+
import webpack from 'webpack';
|
|
5
|
+
import { FileSystem } from './utils/fs.js';
|
|
6
|
+
import { Options as ServiceOptions, Service } from './Service.js';
|
|
7
|
+
import { Logger, Optional, StatsOptions, UnionCompiler, UnionStats, UnionWatching } from '../interface.js';
|
|
8
|
+
export interface Callback {
|
|
9
|
+
(stats: UnionStats): void;
|
|
10
|
+
}
|
|
11
|
+
export interface ErrorCallback {
|
|
12
|
+
(error?: Error | null): void;
|
|
13
|
+
}
|
|
14
|
+
export interface Expose {
|
|
15
|
+
readonly logger: Logger;
|
|
16
|
+
readonly state: boolean;
|
|
17
|
+
readonly ready: (callback: Callback) => void;
|
|
18
|
+
readonly close: (callback: ErrorCallback) => void;
|
|
19
|
+
readonly invalidate: (callback: ErrorCallback) => void;
|
|
20
|
+
}
|
|
21
|
+
export type FileService = [publicPath: string, service: Service];
|
|
22
|
+
export interface Options extends Optional<ServiceOptions, 'fs'> {
|
|
23
|
+
stats?: StatsOptions;
|
|
24
|
+
writeToDisk?: boolean | ((targetPath: string) => boolean);
|
|
25
|
+
onCompilationDone?: (stats: UnionStats, statsOptions: Readonly<webpack.StatsOptions>) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface Context {
|
|
28
|
+
logger: Logger;
|
|
29
|
+
callbacks: Callback[];
|
|
30
|
+
compiler: UnionCompiler;
|
|
31
|
+
watching: UnionWatching;
|
|
32
|
+
services?: FileService[];
|
|
33
|
+
stats: UnionStats | null;
|
|
34
|
+
options: Options & {
|
|
35
|
+
fs: FileSystem;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export type InitialContext = Optional<Context, 'watching'>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module fs
|
|
3
|
+
*/
|
|
4
|
+
import webpack from 'webpack';
|
|
5
|
+
import fs, { Stats } from 'node:fs';
|
|
6
|
+
import { GetProp } from '../../interface.js';
|
|
7
|
+
export interface FileSystem extends GetProp<webpack.Compiler, 'outputFileSystem'> {
|
|
8
|
+
stat: typeof fs.stat;
|
|
9
|
+
open: typeof fs.open;
|
|
10
|
+
read: typeof fs.read;
|
|
11
|
+
close: typeof fs.close;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @function createMemfs
|
|
15
|
+
* @description Create memfs instance.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createMemfs(): FileSystem;
|
|
18
|
+
/**
|
|
19
|
+
* @function stat
|
|
20
|
+
* @description Get file stats.
|
|
21
|
+
* @param fs The file system to used.
|
|
22
|
+
* @param path The file path.
|
|
23
|
+
*/
|
|
24
|
+
export declare function stat(fs: FileSystem, path: string): Promise<Stats | null>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module http
|
|
3
|
+
*/
|
|
4
|
+
import { Context } from 'koa';
|
|
5
|
+
import { Stats } from 'node:fs';
|
|
6
|
+
import { Buffer } from 'node:buffer';
|
|
7
|
+
export interface Range {
|
|
8
|
+
offset: number;
|
|
9
|
+
length: number;
|
|
10
|
+
prefix?: Buffer;
|
|
11
|
+
suffix?: Buffer;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @function decodeURI
|
|
15
|
+
* @description Decode URI component.
|
|
16
|
+
* @param URI The URI to decode.
|
|
17
|
+
*/
|
|
18
|
+
export declare function decodeURI(URI: string): string | -1;
|
|
19
|
+
/**
|
|
20
|
+
* @function isConditionalGET
|
|
21
|
+
* @description Check if request is conditional GET.
|
|
22
|
+
* @param context The koa context.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isConditionalGET({ request }: Context): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @function isPreconditionFailed
|
|
27
|
+
* @description Check if request precondition failed.
|
|
28
|
+
* @param context The koa context.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isPreconditionFailed({ request, response }: Context): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @function parseRanges
|
|
33
|
+
* @description Parse ranges.
|
|
34
|
+
* @param context The koa context.
|
|
35
|
+
* @param stats The file stats.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseRanges(context: Context, stats: Stats): Range[] | -1 | -2;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module path
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @function unixify
|
|
6
|
+
* @description Convert path to unix style.
|
|
7
|
+
* @param path The path to convert.
|
|
8
|
+
*/
|
|
9
|
+
export declare function unixify(path: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* @function hasTrailingSlash
|
|
12
|
+
* @description Check if path has trailing slash.
|
|
13
|
+
* @param path The path to check.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasTrailingSlash(path: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @function isOutRoot
|
|
18
|
+
* @description Check if path is out of root.
|
|
19
|
+
* @param path The path to check.
|
|
20
|
+
* @param root The root path.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isOutRoot(path: string, root: string): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -30,7 +30,7 @@ function normalizeStatsOptions(statsOptions) {
|
|
|
30
30
|
function getStatsOptions(context) {
|
|
31
31
|
const { compiler } = context;
|
|
32
32
|
const { stats } = context.options;
|
|
33
|
-
if (stats) {
|
|
33
|
+
if (stats != null) {
|
|
34
34
|
if (isMultiCompiler(compiler)) {
|
|
35
35
|
return {
|
|
36
36
|
children: compiler.compilers.map(() => {
|
|
@@ -55,8 +55,6 @@ function setupHooks(context) {
|
|
|
55
55
|
const invalid = () => {
|
|
56
56
|
// We are now in invalid state.
|
|
57
57
|
context.stats = null;
|
|
58
|
-
};
|
|
59
|
-
const watchRun = () => {
|
|
60
58
|
// Log compilation starting.
|
|
61
59
|
context.logger.log('compilation starting...');
|
|
62
60
|
};
|
|
@@ -94,7 +92,6 @@ function setupHooks(context) {
|
|
|
94
92
|
};
|
|
95
93
|
hooks.done.tap(PLUGIN_NAME, done);
|
|
96
94
|
hooks.invalid.tap(PLUGIN_NAME, invalid);
|
|
97
|
-
hooks.watchRun.tap(PLUGIN_NAME, watchRun);
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
export { setupHooks };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package webpack-dev-service
|
|
3
3
|
* @license MIT
|
|
4
|
-
* @version 0.
|
|
4
|
+
* @version 0.14.0
|
|
5
5
|
* @author nuintun <nuintun@qq.com>
|
|
6
6
|
* @description A koa 2 middleware for webpack development and hot reloading.
|
|
7
7
|
* @see https://github.com/nuintun/webpack-dev-service#readme
|
|
@@ -15,7 +15,7 @@ import { getCompilers, PLUGIN_NAME, isFunction } from '../../utils.js';
|
|
|
15
15
|
* @module setupWriteToDisk
|
|
16
16
|
*/
|
|
17
17
|
function getCompilerName({ options: { name } }) {
|
|
18
|
-
return
|
|
18
|
+
return `compiler ${name ? `${name}: ` : ''}`;
|
|
19
19
|
}
|
|
20
20
|
function isAllowWrite(targetPath, filter) {
|
|
21
21
|
return isFunction(filter) ? filter(targetPath) : filter === true;
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* @module message
|
|
3
3
|
*/
|
|
4
4
|
import webpack from 'webpack';
|
|
5
|
-
|
|
5
|
+
import { GetProp } from '../interface.js';
|
|
6
|
+
export interface Invalid {
|
|
6
7
|
action: 'invalid';
|
|
7
8
|
payload: {
|
|
8
|
-
path: string;
|
|
9
9
|
timestamp: number;
|
|
10
|
+
path: string | null;
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
|
-
export interface
|
|
13
|
+
export interface Progress {
|
|
13
14
|
action: 'progress';
|
|
14
15
|
payload: {
|
|
15
16
|
status: string;
|
|
@@ -17,14 +18,14 @@ export interface ProgressMessage {
|
|
|
17
18
|
percentage: number;
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
|
-
export interface
|
|
21
|
+
export interface Hash {
|
|
21
22
|
action: 'hash';
|
|
22
23
|
payload: {
|
|
23
24
|
hash: string;
|
|
24
25
|
timestamp: number;
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
export interface
|
|
28
|
+
export interface Issues {
|
|
28
29
|
action: 'issues';
|
|
29
30
|
payload: {
|
|
30
31
|
timestamp: number;
|
|
@@ -32,10 +33,17 @@ export interface IssuesMessage {
|
|
|
32
33
|
warnings: webpack.StatsError[];
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
export interface
|
|
36
|
+
export interface Ok {
|
|
36
37
|
action: 'ok';
|
|
37
38
|
payload: {
|
|
38
39
|
timestamp: number;
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
|
-
export
|
|
42
|
+
export interface Messages {
|
|
43
|
+
ok: GetProp<Ok, 'payload'>;
|
|
44
|
+
hash: GetProp<Hash, 'payload'>;
|
|
45
|
+
issues: GetProp<Issues, 'payload'>;
|
|
46
|
+
invalid: GetProp<Invalid, 'payload'>;
|
|
47
|
+
progress: GetProp<Progress, 'payload'>;
|
|
48
|
+
}
|
|
49
|
+
export type Message = Invalid | Progress | Hash | Issues | Ok;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Socket
|
|
3
|
+
*/
|
|
4
|
+
import { Context } from 'koa';
|
|
5
|
+
import { UnionCompiler } from '../interface.js';
|
|
6
|
+
import { Options } from './interface.js';
|
|
7
|
+
export declare class Socket {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(compiler: UnionCompiler, options?: Options);
|
|
10
|
+
upgrade(context: Context): boolean;
|
|
11
|
+
}
|