diff options
Diffstat (limited to 'node_modules/browserslist/node.js')
| -rw-r--r-- | node_modules/browserslist/node.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/node_modules/browserslist/node.js b/node_modules/browserslist/node.js index 100ded66..a935371d 100644 --- a/node_modules/browserslist/node.js +++ b/node_modules/browserslist/node.js @@ -7,7 +7,7 @@ var BrowserslistError = require('./error') var IS_SECTION = /^\s*\[(.+)]\s*$/ var CONFIG_PATTERN = /^browserslist-config-/ -var SCOPED_CONFIG__PATTERN = /@[^/]+\/browserslist-config(-|$|\/)/ +var SCOPED_CONFIG__PATTERN = /@[^/]+(?:\/[^/]+)?\/browserslist-config(?:-|$|\/)/ var TIME_TO_UPDATE_CANIUSE = 6 * 30 * 24 * 60 * 60 * 1000 var FORMAT = 'Browserslist config should be a string or an array ' + @@ -50,12 +50,22 @@ function eachParent(file, callback) { var dir = isFile(file) ? path.dirname(file) : file var loc = path.resolve(dir) do { + if (!pathInRoot(loc)) break; var result = callback(loc) if (typeof result !== 'undefined') return result } while (loc !== (loc = path.dirname(loc))) return undefined } +function pathInRoot(p) { + if (!process.env.BROWSERSLIST_ROOT_PATH) return true + var rootPath = path.resolve(process.env.BROWSERSLIST_ROOT_PATH); + if (path.relative(rootPath, p).substring(0,2) === '..') { + return false; + } + return true +} + function check(section) { if (Array.isArray(section)) { for (var i = 0; i < section.length; i++) { |
