@midwayjs/glob
Advanced tools
Comparing version 1.0.7-beta.1 to 1.1.0
@@ -8,24 +8,30 @@ "use strict"; | ||
const util_1 = require("util"); | ||
const log = util_1.debuglog('midway:glob'); | ||
const os = require("os"); | ||
const log = (0, util_1.debuglog)('midway:glob'); | ||
function formatWindowsPath(paths) { | ||
if (os.platform() === 'win32' && paths) { | ||
return paths.map(p => p.split(path_1.sep).join(path_1.posix.sep)); | ||
} | ||
return paths; | ||
} | ||
const run = (pattern, options = { cwd: process.cwd(), ignore: [] }) => { | ||
const startTime = Date.now(); | ||
const entryDir = options.cwd; | ||
pattern = formatWindowsPath(pattern) || []; | ||
const isMatch = pm(pattern, { | ||
ignore: options.ignore || [] | ||
ignore: formatWindowsPath(options.ignore) || [] | ||
}); | ||
const ignoreMatch = pm('**', { | ||
ignore: options.ignore || [] | ||
ignore: formatWindowsPath(options.ignore) || [] | ||
}); | ||
function globDirectory(dirname, isMatch, ignoreDirMatch, options) { | ||
if (!fs_1.existsSync(dirname)) { | ||
log(`not exists ${dirname}`); | ||
if (!(0, fs_1.existsSync)(dirname)) { | ||
return []; | ||
} | ||
const list = fs_1.readdirSync(dirname); | ||
log(`list ${list}`); | ||
const list = (0, fs_1.readdirSync)(dirname); | ||
const result = []; | ||
for (let file of list) { | ||
const resolvePath = path_1.resolve(dirname, file); | ||
const resolvePath = (0, path_1.resolve)(dirname, file); | ||
log(`resolvePath = ${resolvePath}`); | ||
const fileStat = fs_1.statSync(resolvePath); | ||
const fileStat = (0, fs_1.statSync)(resolvePath); | ||
if (fileStat.isDirectory() && ignoreDirMatch(resolvePath.replace(entryDir, ''))) { | ||
@@ -41,3 +47,2 @@ const childs = globDirectory(resolvePath, isMatch, ignoreDirMatch, options); | ||
} | ||
log(`entryDir ${entryDir}`); | ||
const result = globDirectory(entryDir, isMatch, ignoreMatch, options); | ||
@@ -48,2 +53,2 @@ log(`midway glob timing ${Date.now() - startTime}ms`); | ||
exports.run = run; | ||
//# sourceMappingURL=data:application/json;base64,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MsV0FBVyxDQUFDLE9BQU8sQ0FBQyxRQUFRLEVBQUUsRUFBRSxDQUFDLENBQUMsRUFBRTtnQkFDL0UsTUFBTSxNQUFNLEdBQUcsYUFBYSxDQUFDLFdBQVcsRUFBRSxPQUFPLEVBQUUsY0FBYyxFQUFFLE9BQU8sQ0FBQyxDQUFDO2dCQUM1RSxNQUFNLENBQUMsSUFBSSxDQUFDLEdBQUcsTUFBTSxDQUFDLENBQUM7YUFDeEI7aUJBQU0sSUFBRyxRQUFRLENBQUMsTUFBTSxFQUFFLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsUUFBUSxFQUFFLEVBQUUsQ0FBQyxDQUFDLEVBQUU7Z0JBQ3pFLE1BQU0sQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUM7YUFDMUI7U0FDRjtRQUVELE9BQU8sTUFBTSxDQUFDO0lBQ2hCLENBQUM7SUFFRCxNQUFNLE1BQU0sR0FBRyxhQUFhLENBQUMsUUFBUSxFQUFFLE9BQU8sRUFBRSxXQUFXLEVBQUUsT0FBTyxDQUFDLENBQUM7SUFDdEUsR0FBRyxDQUFDLHNCQUFzQixJQUFJLENBQUMsR0FBRyxFQUFFLEdBQUcsU0FBUyxJQUFJLENBQUMsQ0FBQztJQUN0RCxPQUFPLE1BQU0sQ0FBQztBQUNoQixDQUFDLENBQUE7QUFwQ1ksUUFBQSxHQUFHLE9Bb0NmIn0= |
{ | ||
"name": "@midwayjs/glob", | ||
"version": "1.0.7-beta.1", | ||
"version": "1.1.0", | ||
"main": "dist/index", | ||
@@ -12,3 +12,3 @@ "typings": "dist/index.d.ts", | ||
"dependencies": { | ||
"picomatch": "^2.2.2" | ||
"picomatch": "^2.3.1" | ||
}, | ||
@@ -19,14 +19,15 @@ "files": [ | ||
"devDependencies": { | ||
"@types/mocha": "^7.0.2", | ||
"@types/node": "*", | ||
"midway-bin": "2" | ||
"@types/jest": "^19.2.4", | ||
"@types/node": "^16.18.3", | ||
"cross-env": "^7.0.3", | ||
"jest": "^29.3.1", | ||
"ts-jest": "^29.0.3", | ||
"typescript": "^4.9.3" | ||
}, | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "midway-bin build -c", | ||
"test": "NODE_ENV=test midway-bin test --ts --full-trace", | ||
"cov": "NODE_ENV=unittest midway-bin cov --ts", | ||
"clean": "midway-bin clean", | ||
"autod": "midway-bin autod" | ||
"build": "cross-env rm -rf dist && tsc", | ||
"test": "cross-env NODE_ENV=test jest", | ||
"cov": "cross-env NODE_ENV=unittest jest --coverage" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
5870
55
0
0
6
4
Updatedpicomatch@^2.3.1