Skip to content

Commit

Permalink
feat(shebang): add support for env's split-string option (#195)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
dudeofawesome authored and aladdin-add committed Mar 6, 2024
1 parent 427b0d6 commit 45f9011
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rules/hashbang.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 45f9011

Please sign in to comment.