webpack-dev-service 0.14.0 → 0.14.1

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.
Files changed (92) hide show
  1. package/cjs/client/client.cjs +1 -1
  2. package/cjs/client/events.cjs +1 -1
  3. package/cjs/client/hot.cjs +1 -1
  4. package/cjs/client/index.cjs +1 -1
  5. package/cjs/client/main.cjs +1 -1
  6. package/cjs/client/ui/Overlay.cjs +1 -1
  7. package/cjs/client/ui/Progress.cjs +1 -1
  8. package/cjs/client/ui/utils.cjs +1 -1
  9. package/cjs/server/compose.cjs +1 -1
  10. package/cjs/server/dev/ReadStream.cjs +1 -1
  11. package/cjs/server/dev/Service.cjs +1 -1
  12. package/cjs/server/dev/index.cjs +1 -1
  13. package/cjs/server/dev/middleware.cjs +1 -1
  14. package/cjs/server/dev/utils/fs.cjs +1 -1
  15. package/cjs/server/dev/utils/hash.cjs +1 -1
  16. package/cjs/server/dev/utils/http.cjs +1 -1
  17. package/cjs/server/dev/utils/path.cjs +1 -1
  18. package/cjs/server/dev/utils/paths.cjs +1 -1
  19. package/cjs/server/dev/utils/ready.cjs +1 -1
  20. package/cjs/server/dev/utils/setupHooks.cjs +1 -1
  21. package/cjs/server/dev/utils/setupOutputFileSystem.cjs +1 -1
  22. package/cjs/server/dev/utils/setupWatching.cjs +1 -1
  23. package/cjs/server/dev/utils/setupWriteToDisk.cjs +1 -1
  24. package/cjs/server/hot/Socket.cjs +1 -1
  25. package/cjs/server/hot/index.cjs +1 -1
  26. package/cjs/server/hot/utils.cjs +1 -1
  27. package/cjs/server/index.cjs +1 -1
  28. package/cjs/server/schema.cjs +1 -1
  29. package/cjs/server/utils.cjs +1 -1
  30. package/esm/client/client.js +1 -1
  31. package/esm/client/events.js +1 -1
  32. package/esm/client/hot.js +1 -1
  33. package/esm/client/index.js +1 -1
  34. package/esm/client/main.js +1 -1
  35. package/esm/client/ui/Overlay.js +1 -1
  36. package/esm/client/ui/Progress.js +1 -1
  37. package/esm/client/ui/utils.js +1 -1
  38. package/esm/server/compose.js +1 -1
  39. package/esm/server/dev/ReadStream.js +1 -1
  40. package/esm/server/dev/Service.js +1 -1
  41. package/esm/server/dev/index.js +1 -1
  42. package/esm/server/dev/middleware.js +1 -1
  43. package/esm/server/dev/utils/fs.js +1 -1
  44. package/esm/server/dev/utils/hash.js +1 -1
  45. package/esm/server/dev/utils/http.js +1 -1
  46. package/esm/server/dev/utils/path.js +1 -1
  47. package/esm/server/dev/utils/paths.js +1 -1
  48. package/esm/server/dev/utils/ready.js +1 -1
  49. package/esm/server/dev/utils/setupHooks.js +1 -1
  50. package/esm/server/dev/utils/setupOutputFileSystem.js +1 -1
  51. package/esm/server/dev/utils/setupWatching.js +1 -1
  52. package/esm/server/dev/utils/setupWriteToDisk.js +1 -1
  53. package/esm/server/hot/Socket.js +1 -1
  54. package/esm/server/hot/index.js +1 -1
  55. package/esm/server/hot/utils.js +1 -1
  56. package/esm/server/index.js +1 -1
  57. package/esm/server/schema.js +1 -1
  58. package/esm/server/utils.js +1 -1
  59. package/package.json +5 -19
  60. package/types/client/client.d.ts +0 -14
  61. package/types/client/events.d.ts +0 -28
  62. package/types/client/hot.d.ts +0 -16
  63. package/types/client/index.d.ts +0 -4
  64. package/types/client/main.d.ts +0 -4
  65. package/types/client/ui/Overlay.d.ts +0 -12
  66. package/types/client/ui/Progress.d.ts +0 -12
  67. package/types/client/ui/utils.d.ts +0 -15
  68. package/types/server/compose.d.ts +0 -18
  69. package/types/server/dev/ReadStream.d.ts +0 -43
  70. package/types/server/dev/Service.d.ts +0 -48
  71. package/types/server/dev/index.d.ts +0 -8
  72. package/types/server/dev/interface.d.ts +0 -38
  73. package/types/server/dev/middleware.d.ts +0 -6
  74. package/types/server/dev/utils/fs.d.ts +0 -24
  75. package/types/server/dev/utils/hash.d.ts +0 -9
  76. package/types/server/dev/utils/http.d.ts +0 -37
  77. package/types/server/dev/utils/path.d.ts +0 -22
  78. package/types/server/dev/utils/paths.d.ts +0 -7
  79. package/types/server/dev/utils/ready.d.ts +0 -5
  80. package/types/server/dev/utils/setupHooks.d.ts +0 -5
  81. package/types/server/dev/utils/setupOutputFileSystem.d.ts +0 -5
  82. package/types/server/dev/utils/setupWatching.d.ts +0 -5
  83. package/types/server/dev/utils/setupWriteToDisk.d.ts +0 -5
  84. package/types/server/hot/Message.d.ts +0 -49
  85. package/types/server/hot/Socket.d.ts +0 -11
  86. package/types/server/hot/index.d.ts +0 -8
  87. package/types/server/hot/interface.d.ts +0 -22
  88. package/types/server/hot/utils.d.ts +0 -12
  89. package/types/server/index.d.ts +0 -17
  90. package/types/server/interface.d.ts +0 -14
  91. package/types/server/schema.d.ts +0 -7
  92. package/types/server/utils.d.ts +0 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack-dev-service",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "A koa 2 middleware for webpack development and hot reloading.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -9,33 +9,19 @@
9
9
  ],
10
10
  "main": "cjs/server/index.cjs",
11
11
  "module": "esm/server/index.js",
12
- "types": "types/server/index.d.ts",
13
12
  "exports": {
14
13
  ".": {
15
14
  "import": "./esm/server/index.js",
16
- "require": "./cjs/server/index.cjs",
17
- "types": "./types/server/index.d.ts"
15
+ "require": "./cjs/server/index.cjs"
18
16
  },
19
17
  "./client": {
20
18
  "import": "./esm/client/index.js",
21
- "require": "./cjs/client/index.cjs",
22
- "types": "./types/client/index.d.ts"
23
- }
24
- },
25
- "typesVersions": {
26
- "*": {
27
- ".": [
28
- "./types/server/index.d.ts"
29
- ],
30
- "client": [
31
- "./types/client/index.d.ts"
32
- ]
19
+ "require": "./cjs/client/index.cjs"
33
20
  }
34
21
  },
35
22
  "files": [
36
23
  "cjs",
37
24
  "esm",
38
- "types",
39
25
  "global.d.ts"
40
26
  ],
41
27
  "engines": {
@@ -68,10 +54,10 @@
68
54
  "test": "cd tests && node webpack.js",
69
55
  "build:cjs": "rollup -c tools/rollup.cjs.js",
70
56
  "build:esm": "rollup -c tools/rollup.esm.js",
57
+ "build:fix-types": "node tools/fix-types.js",
71
58
  "format": "prettier --write . --ignore-path .prettierignore",
72
59
  "build": "npm run clean && npm run build:main && npm run format",
73
- "build:main": "npm run build:cjs && npm run build:esm && npm run build:types",
74
- "build:types": "tsc --declaration --emitDeclarationOnly --declarationDir types && node tools/fix-types.js"
60
+ "build:main": "npm run build:cjs && npm run build:esm && npm run build:fix-types"
75
61
  },
76
62
  "dependencies": {
77
63
  "@nuintun/ansi": "^0.1.1",
@@ -1,14 +0,0 @@
1
- /**
2
- * @module client
3
- */
4
- export interface Options {
5
- readonly hmr: boolean;
6
- readonly name: string;
7
- readonly path: string;
8
- readonly origin: string;
9
- readonly reload: boolean;
10
- readonly overlay: boolean;
11
- readonly progress: boolean;
12
- readonly uuid: string | null;
13
- }
14
- export declare function createClient(options: Options): void;
@@ -1,28 +0,0 @@
1
- /**
2
- * @module events
3
- */
4
- import { Options } from './client';
5
- import { GetProp } from '/server/interface';
6
- import { Messages } from '/server/hot/Message';
7
- export interface Events {
8
- ok(message: GetProp<Messages, 'ok'>, options: Options): void;
9
- hash(message: GetProp<Messages, 'hash'>, options: Options): void;
10
- issues(message: GetProp<Messages, 'issues'>, options: Options): void;
11
- invalid(message: GetProp<Messages, 'invalid'>, options: Options): void;
12
- progress(message: GetProp<Messages, 'progress'>, options: Options): void;
13
- }
14
- /**
15
- * @function on
16
- * @description Add an event listener callback.
17
- * @param event Event name.
18
- * @param callback Event listener callback.
19
- */
20
- export declare function on<E extends keyof Events>(event: E, callback: GetProp<Events, E>): void;
21
- /**
22
- * @function off
23
- * @description Remove an event listener callback.
24
- * @param event Event name.
25
- * @param callback Event listener callback.
26
- */
27
- export declare function off<E extends keyof Events>(event: E, callback?: GetProp<Events, E>): void;
28
- export declare function emit<E extends keyof Events>(event: E, message: GetProp<Messages, E>, options: Options): void;
@@ -1,16 +0,0 @@
1
- /**
2
- * @module hot
3
- */
4
- /**
5
- * @function updateHash
6
- * @description Update webpack hash.
7
- * @param value The new hash value.
8
- */
9
- export declare function updateHash(value: string): void;
10
- /**
11
- * @function applyUpdate
12
- * @description Apply update.
13
- * @param hmr Whether to enable HMR.
14
- * @param fallback Fallback function when HMR fail.
15
- */
16
- export declare function applyUpdate(hmr: boolean, fallback: (error?: Error) => void): void;
@@ -1,4 +0,0 @@
1
- /**
2
- * @module index
3
- */
4
- export { off, on } from './events';
@@ -1,4 +0,0 @@
1
- /**
2
- * @module main
3
- */
4
- export {};
@@ -1,12 +0,0 @@
1
- /**
2
- * @module overlay
3
- * @see https://github.com/shellscape/webpack-plugin-serve
4
- */
5
- import webpack from 'webpack';
6
- export declare class Overlay {
7
- #private;
8
- constructor(name: string);
9
- setIssues(type: 'errors' | 'warnings', issues: webpack.StatsError[]): void;
10
- show(): void;
11
- hide(): void;
12
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * @module progress
3
- * @see https://github.com/shellscape/webpack-plugin-serve
4
- * @see https://www.zhangxinxu.com/wordpress/2015/07/svg-circle-loading
5
- */
6
- export declare class Progress {
7
- #private;
8
- constructor();
9
- update(percentage: number): void;
10
- show(): void;
11
- hide(): void;
12
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * @module utils
3
- */
4
- import { AnsiBlock } from '@nuintun/ansi';
5
- export declare function escapeHTML(text: string): string;
6
- export declare function blockToHTML({ style, value, url }: AnsiBlock): string;
7
- export declare function ansiToHTML(text: string): string;
8
- export type RootElement = HTMLElement | ShadowRoot;
9
- export declare function getRootElement(tagName: string): ShadowRoot;
10
- export declare function injectCSS(
11
- css: string,
12
- root?: HTMLElement | ShadowRoot,
13
- styleElement?: HTMLStyleElement
14
- ): HTMLStyleElement;
15
- export declare function appendHTML(html: string, root?: RootElement): ChildNode[];
@@ -1,18 +0,0 @@
1
- /**
2
- * @module compose
3
- */
4
- export interface Next {
5
- (): Promise<void>;
6
- }
7
- export interface Composed<C> {
8
- (context: C, next?: Next): Promise<void>;
9
- }
10
- export interface Middleware<C> {
11
- (context: C, next: Next): Promise<void> | void;
12
- }
13
- /**
14
- * @function compose
15
- * @description Compose middlewares.
16
- * @param middlewares The middlewares list.
17
- */
18
- export declare function compose<C>(...middlewares: Middleware<C>[]): Composed<C>;
@@ -1,43 +0,0 @@
1
- /**
2
- * @module ReadStream
3
- */
4
- import { PathLike } from 'node:fs';
5
- import { Range } from './utils/http';
6
- import { FileSystem } from './utils/fs';
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,48 +0,0 @@
1
- /**
2
- * @module Service
3
- */
4
- import { Context } from 'koa';
5
- import { Stats } from 'node:fs';
6
- import { FileSystem } from './utils/fs';
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,8 +0,0 @@
1
- /**
2
- * @module index
3
- */
4
- import { Middleware } from 'koa';
5
- import { UnionCompiler } from '/server/interface';
6
- import { Expose, Options } from './interface';
7
- export { Expose, Options };
8
- export declare function dev(compiler: UnionCompiler, options: Options): Middleware & Expose;
@@ -1,38 +0,0 @@
1
- /**
2
- * @module interface
3
- */
4
- import webpack from 'webpack';
5
- import { FileSystem } from './utils/fs';
6
- import { Options as ServiceOptions, Service } from './Service';
7
- import { Logger, Optional, StatsOptions, UnionCompiler, UnionStats, UnionWatching } from '/server/interface';
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,6 +0,0 @@
1
- /**
2
- * @module middleware
3
- */
4
- import { Middleware } from 'koa';
5
- import { Context } from './interface';
6
- export declare function middleware(context: Context): Middleware;
@@ -1,24 +0,0 @@
1
- /**
2
- * @module fs
3
- */
4
- import webpack from 'webpack';
5
- import fs, { Stats } from 'node:fs';
6
- import { GetProp } from '/server/interface';
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,9 +0,0 @@
1
- /**
2
- * @module hash
3
- */
4
- /**
5
- * @function generate
6
- * @description Generate a hash.
7
- * @param length The length of hash.
8
- */
9
- export declare function generate(length: number): string;
@@ -1,37 +0,0 @@
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,22 +0,0 @@
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 +0,0 @@
1
- /**
2
- * @module paths
3
- */
4
- import { UnionStats } from '/server/interface';
5
- type PathsItem = [outputPath: string, publicPath: string];
6
- export declare function getPaths(stats: UnionStats): PathsItem[];
7
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * @module ready
3
- */
4
- import { Callback, Context } from '/server/dev/interface';
5
- export declare function ready({ stats, callbacks }: Context, callback: Callback): void;
@@ -1,5 +0,0 @@
1
- /**
2
- * @module setupHooks
3
- */
4
- import { InitialContext } from '/server/dev/interface';
5
- export declare function setupHooks(context: InitialContext): void;
@@ -1,5 +0,0 @@
1
- /**
2
- * @module setupOutputFileSystem
3
- */
4
- import { InitialContext } from '/server/dev/interface';
5
- export declare function setupOutputFileSystem(context: InitialContext): void;
@@ -1,5 +0,0 @@
1
- /**
2
- * @module setupWatching
3
- */
4
- import { InitialContext } from '/server/dev/interface';
5
- export declare function setupWatching(context: InitialContext): void;
@@ -1,5 +0,0 @@
1
- /**
2
- * @module setupWriteToDisk
3
- */
4
- import { InitialContext } from '/server/dev/interface';
5
- export declare function setupWriteToDisk(context: InitialContext): void;
@@ -1,49 +0,0 @@
1
- /**
2
- * @module message
3
- */
4
- import webpack from 'webpack';
5
- import { GetProp } from '/server/interface';
6
- export interface Invalid {
7
- action: 'invalid';
8
- payload: {
9
- timestamp: number;
10
- path: string | null;
11
- };
12
- }
13
- export interface Progress {
14
- action: 'progress';
15
- payload: {
16
- status: string;
17
- messages: string[];
18
- percentage: number;
19
- };
20
- }
21
- export interface Hash {
22
- action: 'hash';
23
- payload: {
24
- hash: string;
25
- timestamp: number;
26
- };
27
- }
28
- export interface Issues {
29
- action: 'issues';
30
- payload: {
31
- timestamp: number;
32
- errors: webpack.StatsError[];
33
- warnings: webpack.StatsError[];
34
- };
35
- }
36
- export interface Ok {
37
- action: 'ok';
38
- payload: {
39
- timestamp: number;
40
- };
41
- }
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;
@@ -1,11 +0,0 @@
1
- /**
2
- * @module Socket
3
- */
4
- import { Context } from 'koa';
5
- import { UnionCompiler } from '/server/interface';
6
- import { Options } from './interface';
7
- export declare class Socket {
8
- #private;
9
- constructor(compiler: UnionCompiler, options?: Options);
10
- upgrade(context: Context): boolean;
11
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * @module index
3
- */
4
- import { Middleware } from 'koa';
5
- import { Options } from './interface';
6
- import { UnionCompiler } from '/server/interface';
7
- export { Options };
8
- export declare function hot(compiler: UnionCompiler, options?: Options): Middleware;
@@ -1,22 +0,0 @@
1
- /**
2
- * @module interface
3
- */
4
- import WebSocket from 'ws';
5
- import webpack from 'webpack';
6
- import { RequiredKeys } from '/server/interface';
7
- export interface Options {
8
- hmr?: boolean;
9
- path?: string;
10
- wss?: boolean;
11
- reload?: boolean;
12
- overlay?: boolean;
13
- progress?: boolean;
14
- }
15
- export type Clients = Set<WebSocket>;
16
- export interface CompilerContext {
17
- percentage: number;
18
- readonly uuid: string;
19
- readonly clients: Clients;
20
- stats: Required<webpack.StatsCompilation> | null;
21
- }
22
- export type NormalizedOptions = RequiredKeys<Options, 'hmr' | 'path' | 'reload' | 'overlay' | 'progress'>;
@@ -1,12 +0,0 @@
1
- /**
2
- * @module utils
3
- */
4
- import webpack from 'webpack';
5
- import { Context } from 'koa';
6
- import { NormalizedOptions, Options } from './interface';
7
- export declare const BASE_URL = 'wss://127.0.0.1';
8
- export declare function isUpgradable({ request }: Context): boolean;
9
- export declare function getOptions(options?: Options): NormalizedOptions;
10
- export declare function hasIssues<T>(issues: ArrayLike<T> | undefined): boolean;
11
- export declare function getStatsOptions(compiler: webpack.Compiler): webpack.StatsOptions;
12
- export declare function getTimestamp({ builtAt, children }: webpack.StatsCompilation): number;
@@ -1,17 +0,0 @@
1
- /**
2
- * @module index
3
- */
4
- import { Middleware } from 'koa';
5
- import { UnionCompiler } from './interface';
6
- import { Options as HotOptions } from './hot';
7
- import { Expose, Options as DevOptions } from './dev';
8
- export type Options = DevOptions & {
9
- hot?: HotOptions | false;
10
- };
11
- /**
12
- * @function server
13
- * @description Create koa dev server middleware.
14
- * @param compiler The rspack compiler instance.
15
- * @param options Options.
16
- */
17
- export declare function server(compiler: UnionCompiler, options?: Options): Middleware & Expose;
@@ -1,14 +0,0 @@
1
- /**
2
- * @module interface
3
- */
4
- import webpack from 'webpack';
5
- export type UnionStats = webpack.Stats | webpack.MultiStats;
6
- export type GetProp<T, P extends keyof T> = NonNullable<T[P]>;
7
- export type StatsOptions = GetProp<webpack.Configuration, 'stats'>;
8
- export type UnionCompiler = webpack.Compiler | webpack.MultiCompiler;
9
- export type RequiredKeys<T, K extends keyof T> = T & {
10
- [P in K]-?: T[P];
11
- };
12
- export type Logger = ReturnType<GetProp<webpack.Compiler, 'getInfrastructureLogger'>>;
13
- export type UnionWatching = webpack.Watching | ReturnType<GetProp<webpack.MultiCompiler, 'watch'>>;
14
- export type Optional<T extends object, K extends keyof T = keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
@@ -1,7 +0,0 @@
1
- /**
2
- * @module schema
3
- */
4
- import { validate } from 'schema-utils';
5
- type Schema = Parameters<typeof validate>[0];
6
- export declare const schema: Schema;
7
- export {};
@@ -1,11 +0,0 @@
1
- /**
2
- * @module utils
3
- */
4
- import webpack from 'webpack';
5
- import { UnionCompiler } from './interface';
6
- export declare const PLUGIN_NAME: string;
7
- export declare function isString(value: unknown): value is string;
8
- export declare function isBoolean(value: unknown): value is boolean;
9
- export declare function isFunction(value: unknown): value is Function;
10
- export declare function getCompilers(compiler: UnionCompiler): webpack.Compiler[];
11
- export declare function isMultiCompiler(compiler: UnionCompiler): compiler is webpack.MultiCompiler;