From d9fbdb46b903ebf605eb93c098724aee44d078a6 Mon Sep 17 00:00:00 2001 From: Stephen Halliburton Date: Sat, 22 Jun 2019 14:35:59 -0400 Subject: [PATCH 1/4] Updated open package to fix critical NPM vulnerability --- package-lock.json | 21 +++++++++++++++++++++ package.json | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..67051dd --- /dev/null +++ b/package-lock.json @@ -0,0 +1,21 @@ +{ + "name": "open-browser-webpack-plugin", + "version": "0.0.5", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" + }, + "open": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/open/-/open-6.3.0.tgz", + "integrity": "sha512-6AHdrJxPvAXIowO/aIaeHZ8CeMdDf7qCyRNq8NwJpinmCdXhz+NZR7ie1Too94lpciCDsG+qHGO9Mt0svA4OqA==", + "requires": { + "is-wsl": "^1.1.0" + } + } + } +} diff --git a/package.json b/package.json index 00098a0..ffb5cbf 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "homepage": "https://github.com/baldore/webpack-open-plugin#readme", "dependencies": { - "open": "0.0.5" + "open": "^6.3.0" }, "devDependencies": { "webpack": "^1.12.1" From b5ea30fb2eadb719ef0266b6d9194cd764073929 Mon Sep 17 00:00:00 2001 From: Stephen Halliburton Date: Sat, 22 Jun 2019 14:41:04 -0400 Subject: [PATCH 2/4] Converted from webpack plugins to hooks --- index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 74396e7..57135ae 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -var open = require('open'); +var open = require("open"); /** * Creates a function that is restricted to invoking func once. @@ -14,7 +14,7 @@ function once(fn) { called = true; fn.apply(this, arguments); } - } + }; } /** @@ -28,7 +28,7 @@ function once(fn) { */ function OpenBrowserPlugin(options) { options || (options = {}); - this.url = options.url || 'http://localhost:8080'; + this.url = options.url || "http://localhost:8080"; this.delay = options.delay || 0; this.browser = options.browser; this.ignoreErrors = options.ignoreErrors; @@ -41,19 +41,19 @@ OpenBrowserPlugin.prototype.apply = function(compiler) { var browser = this.browser; var ignoreErrors = this.ignoreErrors; var executeOpen = once(function() { - setTimeout(function () { + setTimeout(function() { open(url, browser, function(err) { if (err) throw err; }); }, delay); - }) + }); - compiler.plugin('watch-run', function checkWatchingMode(watching, done) { + compiler.hooks("watch-run", function checkWatchingMode(watching, done) { isWatching = true; done(); }); - compiler.plugin('done', function doneCallback(stats) { + compiler.hooks("done", function doneCallback(stats) { if (isWatching && (!stats.hasErrors() || ignoreErrors)) { executeOpen(); } From 425c7d153d888a6e076118629462b7c2dff7dc73 Mon Sep 17 00:00:00 2001 From: Stephen Halliburton Date: Sat, 22 Jun 2019 14:43:15 -0400 Subject: [PATCH 3/4] Fixed webpack plugin hooks --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 57135ae..4971f54 100644 --- a/index.js +++ b/index.js @@ -34,7 +34,7 @@ function OpenBrowserPlugin(options) { this.ignoreErrors = options.ignoreErrors; } -OpenBrowserPlugin.prototype.apply = function(compiler) { +OpenBrowserPlugin.prototype.hooks = function(compiler) { var isWatching = false; var url = this.url; var delay = this.delay; @@ -48,12 +48,12 @@ OpenBrowserPlugin.prototype.apply = function(compiler) { }, delay); }); - compiler.hooks("watch-run", function checkWatchingMode(watching, done) { + compiler.plugin("watch-run", function checkWatchingMode(watching, done) { isWatching = true; done(); }); - compiler.hooks("done", function doneCallback(stats) { + compiler.plugin("done", function doneCallback(stats) { if (isWatching && (!stats.hasErrors() || ignoreErrors)) { executeOpen(); } From 321e05f76d4892d2b01bea7215d65a3379a860af Mon Sep 17 00:00:00 2001 From: Stephen Halliburton Date: Sat, 22 Jun 2019 14:44:19 -0400 Subject: [PATCH 4/4] Reverted until more research can be done on the deprecation solution --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 4971f54..0c423c5 100644 --- a/index.js +++ b/index.js @@ -34,7 +34,7 @@ function OpenBrowserPlugin(options) { this.ignoreErrors = options.ignoreErrors; } -OpenBrowserPlugin.prototype.hooks = function(compiler) { +OpenBrowserPlugin.prototype.apply = function(compiler) { var isWatching = false; var url = this.url; var delay = this.delay;