-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,303 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/LICENSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2013 Julian Gruber <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
203 changes: 203 additions & 0 deletions
203
node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
var balanced = require('balanced-match'); | ||
|
||
module.exports = expandTop; | ||
|
||
var escSlash = '\0SLASH'+Math.random()+'\0'; | ||
var escOpen = '\0OPEN'+Math.random()+'\0'; | ||
var escClose = '\0CLOSE'+Math.random()+'\0'; | ||
var escComma = '\0COMMA'+Math.random()+'\0'; | ||
var escPeriod = '\0PERIOD'+Math.random()+'\0'; | ||
|
||
function numeric(str) { | ||
return parseInt(str, 10) == str | ||
? parseInt(str, 10) | ||
: str.charCodeAt(0); | ||
} | ||
|
||
function escapeBraces(str) { | ||
return str.split('\\\\').join(escSlash) | ||
.split('\\{').join(escOpen) | ||
.split('\\}').join(escClose) | ||
.split('\\,').join(escComma) | ||
.split('\\.').join(escPeriod); | ||
} | ||
|
||
function unescapeBraces(str) { | ||
return str.split(escSlash).join('\\') | ||
.split(escOpen).join('{') | ||
.split(escClose).join('}') | ||
.split(escComma).join(',') | ||
.split(escPeriod).join('.'); | ||
} | ||
|
||
|
||
// Basically just str.split(","), but handling cases | ||
// where we have nested braced sections, which should be | ||
// treated as individual members, like {a,{b,c},d} | ||
function parseCommaParts(str) { | ||
if (!str) | ||
return ['']; | ||
|
||
var parts = []; | ||
var m = balanced('{', '}', str); | ||
|
||
if (!m) | ||
return str.split(','); | ||
|
||
var pre = m.pre; | ||
var body = m.body; | ||
var post = m.post; | ||
var p = pre.split(','); | ||
|
||
p[p.length-1] += '{' + body + '}'; | ||
var postParts = parseCommaParts(post); | ||
if (post.length) { | ||
p[p.length-1] += postParts.shift(); | ||
p.push.apply(p, postParts); | ||
} | ||
|
||
parts.push.apply(parts, p); | ||
|
||
return parts; | ||
} | ||
|
||
function expandTop(str) { | ||
if (!str) | ||
return []; | ||
|
||
// I don't know why Bash 4.3 does this, but it does. | ||
// Anything starting with {} will have the first two bytes preserved | ||
// but *only* at the top level, so {},a}b will not expand to anything, | ||
// but a{},b}c will be expanded to [a}c,abc]. | ||
// One could argue that this is a bug in Bash, but since the goal of | ||
// this module is to match Bash's rules, we escape a leading {} | ||
if (str.substr(0, 2) === '{}') { | ||
str = '\\{\\}' + str.substr(2); | ||
} | ||
|
||
return expand(escapeBraces(str), true).map(unescapeBraces); | ||
} | ||
|
||
function embrace(str) { | ||
return '{' + str + '}'; | ||
} | ||
function isPadded(el) { | ||
return /^-?0\d/.test(el); | ||
} | ||
|
||
function lte(i, y) { | ||
return i <= y; | ||
} | ||
function gte(i, y) { | ||
return i >= y; | ||
} | ||
|
||
function expand(str, isTop) { | ||
var expansions = []; | ||
|
||
var m = balanced('{', '}', str); | ||
if (!m) return [str]; | ||
|
||
// no need to expand pre, since it is guaranteed to be free of brace-sets | ||
var pre = m.pre; | ||
var post = m.post.length | ||
? expand(m.post, false) | ||
: ['']; | ||
|
||
if (/\$$/.test(m.pre)) { | ||
for (var k = 0; k < post.length; k++) { | ||
var expansion = pre+ '{' + m.body + '}' + post[k]; | ||
expansions.push(expansion); | ||
} | ||
} else { | ||
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); | ||
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); | ||
var isSequence = isNumericSequence || isAlphaSequence; | ||
var isOptions = m.body.indexOf(',') >= 0; | ||
if (!isSequence && !isOptions) { | ||
// {a},b} | ||
if (m.post.match(/,.*\}/)) { | ||
str = m.pre + '{' + m.body + escClose + m.post; | ||
return expand(str); | ||
} | ||
return [str]; | ||
} | ||
|
||
var n; | ||
if (isSequence) { | ||
n = m.body.split(/\.\./); | ||
} else { | ||
n = parseCommaParts(m.body); | ||
if (n.length === 1) { | ||
// x{{a,b}}y ==> x{a}y x{b}y | ||
n = expand(n[0], false).map(embrace); | ||
if (n.length === 1) { | ||
return post.map(function(p) { | ||
return m.pre + n[0] + p; | ||
}); | ||
} | ||
} | ||
} | ||
|
||
// at this point, n is the parts, and we know it's not a comma set | ||
// with a single entry. | ||
var N; | ||
|
||
if (isSequence) { | ||
var x = numeric(n[0]); | ||
var y = numeric(n[1]); | ||
var width = Math.max(n[0].length, n[1].length) | ||
var incr = n.length == 3 | ||
? Math.abs(numeric(n[2])) | ||
: 1; | ||
var test = lte; | ||
var reverse = y < x; | ||
if (reverse) { | ||
incr *= -1; | ||
test = gte; | ||
} | ||
var pad = n.some(isPadded); | ||
|
||
N = []; | ||
|
||
for (var i = x; test(i, y); i += incr) { | ||
var c; | ||
if (isAlphaSequence) { | ||
c = String.fromCharCode(i); | ||
if (c === '\\') | ||
c = ''; | ||
} else { | ||
c = String(i); | ||
if (pad) { | ||
var need = width - c.length; | ||
if (need > 0) { | ||
var z = new Array(need + 1).join('0'); | ||
if (i < 0) | ||
c = '-' + z + c.slice(1); | ||
else | ||
c = z + c; | ||
} | ||
} | ||
} | ||
N.push(c); | ||
} | ||
} else { | ||
N = []; | ||
|
||
for (var j = 0; j < n.length; j++) { | ||
N.push.apply(N, expand(n[j], false)); | ||
} | ||
} | ||
|
||
for (var j = 0; j < N.length; j++) { | ||
for (var k = 0; k < post.length; k++) { | ||
var expansion = pre + N[j] + post[k]; | ||
if (!isTop || isSequence || expansion) | ||
expansions.push(expansion); | ||
} | ||
} | ||
} | ||
|
||
return expansions; | ||
} | ||
|
46 changes: 46 additions & 0 deletions
46
node_modules/@npmcli/map-workspaces/node_modules/brace-expansion/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "brace-expansion", | ||
"description": "Brace expansion as known from sh/bash", | ||
"version": "2.0.1", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/juliangruber/brace-expansion.git" | ||
}, | ||
"homepage": "https://github.com/juliangruber/brace-expansion", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "tape test/*.js", | ||
"gentest": "bash test/generate.sh", | ||
"bench": "matcha test/perf/bench.js" | ||
}, | ||
"dependencies": { | ||
"balanced-match": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@c4312/matcha": "^1.3.1", | ||
"tape": "^4.6.0" | ||
}, | ||
"keywords": [], | ||
"author": { | ||
"name": "Julian Gruber", | ||
"email": "[email protected]", | ||
"url": "http://juliangruber.com" | ||
}, | ||
"license": "MIT", | ||
"testling": { | ||
"files": "test/*.js", | ||
"browsers": [ | ||
"ie/8..latest", | ||
"firefox/20..latest", | ||
"firefox/nightly", | ||
"chrome/25..latest", | ||
"chrome/canary", | ||
"opera/12..latest", | ||
"opera/next", | ||
"safari/5.1..latest", | ||
"ipad/6.0..latest", | ||
"iphone/6.0..latest", | ||
"android-browser/4.2..latest" | ||
] | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
node_modules/@npmcli/map-workspaces/node_modules/minimatch/LICENSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
The ISC License | ||
|
||
Copyright (c) 2011-2022 Isaac Z. Schlueter and Contributors | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR | ||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
4 changes: 4 additions & 0 deletions
4
node_modules/@npmcli/map-workspaces/node_modules/minimatch/lib/path.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const isWindows = typeof process === 'object' && | ||
process && | ||
process.platform === 'win32' | ||
module.exports = isWindows ? { sep: '\\' } : { sep: '/' } |
Oops, something went wrong.