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 9.0.2 to 9.1.0

64

dist/cjs/glob.d.ts

@@ -24,10 +24,12 @@ /// <reference types="node" />

/**
* Set to true to always receive absolute paths for
* matched files. This does _not_ make an extra system call to get
* Set to `true` to always receive absolute paths for
* matched files. Set to `false` to always return relative paths.
*
* When this option is not set, absolute paths are returned for patterns
* that are absolute, and otherwise paths are returned that are relative
* to the `cwd` setting.
*
* This does _not_ make an extra system call to get
* the realpath, it only does string path resolution.
*
* By default, when this option is not set, absolute paths are
* returned for patterns that are absolute, and otherwise paths
* are returned that are relative to the `cwd` setting.
*
* Conflicts with {@link withFileTypes}

@@ -56,2 +58,12 @@ */

/**
* Prepend all relative path strings with `./` (or `.\` on Windows).
*
* Without this option, returned relative paths are "bare", so instead of
* returning `'./foo/bar'`, they are returned as `'foo/bar'`.
*
* Relative patterns starting with `'../'` are not prepended with `./`, even
* if this option is set.
*/
dotRelative?: boolean;
/**
* Follow symlinked directories when expanding `**`

@@ -73,2 +85,9 @@ * patterns. This can result in a lot of duplicate references in

/**
* Treat brace expansion like `{a,b}` as a "magic" pattern. Has no
* effect if {@link nobrace} is set.
*
* Only has effect on the {@link hasMagic} function.
*/
magicalBraces?: boolean;
/**
* Add a `/` character to directory matches. Note that this requires

@@ -129,2 +148,26 @@ * additional stat calls in some cases.

/**
*
* A string path resolved against the `cwd` option, which
* is used as the starting point for absolute patterns that start
* with `/`, (but not drive letters or UNC paths on Windows).
*
* Note that this _doesn't_ necessarily limit the walk to the
* `root` directory, and doesn't affect the cwd starting point for
* non-absolute patterns. A pattern containing `..` will still be
* able to traverse out of the root directory, if it is not an
* actual root directory on the filesystem, and any non-absolute
* patterns will be matched in the `cwd`. For example, the
* pattern `/../*` with `{root:'/some/path'}` will return all
* files in `/some`, not all files in `/some/path`. The pattern
* `*` with `{root:'/some/path'}` will return all the entries in
* the cwd, not the entries in `/some/path`.
*
* To start absolute and non-absolute patterns in the same
* path, you can use `{root:''}`. However, be aware that on
* Windows systems, a pattern like `x:/*` or `//host/share/*` will
* _always_ start in the `x:/` or `//host/share` directory,
* regardless of the `root` setting.
*/
root?: string;
/**
* A [PathScurry](http://npm.im/path-scurry) object used

@@ -168,3 +211,3 @@ * to traverse the file system. If the `nocase` option is set

withFileTypes: true;
absolute?: false;
absolute?: undefined;
};

@@ -184,8 +227,11 @@ export type GlobOptionsWithFileTypesFalse = GlobOptions & {

export declare class Glob<Opts extends GlobOptions> implements GlobOptions {
absolute: boolean;
absolute?: boolean;
cwd: string;
root?: string;
dot: boolean;
dotRelative: boolean;
follow: boolean;
ignore?: Ignore;
mark: boolean;
magicalBraces: boolean;
mark?: boolean;
matchBase: boolean;

@@ -192,0 +238,0 @@ nobrace: boolean;

12

dist/cjs/glob.js

@@ -22,5 +22,8 @@ "use strict";

cwd;
root;
dot;
dotRelative;
follow;
ignore;
magicalBraces;
mark;

@@ -65,2 +68,3 @@ matchBase;

this.dot = !!opts.dot;
this.dotRelative = !!opts.dotRelative;
this.nodir = !!opts.nodir;

@@ -75,10 +79,12 @@ this.mark = !!opts.mark;

this.cwd = opts.cwd || '';
this.root = opts.root;
this.magicalBraces = !!opts.magicalBraces;
this.nobrace = !!opts.nobrace;
this.noext = !!opts.noext;
this.realpath = !!opts.realpath;
this.absolute = !!opts.absolute;
this.absolute = opts.absolute;
this.noglobstar = !!opts.noglobstar;
this.matchBase = !!opts.matchBase;
if (this.withFileTypes && this.absolute) {
throw new Error('cannot set absolute:true and withFileTypes:true');
if (this.withFileTypes && this.absolute !== undefined) {
throw new Error('cannot set absolute and withFileTypes:true');
}

@@ -85,0 +91,0 @@ if (typeof pattern === 'string') {

import { GlobOptions } from './glob.js';
/**
* Return true if the patterns provided contain any magic
* glob characters.
* Return true if the patterns provided contain any magic glob characters,
* given the options provided.
*
* Brace expansion is not considered "magic" unless the `magicalBraces` option
* is set, as brace expansion just turns one string into an array of strings.
* So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and
* `'xby'` both do not contain any magic glob characters, and it's treated the
* same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`
* is in the options, brace expansion _is_ treated as a pattern having magic.
*/
export declare const hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasMagic = void 0;
const glob_js_1 = require("./glob.js");
const minimatch_1 = require("minimatch");
/**
* Return true if the patterns provided contain any magic
* glob characters.
* Return true if the patterns provided contain any magic glob characters,
* given the options provided.
*
* Brace expansion is not considered "magic" unless the `magicalBraces` option
* is set, as brace expansion just turns one string into an array of strings.
* So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and
* `'xby'` both do not contain any magic glob characters, and it's treated the
* same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`
* is in the options, brace expansion _is_ treated as a pattern having magic.
*/

@@ -13,8 +20,9 @@ const hasMagic = (pattern, options = {}) => {

}
const g = new glob_js_1.Glob(pattern, options);
return g.patterns.length === 0
? false
: g.patterns.some(p => p.hasMagic());
for (const p of pattern) {
if (new minimatch_1.Minimatch(p, options).hasMagic())
return true;
}
return false;
};
exports.hasMagic = hasMagic;
//# sourceMappingURL=has-magic.js.map

@@ -10,2 +10,4 @@ declare const _default: typeof import("./index.js").glob & {

hasMagic: (pattern: string | string[], options?: import("./glob.js").GlobOptions) => boolean;
escape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
unescape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
} & {

@@ -21,2 +23,4 @@ default: typeof import("./index.js").glob & {

hasMagic: (pattern: string | string[], options?: import("./glob.js").GlobOptions) => boolean;
escape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
unescape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
};

@@ -32,4 +36,6 @@ glob: typeof import("./index.js").glob & {

hasMagic: (pattern: string | string[], options?: import("./glob.js").GlobOptions) => boolean;
escape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
unescape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
};
};
export = _default;

@@ -52,2 +52,3 @@ import type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, Results } from './glob.js';

export declare function globIterateSync(pattern: string | string[], options: GlobOptions): Generator<Result<GlobOptions>, void, void>;
export { escape, unescape } from 'minimatch';
export { Glob } from './glob.js';

@@ -66,3 +67,5 @@ export type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, Result, Results, } from './glob.js';

hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean;
escape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
unescape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
};
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasMagic = exports.Glob = exports.globIterateSync = exports.globIterate = exports.glob = exports.globSync = exports.globStream = exports.globStreamSync = void 0;
exports.hasMagic = exports.Glob = exports.unescape = exports.escape = exports.globIterateSync = exports.globIterate = exports.glob = exports.globSync = exports.globStream = exports.globStreamSync = void 0;
const minimatch_1 = require("minimatch");
const glob_js_1 = require("./glob.js");

@@ -31,2 +32,5 @@ const has_magic_js_1 = require("./has-magic.js");

/* 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");

@@ -46,3 +50,5 @@ Object.defineProperty(exports, "Glob", { enumerable: true, get: function () { return glob_js_2.Glob; } });

hasMagic: has_magic_js_1.hasMagic,
escape: minimatch_1.escape,
unescape: minimatch_1.unescape,
});
//# sourceMappingURL=index.js.map

@@ -68,6 +68,2 @@ /// <reference types="node" />

/**
* True if the pattern has any non-string components
*/
hasMagic(): boolean;
/**
* Check to see if the current globstar pattern is allowed to follow

@@ -74,0 +70,0 @@ * a symbolic link.

@@ -200,13 +200,2 @@ "use strict";

/**
* True if the pattern has any non-string components
*/
hasMagic() {
for (let i = 0; i < this.length; i++) {
if (typeof this.#patternList[i] !== 'string') {
return true;
}
}
return false;
}
/**
* Check to see if the current globstar pattern is allowed to follow

@@ -213,0 +202,0 @@ * a symbolic link.

@@ -118,6 +118,8 @@ "use strict";

const root = pattern.root();
const absolute = pattern.isAbsolute();
const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
// start absolute patterns at root
if (root) {
t = t.resolve(root);
t = t.resolve(root === '/' && this.opts.root !== undefined
? this.opts.root
: root);
const rest = pattern.rest();

@@ -124,0 +126,0 @@ if (!rest) {

@@ -18,2 +18,3 @@ /// <reference types="node" />

dot?: boolean;
dotRelative?: boolean;
follow?: boolean;

@@ -30,2 +31,3 @@ ignore?: string | string[] | Ignore;

realpath?: boolean;
root?: string;
signal?: AbortSignal;

@@ -32,0 +34,0 @@ windowsPathsNoEscape?: boolean;

@@ -124,2 +124,3 @@ "use strict";

return;
const abs = this.opts.absolute === undefined ? absolute : this.opts.absolute;
this.seen.add(e);

@@ -131,3 +132,3 @@ const mark = this.opts.mark && e.isDirectory() ? this.#sep : '';

}
else if (this.opts.absolute || absolute) {
else if (abs) {
this.matchEmit(e.fullpath() + mark);

@@ -137,3 +138,5 @@ }

const rel = e.relative();
this.matchEmit(!rel && mark ? './' : rel + mark);
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep)
? '.' + this.#sep : '';
this.matchEmit(!rel && mark ? '.' + mark : pre + rel + mark);
}

@@ -140,0 +143,0 @@ }

@@ -24,10 +24,12 @@ /// <reference types="node" />

/**
* Set to true to always receive absolute paths for
* matched files. This does _not_ make an extra system call to get
* Set to `true` to always receive absolute paths for
* matched files. Set to `false` to always return relative paths.
*
* When this option is not set, absolute paths are returned for patterns
* that are absolute, and otherwise paths are returned that are relative
* to the `cwd` setting.
*
* This does _not_ make an extra system call to get
* the realpath, it only does string path resolution.
*
* By default, when this option is not set, absolute paths are
* returned for patterns that are absolute, and otherwise paths
* are returned that are relative to the `cwd` setting.
*
* Conflicts with {@link withFileTypes}

@@ -56,2 +58,12 @@ */

/**
* Prepend all relative path strings with `./` (or `.\` on Windows).
*
* Without this option, returned relative paths are "bare", so instead of
* returning `'./foo/bar'`, they are returned as `'foo/bar'`.
*
* Relative patterns starting with `'../'` are not prepended with `./`, even
* if this option is set.
*/
dotRelative?: boolean;
/**
* Follow symlinked directories when expanding `**`

@@ -73,2 +85,9 @@ * patterns. This can result in a lot of duplicate references in

/**
* Treat brace expansion like `{a,b}` as a "magic" pattern. Has no
* effect if {@link nobrace} is set.
*
* Only has effect on the {@link hasMagic} function.
*/
magicalBraces?: boolean;
/**
* Add a `/` character to directory matches. Note that this requires

@@ -129,2 +148,26 @@ * additional stat calls in some cases.

/**
*
* A string path resolved against the `cwd` option, which
* is used as the starting point for absolute patterns that start
* with `/`, (but not drive letters or UNC paths on Windows).
*
* Note that this _doesn't_ necessarily limit the walk to the
* `root` directory, and doesn't affect the cwd starting point for
* non-absolute patterns. A pattern containing `..` will still be
* able to traverse out of the root directory, if it is not an
* actual root directory on the filesystem, and any non-absolute
* patterns will be matched in the `cwd`. For example, the
* pattern `/../*` with `{root:'/some/path'}` will return all
* files in `/some`, not all files in `/some/path`. The pattern
* `*` with `{root:'/some/path'}` will return all the entries in
* the cwd, not the entries in `/some/path`.
*
* To start absolute and non-absolute patterns in the same
* path, you can use `{root:''}`. However, be aware that on
* Windows systems, a pattern like `x:/*` or `//host/share/*` will
* _always_ start in the `x:/` or `//host/share` directory,
* regardless of the `root` setting.
*/
root?: string;
/**
* A [PathScurry](http://npm.im/path-scurry) object used

@@ -168,3 +211,3 @@ * to traverse the file system. If the `nocase` option is set

withFileTypes: true;
absolute?: false;
absolute?: undefined;
};

@@ -184,8 +227,11 @@ export type GlobOptionsWithFileTypesFalse = GlobOptions & {

export declare class Glob<Opts extends GlobOptions> implements GlobOptions {
absolute: boolean;
absolute?: boolean;
cwd: string;
root?: string;
dot: boolean;
dotRelative: boolean;
follow: boolean;
ignore?: Ignore;
mark: boolean;
magicalBraces: boolean;
mark?: boolean;
matchBase: boolean;

@@ -192,0 +238,0 @@ nobrace: boolean;

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

cwd;
root;
dot;
dotRelative;
follow;
ignore;
magicalBraces;
mark;

@@ -62,2 +65,3 @@ matchBase;

this.dot = !!opts.dot;
this.dotRelative = !!opts.dotRelative;
this.nodir = !!opts.nodir;

@@ -72,10 +76,12 @@ this.mark = !!opts.mark;

this.cwd = opts.cwd || '';
this.root = opts.root;
this.magicalBraces = !!opts.magicalBraces;
this.nobrace = !!opts.nobrace;
this.noext = !!opts.noext;
this.realpath = !!opts.realpath;
this.absolute = !!opts.absolute;
this.absolute = opts.absolute;
this.noglobstar = !!opts.noglobstar;
this.matchBase = !!opts.matchBase;
if (this.withFileTypes && this.absolute) {
throw new Error('cannot set absolute:true and withFileTypes:true');
if (this.withFileTypes && this.absolute !== undefined) {
throw new Error('cannot set absolute and withFileTypes:true');
}

@@ -82,0 +88,0 @@ if (typeof pattern === 'string') {

import { GlobOptions } from './glob.js';
/**
* Return true if the patterns provided contain any magic
* glob characters.
* Return true if the patterns provided contain any magic glob characters,
* given the options provided.
*
* Brace expansion is not considered "magic" unless the `magicalBraces` option
* is set, as brace expansion just turns one string into an array of strings.
* So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and
* `'xby'` both do not contain any magic glob characters, and it's treated the
* same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`
* is in the options, brace expansion _is_ treated as a pattern having magic.
*/
export declare const hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean;

@@ -1,5 +0,12 @@

import { Glob } from './glob.js';
import { Minimatch } from 'minimatch';
/**
* Return true if the patterns provided contain any magic
* glob characters.
* Return true if the patterns provided contain any magic glob characters,
* given the options provided.
*
* Brace expansion is not considered "magic" unless the `magicalBraces` option
* is set, as brace expansion just turns one string into an array of strings.
* So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and
* `'xby'` both do not contain any magic glob characters, and it's treated the
* same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`
* is in the options, brace expansion _is_ treated as a pattern having magic.
*/

@@ -10,7 +17,8 @@ export const hasMagic = (pattern, options = {}) => {

}
const g = new Glob(pattern, options);
return g.patterns.length === 0
? false
: g.patterns.some(p => p.hasMagic());
for (const p of pattern) {
if (new Minimatch(p, options).hasMagic())
return true;
}
return false;
};
//# sourceMappingURL=has-magic.js.map

@@ -52,2 +52,3 @@ import type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, Results } from './glob.js';

export declare function globIterateSync(pattern: string | string[], options: GlobOptions): Generator<Result<GlobOptions>, void, void>;
export { escape, unescape } from 'minimatch';
export { Glob } from './glob.js';

@@ -66,3 +67,5 @@ export type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, Result, Results, } from './glob.js';

hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean;
escape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
unescape: (s: string, { windowsPathsNoEscape, }?: Pick<import("minimatch").MinimatchOptions, "windowsPathsNoEscape"> | undefined) => string;
};
export default _default;

@@ -0,1 +1,2 @@

import { escape, unescape } from 'minimatch';
import { Glob } from './glob.js';

@@ -22,2 +23,3 @@ import { hasMagic } from './has-magic.js';

/* c8 ignore start */
export { escape, unescape } from 'minimatch';
export { Glob } from './glob.js';

@@ -35,3 +37,5 @@ export { hasMagic } from './has-magic.js';

hasMagic,
escape,
unescape,
});
//# sourceMappingURL=index.js.map

@@ -68,6 +68,2 @@ /// <reference types="node" />

/**
* True if the pattern has any non-string components
*/
hasMagic(): boolean;
/**
* Check to see if the current globstar pattern is allowed to follow

@@ -74,0 +70,0 @@ * a symbolic link.

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

/**
* True if the pattern has any non-string components
*/
hasMagic() {
for (let i = 0; i < this.length; i++) {
if (typeof this.#patternList[i] !== 'string') {
return true;
}
}
return false;
}
/**
* Check to see if the current globstar pattern is allowed to follow

@@ -210,0 +199,0 @@ * a symbolic link.

@@ -112,6 +112,8 @@ // synchronous utility for filtering entries and calculating subwalks

const root = pattern.root();
const absolute = pattern.isAbsolute();
const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
// start absolute patterns at root
if (root) {
t = t.resolve(root);
t = t.resolve(root === '/' && this.opts.root !== undefined
? this.opts.root
: root);
const rest = pattern.rest();

@@ -118,0 +120,0 @@ if (!rest) {

@@ -18,2 +18,3 @@ /// <reference types="node" />

dot?: boolean;
dotRelative?: boolean;
follow?: boolean;

@@ -30,2 +31,3 @@ ignore?: string | string[] | Ignore;

realpath?: boolean;
root?: string;
signal?: AbortSignal;

@@ -32,0 +34,0 @@ windowsPathsNoEscape?: boolean;

@@ -118,2 +118,3 @@ /**

return;
const abs = this.opts.absolute === undefined ? absolute : this.opts.absolute;
this.seen.add(e);

@@ -125,3 +126,3 @@ const mark = this.opts.mark && e.isDirectory() ? this.#sep : '';

}
else if (this.opts.absolute || absolute) {
else if (abs) {
this.matchEmit(e.fullpath() + mark);

@@ -131,3 +132,5 @@ }

const rel = e.relative();
this.matchEmit(!rel && mark ? './' : rel + mark);
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep)
? '.' + this.#sep : '';
this.matchEmit(!rel && mark ? '.' + mark : pre + rel + mark);
}

@@ -134,0 +137,0 @@ }

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

"description": "the most correct and second fastest glob implementation in JavaScript",
"version": "9.0.2",
"version": "9.1.0",
"repository": {

@@ -64,3 +64,3 @@ "type": "git",

"fs.realpath": "^1.0.0",
"minimatch": "^7.3.0",
"minimatch": "^7.4.0",
"minipass": "^4.2.4",

@@ -67,0 +67,0 @@ "path-scurry": "^1.5.0"

@@ -132,8 +132,39 @@ # Glob

Note that brace expansion is not considered "magic", as that just
turns one string into an array of strings. So a pattern like
`'x{a,b}y'` would return `false`, because `'xay'` and `'xby'`
both do not contain any magic glob characters, and it's treated
the same as if you had called it on `['xay', 'xby']`.
Brace expansion is not considered "magic" unless the
`magicalBraces` option is set, as brace expansion just turns one
string into an array of strings. So a pattern like `'x{a,b}y'`
would return `false`, because `'xay'` and `'xby'` both do not
contain any magic glob characters, and it's treated the same as
if you had called it on `['xay', 'xby']`. When
`magicalBraces:true` is in the options, brace expansion _is_
treated as a pattern having magic.
## `escape(pattern: string, options?: GlobOptions) => string`
Escape all magic characters in a glob pattern, so that it will
only ever match literal strings
If the `windowsPathsNoEscape` option is used, then characters are
escaped by wrapping in `[]`, because a magic character wrapped in
a character class can only be satisfied by that exact character.
Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot
be escaped or unescaped.
## `unescape(pattern: string, options?: GlobOptions) => string`
Un-escape a glob string that may contain some escaped characters.
If the `windowsPathsNoEscape` option is used, then square-brace
escapes are removed, but not backslash escapes. For example, it
will turn the string `'[*]'` into `*`, but it will not turn
`'\\*'` into `'*'`, because `\` is a path separator in
`windowsPathsNoEscape` mode.
When `windowsPathsNoEscape` is not set, then both brace escapes
and backslash escapes are removed.
Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot
be escaped or unescaped.
## Class `Glob`

@@ -204,3 +235,3 @@

current working directory in which to search. Defaults to
`process.cwd()`. See also: "Windows, CWDs, Drive Letters, and
`process.cwd()`. See also: "Windows, CWDs, Drive Letters, and
UNC Paths", below.

@@ -211,2 +242,23 @@

- `root` A string path resolved against the `cwd` option, which
is used as the starting point for absolute patterns that start
with `/`, (but not drive letters or UNC paths on Windows).
Note that this _doesn't_ necessarily limit the walk to the
`root` directory, and doesn't affect the cwd starting point for
non-absolute patterns. A pattern containing `..` will still be
able to traverse out of the root directory, if it is not an
actual root directory on the filesystem, and any non-absolute
patterns will be matched in the `cwd`. For example, the
pattern `/../*` with `{root:'/some/path'}` will return all
files in `/some`, not all files in `/some/path`. The pattern
`*` with `{root:'/some/path'}` will return all the entries in
the cwd, not the entries in `/some/path`.
To start absolute and non-absolute patterns in the same
path, you can use `{root:''}`. However, be aware that on
Windows systems, a pattern like `x:/*` or `//host/share/*` will
_always_ start in the `x:/` or `//host/share` directory,
regardless of the `root` setting.
- `windowsPathsNoEscape` Use `\\` as a path separator _only_, and

@@ -229,2 +281,18 @@ _never_ as an escape character. If set, all `\\` characters are

- `magicalBraces` Treat brace expansion like `{a,b}` as a "magic"
pattern. Has no effect if {@link nobrace} is set.
Only has effect on the {@link hasMagic} function, no effect on
glob pattern matching itself.
- `dotRelative` Prepend all relative path strings with `./` (or
`.\` on Windows).
Without this option, returned relative paths are "bare", so
instead of returning `'./foo/bar'`, they are returned as
`'foo/bar'`.
Relative patterns starting with `'../'` are not prepended with
`./`, even if this option is set.
- `mark` Add a `/` character to directory matches. Note that this

@@ -279,4 +347,4 @@ requires additional stat calls.

- `absolute` Set to true to always receive absolute paths for
matched files. This does _not_ make an extra system call to get
the realpath, it only does string path resolution.
matched files. Set to `false` to always receive relative paths
for matched files.

@@ -287,2 +355,5 @@ By default, when this option is not set, absolute paths are

This does _not_ make an extra system call to get the realpath,
it only does string path resolution.
`absolute` may not be used along with `withFileTypes`.

@@ -289,0 +360,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

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