From 3a817bae494a44559bf871ac301b892c0f787ae1 Mon Sep 17 00:00:00 2001 From: Louis Orleans Date: Tue, 5 Mar 2024 01:24:36 -0800 Subject: [PATCH] feat(shebang): add support for env's split-string option (#195) * feat(shebang): add support for env's split-string option This is useful for passing arguments to node * feat(shebang): support all `env` options * feat(shebang): improve regex performance --- lib/rules/hashbang.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rules/hashbang.js b/lib/rules/hashbang.js index 0c776262..f3849545 100644 --- a/lib/rules/hashbang.js +++ b/lib/rules/hashbang.js @@ -13,7 +13,8 @@ const getNpmignore = require("../util/get-npmignore") const NODE_SHEBANG = "#!/usr/bin/env node\n" const SHEBANG_PATTERN = /^(#!.+?)?(\r)?\n/u -const NODE_SHEBANG_PATTERN = /^#!\/usr\/bin\/env(?: -\S+)*(?: [^\s=-]+=\S+)* node(?: [^\r\n]+?)?\n/u +const NODE_SHEBANG_PATTERN = +/^#!\/usr\/bin\/env(?: -\S+)*(?: [^\s=-]+=\S+)* node(?: [^\r\n]+?)?\n/u function simulateNodeResolutionAlgorithm(filePath, binField) { const possibilities = [filePath]