From 522e4c25e6693e31191b47fc5729b6aff9909ce3 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Sat, 24 Oct 2020 18:10:41 -0400 Subject: [PATCH] fix: shebang handling supported in Node v12 (#128) --- lib/source.js | 6 +++--- test/fixtures/shebang.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/source.js b/lib/source.js index c4233e63..e573d1b4 100644 --- a/lib/source.js +++ b/lib/source.js @@ -206,10 +206,10 @@ function originalPositionTryBoth (sourceMap, line, column) { return original } -// Not required since Node 13, see: https://github.com/nodejs/node/pull/27375 -const isPrerNode13 = /^v1[0-2]\./u.test(process.version) +// Not required since Node 12, see: https://github.com/nodejs/node/pull/27375 +const isPreNode12 = /^v1[0-1]\./u.test(process.version) function getShebangLength (source) { - if (isPrerNode13 && source.indexOf('#!') === 0) { + if (isPreNode12 && source.indexOf('#!') === 0) { const match = source.match(/(?#!.*)/) if (match) { return match.groups.shebang.length diff --git a/test/fixtures/shebang.js b/test/fixtures/shebang.js index 124f2e57..63355def 100644 --- a/test/fixtures/shebang.js +++ b/test/fixtures/shebang.js @@ -1,6 +1,6 @@ module.exports = { describe: 'shebang', - maxNodeVersion: 'v13.0.0', + maxNodeVersion: 'v12.0.0', coverageV8: { "scriptId": "56", "url": "./test/fixtures/scripts/shebang.js",