webpack-dev-server 3.6.0 → 3.8.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/CHANGELOG.md +56 -0
- package/bin/options.js +4 -1
- package/bin/webpack-dev-server.js +13 -20
- package/client/clients/BaseClient.js +27 -0
- package/client/clients/SockJSClient.js +74 -0
- package/client/clients/WebsocketClient.js +74 -0
- package/client/index.bundle.js +1 -1
- package/client/live.bundle.js +3 -3
- package/client/overlay.js +19 -22
- package/client/socket.js +9 -2
- package/client/sockjs.bundle.js +1 -1
- package/client/utils/createSocketUrl.js +7 -3
- package/client/utils/reloadApp.js +1 -1
- package/lib/Server.js +68 -71
- package/lib/options.json +32 -12
- package/lib/servers/SockJSServer.js +13 -3
- package/lib/servers/WebsocketServer.js +41 -4
- package/lib/utils/addEntries.js +49 -5
- package/lib/utils/createConfig.js +7 -2
- package/lib/utils/createLogger.js +1 -1
- package/lib/utils/findPort.js +17 -6
- package/lib/utils/getSocketClientPath.js +37 -0
- package/lib/utils/getSocketServerImplementation.js +8 -7
- package/lib/utils/getVersions.js +0 -2
- package/lib/utils/normalizeOptions.js +38 -0
- package/lib/utils/processOptions.js +16 -1
- package/lib/utils/routes.js +16 -30
- package/lib/utils/runBonjour.js +2 -3
- package/lib/utils/runOpen.js +10 -3
- package/lib/utils/setupExitSignals.js +3 -3
- package/lib/utils/tryParseInt.js +2 -0
- package/lib/utils/updateCompiler.js +2 -2
- package/package.json +42 -33
- package/lib/clients/BaseClient.js +0 -10
- package/lib/clients/SockJSClient.js +0 -33
- package/lib/clients/WebsocketClient.js +0 -5
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function getSocketClientPath(options) {
|
|
4
|
+
let ClientImplementation;
|
|
5
|
+
let clientImplFound = true;
|
|
6
|
+
switch (typeof options.transportMode.client) {
|
|
7
|
+
case 'string':
|
|
8
|
+
// could be 'sockjs', 'ws', or a path that should be required
|
|
9
|
+
if (options.transportMode.client === 'sockjs') {
|
|
10
|
+
ClientImplementation = require('../../client/clients/SockJSClient');
|
|
11
|
+
} else if (options.transportMode.client === 'ws') {
|
|
12
|
+
ClientImplementation = require('../../client/clients/WebsocketClient');
|
|
13
|
+
} else {
|
|
14
|
+
try {
|
|
15
|
+
// eslint-disable-next-line import/no-dynamic-require
|
|
16
|
+
ClientImplementation = require(options.transportMode.client);
|
|
17
|
+
} catch (e) {
|
|
18
|
+
clientImplFound = false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
break;
|
|
22
|
+
default:
|
|
23
|
+
clientImplFound = false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!clientImplFound) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
"transportMode.client must be a string denoting a default implementation (e.g. 'sockjs', 'ws') or a full path to " +
|
|
29
|
+
'a JS file which exports a class extending BaseClient (webpack-dev-server/client-src/clients/BaseClient) ' +
|
|
30
|
+
'via require.resolve(...)'
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return ClientImplementation.getClientPath(options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = getSocketClientPath;
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
function getSocketServerImplementation(options) {
|
|
4
4
|
let ServerImplementation;
|
|
5
5
|
let serverImplFound = true;
|
|
6
|
-
switch (typeof options.
|
|
6
|
+
switch (typeof options.transportMode.server) {
|
|
7
7
|
case 'string':
|
|
8
8
|
// could be 'sockjs', in the future 'ws', or a path that should be required
|
|
9
|
-
if (options.
|
|
10
|
-
// eslint-disable-next-line global-require
|
|
9
|
+
if (options.transportMode.server === 'sockjs') {
|
|
11
10
|
ServerImplementation = require('../servers/SockJSServer');
|
|
11
|
+
} else if (options.transportMode.server === 'ws') {
|
|
12
|
+
ServerImplementation = require('../servers/WebsocketServer');
|
|
12
13
|
} else {
|
|
13
14
|
try {
|
|
14
|
-
// eslint-disable-next-line
|
|
15
|
-
ServerImplementation = require(options.
|
|
15
|
+
// eslint-disable-next-line import/no-dynamic-require
|
|
16
|
+
ServerImplementation = require(options.transportMode.server);
|
|
16
17
|
} catch (e) {
|
|
17
18
|
serverImplFound = false;
|
|
18
19
|
}
|
|
@@ -21,7 +22,7 @@ function getSocketServerImplementation(options) {
|
|
|
21
22
|
case 'function':
|
|
22
23
|
// potentially do more checks here to confirm that the user implemented this properlly
|
|
23
24
|
// since errors could be difficult to understand
|
|
24
|
-
ServerImplementation = options.
|
|
25
|
+
ServerImplementation = options.transportMode.server;
|
|
25
26
|
break;
|
|
26
27
|
default:
|
|
27
28
|
serverImplFound = false;
|
|
@@ -29,7 +30,7 @@ function getSocketServerImplementation(options) {
|
|
|
29
30
|
|
|
30
31
|
if (!serverImplFound) {
|
|
31
32
|
throw new Error(
|
|
32
|
-
"
|
|
33
|
+
"transportMode.server must be a string denoting a default implementation (e.g. 'sockjs', 'ws'), a full path to " +
|
|
33
34
|
'a JS file which exports a class extending BaseServer (webpack-dev-server/lib/servers/BaseServer) ' +
|
|
34
35
|
'via require.resolve(...), or the class itself which extends BaseServer'
|
|
35
36
|
);
|
package/lib/utils/getVersions.js
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable
|
|
4
|
+
no-undefined
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
function normalizeOptions(compiler, options) {
|
|
8
|
+
// Setup default value
|
|
9
|
+
options.contentBase =
|
|
10
|
+
options.contentBase !== undefined ? options.contentBase : process.cwd();
|
|
11
|
+
|
|
12
|
+
// normalize transportMode option
|
|
13
|
+
if (options.transportMode === undefined) {
|
|
14
|
+
options.transportMode = {
|
|
15
|
+
server: 'sockjs',
|
|
16
|
+
client: 'sockjs',
|
|
17
|
+
};
|
|
18
|
+
} else {
|
|
19
|
+
switch (typeof options.transportMode) {
|
|
20
|
+
case 'string':
|
|
21
|
+
options.transportMode = {
|
|
22
|
+
server: options.transportMode,
|
|
23
|
+
client: options.transportMode,
|
|
24
|
+
};
|
|
25
|
+
break;
|
|
26
|
+
// if not a string, it is an object
|
|
27
|
+
default:
|
|
28
|
+
options.transportMode.server = options.transportMode.server || 'sockjs';
|
|
29
|
+
options.transportMode.client = options.transportMode.client || 'sockjs';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!options.watchOptions) {
|
|
34
|
+
options.watchOptions = {};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = normalizeOptions;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const createConfig = require('./createConfig');
|
|
4
4
|
const defaultPort = require('./defaultPort');
|
|
5
|
+
const findPort = require('./findPort');
|
|
5
6
|
|
|
6
7
|
function processOptions(config, argv, callback) {
|
|
7
8
|
// processOptions {Promise}
|
|
@@ -23,7 +24,21 @@ function processOptions(config, argv, callback) {
|
|
|
23
24
|
// we should use portfinder.
|
|
24
25
|
const options = createConfig(config, argv, { port: defaultPort });
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
if (options.socket) {
|
|
28
|
+
callback(config, options);
|
|
29
|
+
} else {
|
|
30
|
+
findPort(options.port)
|
|
31
|
+
.then((port) => {
|
|
32
|
+
options.port = port;
|
|
33
|
+
callback(config, options);
|
|
34
|
+
})
|
|
35
|
+
.catch((err) => {
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
37
|
+
console.error(err.stack || err);
|
|
38
|
+
// eslint-disable-next-line no-process-exit
|
|
39
|
+
process.exit(1);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
27
42
|
}
|
|
28
43
|
|
|
29
44
|
module.exports = processOptions;
|
package/lib/utils/routes.js
CHANGED
|
@@ -3,37 +3,31 @@
|
|
|
3
3
|
const { createReadStream } = require('fs');
|
|
4
4
|
const { join } = require('path');
|
|
5
5
|
|
|
6
|
+
const clientBasePath = join(__dirname, '..', '..', 'client');
|
|
7
|
+
|
|
6
8
|
function routes(app, middleware, options) {
|
|
7
9
|
app.get('/__webpack_dev_server__/live.bundle.js', (req, res) => {
|
|
8
10
|
res.setHeader('Content-Type', 'application/javascript');
|
|
9
11
|
|
|
10
|
-
createReadStream(
|
|
11
|
-
join(__dirname, '..', '..', 'client', 'live.bundle.js')
|
|
12
|
-
).pipe(res);
|
|
12
|
+
createReadStream(join(clientBasePath, 'live.bundle.js')).pipe(res);
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
app.get('/__webpack_dev_server__/sockjs.bundle.js', (req, res) => {
|
|
16
16
|
res.setHeader('Content-Type', 'application/javascript');
|
|
17
17
|
|
|
18
|
-
createReadStream(
|
|
19
|
-
join(__dirname, '..', '..', 'client', 'sockjs.bundle.js')
|
|
20
|
-
).pipe(res);
|
|
18
|
+
createReadStream(join(clientBasePath, 'sockjs.bundle.js')).pipe(res);
|
|
21
19
|
});
|
|
22
20
|
|
|
23
21
|
app.get('/webpack-dev-server.js', (req, res) => {
|
|
24
22
|
res.setHeader('Content-Type', 'application/javascript');
|
|
25
23
|
|
|
26
|
-
createReadStream(
|
|
27
|
-
join(__dirname, '..', '..', 'client', 'index.bundle.js')
|
|
28
|
-
).pipe(res);
|
|
24
|
+
createReadStream(join(clientBasePath, 'index.bundle.js')).pipe(res);
|
|
29
25
|
});
|
|
30
26
|
|
|
31
27
|
app.get('/webpack-dev-server/*', (req, res) => {
|
|
32
28
|
res.setHeader('Content-Type', 'text/html');
|
|
33
29
|
|
|
34
|
-
createReadStream(join(
|
|
35
|
-
res
|
|
36
|
-
);
|
|
30
|
+
createReadStream(join(clientBasePath, 'live.html')).pipe(res);
|
|
37
31
|
});
|
|
38
32
|
|
|
39
33
|
app.get('/webpack-dev-server', (req, res) => {
|
|
@@ -59,35 +53,27 @@ function routes(app, middleware, options) {
|
|
|
59
53
|
const p = `${basePath}/${item}`;
|
|
60
54
|
|
|
61
55
|
if (filesystem.statSync(p).isFile()) {
|
|
62
|
-
res.write(
|
|
63
|
-
res.write(baseUrl + item);
|
|
64
|
-
res.write('">');
|
|
65
|
-
res.write(item);
|
|
66
|
-
res.write('</a></li>');
|
|
56
|
+
res.write(`<li><a href="${baseUrl + item}">${item}</a></li>`);
|
|
67
57
|
|
|
68
58
|
if (/\.js$/.test(item)) {
|
|
69
59
|
const html = item.substr(0, item.length - 3);
|
|
60
|
+
const containerHref = baseUrl + html;
|
|
70
61
|
|
|
71
|
-
|
|
72
|
-
res.write(baseUrl + html);
|
|
73
|
-
res.write('">');
|
|
74
|
-
res.write(html);
|
|
75
|
-
res.write('</a> (magic html for ');
|
|
76
|
-
res.write(item);
|
|
77
|
-
res.write(') (<a href="');
|
|
78
|
-
res.write(
|
|
62
|
+
const magicHtmlHref =
|
|
79
63
|
baseUrl.replace(
|
|
80
64
|
// eslint-disable-next-line
|
|
81
65
|
/(^(https?:\/\/[^\/]+)?\/)/,
|
|
82
66
|
'$1webpack-dev-server/'
|
|
83
|
-
) + html
|
|
67
|
+
) + html;
|
|
68
|
+
|
|
69
|
+
res.write(
|
|
70
|
+
`<li><a href="${containerHref}">${html}</a>` +
|
|
71
|
+
` (magic html for ${item}) (<a href="${magicHtmlHref}">webpack-dev-server</a>)` +
|
|
72
|
+
`</li>`
|
|
84
73
|
);
|
|
85
|
-
res.write('">webpack-dev-server</a>)</li>');
|
|
86
74
|
}
|
|
87
75
|
} else {
|
|
88
|
-
res.write(
|
|
89
|
-
res.write(item);
|
|
90
|
-
res.write('<br>');
|
|
76
|
+
res.write(`<li>${item}<br>`);
|
|
91
77
|
|
|
92
78
|
writeDirectory(`${baseUrl + item}/`, p);
|
|
93
79
|
|
package/lib/utils/runBonjour.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function runBonjour(
|
|
4
|
-
// eslint-disable-next-line global-require
|
|
3
|
+
function runBonjour({ port }) {
|
|
5
4
|
const bonjour = require('bonjour')();
|
|
6
5
|
|
|
7
6
|
bonjour.publish({
|
|
8
7
|
name: 'Webpack Dev Server',
|
|
9
|
-
port
|
|
8
|
+
port,
|
|
10
9
|
type: 'http',
|
|
11
10
|
subtypes: ['webpack'],
|
|
12
11
|
});
|
package/lib/utils/runOpen.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const open = require('opn');
|
|
4
|
+
const isAbsoluteUrl = require('is-absolute-url');
|
|
4
5
|
|
|
5
6
|
function runOpen(uri, options, log) {
|
|
6
|
-
|
|
7
|
+
// https://github.com/webpack/webpack-dev-server/issues/1990
|
|
8
|
+
let openOptions = { wait: false };
|
|
7
9
|
let openMessage = 'Unable to open browser';
|
|
8
10
|
|
|
9
11
|
if (typeof options.open === 'string') {
|
|
10
|
-
openOptions = { app: options.open };
|
|
12
|
+
openOptions = Object.assign({}, openOptions, { app: options.open });
|
|
11
13
|
openMessage += `: ${options.open}`;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
const pageUrl =
|
|
17
|
+
options.openPage && isAbsoluteUrl(options.openPage)
|
|
18
|
+
? options.openPage
|
|
19
|
+
: `${uri}${options.openPage || ''}`;
|
|
20
|
+
|
|
21
|
+
return open(pageUrl, openOptions).catch(() => {
|
|
15
22
|
log.warn(
|
|
16
23
|
`${openMessage}. If you are running in a headless environment, please do not use the --open flag`
|
|
17
24
|
);
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
const signals = ['SIGINT', 'SIGTERM'];
|
|
4
4
|
|
|
5
|
-
function setupExitSignals(
|
|
5
|
+
function setupExitSignals(serverData) {
|
|
6
6
|
signals.forEach((signal) => {
|
|
7
7
|
process.on(signal, () => {
|
|
8
|
-
if (server) {
|
|
9
|
-
server.close(() => {
|
|
8
|
+
if (serverData.server) {
|
|
9
|
+
serverData.server.close(() => {
|
|
10
10
|
// eslint-disable-next-line no-process-exit
|
|
11
11
|
process.exit();
|
|
12
12
|
});
|
package/lib/utils/tryParseInt.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
const webpack = require('webpack');
|
|
8
8
|
const addEntries = require('./addEntries');
|
|
9
|
-
const
|
|
9
|
+
const getSocketClientPath = require('./getSocketClientPath');
|
|
10
10
|
|
|
11
11
|
function updateCompiler(compiler, options) {
|
|
12
12
|
if (options.inline !== false) {
|
|
@@ -51,7 +51,7 @@ function updateCompiler(compiler, options) {
|
|
|
51
51
|
compiler.hooks.entryOption.call(config.context, config.entry);
|
|
52
52
|
|
|
53
53
|
const providePlugin = new webpack.ProvidePlugin({
|
|
54
|
-
__webpack_dev_server_client__:
|
|
54
|
+
__webpack_dev_server_client__: getSocketClientPath(options),
|
|
55
55
|
});
|
|
56
56
|
providePlugin.apply(compiler);
|
|
57
57
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack-dev-server",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Serves a webpack app. Updates the browser on changes.",
|
|
5
5
|
"bin": "bin/webpack-dev-server.js",
|
|
6
6
|
"main": "lib/Server.js",
|
|
@@ -17,19 +17,22 @@
|
|
|
17
17
|
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --list-different",
|
|
18
18
|
"lint:js": "eslint . --cache",
|
|
19
19
|
"lint": "npm-run-all -l -p \"lint:**\"",
|
|
20
|
+
"lint:type": "tsc --noEmit",
|
|
20
21
|
"commitlint": "commitlint --from=master",
|
|
21
22
|
"security": "npm audit",
|
|
22
|
-
"test:only": "jest --
|
|
23
|
+
"test:only": "jest --forceExit",
|
|
23
24
|
"test:coverage": "npm run test:only -- --coverage",
|
|
24
25
|
"test:watch": "npm run test:coverage --watch",
|
|
25
26
|
"test": "npm run test:coverage",
|
|
26
27
|
"pretest": "npm run lint",
|
|
27
|
-
"prepare": "rimraf ./ssl/*.pem && npm run
|
|
28
|
-
"
|
|
29
|
-
"build:
|
|
30
|
-
"build:
|
|
31
|
-
"build:
|
|
32
|
-
"
|
|
28
|
+
"prepare": "rimraf ./ssl/*.pem && npm run build:client",
|
|
29
|
+
"build:client:default": "babel client-src/default --out-dir client --ignore \"./client-src/default/*.config.js\"",
|
|
30
|
+
"build:client:clients": "babel client-src/clients --out-dir client/clients",
|
|
31
|
+
"build:client:index": "webpack ./client-src/default/index.js -o client/index.bundle.js --color --config client-src/default/webpack.config.js",
|
|
32
|
+
"build:client:live": "webpack ./client-src/live/index.js -o client/live.bundle.js --color --config client-src/live/webpack.config.js",
|
|
33
|
+
"build:client:sockjs": "webpack ./client-src/sockjs/index.js -o client/sockjs.bundle.js --color --config client-src/sockjs/webpack.config.js",
|
|
34
|
+
"build:client": "rimraf ./client/* && npm-run-all -s -l -p \"build:client:**\"",
|
|
35
|
+
"webpack-dev-server": "node examples/run-example.js",
|
|
33
36
|
"release": "standard-version"
|
|
34
37
|
},
|
|
35
38
|
"dependencies": {
|
|
@@ -46,63 +49,69 @@
|
|
|
46
49
|
"import-local": "^2.0.0",
|
|
47
50
|
"internal-ip": "^4.3.0",
|
|
48
51
|
"ip": "^1.1.5",
|
|
52
|
+
"is-absolute-url": "^3.0.0",
|
|
49
53
|
"killable": "^1.0.1",
|
|
50
|
-
"loglevel": "^1.6.
|
|
54
|
+
"loglevel": "^1.6.3",
|
|
51
55
|
"opn": "^5.5.0",
|
|
52
|
-
"
|
|
56
|
+
"p-retry": "^3.0.1",
|
|
57
|
+
"portfinder": "^1.0.21",
|
|
53
58
|
"schema-utils": "^1.0.0",
|
|
54
59
|
"selfsigned": "^1.10.4",
|
|
55
|
-
"semver": "^6.
|
|
60
|
+
"semver": "^6.3.0",
|
|
56
61
|
"serve-index": "^1.9.1",
|
|
57
62
|
"sockjs": "0.3.19",
|
|
58
63
|
"sockjs-client": "1.3.0",
|
|
59
|
-
"spdy": "^4.0.
|
|
64
|
+
"spdy": "^4.0.1",
|
|
60
65
|
"strip-ansi": "^3.0.1",
|
|
61
66
|
"supports-color": "^6.1.0",
|
|
62
67
|
"url": "^0.11.0",
|
|
63
68
|
"webpack-dev-middleware": "^3.7.0",
|
|
64
69
|
"webpack-log": "^2.0.0",
|
|
70
|
+
"ws": "^6.2.1",
|
|
65
71
|
"yargs": "12.0.5"
|
|
66
72
|
},
|
|
67
73
|
"devDependencies": {
|
|
68
|
-
"@babel/cli": "^7.
|
|
69
|
-
"@babel/core": "^7.
|
|
70
|
-
"@babel/
|
|
71
|
-
"@
|
|
72
|
-
"@
|
|
74
|
+
"@babel/cli": "^7.5.5",
|
|
75
|
+
"@babel/core": "^7.5.5",
|
|
76
|
+
"@babel/plugin-transform-runtime": "^7.5.5",
|
|
77
|
+
"@babel/preset-env": "^7.5.5",
|
|
78
|
+
"@babel/runtime": "^7.5.5",
|
|
79
|
+
"@commitlint/cli": "^8.1.0",
|
|
80
|
+
"@commitlint/config-conventional": "^8.1.0",
|
|
73
81
|
"babel-loader": "^8.0.6",
|
|
74
82
|
"body-parser": "^1.19.0",
|
|
75
83
|
"commitlint-azure-pipelines-cli": "^1.0.2",
|
|
76
|
-
"copy-webpack-plugin": "^5.0.
|
|
84
|
+
"copy-webpack-plugin": "^5.0.4",
|
|
77
85
|
"css-loader": "^2.1.1",
|
|
78
|
-
"eslint": "^
|
|
79
|
-
"eslint-config-prettier": "^
|
|
86
|
+
"eslint": "^6.1.0",
|
|
87
|
+
"eslint-config-prettier": "^6.0.0",
|
|
80
88
|
"eslint-config-webpack": "^1.2.5",
|
|
81
|
-
"eslint-plugin-import": "^2.
|
|
89
|
+
"eslint-plugin-import": "^2.18.2",
|
|
82
90
|
"execa": "^1.0.0",
|
|
83
91
|
"file-loader": "^3.0.1",
|
|
84
92
|
"html-loader": "^0.5.5",
|
|
85
93
|
"html-webpack-plugin": "^3.2.0",
|
|
86
|
-
"husky": "^
|
|
94
|
+
"husky": "^3.0.3",
|
|
87
95
|
"jest": "^24.8.0",
|
|
88
|
-
"jest-junit": "^
|
|
96
|
+
"jest-junit": "^7.0.0",
|
|
89
97
|
"jquery": "^3.4.1",
|
|
90
98
|
"less": "^3.9.0",
|
|
91
99
|
"less-loader": "^5.0.0",
|
|
92
|
-
"lint-staged": "^
|
|
93
|
-
"marked": "^0.
|
|
94
|
-
"memfs": "^2.15.
|
|
100
|
+
"lint-staged": "^9.2.1",
|
|
101
|
+
"marked": "^0.7.0",
|
|
102
|
+
"memfs": "^2.15.5",
|
|
95
103
|
"npm-run-all": "^4.1.5",
|
|
96
|
-
"prettier": "^1.
|
|
97
|
-
"puppeteer": "^1.
|
|
104
|
+
"prettier": "^1.18.2",
|
|
105
|
+
"puppeteer": "^1.19.0",
|
|
98
106
|
"rimraf": "^2.6.3",
|
|
99
|
-
"standard-version": "^
|
|
100
|
-
"style-loader": "^0.
|
|
107
|
+
"standard-version": "^7.0.0",
|
|
108
|
+
"style-loader": "^1.0.0",
|
|
101
109
|
"supertest": "^4.0.2",
|
|
110
|
+
"tcp-port-used": "^1.0.1",
|
|
111
|
+
"typescript": "^3.5.3",
|
|
102
112
|
"url-loader": "^1.1.2",
|
|
103
|
-
"webpack": "^4.
|
|
104
|
-
"webpack-cli": "^3.3.
|
|
105
|
-
"ws": "^6.2.1"
|
|
113
|
+
"webpack": "^4.39.1",
|
|
114
|
+
"webpack-cli": "^3.3.6"
|
|
106
115
|
},
|
|
107
116
|
"peerDependencies": {
|
|
108
117
|
"webpack": "^4.0.0"
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable
|
|
4
|
-
no-unused-vars
|
|
5
|
-
*/
|
|
6
|
-
const SockJS = require('sockjs-client/dist/sockjs');
|
|
7
|
-
const BaseClient = require('./BaseClient');
|
|
8
|
-
|
|
9
|
-
module.exports = class SockJSClient extends BaseClient {
|
|
10
|
-
constructor(url) {
|
|
11
|
-
super();
|
|
12
|
-
this.sock = new SockJS(url);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
static getClientPath(options) {
|
|
16
|
-
return require.resolve('./SockJSClient');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
onOpen(f) {
|
|
20
|
-
this.sock.onopen = f;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
onClose(f) {
|
|
24
|
-
this.sock.onclose = f;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// call f with the message string as the first argument
|
|
28
|
-
onMessage(f) {
|
|
29
|
-
this.sock.onmessage = (e) => {
|
|
30
|
-
f(e.data);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
};
|