From 6f7af727909f7dc527641543257f5b88e2bd5795 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sun, 7 Apr 2019 12:41:29 +0200 Subject: [PATCH 1/3] chore: future proof module hooks This removes the dependency from the Node.js internal `_resolveLookupPaths()` function and instead directly accesses the required as done in Node.js as well. --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ae8978c..d934da7 100644 --- a/index.js +++ b/index.js @@ -300,9 +300,11 @@ Rigger.prototype.plugin = function(match, settings, callback) { done: callback }; + var basePaths = ['.'].concat(mod._nodeModulePaths('.'), mod.globalPaths); + var paths = mod._nodeModulePaths(this.cwd) .concat(mod._nodeModulePaths(this.csd)) - .concat(mod._resolveLookupPaths(this.cwd)[1]); + .concat(basePaths); // add the module name to the paths paths = paths.map(function(basePath) { From 12727b2bbeefedf7a674b3737fb9ad3f61d9f350 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sun, 7 Apr 2019 12:42:55 +0200 Subject: [PATCH 2/3] chore: fix buffer deprecation warning This makes sure `Buffer.from` is used instead of `new Buffer` if available. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d934da7..d660b27 100644 --- a/index.js +++ b/index.js @@ -191,7 +191,7 @@ Rigger.prototype.end = function() { } else { // emit a buffer for the parsed lines - rigger.emit('data', new Buffer(content)); + rigger.emit('data', Buffer.from ? Buffer.from(content) : new Buffer(content)); rigger.emit('end'); } }); From 00435b2999974dbd8565073fa57b9fb2e8b3a908 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sun, 7 Apr 2019 12:44:03 +0200 Subject: [PATCH 3/3] chore: remove unused variables --- index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/index.js b/index.js index d660b27..d368c53 100644 --- a/index.js +++ b/index.js @@ -262,10 +262,8 @@ Rigger.prototype.write = function(data, all) { /* core action handlers */ Rigger.prototype.include = function(match, settings, callback) { - var rigger = this; var target; var targetExt; - var conversion; var templateText = match[3] .replace(regexes.trailingDot, '') @@ -295,7 +293,6 @@ Rigger.prototype.include = function(match, settings, callback) { Rigger.prototype.plugin = function(match, settings, callback) { var rigger = this; var pluginName = match[3]; - var plugin; var scope = { done: callback };