@amazon-codecatalyst/blueprints.blueprint
Advanced tools
Comparing version
@@ -13,6 +13,5 @@ exports.setopts = setopts | ||
var fs = require("fs") | ||
var path = require("path") | ||
var minimatch = require("minimatch") | ||
var isAbsolute = require("path").isAbsolute | ||
var isAbsolute = require("path-is-absolute") | ||
var Minimatch = minimatch.Minimatch | ||
@@ -61,8 +60,2 @@ | ||
self.windowsPathsNoEscape = !!options.windowsPathsNoEscape || | ||
options.allowWindowsEscape === false | ||
if (self.windowsPathsNoEscape) { | ||
pattern = pattern.replace(/\\/g, '/') | ||
} | ||
self.silent = !!options.silent | ||
@@ -87,3 +80,2 @@ self.pattern = pattern | ||
self.absolute = !!options.absolute | ||
self.fs = options.fs || fs | ||
@@ -100,3 +92,3 @@ self.maxLength = options.maxLength || Infinity | ||
if (!ownProp(options, "cwd")) | ||
self.cwd = path.resolve(cwd) | ||
self.cwd = cwd | ||
else { | ||
@@ -109,2 +101,4 @@ self.cwd = path.resolve(options.cwd) | ||
self.root = path.resolve(self.root) | ||
if (process.platform === "win32") | ||
self.root = self.root.replace(/\\/g, "/") | ||
@@ -114,10 +108,6 @@ // TODO: is an absolute `cwd` supposed to be resolved against `root`? | ||
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) | ||
if (process.platform === "win32") | ||
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") | ||
self.nomount = !!options.nomount | ||
if (process.platform === "win32") { | ||
self.root = self.root.replace(/\\/g, "/") | ||
self.cwd = self.cwd.replace(/\\/g, "/") | ||
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") | ||
} | ||
// disable comments and negation in Minimatch. | ||
@@ -124,0 +114,0 @@ // Note that they are not supported in Glob itself anyway. |
@@ -43,2 +43,3 @@ // Approach: | ||
var fs = require('fs') | ||
var rp = require('fs.realpath') | ||
@@ -51,3 +52,3 @@ var minimatch = require('minimatch') | ||
var assert = require('assert') | ||
var isAbsolute = require('path').isAbsolute | ||
var isAbsolute = require('path-is-absolute') | ||
var globSync = require('./sync.js') | ||
@@ -347,6 +348,3 @@ var common = require('./common.js') | ||
read = '.' | ||
else if (isAbsolute(prefix) || | ||
isAbsolute(pattern.map(function (p) { | ||
return typeof p === 'string' ? p : '[*]' | ||
}).join('/'))) { | ||
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { | ||
if (!prefix || !isAbsolute(prefix)) | ||
@@ -509,3 +507,3 @@ prefix = '/' + prefix | ||
if (lstatcb) | ||
self.fs.lstat(abs, lstatcb) | ||
fs.lstat(abs, lstatcb) | ||
@@ -551,3 +549,3 @@ function lstatcb_ (er, lstat) { | ||
var self = this | ||
self.fs.readdir(abs, readdirCb(this, abs, cb)) | ||
fs.readdir(abs, readdirCb(this, abs, cb)) | ||
} | ||
@@ -756,3 +754,3 @@ | ||
if (statcb) | ||
self.fs.lstat(abs, statcb) | ||
fs.lstat(abs, statcb) | ||
@@ -763,3 +761,3 @@ function lstatcb_ (er, lstat) { | ||
// the target does not exist, then treat it as a file. | ||
return self.fs.stat(abs, function (er, stat) { | ||
return fs.stat(abs, function (er, stat) { | ||
if (er) | ||
@@ -766,0 +764,0 @@ self._stat2(f, abs, null, lstat, cb) |
@@ -5,3 +5,3 @@ { | ||
"description": "a little globber", | ||
"version": "8.1.0", | ||
"version": "7.1.7", | ||
"repository": { | ||
@@ -18,3 +18,3 @@ "type": "git", | ||
"engines": { | ||
"node": ">=12" | ||
"node": "*" | ||
}, | ||
@@ -25,10 +25,10 @@ "dependencies": { | ||
"inherits": "2", | ||
"minimatch": "^5.0.1", | ||
"once": "^1.3.0" | ||
"minimatch": "^3.0.4", | ||
"once": "^1.3.0", | ||
"path-is-absolute": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"memfs": "^3.2.0", | ||
"mkdirp": "0", | ||
"rimraf": "^2.2.8", | ||
"tap": "^16.0.1", | ||
"tap": "^15.0.6", | ||
"tick": "0.0.6" | ||
@@ -39,6 +39,2 @@ }, | ||
"after": "test/zz-cleanup.js", | ||
"statements": 90, | ||
"branches": 90, | ||
"functions": 90, | ||
"lines": 90, | ||
"jobs": 1 | ||
@@ -45,0 +41,0 @@ }, |
@@ -213,22 +213,6 @@ # Glob | ||
* `cwd` The current working directory in which to search. Defaults | ||
to `process.cwd()`. This option is always coerced to use | ||
forward-slashes as a path separator, because it is not tested | ||
as a glob pattern, so there is no need to escape anything. | ||
to `process.cwd()`. | ||
* `root` The place where patterns starting with `/` will be mounted | ||
onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix | ||
systems, and `C:\` or some such on Windows.) This option is | ||
always coerced to use forward-slashes as a path separator, | ||
because it is not tested as a glob pattern, so there is no need | ||
to escape anything. | ||
* `windowsPathsNoEscape` Use `\\` as a path separator _only_, and | ||
_never_ as an escape character. If set, all `\\` characters | ||
are replaced with `/` in the pattern. Note that this makes it | ||
**impossible** to match against paths containing literal glob | ||
pattern characters, but allows matching with patterns constructed | ||
using `path.join()` and `path.resolve()` on Windows platforms, | ||
mimicking the (buggy!) behavior of Glob v7 and before on | ||
Windows. Please use with caution, and be mindful of [the caveat | ||
below about Windows paths](#windows). (For legacy reasons, | ||
this is also set if `allowWindowsEscape` is set to the exact | ||
value `false`.) | ||
systems, and `C:\` or some such on Windows.) | ||
* `dot` Include `.dot` files in normal matches and `globstar` matches. | ||
@@ -296,5 +280,2 @@ Note that an explicit dot in a portion of the pattern will always | ||
the `match` event. | ||
* `fs` File-system object with Node's `fs` API. By default, the built-in | ||
`fs` module will be used. Set to a volume provided by a library like | ||
`memfs` to avoid using the "real" file-system. | ||
@@ -353,7 +334,2 @@ ## Comparisons to other fnmatch/glob implementations | ||
To automatically coerce all `\` characters to `/` in pattern | ||
strings, **thus making it impossible to escape literal glob | ||
characters**, you may set the `windowsPathsNoEscape` option to | ||
`true`. | ||
## Race Conditions | ||
@@ -360,0 +336,0 @@ |
module.exports = globSync | ||
globSync.GlobSync = GlobSync | ||
var fs = require('fs') | ||
var rp = require('fs.realpath') | ||
@@ -11,3 +12,3 @@ var minimatch = require('minimatch') | ||
var assert = require('assert') | ||
var isAbsolute = require('path').isAbsolute | ||
var isAbsolute = require('path-is-absolute') | ||
var common = require('./common.js') | ||
@@ -52,3 +53,3 @@ var setopts = common.setopts | ||
GlobSync.prototype._finish = function () { | ||
assert.ok(this instanceof GlobSync) | ||
assert(this instanceof GlobSync) | ||
if (this.realpath) { | ||
@@ -77,3 +78,3 @@ var self = this | ||
GlobSync.prototype._process = function (pattern, index, inGlobStar) { | ||
assert.ok(this instanceof GlobSync) | ||
assert(this instanceof GlobSync) | ||
@@ -115,6 +116,3 @@ // Get the first [n] parts of pattern that are all strings. | ||
read = '.' | ||
else if (isAbsolute(prefix) || | ||
isAbsolute(pattern.map(function (p) { | ||
return typeof p === 'string' ? p : '[*]' | ||
}).join('/'))) { | ||
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { | ||
if (!prefix || !isAbsolute(prefix)) | ||
@@ -255,3 +253,3 @@ prefix = '/' + prefix | ||
try { | ||
lstat = this.fs.lstatSync(abs) | ||
lstat = fs.lstatSync(abs) | ||
} catch (er) { | ||
@@ -293,3 +291,3 @@ if (er.code === 'ENOENT') { | ||
try { | ||
return this._readdirEntries(abs, this.fs.readdirSync(abs)) | ||
return this._readdirEntries(abs, fs.readdirSync(abs)) | ||
} catch (er) { | ||
@@ -453,3 +451,3 @@ this._readdirError(abs, er) | ||
try { | ||
lstat = this.fs.lstatSync(abs) | ||
lstat = fs.lstatSync(abs) | ||
} catch (er) { | ||
@@ -464,3 +462,3 @@ if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { | ||
try { | ||
stat = this.fs.statSync(abs) | ||
stat = fs.statSync(abs) | ||
} catch (er) { | ||
@@ -467,0 +465,0 @@ stat = lstat |
@@ -78,3 +78,3 @@ { | ||
"homepage": "https://aws.amazon.com/", | ||
"version": "0.3.31", | ||
"version": "0.3.32", | ||
"jest": { | ||
@@ -81,0 +81,0 @@ "testMatch": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
499
0.2%12740887
0188485
-0.01%98
1.03%