webpack-dev-service 0.10.0 → 0.10.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 (57) hide show
  1. package/cjs/client/client.cjs +128 -0
  2. package/cjs/client/events.cjs +64 -0
  3. package/cjs/client/hot.cjs +111 -0
  4. package/cjs/client/index.cjs +15 -0
  5. package/cjs/client/main.cjs +59 -0
  6. package/cjs/client/ui/overlay.cjs +233 -0
  7. package/cjs/client/ui/progress.cjs +92 -0
  8. package/cjs/client/ui/utils.cjs +136 -0
  9. package/cjs/server/compose.cjs +56 -0
  10. package/cjs/server/dev/Service.cjs +269 -0
  11. package/cjs/server/dev/index.cjs +60 -0
  12. package/cjs/server/dev/middleware.cjs +96 -0
  13. package/cjs/server/dev/utils/fs.cjs +29 -0
  14. package/cjs/server/dev/utils/hash.cjs +46 -0
  15. package/cjs/server/dev/utils/http.cjs +227 -0
  16. package/cjs/server/dev/utils/path.cjs +46 -0
  17. package/cjs/server/dev/utils/paths.cjs +59 -0
  18. package/cjs/server/dev/utils/ready.cjs +23 -0
  19. package/cjs/server/dev/utils/setupHooks.cjs +106 -0
  20. package/cjs/server/dev/utils/setupOutputFileSystem.cjs +31 -0
  21. package/cjs/server/dev/utils/setupWatching.cjs +43 -0
  22. package/cjs/server/dev/utils/setupWriteToDisk.cjs +54 -0
  23. package/cjs/server/hot/Socket.cjs +185 -0
  24. package/cjs/server/hot/index.cjs +34 -0
  25. package/cjs/server/hot/utils.cjs +100 -0
  26. package/cjs/server/index.cjs +1 -1
  27. package/cjs/server/schema.cjs +127 -0
  28. package/cjs/server/utils.cjs +45 -0
  29. package/esm/client/client.js +126 -0
  30. package/esm/client/events.js +60 -0
  31. package/esm/client/hot.js +106 -0
  32. package/esm/client/index.js +10 -0
  33. package/esm/client/main.js +57 -0
  34. package/esm/client/ui/overlay.js +231 -0
  35. package/esm/client/ui/progress.js +90 -0
  36. package/esm/client/ui/utils.js +123 -0
  37. package/esm/server/compose.js +54 -0
  38. package/esm/server/dev/Service.js +260 -0
  39. package/esm/server/dev/index.js +58 -0
  40. package/esm/server/dev/middleware.js +94 -0
  41. package/esm/server/dev/utils/fs.js +27 -0
  42. package/esm/server/dev/utils/hash.js +44 -0
  43. package/esm/server/dev/utils/http.js +216 -0
  44. package/esm/server/dev/utils/path.js +42 -0
  45. package/esm/server/dev/utils/paths.js +57 -0
  46. package/esm/server/dev/utils/ready.js +21 -0
  47. package/esm/server/dev/utils/setupHooks.js +98 -0
  48. package/esm/server/dev/utils/setupOutputFileSystem.js +29 -0
  49. package/esm/server/dev/utils/setupWatching.js +41 -0
  50. package/esm/server/dev/utils/setupWriteToDisk.js +52 -0
  51. package/esm/server/hot/Socket.js +176 -0
  52. package/esm/server/hot/index.js +32 -0
  53. package/esm/server/hot/utils.js +93 -0
  54. package/esm/server/index.js +37 -0
  55. package/esm/server/schema.js +125 -0
  56. package/esm/server/utils.js +37 -0
  57. package/package.json +4 -4
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @package webpack-dev-service
3
+ * @license MIT
4
+ * @version 0.10.1
5
+ * @author nuintun <nuintun@qq.com>
6
+ * @description A koa 2 middleware for webpack development and hot reloading.
7
+ * @see https://github.com/nuintun/webpack-dev-service#readme
8
+ */
9
+
10
+ /**
11
+ * @module schema
12
+ */
13
+ const schema = {
14
+ type: 'object',
15
+ properties: {
16
+ hot: {
17
+ description: 'Enable or disable HMR server.',
18
+ anyOf: [
19
+ {
20
+ type: 'boolean',
21
+ enum: [false]
22
+ },
23
+ {
24
+ type: 'object',
25
+ properties: {
26
+ hmr: {
27
+ type: 'boolean',
28
+ description: 'Enable or disable Hot Module Replacement.'
29
+ },
30
+ path: {
31
+ type: 'string',
32
+ description: 'Specify the path used by the HMR server.'
33
+ },
34
+ wss: {
35
+ type: 'boolean',
36
+ description: 'Use WebSockets Secure (wss://) for HMR instead of the default WebSocket (ws://).'
37
+ },
38
+ reload: {
39
+ type: 'boolean',
40
+ description: 'Control whether the full page should be reloaded when HMR failure.'
41
+ },
42
+ overlay: {
43
+ type: 'boolean',
44
+ description: 'Enable or disable an error overlay in the browser when there are compilation errors.'
45
+ },
46
+ progress: {
47
+ type: 'boolean',
48
+ description: 'Display a progress bar in the browser during the build process.'
49
+ }
50
+ },
51
+ additionalProperties: false
52
+ }
53
+ ]
54
+ },
55
+ ignore: {
56
+ instanceof: 'Function',
57
+ description: 'Function that determines if a file should be ignored.'
58
+ },
59
+ etag: {
60
+ type: 'boolean',
61
+ description: 'Enable or disable the ETag functionality for file serving.'
62
+ },
63
+ acceptRanges: {
64
+ type: 'boolean',
65
+ description: 'Indicate whether the server supports range requests for file resources.'
66
+ },
67
+ lastModified: {
68
+ type: 'boolean',
69
+ description: 'Enable or disable sending last modified headers for file resources.'
70
+ },
71
+ headers: {
72
+ description: 'Headers to serve with files.',
73
+ anyOf: [
74
+ {
75
+ type: 'object',
76
+ additionalProperties: {
77
+ anyOf: [
78
+ {
79
+ type: 'string'
80
+ },
81
+ {
82
+ type: 'array',
83
+ items: {
84
+ type: 'string'
85
+ }
86
+ }
87
+ ]
88
+ },
89
+ description: 'Headers object to serve with files.'
90
+ },
91
+ {
92
+ instanceof: 'Function',
93
+ description: 'Function that returns headers to serve with files.'
94
+ }
95
+ ]
96
+ },
97
+ fs: {
98
+ type: 'object',
99
+ description: 'The output file system used by the dev server.'
100
+ },
101
+ stats: {
102
+ type: 'object',
103
+ description: 'Options for the statistics output.'
104
+ },
105
+ writeToDisk: {
106
+ anyOf: [
107
+ {
108
+ type: 'boolean',
109
+ description: 'Enable or disable writing files to disk.'
110
+ },
111
+ {
112
+ instanceof: 'Function',
113
+ description: 'Function that determines if a file should be written to disk based on its target path.'
114
+ }
115
+ ]
116
+ },
117
+ onCompilerDone: {
118
+ instanceof: 'Function',
119
+ description: 'Callback function when the compiler is done, providing statistics and options.'
120
+ }
121
+ },
122
+ additionalProperties: false
123
+ };
124
+
125
+ export { schema };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @package webpack-dev-service
3
+ * @license MIT
4
+ * @version 0.10.1
5
+ * @author nuintun <nuintun@qq.com>
6
+ * @description A koa 2 middleware for webpack development and hot reloading.
7
+ * @see https://github.com/nuintun/webpack-dev-service#readme
8
+ */
9
+
10
+ /**
11
+ * @module utils
12
+ */
13
+ const { toString } = Object.prototype;
14
+ const PLUGIN_NAME = 'webpack-dev-service';
15
+ function isObject(value) {
16
+ return toString.call(value) === '[object Object]';
17
+ }
18
+ function isString(value) {
19
+ return toString.call(value) === '[object String]';
20
+ }
21
+ function isBoolean(value) {
22
+ return toString.call(value) === '[object Boolean]';
23
+ }
24
+ function isFunction(value) {
25
+ return typeof value === 'function';
26
+ }
27
+ function getCompilers(compiler) {
28
+ if (isMultiCompilerMode(compiler)) {
29
+ return compiler.compilers;
30
+ }
31
+ return [compiler];
32
+ }
33
+ function isMultiCompilerMode(compiler) {
34
+ return 'compilers' in compiler;
35
+ }
36
+
37
+ export { PLUGIN_NAME, getCompilers, isBoolean, isFunction, isMultiCompilerMode, isObject, isString };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack-dev-service",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "A koa 2 middleware for webpack development and hot reloading.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -33,9 +33,9 @@
33
33
  }
34
34
  },
35
35
  "files": [
36
- "types",
37
- "server",
38
- "client"
36
+ "cjs",
37
+ "esm",
38
+ "types"
39
39
  ],
40
40
  "engines": {
41
41
  "node": ">=18.0.0"