summaryrefslogtreecommitdiff
path: root/node_modules/browserslist/node.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-05-14 14:05:49 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-05-14 14:05:49 +0800
commit06823fbf1c2e763a5bf76c3990ca98fbbcd98691 (patch)
tree4280bece3888d12a022093bf1a9cd1b049393602 /node_modules/browserslist/node.js
parent1368909b3cd552dbb0d12d5863c597f5be46177d (diff)
updated node_modules
Diffstat (limited to 'node_modules/browserslist/node.js')
-rw-r--r--node_modules/browserslist/node.js12
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++) {