Socket
Socket
Sign inDemoInstall

glob

Package Overview
Dependencies
Maintainers
1
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glob - npm Package Compare versions

Comparing version 10.4.0 to 10.4.1

31

dist/commonjs/glob.js

@@ -11,6 +11,6 @@ "use strict";

// so we default to case-sensitive, / separators
const defaultPlatform = typeof process === 'object' &&
const defaultPlatform = (typeof process === 'object' &&
process &&
typeof process.platform === 'string'
? process.platform
typeof process.platform === 'string') ?
process.platform
: 'linux';

@@ -128,8 +128,5 @@ /**

else {
const Scurry = opts.platform === 'win32'
? path_scurry_1.PathScurryWin32
: opts.platform === 'darwin'
? path_scurry_1.PathScurryDarwin
: opts.platform
? path_scurry_1.PathScurryPosix
const Scurry = opts.platform === 'win32' ? path_scurry_1.PathScurryWin32
: opts.platform === 'darwin' ? path_scurry_1.PathScurryDarwin
: opts.platform ? path_scurry_1.PathScurryPosix
: path_scurry_1.PathScurry;

@@ -186,4 +183,4 @@ this.scurry = new Scurry(this.cwd, {

...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,

@@ -200,4 +197,4 @@ platform: this.platform,

...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,

@@ -213,4 +210,4 @@ platform: this.platform,

...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,

@@ -225,4 +222,4 @@ platform: this.platform,

...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,

@@ -229,0 +226,0 @@ platform: this.platform,

@@ -10,6 +10,6 @@ "use strict";

const pattern_js_1 = require("./pattern.js");
const defaultPlatform = typeof process === 'object' &&
const defaultPlatform = (typeof process === 'object' &&
process &&
typeof process.platform === 'string'
? process.platform
typeof process.platform === 'string') ?
process.platform
: 'linux';

@@ -16,0 +16,0 @@ /**

@@ -5,2 +5,10 @@ import { Minipass } from 'minipass';

import { Glob } from './glob.js';
export { escape, unescape } from 'minimatch';
export type { FSOption, Path, WalkOptions, WalkOptionsWithFileTypesTrue, WalkOptionsWithFileTypesUnset, } from 'path-scurry';
export { Glob } from './glob.js';
export type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, } from './glob.js';
export { hasMagic } from './has-magic.js';
export { Ignore } from './ignore.js';
export type { IgnoreLike } from './ignore.js';
export type { MatchStream } from './walker.js';
/**

@@ -66,9 +74,2 @@ * Syncronous form of {@link globStream}. Will read all the matches as fast as

};
export { escape, unescape } from 'minimatch';
export { Glob } from './glob.js';
export type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, } from './glob.js';
export { hasMagic } from './has-magic.js';
export type { IgnoreLike } from './ignore.js';
export type { MatchStream } from './walker.js';
export type { Path, WalkOptionsWithFileTypesTrue, WalkOptionsWithFileTypesUnset, WalkOptions, FSOption, } from 'path-scurry';
export declare const glob: typeof glob_ & {

@@ -75,0 +76,0 @@ glob: typeof glob_;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.glob = exports.hasMagic = exports.Glob = exports.unescape = exports.escape = exports.sync = exports.iterate = exports.iterateSync = exports.stream = exports.streamSync = exports.globIterate = exports.globIterateSync = exports.globSync = exports.globStream = exports.globStreamSync = void 0;
exports.glob = exports.sync = exports.iterate = exports.iterateSync = exports.stream = exports.streamSync = exports.globIterate = exports.globIterateSync = exports.globSync = exports.globStream = exports.globStreamSync = exports.Ignore = exports.hasMagic = exports.Glob = exports.unescape = exports.escape = void 0;
const minimatch_1 = require("minimatch");
const glob_js_1 = require("./glob.js");
const has_magic_js_1 = require("./has-magic.js");
var minimatch_2 = require("minimatch");
Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return minimatch_2.escape; } });
Object.defineProperty(exports, "unescape", { enumerable: true, get: function () { return minimatch_2.unescape; } });
var glob_js_2 = require("./glob.js");
Object.defineProperty(exports, "Glob", { enumerable: true, get: function () { return glob_js_2.Glob; } });
var has_magic_js_2 = require("./has-magic.js");
Object.defineProperty(exports, "hasMagic", { enumerable: true, get: function () { return has_magic_js_2.hasMagic; } });
var ignore_js_1 = require("./ignore.js");
Object.defineProperty(exports, "Ignore", { enumerable: true, get: function () { return ignore_js_1.Ignore; } });
function globStreamSync(pattern, options = {}) {

@@ -41,11 +50,2 @@ return new glob_js_1.Glob(pattern, options).streamSync();

});
/* c8 ignore start */
var minimatch_2 = require("minimatch");
Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return minimatch_2.escape; } });
Object.defineProperty(exports, "unescape", { enumerable: true, get: function () { return minimatch_2.unescape; } });
var glob_js_2 = require("./glob.js");
Object.defineProperty(exports, "Glob", { enumerable: true, get: function () { return glob_js_2.Glob; } });
var has_magic_js_2 = require("./has-magic.js");
Object.defineProperty(exports, "hasMagic", { enumerable: true, get: function () { return has_magic_js_2.hasMagic; } });
/* c8 ignore stop */
exports.glob = Object.assign(glob_, {

@@ -52,0 +52,0 @@ glob: glob_,

@@ -113,5 +113,5 @@ "use strict";

this.#globString ||
(this.#index === 0
? this.isAbsolute()
? this.#globList[0] + this.#globList.slice(1).join('/')
(this.#index === 0 ?
this.isAbsolute() ?
this.#globList[0] + this.#globList.slice(1).join('/')
: this.#globList.join('/')

@@ -145,4 +145,4 @@ : this.#globList.slice(this.#index).join('/')));

const pl = this.#patternList;
return this.#isUNC !== undefined
? this.#isUNC
return this.#isUNC !== undefined ?
this.#isUNC
: (this.#isUNC =

@@ -168,4 +168,4 @@ this.#platform === 'win32' &&

const pl = this.#patternList;
return this.#isDrive !== undefined
? this.#isDrive
return this.#isDrive !== undefined ?
this.#isDrive
: (this.#isDrive =

@@ -186,4 +186,4 @@ this.#platform === 'win32' &&

const pl = this.#patternList;
return this.#isAbsolute !== undefined
? this.#isAbsolute
return this.#isAbsolute !== undefined ?
this.#isAbsolute
: (this.#isAbsolute =

@@ -199,4 +199,4 @@ (pl[0] === '' && pl.length > 1) ||

const p = this.#patternList[0];
return typeof p === 'string' && this.isAbsolute() && this.#index === 0
? p
return (typeof p === 'string' && this.isAbsolute() && this.#index === 0) ?
p
: '';

@@ -203,0 +203,0 @@ }

@@ -106,5 +106,4 @@ "use strict";

this.dot = !!opts.dot;
this.hasWalkedCache = hasWalkedCache
? hasWalkedCache.copy()
: new HasWalkedCache();
this.hasWalkedCache =
hasWalkedCache ? hasWalkedCache.copy() : new HasWalkedCache();
}

@@ -122,4 +121,4 @@ processPatterns(target, patterns) {

if (root) {
t = t.resolve(root === '/' && this.opts.root !== undefined
? this.opts.root
t = t.resolve(root === '/' && this.opts.root !== undefined ?
this.opts.root
: root);

@@ -126,0 +125,0 @@ const rest = pattern.rest();

@@ -13,6 +13,4 @@ "use strict";

const processor_js_1 = require("./processor.js");
const makeIgnore = (ignore, opts) => typeof ignore === 'string'
? new ignore_js_1.Ignore([ignore], opts)
: Array.isArray(ignore)
? new ignore_js_1.Ignore(ignore, opts)
const makeIgnore = (ignore, opts) => typeof ignore === 'string' ? new ignore_js_1.Ignore([ignore], opts)
: Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts)
: ignore;

@@ -119,3 +117,3 @@ /**

matchCheckTest(e, ifDir) {
return e &&
return (e &&
(this.maxDepth === Infinity || e.depth() <= this.maxDepth) &&

@@ -128,4 +126,4 @@ (!ifDir || e.canReaddir()) &&

!e.realpathCached()?.isDirectory()) &&
!this.#ignored(e)
? e
!this.#ignored(e)) ?
e
: undefined;

@@ -174,4 +172,4 @@ }

const rel = this.opts.posix ? e.relativePosix() : e.relative();
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep)
? '.' + this.#sep
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep) ?
'.' + this.#sep
: '';

@@ -178,0 +176,0 @@ this.matchEmit(!rel ? '.' + mark : pre + rel + mark);

@@ -8,6 +8,6 @@ import { Minimatch } from 'minimatch';

// so we default to case-sensitive, / separators
const defaultPlatform = typeof process === 'object' &&
const defaultPlatform = (typeof process === 'object' &&
process &&
typeof process.platform === 'string'
? process.platform
typeof process.platform === 'string') ?
process.platform
: 'linux';

@@ -125,8 +125,5 @@ /**

else {
const Scurry = opts.platform === 'win32'
? PathScurryWin32
: opts.platform === 'darwin'
? PathScurryDarwin
: opts.platform
? PathScurryPosix
const Scurry = opts.platform === 'win32' ? PathScurryWin32
: opts.platform === 'darwin' ? PathScurryDarwin
: opts.platform ? PathScurryPosix
: PathScurry;

@@ -183,4 +180,4 @@ this.scurry = new Scurry(this.cwd, {

...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,

@@ -197,4 +194,4 @@ platform: this.platform,

...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,

@@ -210,4 +207,4 @@ platform: this.platform,

...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,

@@ -222,4 +219,4 @@ platform: this.platform,

...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,

@@ -226,0 +223,0 @@ platform: this.platform,

@@ -7,6 +7,6 @@ // give it a pattern, and it'll be able to tell you if

import { Pattern } from './pattern.js';
const defaultPlatform = typeof process === 'object' &&
const defaultPlatform = (typeof process === 'object' &&
process &&
typeof process.platform === 'string'
? process.platform
typeof process.platform === 'string') ?
process.platform
: 'linux';

@@ -13,0 +13,0 @@ /**

@@ -5,2 +5,10 @@ import { Minipass } from 'minipass';

import { Glob } from './glob.js';
export { escape, unescape } from 'minimatch';
export type { FSOption, Path, WalkOptions, WalkOptionsWithFileTypesTrue, WalkOptionsWithFileTypesUnset, } from 'path-scurry';
export { Glob } from './glob.js';
export type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, } from './glob.js';
export { hasMagic } from './has-magic.js';
export { Ignore } from './ignore.js';
export type { IgnoreLike } from './ignore.js';
export type { MatchStream } from './walker.js';
/**

@@ -66,9 +74,2 @@ * Syncronous form of {@link globStream}. Will read all the matches as fast as

};
export { escape, unescape } from 'minimatch';
export { Glob } from './glob.js';
export type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, } from './glob.js';
export { hasMagic } from './has-magic.js';
export type { IgnoreLike } from './ignore.js';
export type { MatchStream } from './walker.js';
export type { Path, WalkOptionsWithFileTypesTrue, WalkOptionsWithFileTypesUnset, WalkOptions, FSOption, } from 'path-scurry';
export declare const glob: typeof glob_ & {

@@ -75,0 +76,0 @@ glob: typeof glob_;

import { escape, unescape } from 'minimatch';
import { Glob } from './glob.js';
import { hasMagic } from './has-magic.js';
export { escape, unescape } from 'minimatch';
export { Glob } from './glob.js';
export { hasMagic } from './has-magic.js';
export { Ignore } from './ignore.js';
export function globStreamSync(pattern, options = {}) {

@@ -33,7 +37,2 @@ return new Glob(pattern, options).streamSync();

});
/* c8 ignore start */
export { escape, unescape } from 'minimatch';
export { Glob } from './glob.js';
export { hasMagic } from './has-magic.js';
/* c8 ignore stop */
export const glob = Object.assign(glob_, {

@@ -40,0 +39,0 @@ glob: glob_,

@@ -110,5 +110,5 @@ // this is just a very light wrapper around 2 arrays with an offset index

this.#globString ||
(this.#index === 0
? this.isAbsolute()
? this.#globList[0] + this.#globList.slice(1).join('/')
(this.#index === 0 ?
this.isAbsolute() ?
this.#globList[0] + this.#globList.slice(1).join('/')
: this.#globList.join('/')

@@ -142,4 +142,4 @@ : this.#globList.slice(this.#index).join('/')));

const pl = this.#patternList;
return this.#isUNC !== undefined
? this.#isUNC
return this.#isUNC !== undefined ?
this.#isUNC
: (this.#isUNC =

@@ -165,4 +165,4 @@ this.#platform === 'win32' &&

const pl = this.#patternList;
return this.#isDrive !== undefined
? this.#isDrive
return this.#isDrive !== undefined ?
this.#isDrive
: (this.#isDrive =

@@ -183,4 +183,4 @@ this.#platform === 'win32' &&

const pl = this.#patternList;
return this.#isAbsolute !== undefined
? this.#isAbsolute
return this.#isAbsolute !== undefined ?
this.#isAbsolute
: (this.#isAbsolute =

@@ -196,4 +196,4 @@ (pl[0] === '' && pl.length > 1) ||

const p = this.#patternList[0];
return typeof p === 'string' && this.isAbsolute() && this.#index === 0
? p
return (typeof p === 'string' && this.isAbsolute() && this.#index === 0) ?
p
: '';

@@ -200,0 +200,0 @@ }

@@ -100,5 +100,4 @@ // synchronous utility for filtering entries and calculating subwalks

this.dot = !!opts.dot;
this.hasWalkedCache = hasWalkedCache
? hasWalkedCache.copy()
: new HasWalkedCache();
this.hasWalkedCache =
hasWalkedCache ? hasWalkedCache.copy() : new HasWalkedCache();
}

@@ -116,4 +115,4 @@ processPatterns(target, patterns) {

if (root) {
t = t.resolve(root === '/' && this.opts.root !== undefined
? this.opts.root
t = t.resolve(root === '/' && this.opts.root !== undefined ?
this.opts.root
: root);

@@ -120,0 +119,0 @@ const rest = pattern.rest();

@@ -10,6 +10,4 @@ /**

import { Processor } from './processor.js';
const makeIgnore = (ignore, opts) => typeof ignore === 'string'
? new Ignore([ignore], opts)
: Array.isArray(ignore)
? new Ignore(ignore, opts)
const makeIgnore = (ignore, opts) => typeof ignore === 'string' ? new Ignore([ignore], opts)
: Array.isArray(ignore) ? new Ignore(ignore, opts)
: ignore;

@@ -116,3 +114,3 @@ /**

matchCheckTest(e, ifDir) {
return e &&
return (e &&
(this.maxDepth === Infinity || e.depth() <= this.maxDepth) &&

@@ -125,4 +123,4 @@ (!ifDir || e.canReaddir()) &&

!e.realpathCached()?.isDirectory()) &&
!this.#ignored(e)
? e
!this.#ignored(e)) ?
e
: undefined;

@@ -171,4 +169,4 @@ }

const rel = this.opts.posix ? e.relativePosix() : e.relative();
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep)
? '.' + this.#sep
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep) ?
'.' + this.#sep
: '';

@@ -175,0 +173,0 @@ this.matchEmit(!rel ? '.' + mark : pre + rel + mark);

@@ -5,3 +5,3 @@ {

"description": "the most correct and second fastest glob implementation in JavaScript",
"version": "10.4.0",
"version": "10.4.1",
"type": "module",

@@ -47,3 +47,3 @@ "tshy": {

"snap": "tap",
"format": "prettier --write . --loglevel warn",
"format": "prettier --write . --log-level warn",
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts",

@@ -60,2 +60,3 @@ "prepublish": "npm run benchclean",

"prettier": {
"experimentalTernaries": true,
"semi": false,

@@ -82,3 +83,3 @@ "printWidth": 75,

"mkdirp": "^3.0.1",
"prettier": "^2.8.3",
"prettier": "^3.2.5",
"rimraf": "^5.0.7",

@@ -85,0 +86,0 @@ "sync-content": "^1.0.2",

@@ -80,3 +80,3 @@ # Glob

path.isDirectory(),
path.readdirSync().map(e => e.name)
path.readdirSync().map(e => e.name),
)

@@ -610,5 +610,5 @@ })

**Caveat** It *only* ignores matches that would be a descendant
**Caveat** It _only_ ignores matches that would be a descendant
of a previous match, and only if that descendant is matched
*after* the ancestor is encountered. Since the file system walk
_after_ the ancestor is encountered. Since the file system walk
happens in indeterminate order, it's possible that a match will

@@ -621,14 +621,17 @@ already be added before its ancestor, if multiple or braced

```js
const results = await glob([
// likely to match first, since it's just a stat
'a/b/c/d/e/f',
const results = await glob(
[
// likely to match first, since it's just a stat
'a/b/c/d/e/f',
// this pattern is more complicated! It must to various readdir()
// calls and test the results against a regular expression, and that
// is certainly going to take a little bit longer.
//
// So, later on, it encounters a match at 'a/b/c/d/e', but it's too
// late to ignore a/b/c/d/e/f, because it's already been emitted.
'a/[bdf]/?/[a-z]/*',
], { includeChildMatches: false })
// this pattern is more complicated! It must to various readdir()
// calls and test the results against a regular expression, and that
// is certainly going to take a little bit longer.
//
// So, later on, it encounters a match at 'a/b/c/d/e', but it's too
// late to ignore a/b/c/d/e/f, because it's already been emitted.
'a/[bdf]/?/[a-z]/*',
],
{ includeChildMatches: false },
)
```

@@ -635,0 +638,0 @@

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc