recrawl-sync
Advanced tools
Comparing version 1.2.3 to 2.0.0
@@ -9,1 +9,2 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
}; | ||
//# sourceMappingURL=fs.js.map |
@@ -22,3 +22,3 @@ import { Crawler, RecrawlOptions } from './types'; | ||
*/ | ||
export declare function compileGlob(glob: string, mapGlob?: (glob: string) => string): string; | ||
export declare function compileGlob(glob: string, root?: string): string; | ||
/** | ||
@@ -28,2 +28,2 @@ * Create a function that tests against an array of Recrawl glob strings by | ||
*/ | ||
export declare function createMatcher(globs: string[] | undefined, mapGlob?: (glob: string) => string): GlobMatcher | null; | ||
export declare function createMatcher(globs: string[] | undefined, root?: string): GlobMatcher | null; |
@@ -93,3 +93,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
*/ | ||
function compileGlob(glob, mapGlob) { | ||
function compileGlob(glob, root) { | ||
if (glob[0] == path.sep) { | ||
@@ -104,4 +104,4 @@ glob = glob.slice(1); | ||
} | ||
if (mapGlob) | ||
glob = mapGlob(glob); | ||
if (root) | ||
glob = path.join(root, glob); | ||
return glob_regex_1.default.replace(glob); | ||
@@ -114,3 +114,3 @@ } | ||
*/ | ||
function createMatcher(globs, mapGlob) { | ||
function createMatcher(globs, root) { | ||
if (!globs || !globs.length) { | ||
@@ -123,7 +123,5 @@ return null; | ||
if (globAllRE.test(glob)) { | ||
fileGlobs.push(compileGlob(glob, mapGlob)); | ||
fileGlobs.push(compileGlob(glob, root)); | ||
} | ||
else { | ||
if (mapGlob) | ||
glob = mapGlob(glob); | ||
nameGlobs.push(glob_regex_1.default.replace(glob)); | ||
@@ -159,3 +157,3 @@ } | ||
do { | ||
const target = fs.readlink(link); | ||
let target = fs.readlink(link); | ||
if (path.isAbsolute(target)) { | ||
@@ -167,2 +165,6 @@ name = null; | ||
else if (name !== null) { | ||
// The "relative" function expects ./ or ../ | ||
if (!/^\.\.?\//.test(target[0])) { | ||
target = './' + target; | ||
} | ||
// This code path is faster. | ||
@@ -187,1 +189,2 @@ name = relative_1.default(name, target); | ||
} | ||
//# sourceMappingURL=recrawl.js.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
{ | ||
"name": "recrawl-sync", | ||
"version": "1.2.3", | ||
"version": "2.0.0", | ||
"main": "lib/recrawl.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
17668
12
253