Upload folder using huggingface_hub (part 4)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/fake-indexeddb/lib/README.md +5 -0
- node_modules/fake-indexeddb/lib/fakeIndexedDB.d.ts +2 -0
- node_modules/fake-indexeddb/lib/package.json +3 -0
- node_modules/fake-indexeddb/package.json +151 -0
- node_modules/fake-indexeddb/types.d.ts +33 -0
- node_modules/fast-deep-equal/LICENSE +21 -0
- node_modules/fast-deep-equal/README.md +96 -0
- node_modules/fast-deep-equal/es6/index.d.ts +2 -0
- node_modules/fast-deep-equal/es6/index.js +72 -0
- node_modules/fast-deep-equal/es6/react.d.ts +2 -0
- node_modules/fast-deep-equal/es6/react.js +79 -0
- node_modules/fast-deep-equal/index.d.ts +4 -0
- node_modules/fast-deep-equal/index.js +46 -0
- node_modules/fast-deep-equal/package.json +61 -0
- node_modules/fast-deep-equal/react.d.ts +2 -0
- node_modules/fast-deep-equal/react.js +53 -0
- node_modules/fast-glob/LICENSE +21 -0
- node_modules/fast-glob/README.md +830 -0
- node_modules/fast-glob/node_modules/glob-parent/CHANGELOG.md +110 -0
- node_modules/fast-glob/node_modules/glob-parent/LICENSE +15 -0
- node_modules/fast-glob/node_modules/glob-parent/README.md +137 -0
- node_modules/fast-glob/node_modules/glob-parent/index.js +42 -0
- node_modules/fast-glob/node_modules/glob-parent/package.json +48 -0
- node_modules/fast-glob/out/index.d.ts +40 -0
- node_modules/fast-glob/out/index.js +102 -0
- node_modules/fast-glob/out/managers/tasks.d.ts +22 -0
- node_modules/fast-glob/out/managers/tasks.js +110 -0
- node_modules/fast-glob/out/providers/async.d.ts +9 -0
- node_modules/fast-glob/out/providers/async.js +23 -0
- node_modules/fast-glob/out/providers/filters/deep.d.ts +16 -0
- node_modules/fast-glob/out/providers/filters/deep.js +62 -0
- node_modules/fast-glob/out/providers/filters/entry.d.ts +16 -0
- node_modules/fast-glob/out/providers/filters/entry.js +63 -0
- node_modules/fast-glob/out/providers/filters/error.d.ts +8 -0
- node_modules/fast-glob/out/providers/filters/error.js +15 -0
- node_modules/fast-glob/out/providers/matchers/matcher.d.ts +33 -0
- node_modules/fast-glob/out/providers/matchers/matcher.js +45 -0
- node_modules/fast-glob/out/providers/matchers/partial.d.ts +4 -0
- node_modules/fast-glob/out/providers/matchers/partial.js +38 -0
- node_modules/fast-glob/out/providers/provider.d.ts +19 -0
- node_modules/fast-glob/out/providers/provider.js +48 -0
- node_modules/fast-glob/out/providers/stream.d.ts +11 -0
- node_modules/fast-glob/out/providers/stream.js +31 -0
- node_modules/fast-glob/out/providers/sync.d.ts +9 -0
- node_modules/fast-glob/out/providers/sync.js +23 -0
- node_modules/fast-glob/out/providers/transformers/entry.d.ts +8 -0
- node_modules/fast-glob/out/providers/transformers/entry.js +26 -0
- node_modules/fast-glob/out/readers/async.d.ts +10 -0
- node_modules/fast-glob/out/readers/async.js +35 -0
- node_modules/fast-glob/out/readers/reader.d.ts +15 -0
node_modules/fake-indexeddb/lib/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
These are just for backwards compatibility with fake-indexeddb v3 and earlier.
|
| 2 |
+
|
| 3 |
+
The .js files are for things that don't understand the package.json exports field, such as Jest 27 and earlier.
|
| 4 |
+
|
| 5 |
+
The .d.ts files are here for the same reason, but are additionally used by things reading the package.json exports field too, since TypeScript 4.6 and earlier don't support specifying types in exports.
|
node_modules/fake-indexeddb/lib/fakeIndexedDB.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare const fakeIndexedDB: typeof indexedDB;
|
| 2 |
+
export default fakeIndexedDB;
|
node_modules/fake-indexeddb/lib/package.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"type": "commonjs"
|
| 3 |
+
}
|
node_modules/fake-indexeddb/package.json
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "fake-indexeddb",
|
| 3 |
+
"version": "6.2.5",
|
| 4 |
+
"description": "Fake IndexedDB: a pure JS in-memory implementation of the IndexedDB API",
|
| 5 |
+
"homepage": "https://github.com/dumbmatter/fakeIndexedDB",
|
| 6 |
+
"repository": {
|
| 7 |
+
"type": "git",
|
| 8 |
+
"url": "git://github.com/dumbmatter/fakeIndexedDB.git"
|
| 9 |
+
},
|
| 10 |
+
"bugs": {
|
| 11 |
+
"url": "https://github.com/dumbmatter/fakeIndexedDB/issues"
|
| 12 |
+
},
|
| 13 |
+
"keywords": [
|
| 14 |
+
"indexeddb",
|
| 15 |
+
"datastore",
|
| 16 |
+
"database",
|
| 17 |
+
"embedded",
|
| 18 |
+
"nosql",
|
| 19 |
+
"in-memory",
|
| 20 |
+
"polyfill",
|
| 21 |
+
"shim"
|
| 22 |
+
],
|
| 23 |
+
"type": "module",
|
| 24 |
+
"main": "./build/cjs/index.js",
|
| 25 |
+
"module": "./build/esm/index.js",
|
| 26 |
+
"exports": {
|
| 27 |
+
".": {
|
| 28 |
+
"types": "./types.d.ts",
|
| 29 |
+
"import": "./build/esm/index.js",
|
| 30 |
+
"require": "./build/cjs/index.js"
|
| 31 |
+
},
|
| 32 |
+
"./auto": {
|
| 33 |
+
"import": "./auto/index.mjs",
|
| 34 |
+
"require": "./auto/index.js"
|
| 35 |
+
},
|
| 36 |
+
"./lib/fakeIndexedDB": {
|
| 37 |
+
"import": "./build/esm/fakeIndexedDB.js",
|
| 38 |
+
"require": "./build/cjs/fakeIndexedDB.js"
|
| 39 |
+
},
|
| 40 |
+
"./lib/FDBCursor": {
|
| 41 |
+
"import": "./build/esm/FDBCursor.js",
|
| 42 |
+
"require": "./build/cjs/FDBCursor.js"
|
| 43 |
+
},
|
| 44 |
+
"./lib/FDBCursorWithValue": {
|
| 45 |
+
"import": "./build/esm/FDBCursorWithValue.js",
|
| 46 |
+
"require": "./build/cjs/FDBCursorWithValue.js"
|
| 47 |
+
},
|
| 48 |
+
"./lib/FDBDatabase": {
|
| 49 |
+
"import": "./build/esm/FDBDatabase.js",
|
| 50 |
+
"require": "./build/cjs/FDBDatabase.js"
|
| 51 |
+
},
|
| 52 |
+
"./lib/FDBFactory": {
|
| 53 |
+
"import": "./build/esm/FDBFactory.js",
|
| 54 |
+
"require": "./build/cjs/FDBFactory.js"
|
| 55 |
+
},
|
| 56 |
+
"./lib/FDBIndex": {
|
| 57 |
+
"import": "./build/esm/FDBIndex.js",
|
| 58 |
+
"require": "./build/cjs/FDBIndex.js"
|
| 59 |
+
},
|
| 60 |
+
"./lib/FDBKeyRange": {
|
| 61 |
+
"import": "./build/esm/FDBKeyRange.js",
|
| 62 |
+
"require": "./build/cjs/FDBKeyRange.js"
|
| 63 |
+
},
|
| 64 |
+
"./lib/FDBObjectStore": {
|
| 65 |
+
"import": "./build/esm/FDBObjectStore.js",
|
| 66 |
+
"require": "./build/cjs/FDBObjectStore.js"
|
| 67 |
+
},
|
| 68 |
+
"./lib/FDBOpenDBRequest": {
|
| 69 |
+
"import": "./build/esm/FDBOpenDBRequest.js",
|
| 70 |
+
"require": "./build/cjs/FDBOpenDBRequest.js"
|
| 71 |
+
},
|
| 72 |
+
"./lib/FDBRequest": {
|
| 73 |
+
"import": "./build/esm/FDBRequest.js",
|
| 74 |
+
"require": "./build/cjs/FDBRequest.js"
|
| 75 |
+
},
|
| 76 |
+
"./lib/FDBTransaction": {
|
| 77 |
+
"import": "./build/esm/FDBTransaction.js",
|
| 78 |
+
"require": "./build/cjs/FDBTransaction.js"
|
| 79 |
+
},
|
| 80 |
+
"./lib/FDBVersionChangeEvent": {
|
| 81 |
+
"import": "./build/esm/FDBVersionChangeEvent.js",
|
| 82 |
+
"require": "./build/cjs/FDBVersionChangeEvent.js"
|
| 83 |
+
},
|
| 84 |
+
"./lib/forceCloseDatabase": {
|
| 85 |
+
"import": "./build/esm/forceCloseDatabase.js",
|
| 86 |
+
"require": "./build/cjs/forceCloseDatabase.js"
|
| 87 |
+
}
|
| 88 |
+
},
|
| 89 |
+
"types": "./types.d.ts",
|
| 90 |
+
"scripts": {
|
| 91 |
+
"build": "rm -rf build && pnpm run build-esm && pnpm run build-cjs",
|
| 92 |
+
"build-cjs": "BABEL_ENV=cjs babel src --out-dir build/cjs --extensions \".ts\" && echo '{\"type\":\"commonjs\"}' > build/cjs/package.json",
|
| 93 |
+
"build-esm": "babel src --out-dir build/esm --extensions \".ts\"",
|
| 94 |
+
"prepack": "pnpm run build && rm -rf build/cjs/test && rm -rf build/esm/test",
|
| 95 |
+
"lint": "eslint 'src/**/*.ts' && tsc",
|
| 96 |
+
"prettier": "prettier --write *.json 'src/**/*.{js,ts}'",
|
| 97 |
+
"test-jest": "pnpm jest test/jest.js",
|
| 98 |
+
"test-mocha": "mocha --timeout 10000 build/esm/test/fakeIndexedDB",
|
| 99 |
+
"build-qunit": "mkdir build/esm/test/indexedDBmock && cp src/test/indexedDBmock/* build/esm/test/indexedDBmock && browserify src/test/indexedDBmock/exports-qunit-bundle.js -o build/esm/test/indexedDBmock/exports-qunit-bundle.js -t [ babelify --presets [ @babel/preset-env ] ]",
|
| 100 |
+
"test-qunit": "pnpm run build-qunit && OPENSSL_CONF=/dev/null node-qunit-phantomjs build/esm/test/indexedDBmock/index.html",
|
| 101 |
+
"test-w3c": "node --test src/test/web-platform-tests/run-all.js",
|
| 102 |
+
"test": "pnpm run lint && pnpm run build && pnpm run test-jest && node test/test.js && node test/dexie.js && pnpm run test-w3c && pnpm run test-mocha && pnpm run test-qunit",
|
| 103 |
+
"prepare": "husky",
|
| 104 |
+
"update-wpt-results": "pnpm run build && node ./bin/update-browser-wpt-results.js && WRITE_TO_README=1 pnpm run test-w3c",
|
| 105 |
+
"version": "pnpm run update-wpt-results && git add README.md"
|
| 106 |
+
},
|
| 107 |
+
"author": "Jeremy Scheff <jdscheff@gmail.com> (https://dumbmatter.com/)",
|
| 108 |
+
"license": "Apache-2.0",
|
| 109 |
+
"files": [
|
| 110 |
+
"auto",
|
| 111 |
+
"auto.d.ts",
|
| 112 |
+
"build",
|
| 113 |
+
"lib",
|
| 114 |
+
"types.d.ts"
|
| 115 |
+
],
|
| 116 |
+
"engines": {
|
| 117 |
+
"node": ">=18"
|
| 118 |
+
},
|
| 119 |
+
"devDependencies": {
|
| 120 |
+
"@babel/cli": "^7.27.2",
|
| 121 |
+
"@babel/core": "^7.27.4",
|
| 122 |
+
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
|
| 123 |
+
"@babel/preset-env": "^7.27.2",
|
| 124 |
+
"@babel/preset-typescript": "^7.27.1",
|
| 125 |
+
"@types/mocha": "^10.0.10",
|
| 126 |
+
"@types/node": "^24.0.0",
|
| 127 |
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
| 128 |
+
"@typescript-eslint/parser": "^7.18.0",
|
| 129 |
+
"babel-plugin-add-module-exports": "^1.0.4",
|
| 130 |
+
"babelify": "^10.0.0",
|
| 131 |
+
"browserify": "^17.0.1",
|
| 132 |
+
"core-js": "^3.43.0",
|
| 133 |
+
"dexie": "^4.0.11",
|
| 134 |
+
"eslint": "^8.57.1",
|
| 135 |
+
"eslint-config-prettier": "^9.1.0",
|
| 136 |
+
"eslint-plugin-import": "^2.32.0",
|
| 137 |
+
"glob": "^11.0.2",
|
| 138 |
+
"husky": "^9.1.7",
|
| 139 |
+
"jest": "^30.0.0",
|
| 140 |
+
"lint-staged": "^16.1.0",
|
| 141 |
+
"mocha": "^11.6.0",
|
| 142 |
+
"node-qunit-phantomjs": "^2.1.1",
|
| 143 |
+
"prettier": "^3.5.3",
|
| 144 |
+
"qunitjs": "^1.23.1",
|
| 145 |
+
"smol-toml": "^1.4.1",
|
| 146 |
+
"typescript": "^5.8.3"
|
| 147 |
+
},
|
| 148 |
+
"lint-staged": {
|
| 149 |
+
"*.{js,json,ts,cjs,mjs}": "prettier --write"
|
| 150 |
+
}
|
| 151 |
+
}
|
node_modules/fake-indexeddb/types.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare const fakeIndexedDB: typeof indexedDB;
|
| 2 |
+
declare const FDBCursor: typeof IDBCursor;
|
| 3 |
+
declare const FDBCursorWithValue: typeof IDBCursorWithValue;
|
| 4 |
+
declare const FDBDatabase: typeof IDBDatabase;
|
| 5 |
+
declare const FDBFactory: typeof IDBFactory;
|
| 6 |
+
declare const FDBIndex: typeof IDBIndex;
|
| 7 |
+
declare const FDBKeyRange: typeof IDBKeyRange;
|
| 8 |
+
declare const FDBObjectStore: typeof IDBObjectStore;
|
| 9 |
+
declare const FDBOpenDBRequest: typeof IDBOpenDBRequest;
|
| 10 |
+
declare const FDBRecord: any; // should be updated once TypeScript DOM types are updated
|
| 11 |
+
declare const FDBRequest: typeof IDBRequest;
|
| 12 |
+
declare const FDBTransaction: typeof IDBTransaction;
|
| 13 |
+
declare const FDBVersionChangeEvent: typeof IDBVersionChangeEvent;
|
| 14 |
+
declare const forceCloseDatabase: (db: typeof FDBDatabase) => void;
|
| 15 |
+
|
| 16 |
+
export default fakeIndexedDB;
|
| 17 |
+
|
| 18 |
+
export {
|
| 19 |
+
fakeIndexedDB as indexedDB,
|
| 20 |
+
FDBCursor as IDBCursor,
|
| 21 |
+
FDBCursorWithValue as IDBCursorWithValue,
|
| 22 |
+
FDBDatabase as IDBDatabase,
|
| 23 |
+
FDBFactory as IDBFactory,
|
| 24 |
+
FDBIndex as IDBIndex,
|
| 25 |
+
FDBKeyRange as IDBKeyRange,
|
| 26 |
+
FDBObjectStore as IDBObjectStore,
|
| 27 |
+
FDBOpenDBRequest as IDBOpenDBRequest,
|
| 28 |
+
FDBRecord as IDBRecord,
|
| 29 |
+
FDBRequest as IDBRequest,
|
| 30 |
+
FDBTransaction as IDBTransaction,
|
| 31 |
+
FDBVersionChangeEvent as IDBVersionChangeEvent,
|
| 32 |
+
forceCloseDatabase,
|
| 33 |
+
};
|
node_modules/fast-deep-equal/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2017 Evgeny Poberezkin
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
node_modules/fast-deep-equal/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# fast-deep-equal
|
| 2 |
+
The fastest deep equal with ES6 Map, Set and Typed arrays support.
|
| 3 |
+
|
| 4 |
+
[](https://travis-ci.org/epoberezkin/fast-deep-equal)
|
| 5 |
+
[](https://www.npmjs.com/package/fast-deep-equal)
|
| 6 |
+
[](https://coveralls.io/github/epoberezkin/fast-deep-equal?branch=master)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
## Install
|
| 10 |
+
|
| 11 |
+
```bash
|
| 12 |
+
npm install fast-deep-equal
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
## Features
|
| 17 |
+
|
| 18 |
+
- ES5 compatible
|
| 19 |
+
- works in node.js (8+) and browsers (IE9+)
|
| 20 |
+
- checks equality of Date and RegExp objects by value.
|
| 21 |
+
|
| 22 |
+
ES6 equal (`require('fast-deep-equal/es6')`) also supports:
|
| 23 |
+
- Maps
|
| 24 |
+
- Sets
|
| 25 |
+
- Typed arrays
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
## Usage
|
| 29 |
+
|
| 30 |
+
```javascript
|
| 31 |
+
var equal = require('fast-deep-equal');
|
| 32 |
+
console.log(equal({foo: 'bar'}, {foo: 'bar'})); // true
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
To support ES6 Maps, Sets and Typed arrays equality use:
|
| 36 |
+
|
| 37 |
+
```javascript
|
| 38 |
+
var equal = require('fast-deep-equal/es6');
|
| 39 |
+
console.log(equal(Int16Array([1, 2]), Int16Array([1, 2]))); // true
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
To use with React (avoiding the traversal of React elements' _owner
|
| 43 |
+
property that contains circular references and is not needed when
|
| 44 |
+
comparing the elements - borrowed from [react-fast-compare](https://github.com/FormidableLabs/react-fast-compare)):
|
| 45 |
+
|
| 46 |
+
```javascript
|
| 47 |
+
var equal = require('fast-deep-equal/react');
|
| 48 |
+
var equal = require('fast-deep-equal/es6/react');
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
## Performance benchmark
|
| 53 |
+
|
| 54 |
+
Node.js v12.6.0:
|
| 55 |
+
|
| 56 |
+
```
|
| 57 |
+
fast-deep-equal x 261,950 ops/sec ±0.52% (89 runs sampled)
|
| 58 |
+
fast-deep-equal/es6 x 212,991 ops/sec ±0.34% (92 runs sampled)
|
| 59 |
+
fast-equals x 230,957 ops/sec ±0.83% (85 runs sampled)
|
| 60 |
+
nano-equal x 187,995 ops/sec ±0.53% (88 runs sampled)
|
| 61 |
+
shallow-equal-fuzzy x 138,302 ops/sec ±0.49% (90 runs sampled)
|
| 62 |
+
underscore.isEqual x 74,423 ops/sec ±0.38% (89 runs sampled)
|
| 63 |
+
lodash.isEqual x 36,637 ops/sec ±0.72% (90 runs sampled)
|
| 64 |
+
deep-equal x 2,310 ops/sec ±0.37% (90 runs sampled)
|
| 65 |
+
deep-eql x 35,312 ops/sec ±0.67% (91 runs sampled)
|
| 66 |
+
ramda.equals x 12,054 ops/sec ±0.40% (91 runs sampled)
|
| 67 |
+
util.isDeepStrictEqual x 46,440 ops/sec ±0.43% (90 runs sampled)
|
| 68 |
+
assert.deepStrictEqual x 456 ops/sec ±0.71% (88 runs sampled)
|
| 69 |
+
|
| 70 |
+
The fastest is fast-deep-equal
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
To run benchmark (requires node.js 6+):
|
| 74 |
+
|
| 75 |
+
```bash
|
| 76 |
+
npm run benchmark
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
__Please note__: this benchmark runs against the available test cases. To choose the most performant library for your application, it is recommended to benchmark against your data and to NOT expect this benchmark to reflect the performance difference in your application.
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
## Enterprise support
|
| 83 |
+
|
| 84 |
+
fast-deep-equal package is a part of [Tidelift enterprise subscription](https://tidelift.com/subscription/pkg/npm-fast-deep-equal?utm_source=npm-fast-deep-equal&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers.
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
## Security contact
|
| 88 |
+
|
| 89 |
+
To report a security vulnerability, please use the
|
| 90 |
+
[Tidelift security contact](https://tidelift.com/security).
|
| 91 |
+
Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues.
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
## License
|
| 95 |
+
|
| 96 |
+
[MIT](https://github.com/epoberezkin/fast-deep-equal/blob/master/LICENSE)
|
node_modules/fast-deep-equal/es6/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare const equal: (a: any, b: any) => boolean;
|
| 2 |
+
export = equal;
|
node_modules/fast-deep-equal/es6/index.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
// do not edit .js files directly - edit src/index.jst
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
module.exports = function equal(a, b) {
|
| 10 |
+
if (a === b) return true;
|
| 11 |
+
|
| 12 |
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
| 13 |
+
if (a.constructor !== b.constructor) return false;
|
| 14 |
+
|
| 15 |
+
var length, i, keys;
|
| 16 |
+
if (Array.isArray(a)) {
|
| 17 |
+
length = a.length;
|
| 18 |
+
if (length != b.length) return false;
|
| 19 |
+
for (i = length; i-- !== 0;)
|
| 20 |
+
if (!equal(a[i], b[i])) return false;
|
| 21 |
+
return true;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
if ((a instanceof Map) && (b instanceof Map)) {
|
| 26 |
+
if (a.size !== b.size) return false;
|
| 27 |
+
for (i of a.entries())
|
| 28 |
+
if (!b.has(i[0])) return false;
|
| 29 |
+
for (i of a.entries())
|
| 30 |
+
if (!equal(i[1], b.get(i[0]))) return false;
|
| 31 |
+
return true;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
if ((a instanceof Set) && (b instanceof Set)) {
|
| 35 |
+
if (a.size !== b.size) return false;
|
| 36 |
+
for (i of a.entries())
|
| 37 |
+
if (!b.has(i[0])) return false;
|
| 38 |
+
return true;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
| 42 |
+
length = a.length;
|
| 43 |
+
if (length != b.length) return false;
|
| 44 |
+
for (i = length; i-- !== 0;)
|
| 45 |
+
if (a[i] !== b[i]) return false;
|
| 46 |
+
return true;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
| 51 |
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
| 52 |
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
| 53 |
+
|
| 54 |
+
keys = Object.keys(a);
|
| 55 |
+
length = keys.length;
|
| 56 |
+
if (length !== Object.keys(b).length) return false;
|
| 57 |
+
|
| 58 |
+
for (i = length; i-- !== 0;)
|
| 59 |
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
| 60 |
+
|
| 61 |
+
for (i = length; i-- !== 0;) {
|
| 62 |
+
var key = keys[i];
|
| 63 |
+
|
| 64 |
+
if (!equal(a[key], b[key])) return false;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
return true;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
// true if both NaN, false otherwise
|
| 71 |
+
return a!==a && b!==b;
|
| 72 |
+
};
|
node_modules/fast-deep-equal/es6/react.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare const equal: (a: any, b: any) => boolean;
|
| 2 |
+
export = equal;
|
node_modules/fast-deep-equal/es6/react.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
// do not edit .js files directly - edit src/index.jst
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
module.exports = function equal(a, b) {
|
| 10 |
+
if (a === b) return true;
|
| 11 |
+
|
| 12 |
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
| 13 |
+
if (a.constructor !== b.constructor) return false;
|
| 14 |
+
|
| 15 |
+
var length, i, keys;
|
| 16 |
+
if (Array.isArray(a)) {
|
| 17 |
+
length = a.length;
|
| 18 |
+
if (length != b.length) return false;
|
| 19 |
+
for (i = length; i-- !== 0;)
|
| 20 |
+
if (!equal(a[i], b[i])) return false;
|
| 21 |
+
return true;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
if ((a instanceof Map) && (b instanceof Map)) {
|
| 26 |
+
if (a.size !== b.size) return false;
|
| 27 |
+
for (i of a.entries())
|
| 28 |
+
if (!b.has(i[0])) return false;
|
| 29 |
+
for (i of a.entries())
|
| 30 |
+
if (!equal(i[1], b.get(i[0]))) return false;
|
| 31 |
+
return true;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
if ((a instanceof Set) && (b instanceof Set)) {
|
| 35 |
+
if (a.size !== b.size) return false;
|
| 36 |
+
for (i of a.entries())
|
| 37 |
+
if (!b.has(i[0])) return false;
|
| 38 |
+
return true;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
| 42 |
+
length = a.length;
|
| 43 |
+
if (length != b.length) return false;
|
| 44 |
+
for (i = length; i-- !== 0;)
|
| 45 |
+
if (a[i] !== b[i]) return false;
|
| 46 |
+
return true;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
| 51 |
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
| 52 |
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
| 53 |
+
|
| 54 |
+
keys = Object.keys(a);
|
| 55 |
+
length = keys.length;
|
| 56 |
+
if (length !== Object.keys(b).length) return false;
|
| 57 |
+
|
| 58 |
+
for (i = length; i-- !== 0;)
|
| 59 |
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
| 60 |
+
|
| 61 |
+
for (i = length; i-- !== 0;) {
|
| 62 |
+
var key = keys[i];
|
| 63 |
+
|
| 64 |
+
if (key === '_owner' && a.$$typeof) {
|
| 65 |
+
// React-specific: avoid traversing React elements' _owner.
|
| 66 |
+
// _owner contains circular references
|
| 67 |
+
// and is not needed when comparing the actual elements (and not their owners)
|
| 68 |
+
continue;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
if (!equal(a[key], b[key])) return false;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
return true;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
// true if both NaN, false otherwise
|
| 78 |
+
return a!==a && b!==b;
|
| 79 |
+
};
|
node_modules/fast-deep-equal/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare module 'fast-deep-equal' {
|
| 2 |
+
const equal: (a: any, b: any) => boolean;
|
| 3 |
+
export = equal;
|
| 4 |
+
}
|
node_modules/fast-deep-equal/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
// do not edit .js files directly - edit src/index.jst
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
module.exports = function equal(a, b) {
|
| 8 |
+
if (a === b) return true;
|
| 9 |
+
|
| 10 |
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
| 11 |
+
if (a.constructor !== b.constructor) return false;
|
| 12 |
+
|
| 13 |
+
var length, i, keys;
|
| 14 |
+
if (Array.isArray(a)) {
|
| 15 |
+
length = a.length;
|
| 16 |
+
if (length != b.length) return false;
|
| 17 |
+
for (i = length; i-- !== 0;)
|
| 18 |
+
if (!equal(a[i], b[i])) return false;
|
| 19 |
+
return true;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
| 25 |
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
| 26 |
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
| 27 |
+
|
| 28 |
+
keys = Object.keys(a);
|
| 29 |
+
length = keys.length;
|
| 30 |
+
if (length !== Object.keys(b).length) return false;
|
| 31 |
+
|
| 32 |
+
for (i = length; i-- !== 0;)
|
| 33 |
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
| 34 |
+
|
| 35 |
+
for (i = length; i-- !== 0;) {
|
| 36 |
+
var key = keys[i];
|
| 37 |
+
|
| 38 |
+
if (!equal(a[key], b[key])) return false;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
return true;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
// true if both NaN, false otherwise
|
| 45 |
+
return a!==a && b!==b;
|
| 46 |
+
};
|
node_modules/fast-deep-equal/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "fast-deep-equal",
|
| 3 |
+
"version": "3.1.3",
|
| 4 |
+
"description": "Fast deep equal",
|
| 5 |
+
"main": "index.js",
|
| 6 |
+
"scripts": {
|
| 7 |
+
"eslint": "eslint *.js benchmark/*.js spec/*.js",
|
| 8 |
+
"build": "node build",
|
| 9 |
+
"benchmark": "npm i && npm run build && cd ./benchmark && npm i && node ./",
|
| 10 |
+
"test-spec": "mocha spec/*.spec.js -R spec",
|
| 11 |
+
"test-cov": "nyc npm run test-spec",
|
| 12 |
+
"test-ts": "tsc --target ES5 --noImplicitAny index.d.ts",
|
| 13 |
+
"test": "npm run build && npm run eslint && npm run test-ts && npm run test-cov",
|
| 14 |
+
"prepublish": "npm run build"
|
| 15 |
+
},
|
| 16 |
+
"repository": {
|
| 17 |
+
"type": "git",
|
| 18 |
+
"url": "git+https://github.com/epoberezkin/fast-deep-equal.git"
|
| 19 |
+
},
|
| 20 |
+
"keywords": [
|
| 21 |
+
"fast",
|
| 22 |
+
"equal",
|
| 23 |
+
"deep-equal"
|
| 24 |
+
],
|
| 25 |
+
"author": "Evgeny Poberezkin",
|
| 26 |
+
"license": "MIT",
|
| 27 |
+
"bugs": {
|
| 28 |
+
"url": "https://github.com/epoberezkin/fast-deep-equal/issues"
|
| 29 |
+
},
|
| 30 |
+
"homepage": "https://github.com/epoberezkin/fast-deep-equal#readme",
|
| 31 |
+
"devDependencies": {
|
| 32 |
+
"coveralls": "^3.1.0",
|
| 33 |
+
"dot": "^1.1.2",
|
| 34 |
+
"eslint": "^7.2.0",
|
| 35 |
+
"mocha": "^7.2.0",
|
| 36 |
+
"nyc": "^15.1.0",
|
| 37 |
+
"pre-commit": "^1.2.2",
|
| 38 |
+
"react": "^16.12.0",
|
| 39 |
+
"react-test-renderer": "^16.12.0",
|
| 40 |
+
"sinon": "^9.0.2",
|
| 41 |
+
"typescript": "^3.9.5"
|
| 42 |
+
},
|
| 43 |
+
"nyc": {
|
| 44 |
+
"exclude": [
|
| 45 |
+
"**/spec/**",
|
| 46 |
+
"node_modules"
|
| 47 |
+
],
|
| 48 |
+
"reporter": [
|
| 49 |
+
"lcov",
|
| 50 |
+
"text-summary"
|
| 51 |
+
]
|
| 52 |
+
},
|
| 53 |
+
"files": [
|
| 54 |
+
"index.js",
|
| 55 |
+
"index.d.ts",
|
| 56 |
+
"react.js",
|
| 57 |
+
"react.d.ts",
|
| 58 |
+
"es6/"
|
| 59 |
+
],
|
| 60 |
+
"types": "index.d.ts"
|
| 61 |
+
}
|
node_modules/fast-deep-equal/react.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
declare const equal: (a: any, b: any) => boolean;
|
| 2 |
+
export = equal;
|
node_modules/fast-deep-equal/react.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
// do not edit .js files directly - edit src/index.jst
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
module.exports = function equal(a, b) {
|
| 8 |
+
if (a === b) return true;
|
| 9 |
+
|
| 10 |
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
| 11 |
+
if (a.constructor !== b.constructor) return false;
|
| 12 |
+
|
| 13 |
+
var length, i, keys;
|
| 14 |
+
if (Array.isArray(a)) {
|
| 15 |
+
length = a.length;
|
| 16 |
+
if (length != b.length) return false;
|
| 17 |
+
for (i = length; i-- !== 0;)
|
| 18 |
+
if (!equal(a[i], b[i])) return false;
|
| 19 |
+
return true;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
| 25 |
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
| 26 |
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
| 27 |
+
|
| 28 |
+
keys = Object.keys(a);
|
| 29 |
+
length = keys.length;
|
| 30 |
+
if (length !== Object.keys(b).length) return false;
|
| 31 |
+
|
| 32 |
+
for (i = length; i-- !== 0;)
|
| 33 |
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
| 34 |
+
|
| 35 |
+
for (i = length; i-- !== 0;) {
|
| 36 |
+
var key = keys[i];
|
| 37 |
+
|
| 38 |
+
if (key === '_owner' && a.$$typeof) {
|
| 39 |
+
// React-specific: avoid traversing React elements' _owner.
|
| 40 |
+
// _owner contains circular references
|
| 41 |
+
// and is not needed when comparing the actual elements (and not their owners)
|
| 42 |
+
continue;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
if (!equal(a[key], b[key])) return false;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
return true;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
// true if both NaN, false otherwise
|
| 52 |
+
return a!==a && b!==b;
|
| 53 |
+
};
|
node_modules/fast-glob/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) Denis Malinochkin
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
node_modules/fast-glob/README.md
ADDED
|
@@ -0,0 +1,830 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# fast-glob
|
| 2 |
+
|
| 3 |
+
> It's a very fast and efficient [glob][glob_definition] library for [Node.js][node_js].
|
| 4 |
+
|
| 5 |
+
This package provides methods for traversing the file system and returning pathnames that matched a defined set of a specified pattern according to the rules used by the Unix Bash shell with some simplifications, meanwhile results are returned in **arbitrary order**. Quick, simple, effective.
|
| 6 |
+
|
| 7 |
+
## Table of Contents
|
| 8 |
+
|
| 9 |
+
<details>
|
| 10 |
+
<summary><strong>Details</strong></summary>
|
| 11 |
+
|
| 12 |
+
* [Highlights](#highlights)
|
| 13 |
+
* [Old and modern mode](#old-and-modern-mode)
|
| 14 |
+
* [Pattern syntax](#pattern-syntax)
|
| 15 |
+
* [Basic syntax](#basic-syntax)
|
| 16 |
+
* [Advanced syntax](#advanced-syntax)
|
| 17 |
+
* [Installation](#installation)
|
| 18 |
+
* [API](#api)
|
| 19 |
+
* [Asynchronous](#asynchronous)
|
| 20 |
+
* [Synchronous](#synchronous)
|
| 21 |
+
* [Stream](#stream)
|
| 22 |
+
* [patterns](#patterns)
|
| 23 |
+
* [[options]](#options)
|
| 24 |
+
* [Helpers](#helpers)
|
| 25 |
+
* [generateTasks](#generatetaskspatterns-options)
|
| 26 |
+
* [isDynamicPattern](#isdynamicpatternpattern-options)
|
| 27 |
+
* [escapePath](#escapepathpath)
|
| 28 |
+
* [convertPathToPattern](#convertpathtopatternpath)
|
| 29 |
+
* [Options](#options-3)
|
| 30 |
+
* [Common](#common)
|
| 31 |
+
* [concurrency](#concurrency)
|
| 32 |
+
* [cwd](#cwd)
|
| 33 |
+
* [deep](#deep)
|
| 34 |
+
* [followSymbolicLinks](#followsymboliclinks)
|
| 35 |
+
* [fs](#fs)
|
| 36 |
+
* [ignore](#ignore)
|
| 37 |
+
* [suppressErrors](#suppresserrors)
|
| 38 |
+
* [throwErrorOnBrokenSymbolicLink](#throwerroronbrokensymboliclink)
|
| 39 |
+
* [Output control](#output-control)
|
| 40 |
+
* [absolute](#absolute)
|
| 41 |
+
* [markDirectories](#markdirectories)
|
| 42 |
+
* [objectMode](#objectmode)
|
| 43 |
+
* [onlyDirectories](#onlydirectories)
|
| 44 |
+
* [onlyFiles](#onlyfiles)
|
| 45 |
+
* [stats](#stats)
|
| 46 |
+
* [unique](#unique)
|
| 47 |
+
* [Matching control](#matching-control)
|
| 48 |
+
* [braceExpansion](#braceexpansion)
|
| 49 |
+
* [caseSensitiveMatch](#casesensitivematch)
|
| 50 |
+
* [dot](#dot)
|
| 51 |
+
* [extglob](#extglob)
|
| 52 |
+
* [globstar](#globstar)
|
| 53 |
+
* [baseNameMatch](#basenamematch)
|
| 54 |
+
* [FAQ](#faq)
|
| 55 |
+
* [What is a static or dynamic pattern?](#what-is-a-static-or-dynamic-pattern)
|
| 56 |
+
* [How to write patterns on Windows?](#how-to-write-patterns-on-windows)
|
| 57 |
+
* [Why are parentheses match wrong?](#why-are-parentheses-match-wrong)
|
| 58 |
+
* [How to exclude directory from reading?](#how-to-exclude-directory-from-reading)
|
| 59 |
+
* [How to use UNC path?](#how-to-use-unc-path)
|
| 60 |
+
* [Compatible with `node-glob`?](#compatible-with-node-glob)
|
| 61 |
+
* [Benchmarks](#benchmarks)
|
| 62 |
+
* [Server](#server)
|
| 63 |
+
* [Nettop](#nettop)
|
| 64 |
+
* [Changelog](#changelog)
|
| 65 |
+
* [License](#license)
|
| 66 |
+
|
| 67 |
+
</details>
|
| 68 |
+
|
| 69 |
+
## Highlights
|
| 70 |
+
|
| 71 |
+
* Fast. Probably the fastest.
|
| 72 |
+
* Supports multiple and negative patterns.
|
| 73 |
+
* Synchronous, Promise and Stream API.
|
| 74 |
+
* Object mode. Can return more than just strings.
|
| 75 |
+
* Error-tolerant.
|
| 76 |
+
|
| 77 |
+
## Old and modern mode
|
| 78 |
+
|
| 79 |
+
This package works in two modes, depending on the environment in which it is used.
|
| 80 |
+
|
| 81 |
+
* **Old mode**. Node.js below 10.10 or when the [`stats`](#stats) option is *enabled*.
|
| 82 |
+
* **Modern mode**. Node.js 10.10+ and the [`stats`](#stats) option is *disabled*.
|
| 83 |
+
|
| 84 |
+
The modern mode is faster. Learn more about the [internal mechanism][nodelib_fs_scandir_old_and_modern_modern].
|
| 85 |
+
|
| 86 |
+
## Pattern syntax
|
| 87 |
+
|
| 88 |
+
> :warning: Always use forward-slashes in glob expressions (patterns and [`ignore`](#ignore) option). Use backslashes for escaping characters.
|
| 89 |
+
|
| 90 |
+
There is more than one form of syntax: basic and advanced. Below is a brief overview of the supported features. Also pay attention to our [FAQ](#faq).
|
| 91 |
+
|
| 92 |
+
> :book: This package uses [`micromatch`][micromatch] as a library for pattern matching.
|
| 93 |
+
|
| 94 |
+
### Basic syntax
|
| 95 |
+
|
| 96 |
+
* An asterisk (`*`) — matches everything except slashes (path separators), hidden files (names starting with `.`).
|
| 97 |
+
* A double star or globstar (`**`) — matches zero or more directories.
|
| 98 |
+
* Question mark (`?`) – matches any single character except slashes (path separators).
|
| 99 |
+
* Sequence (`[seq]`) — matches any character in sequence.
|
| 100 |
+
|
| 101 |
+
> :book: A few additional words about the [basic matching behavior][picomatch_matching_behavior].
|
| 102 |
+
|
| 103 |
+
Some examples:
|
| 104 |
+
|
| 105 |
+
* `src/**/*.js` — matches all files in the `src` directory (any level of nesting) that have the `.js` extension.
|
| 106 |
+
* `src/*.??` — matches all files in the `src` directory (only first level of nesting) that have a two-character extension.
|
| 107 |
+
* `file-[01].js` — matches files: `file-0.js`, `file-1.js`.
|
| 108 |
+
|
| 109 |
+
### Advanced syntax
|
| 110 |
+
|
| 111 |
+
* [Escapes characters][micromatch_backslashes] (`\\`) — matching special characters (`$^*+?()[]`) as literals.
|
| 112 |
+
* [POSIX character classes][picomatch_posix_brackets] (`[[:digit:]]`).
|
| 113 |
+
* [Extended globs][micromatch_extglobs] (`?(pattern-list)`).
|
| 114 |
+
* [Bash style brace expansions][micromatch_braces] (`{}`).
|
| 115 |
+
* [Regexp character classes][micromatch_regex_character_classes] (`[1-5]`).
|
| 116 |
+
* [Regex groups][regular_expressions_brackets] (`(a|b)`).
|
| 117 |
+
|
| 118 |
+
> :book: A few additional words about the [advanced matching behavior][micromatch_extended_globbing].
|
| 119 |
+
|
| 120 |
+
Some examples:
|
| 121 |
+
|
| 122 |
+
* `src/**/*.{css,scss}` — matches all files in the `src` directory (any level of nesting) that have the `.css` or `.scss` extension.
|
| 123 |
+
* `file-[[:digit:]].js` — matches files: `file-0.js`, `file-1.js`, …, `file-9.js`.
|
| 124 |
+
* `file-{1..3}.js` — matches files: `file-1.js`, `file-2.js`, `file-3.js`.
|
| 125 |
+
* `file-(1|2)` — matches files: `file-1.js`, `file-2.js`.
|
| 126 |
+
|
| 127 |
+
## Installation
|
| 128 |
+
|
| 129 |
+
```console
|
| 130 |
+
npm install fast-glob
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
## API
|
| 134 |
+
|
| 135 |
+
### Asynchronous
|
| 136 |
+
|
| 137 |
+
```js
|
| 138 |
+
fg(patterns, [options])
|
| 139 |
+
fg.async(patterns, [options])
|
| 140 |
+
fg.glob(patterns, [options])
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
Returns a `Promise` with an array of matching entries.
|
| 144 |
+
|
| 145 |
+
```js
|
| 146 |
+
const fg = require('fast-glob');
|
| 147 |
+
|
| 148 |
+
const entries = await fg(['.editorconfig', '**/index.js'], { dot: true });
|
| 149 |
+
|
| 150 |
+
// ['.editorconfig', 'services/index.js']
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
### Synchronous
|
| 154 |
+
|
| 155 |
+
```js
|
| 156 |
+
fg.sync(patterns, [options])
|
| 157 |
+
fg.globSync(patterns, [options])
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
Returns an array of matching entries.
|
| 161 |
+
|
| 162 |
+
```js
|
| 163 |
+
const fg = require('fast-glob');
|
| 164 |
+
|
| 165 |
+
const entries = fg.sync(['.editorconfig', '**/index.js'], { dot: true });
|
| 166 |
+
|
| 167 |
+
// ['.editorconfig', 'services/index.js']
|
| 168 |
+
```
|
| 169 |
+
|
| 170 |
+
### Stream
|
| 171 |
+
|
| 172 |
+
```js
|
| 173 |
+
fg.stream(patterns, [options])
|
| 174 |
+
fg.globStream(patterns, [options])
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
Returns a [`ReadableStream`][node_js_stream_readable_streams] when the `data` event will be emitted with matching entry.
|
| 178 |
+
|
| 179 |
+
```js
|
| 180 |
+
const fg = require('fast-glob');
|
| 181 |
+
|
| 182 |
+
const stream = fg.stream(['.editorconfig', '**/index.js'], { dot: true });
|
| 183 |
+
|
| 184 |
+
for await (const entry of stream) {
|
| 185 |
+
// .editorconfig
|
| 186 |
+
// services/index.js
|
| 187 |
+
}
|
| 188 |
+
```
|
| 189 |
+
|
| 190 |
+
#### patterns
|
| 191 |
+
|
| 192 |
+
* Required: `true`
|
| 193 |
+
* Type: `string | string[]`
|
| 194 |
+
|
| 195 |
+
Any correct pattern(s).
|
| 196 |
+
|
| 197 |
+
> :1234: [Pattern syntax](#pattern-syntax)
|
| 198 |
+
>
|
| 199 |
+
> :warning: This package does not respect the order of patterns. First, all the negative patterns are applied, and only then the positive patterns. If you want to get a certain order of records, use sorting or split calls.
|
| 200 |
+
|
| 201 |
+
#### [options]
|
| 202 |
+
|
| 203 |
+
* Required: `false`
|
| 204 |
+
* Type: [`Options`](#options-3)
|
| 205 |
+
|
| 206 |
+
See [Options](#options-3) section.
|
| 207 |
+
|
| 208 |
+
### Helpers
|
| 209 |
+
|
| 210 |
+
#### `generateTasks(patterns, [options])`
|
| 211 |
+
|
| 212 |
+
Returns the internal representation of patterns ([`Task`](./src/managers/tasks.ts) is a combining patterns by base directory).
|
| 213 |
+
|
| 214 |
+
```js
|
| 215 |
+
fg.generateTasks('*');
|
| 216 |
+
|
| 217 |
+
[{
|
| 218 |
+
base: '.', // Parent directory for all patterns inside this task
|
| 219 |
+
dynamic: true, // Dynamic or static patterns are in this task
|
| 220 |
+
patterns: ['*'],
|
| 221 |
+
positive: ['*'],
|
| 222 |
+
negative: []
|
| 223 |
+
}]
|
| 224 |
+
```
|
| 225 |
+
|
| 226 |
+
##### patterns
|
| 227 |
+
|
| 228 |
+
* Required: `true`
|
| 229 |
+
* Type: `string | string[]`
|
| 230 |
+
|
| 231 |
+
Any correct pattern(s).
|
| 232 |
+
|
| 233 |
+
##### [options]
|
| 234 |
+
|
| 235 |
+
* Required: `false`
|
| 236 |
+
* Type: [`Options`](#options-3)
|
| 237 |
+
|
| 238 |
+
See [Options](#options-3) section.
|
| 239 |
+
|
| 240 |
+
#### `isDynamicPattern(pattern, [options])`
|
| 241 |
+
|
| 242 |
+
Returns `true` if the passed pattern is a dynamic pattern.
|
| 243 |
+
|
| 244 |
+
> :1234: [What is a static or dynamic pattern?](#what-is-a-static-or-dynamic-pattern)
|
| 245 |
+
|
| 246 |
+
```js
|
| 247 |
+
fg.isDynamicPattern('*'); // true
|
| 248 |
+
fg.isDynamicPattern('abc'); // false
|
| 249 |
+
```
|
| 250 |
+
|
| 251 |
+
##### pattern
|
| 252 |
+
|
| 253 |
+
* Required: `true`
|
| 254 |
+
* Type: `string`
|
| 255 |
+
|
| 256 |
+
Any correct pattern.
|
| 257 |
+
|
| 258 |
+
##### [options]
|
| 259 |
+
|
| 260 |
+
* Required: `false`
|
| 261 |
+
* Type: [`Options`](#options-3)
|
| 262 |
+
|
| 263 |
+
See [Options](#options-3) section.
|
| 264 |
+
|
| 265 |
+
#### `escapePath(path)`
|
| 266 |
+
|
| 267 |
+
Returns the path with escaped special characters depending on the platform.
|
| 268 |
+
|
| 269 |
+
* Posix:
|
| 270 |
+
* `*?|(){}[]`;
|
| 271 |
+
* `!` at the beginning of line;
|
| 272 |
+
* `@+!` before the opening parenthesis;
|
| 273 |
+
* `\\` before non-special characters;
|
| 274 |
+
* Windows:
|
| 275 |
+
* `(){}`
|
| 276 |
+
* `!` at the beginning of line;
|
| 277 |
+
* `@+!` before the opening parenthesis;
|
| 278 |
+
* Characters like `*?|[]` cannot be used in the path ([windows_naming_conventions][windows_naming_conventions]), so they will not be escaped;
|
| 279 |
+
|
| 280 |
+
```js
|
| 281 |
+
fg.escapePath('!abc');
|
| 282 |
+
// \\!abc
|
| 283 |
+
fg.escapePath('[OpenSource] mrmlnc – fast-glob (Deluxe Edition) 2014') + '/*.flac'
|
| 284 |
+
// \\[OpenSource\\] mrmlnc – fast-glob \\(Deluxe Edition\\) 2014/*.flac
|
| 285 |
+
|
| 286 |
+
fg.posix.escapePath('C:\\Program Files (x86)\\**\\*');
|
| 287 |
+
// C:\\\\Program Files \\(x86\\)\\*\\*\\*
|
| 288 |
+
fg.win32.escapePath('C:\\Program Files (x86)\\**\\*');
|
| 289 |
+
// Windows: C:\\Program Files \\(x86\\)\\**\\*
|
| 290 |
+
```
|
| 291 |
+
|
| 292 |
+
#### `convertPathToPattern(path)`
|
| 293 |
+
|
| 294 |
+
Converts a path to a pattern depending on the platform, including special character escaping.
|
| 295 |
+
|
| 296 |
+
* Posix. Works similarly to the `fg.posix.escapePath` method.
|
| 297 |
+
* Windows. Works similarly to the `fg.win32.escapePath` method, additionally converting backslashes to forward slashes in cases where they are not escape characters (`!()+@{}`).
|
| 298 |
+
|
| 299 |
+
```js
|
| 300 |
+
fg.convertPathToPattern('[OpenSource] mrmlnc – fast-glob (Deluxe Edition) 2014') + '/*.flac';
|
| 301 |
+
// \\[OpenSource\\] mrmlnc – fast-glob \\(Deluxe Edition\\) 2014/*.flac
|
| 302 |
+
|
| 303 |
+
fg.convertPathToPattern('C:/Program Files (x86)/**/*');
|
| 304 |
+
// Posix: C:/Program Files \\(x86\\)/\\*\\*/\\*
|
| 305 |
+
// Windows: C:/Program Files \\(x86\\)/**/*
|
| 306 |
+
|
| 307 |
+
fg.convertPathToPattern('C:\\Program Files (x86)\\**\\*');
|
| 308 |
+
// Posix: C:\\\\Program Files \\(x86\\)\\*\\*\\*
|
| 309 |
+
// Windows: C:/Program Files \\(x86\\)/**/*
|
| 310 |
+
|
| 311 |
+
fg.posix.convertPathToPattern('\\\\?\\c:\\Program Files (x86)') + '/**/*';
|
| 312 |
+
// Posix: \\\\\\?\\\\c:\\\\Program Files \\(x86\\)/**/* (broken pattern)
|
| 313 |
+
fg.win32.convertPathToPattern('\\\\?\\c:\\Program Files (x86)') + '/**/*';
|
| 314 |
+
// Windows: //?/c:/Program Files \\(x86\\)/**/*
|
| 315 |
+
```
|
| 316 |
+
|
| 317 |
+
## Options
|
| 318 |
+
|
| 319 |
+
### Common options
|
| 320 |
+
|
| 321 |
+
#### concurrency
|
| 322 |
+
|
| 323 |
+
* Type: `number`
|
| 324 |
+
* Default: `os.cpus().length`
|
| 325 |
+
|
| 326 |
+
Specifies the maximum number of concurrent requests from a reader to read directories.
|
| 327 |
+
|
| 328 |
+
> :book: The higher the number, the higher the performance and load on the file system. If you want to read in quiet mode, set the value to a comfortable number or `1`.
|
| 329 |
+
|
| 330 |
+
<details>
|
| 331 |
+
|
| 332 |
+
<summary>More details</summary>
|
| 333 |
+
|
| 334 |
+
In Node, there are [two types of threads][nodejs_thread_pool]: Event Loop (code) and a Thread Pool (fs, dns, …). The thread pool size controlled by the `UV_THREADPOOL_SIZE` environment variable. Its default size is 4 ([documentation][libuv_thread_pool]). The pool is one for all tasks within a single Node process.
|
| 335 |
+
|
| 336 |
+
Any code can make 4 real concurrent accesses to the file system. The rest of the FS requests will wait in the queue.
|
| 337 |
+
|
| 338 |
+
> :book: Each new instance of FG in the same Node process will use the same Thread pool.
|
| 339 |
+
|
| 340 |
+
But this package also has the `concurrency` option. This option allows you to control the number of concurrent accesses to the FS at the package level. By default, this package has a value equal to the number of cores available for the current Node process. This allows you to set a value smaller than the pool size (`concurrency: 1`) or, conversely, to prepare tasks for the pool queue more quickly (`concurrency: Number.POSITIVE_INFINITY`).
|
| 341 |
+
|
| 342 |
+
So, in fact, this package can **only make 4 concurrent requests to the FS**. You can increase this value by using an environment variable (`UV_THREADPOOL_SIZE`), but in practice this does not give a multiple advantage.
|
| 343 |
+
|
| 344 |
+
</details>
|
| 345 |
+
|
| 346 |
+
#### cwd
|
| 347 |
+
|
| 348 |
+
* Type: `string`
|
| 349 |
+
* Default: `process.cwd()`
|
| 350 |
+
|
| 351 |
+
The current working directory in which to search.
|
| 352 |
+
|
| 353 |
+
#### deep
|
| 354 |
+
|
| 355 |
+
* Type: `number`
|
| 356 |
+
* Default: `Infinity`
|
| 357 |
+
|
| 358 |
+
Specifies the maximum depth of a read directory relative to the start directory.
|
| 359 |
+
|
| 360 |
+
For example, you have the following tree:
|
| 361 |
+
|
| 362 |
+
```js
|
| 363 |
+
dir/
|
| 364 |
+
└── one/ // 1
|
| 365 |
+
└── two/ // 2
|
| 366 |
+
└── file.js // 3
|
| 367 |
+
```
|
| 368 |
+
|
| 369 |
+
```js
|
| 370 |
+
// With base directory
|
| 371 |
+
fg.sync('dir/**', { onlyFiles: false, deep: 1 }); // ['dir/one']
|
| 372 |
+
fg.sync('dir/**', { onlyFiles: false, deep: 2 }); // ['dir/one', 'dir/one/two']
|
| 373 |
+
|
| 374 |
+
// With cwd option
|
| 375 |
+
fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 1 }); // ['one']
|
| 376 |
+
fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 2 }); // ['one', 'one/two']
|
| 377 |
+
```
|
| 378 |
+
|
| 379 |
+
> :book: If you specify a pattern with some base directory, this directory will not participate in the calculation of the depth of the found directories. Think of it as a [`cwd`](#cwd) option.
|
| 380 |
+
|
| 381 |
+
#### followSymbolicLinks
|
| 382 |
+
|
| 383 |
+
* Type: `boolean`
|
| 384 |
+
* Default: `true`
|
| 385 |
+
|
| 386 |
+
Indicates whether to traverse descendants of symbolic link directories when expanding `**` patterns.
|
| 387 |
+
|
| 388 |
+
> :book: Note that this option does not affect the base directory of the pattern. For example, if `./a` is a symlink to directory `./b` and you specified `['./a**', './b/**']` patterns, then directory `./a` will still be read.
|
| 389 |
+
|
| 390 |
+
> :book: If the [`stats`](#stats) option is specified, the information about the symbolic link (`fs.lstat`) will be replaced with information about the entry (`fs.stat`) behind it.
|
| 391 |
+
|
| 392 |
+
#### fs
|
| 393 |
+
|
| 394 |
+
* Type: `FileSystemAdapter`
|
| 395 |
+
* Default: `fs.*`
|
| 396 |
+
|
| 397 |
+
Custom implementation of methods for working with the file system.
|
| 398 |
+
|
| 399 |
+
```ts
|
| 400 |
+
export interface FileSystemAdapter {
|
| 401 |
+
lstat?: typeof fs.lstat;
|
| 402 |
+
stat?: typeof fs.stat;
|
| 403 |
+
lstatSync?: typeof fs.lstatSync;
|
| 404 |
+
statSync?: typeof fs.statSync;
|
| 405 |
+
readdir?: typeof fs.readdir;
|
| 406 |
+
readdirSync?: typeof fs.readdirSync;
|
| 407 |
+
}
|
| 408 |
+
```
|
| 409 |
+
|
| 410 |
+
#### ignore
|
| 411 |
+
|
| 412 |
+
* Type: `string[]`
|
| 413 |
+
* Default: `[]`
|
| 414 |
+
|
| 415 |
+
An array of glob patterns to exclude matches. This is an alternative way to use negative patterns.
|
| 416 |
+
|
| 417 |
+
```js
|
| 418 |
+
dir/
|
| 419 |
+
├── package-lock.json
|
| 420 |
+
└── package.json
|
| 421 |
+
```
|
| 422 |
+
|
| 423 |
+
```js
|
| 424 |
+
fg.sync(['*.json', '!package-lock.json']); // ['package.json']
|
| 425 |
+
fg.sync('*.json', { ignore: ['package-lock.json'] }); // ['package.json']
|
| 426 |
+
```
|
| 427 |
+
|
| 428 |
+
#### suppressErrors
|
| 429 |
+
|
| 430 |
+
* Type: `boolean`
|
| 431 |
+
* Default: `false`
|
| 432 |
+
|
| 433 |
+
By default this package suppress only `ENOENT` errors. Set to `true` to suppress any error.
|
| 434 |
+
|
| 435 |
+
> :book: Can be useful when the directory has entries with a special level of access.
|
| 436 |
+
|
| 437 |
+
#### throwErrorOnBrokenSymbolicLink
|
| 438 |
+
|
| 439 |
+
* Type: `boolean`
|
| 440 |
+
* Default: `false`
|
| 441 |
+
|
| 442 |
+
Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
|
| 443 |
+
|
| 444 |
+
> :book: This option has no effect on errors when reading the symbolic link directory.
|
| 445 |
+
|
| 446 |
+
### Output control
|
| 447 |
+
|
| 448 |
+
#### absolute
|
| 449 |
+
|
| 450 |
+
* Type: `boolean`
|
| 451 |
+
* Default: `false`
|
| 452 |
+
|
| 453 |
+
Return the absolute path for entries.
|
| 454 |
+
|
| 455 |
+
```js
|
| 456 |
+
fg.sync('*.js', { absolute: false }); // ['index.js']
|
| 457 |
+
fg.sync('*.js', { absolute: true }); // ['/home/user/index.js']
|
| 458 |
+
```
|
| 459 |
+
|
| 460 |
+
> :book: This option is required if you want to use negative patterns with absolute path, for example, `!${__dirname}/*.js`.
|
| 461 |
+
|
| 462 |
+
#### markDirectories
|
| 463 |
+
|
| 464 |
+
* Type: `boolean`
|
| 465 |
+
* Default: `false`
|
| 466 |
+
|
| 467 |
+
Mark the directory path with the final slash.
|
| 468 |
+
|
| 469 |
+
```js
|
| 470 |
+
fg.sync('*', { onlyFiles: false, markDirectories: false }); // ['index.js', 'controllers']
|
| 471 |
+
fg.sync('*', { onlyFiles: false, markDirectories: true }); // ['index.js', 'controllers/']
|
| 472 |
+
```
|
| 473 |
+
|
| 474 |
+
#### objectMode
|
| 475 |
+
|
| 476 |
+
* Type: `boolean`
|
| 477 |
+
* Default: `false`
|
| 478 |
+
|
| 479 |
+
Returns objects (instead of strings) describing entries.
|
| 480 |
+
|
| 481 |
+
```js
|
| 482 |
+
fg.sync('*', { objectMode: false }); // ['src/index.js']
|
| 483 |
+
fg.sync('*', { objectMode: true }); // [{ name: 'index.js', path: 'src/index.js', dirent: <fs.Dirent> }]
|
| 484 |
+
```
|
| 485 |
+
|
| 486 |
+
The object has the following fields:
|
| 487 |
+
|
| 488 |
+
* name (`string`) — the last part of the path (basename)
|
| 489 |
+
* path (`string`) — full path relative to the pattern base directory
|
| 490 |
+
* dirent ([`fs.Dirent`][node_js_fs_class_fs_dirent]) — instance of `fs.Dirent`
|
| 491 |
+
|
| 492 |
+
> :book: An object is an internal representation of entry, so getting it does not affect performance.
|
| 493 |
+
|
| 494 |
+
#### onlyDirectories
|
| 495 |
+
|
| 496 |
+
* Type: `boolean`
|
| 497 |
+
* Default: `false`
|
| 498 |
+
|
| 499 |
+
Return only directories.
|
| 500 |
+
|
| 501 |
+
```js
|
| 502 |
+
fg.sync('*', { onlyDirectories: false }); // ['index.js', 'src']
|
| 503 |
+
fg.sync('*', { onlyDirectories: true }); // ['src']
|
| 504 |
+
```
|
| 505 |
+
|
| 506 |
+
> :book: If `true`, the [`onlyFiles`](#onlyfiles) option is automatically `false`.
|
| 507 |
+
|
| 508 |
+
#### onlyFiles
|
| 509 |
+
|
| 510 |
+
* Type: `boolean`
|
| 511 |
+
* Default: `true`
|
| 512 |
+
|
| 513 |
+
Return only files.
|
| 514 |
+
|
| 515 |
+
```js
|
| 516 |
+
fg.sync('*', { onlyFiles: false }); // ['index.js', 'src']
|
| 517 |
+
fg.sync('*', { onlyFiles: true }); // ['index.js']
|
| 518 |
+
```
|
| 519 |
+
|
| 520 |
+
#### stats
|
| 521 |
+
|
| 522 |
+
* Type: `boolean`
|
| 523 |
+
* Default: `false`
|
| 524 |
+
|
| 525 |
+
Enables an [object mode](#objectmode) with an additional field:
|
| 526 |
+
|
| 527 |
+
* stats ([`fs.Stats`][node_js_fs_class_fs_stats]) — instance of `fs.Stats`
|
| 528 |
+
|
| 529 |
+
```js
|
| 530 |
+
fg.sync('*', { stats: false }); // ['src/index.js']
|
| 531 |
+
fg.sync('*', { stats: true }); // [{ name: 'index.js', path: 'src/index.js', dirent: <fs.Dirent>, stats: <fs.Stats> }]
|
| 532 |
+
```
|
| 533 |
+
|
| 534 |
+
> :book: Returns `fs.stat` instead of `fs.lstat` for symbolic links when the [`followSymbolicLinks`](#followsymboliclinks) option is specified.
|
| 535 |
+
>
|
| 536 |
+
> :warning: Unlike [object mode](#objectmode) this mode requires additional calls to the file system. On average, this mode is slower at least twice. See [old and modern mode](#old-and-modern-mode) for more details.
|
| 537 |
+
|
| 538 |
+
#### unique
|
| 539 |
+
|
| 540 |
+
* Type: `boolean`
|
| 541 |
+
* Default: `true`
|
| 542 |
+
|
| 543 |
+
Ensures that the returned entries are unique.
|
| 544 |
+
|
| 545 |
+
```js
|
| 546 |
+
fg.sync(['*.json', 'package.json'], { unique: false }); // ['package.json', 'package.json']
|
| 547 |
+
fg.sync(['*.json', 'package.json'], { unique: true }); // ['package.json']
|
| 548 |
+
```
|
| 549 |
+
|
| 550 |
+
If `true` and similar entries are found, the result is the first found.
|
| 551 |
+
|
| 552 |
+
### Matching control
|
| 553 |
+
|
| 554 |
+
#### braceExpansion
|
| 555 |
+
|
| 556 |
+
* Type: `boolean`
|
| 557 |
+
* Default: `true`
|
| 558 |
+
|
| 559 |
+
Enables Bash-like brace expansion.
|
| 560 |
+
|
| 561 |
+
> :1234: [Syntax description][bash_hackers_syntax_expansion_brace] or more [detailed description][micromatch_braces].
|
| 562 |
+
|
| 563 |
+
```js
|
| 564 |
+
dir/
|
| 565 |
+
├── abd
|
| 566 |
+
├── acd
|
| 567 |
+
└── a{b,c}d
|
| 568 |
+
```
|
| 569 |
+
|
| 570 |
+
```js
|
| 571 |
+
fg.sync('a{b,c}d', { braceExpansion: false }); // ['a{b,c}d']
|
| 572 |
+
fg.sync('a{b,c}d', { braceExpansion: true }); // ['abd', 'acd']
|
| 573 |
+
```
|
| 574 |
+
|
| 575 |
+
#### caseSensitiveMatch
|
| 576 |
+
|
| 577 |
+
* Type: `boolean`
|
| 578 |
+
* Default: `true`
|
| 579 |
+
|
| 580 |
+
Enables a [case-sensitive][wikipedia_case_sensitivity] mode for matching files.
|
| 581 |
+
|
| 582 |
+
```js
|
| 583 |
+
dir/
|
| 584 |
+
├── file.txt
|
| 585 |
+
└── File.txt
|
| 586 |
+
```
|
| 587 |
+
|
| 588 |
+
```js
|
| 589 |
+
fg.sync('file.txt', { caseSensitiveMatch: false }); // ['file.txt', 'File.txt']
|
| 590 |
+
fg.sync('file.txt', { caseSensitiveMatch: true }); // ['file.txt']
|
| 591 |
+
```
|
| 592 |
+
|
| 593 |
+
#### dot
|
| 594 |
+
|
| 595 |
+
* Type: `boolean`
|
| 596 |
+
* Default: `false`
|
| 597 |
+
|
| 598 |
+
Allow patterns to match entries that begin with a period (`.`).
|
| 599 |
+
|
| 600 |
+
> :book: Note that an explicit dot in a portion of the pattern will always match dot files.
|
| 601 |
+
|
| 602 |
+
```js
|
| 603 |
+
dir/
|
| 604 |
+
├── .editorconfig
|
| 605 |
+
└── package.json
|
| 606 |
+
```
|
| 607 |
+
|
| 608 |
+
```js
|
| 609 |
+
fg.sync('*', { dot: false }); // ['package.json']
|
| 610 |
+
fg.sync('*', { dot: true }); // ['.editorconfig', 'package.json']
|
| 611 |
+
```
|
| 612 |
+
|
| 613 |
+
#### extglob
|
| 614 |
+
|
| 615 |
+
* Type: `boolean`
|
| 616 |
+
* Default: `true`
|
| 617 |
+
|
| 618 |
+
Enables Bash-like `extglob` functionality.
|
| 619 |
+
|
| 620 |
+
> :1234: [Syntax description][micromatch_extglobs].
|
| 621 |
+
|
| 622 |
+
```js
|
| 623 |
+
dir/
|
| 624 |
+
├── README.md
|
| 625 |
+
└── package.json
|
| 626 |
+
```
|
| 627 |
+
|
| 628 |
+
```js
|
| 629 |
+
fg.sync('*.+(json|md)', { extglob: false }); // []
|
| 630 |
+
fg.sync('*.+(json|md)', { extglob: true }); // ['README.md', 'package.json']
|
| 631 |
+
```
|
| 632 |
+
|
| 633 |
+
#### globstar
|
| 634 |
+
|
| 635 |
+
* Type: `boolean`
|
| 636 |
+
* Default: `true`
|
| 637 |
+
|
| 638 |
+
Enables recursively repeats a pattern containing `**`. If `false`, `**` behaves exactly like `*`.
|
| 639 |
+
|
| 640 |
+
```js
|
| 641 |
+
dir/
|
| 642 |
+
└── a
|
| 643 |
+
└── b
|
| 644 |
+
```
|
| 645 |
+
|
| 646 |
+
```js
|
| 647 |
+
fg.sync('**', { onlyFiles: false, globstar: false }); // ['a']
|
| 648 |
+
fg.sync('**', { onlyFiles: false, globstar: true }); // ['a', 'a/b']
|
| 649 |
+
```
|
| 650 |
+
|
| 651 |
+
#### baseNameMatch
|
| 652 |
+
|
| 653 |
+
* Type: `boolean`
|
| 654 |
+
* Default: `false`
|
| 655 |
+
|
| 656 |
+
If set to `true`, then patterns without slashes will be matched against the basename of the path if it contains slashes.
|
| 657 |
+
|
| 658 |
+
```js
|
| 659 |
+
dir/
|
| 660 |
+
└── one/
|
| 661 |
+
└── file.md
|
| 662 |
+
```
|
| 663 |
+
|
| 664 |
+
```js
|
| 665 |
+
fg.sync('*.md', { baseNameMatch: false }); // []
|
| 666 |
+
fg.sync('*.md', { baseNameMatch: true }); // ['one/file.md']
|
| 667 |
+
```
|
| 668 |
+
|
| 669 |
+
## FAQ
|
| 670 |
+
|
| 671 |
+
## What is a static or dynamic pattern?
|
| 672 |
+
|
| 673 |
+
All patterns can be divided into two types:
|
| 674 |
+
|
| 675 |
+
* **static**. A pattern is considered static if it can be used to get an entry on the file system without using matching mechanisms. For example, the `file.js` pattern is a static pattern because we can just verify that it exists on the file system.
|
| 676 |
+
* **dynamic**. A pattern is considered dynamic if it cannot be used directly to find occurrences without using a matching mechanisms. For example, the `*` pattern is a dynamic pattern because we cannot use this pattern directly.
|
| 677 |
+
|
| 678 |
+
A pattern is considered dynamic if it contains the following characters (`…` — any characters or their absence) or options:
|
| 679 |
+
|
| 680 |
+
* The [`caseSensitiveMatch`](#casesensitivematch) option is disabled
|
| 681 |
+
* `\\` (the escape character)
|
| 682 |
+
* `*`, `?`, `!` (at the beginning of line)
|
| 683 |
+
* `[…]`
|
| 684 |
+
* `(…|…)`
|
| 685 |
+
* `@(…)`, `!(…)`, `*(…)`, `?(…)`, `+(…)` (respects the [`extglob`](#extglob) option)
|
| 686 |
+
* `{…,…}`, `{…..…}` (respects the [`braceExpansion`](#braceexpansion) option)
|
| 687 |
+
|
| 688 |
+
## How to write patterns on Windows?
|
| 689 |
+
|
| 690 |
+
Always use forward-slashes in glob expressions (patterns and [`ignore`](#ignore) option). Use backslashes for escaping characters. With the [`cwd`](#cwd) option use a convenient format.
|
| 691 |
+
|
| 692 |
+
**Bad**
|
| 693 |
+
|
| 694 |
+
```ts
|
| 695 |
+
[
|
| 696 |
+
'directory\\*',
|
| 697 |
+
path.join(process.cwd(), '**')
|
| 698 |
+
]
|
| 699 |
+
```
|
| 700 |
+
|
| 701 |
+
**Good**
|
| 702 |
+
|
| 703 |
+
```ts
|
| 704 |
+
[
|
| 705 |
+
'directory/*',
|
| 706 |
+
fg.convertPathToPattern(process.cwd()) + '/**'
|
| 707 |
+
]
|
| 708 |
+
```
|
| 709 |
+
|
| 710 |
+
> :book: Use the [`.convertPathToPattern`](#convertpathtopatternpath) package to convert Windows-style path to a Unix-style path.
|
| 711 |
+
|
| 712 |
+
Read more about [matching with backslashes][micromatch_backslashes].
|
| 713 |
+
|
| 714 |
+
## Why are parentheses match wrong?
|
| 715 |
+
|
| 716 |
+
```js
|
| 717 |
+
dir/
|
| 718 |
+
└── (special-*file).txt
|
| 719 |
+
```
|
| 720 |
+
|
| 721 |
+
```js
|
| 722 |
+
fg.sync(['(special-*file).txt']) // []
|
| 723 |
+
```
|
| 724 |
+
|
| 725 |
+
Refers to Bash. You need to escape special characters:
|
| 726 |
+
|
| 727 |
+
```js
|
| 728 |
+
fg.sync(['\\(special-*file\\).txt']) // ['(special-*file).txt']
|
| 729 |
+
```
|
| 730 |
+
|
| 731 |
+
Read more about [matching special characters as literals][picomatch_matching_special_characters_as_literals]. Or use the [`.escapePath`](#escapepathpath).
|
| 732 |
+
|
| 733 |
+
## How to exclude directory from reading?
|
| 734 |
+
|
| 735 |
+
You can use a negative pattern like this: `!**/node_modules` or `!**/node_modules/**`. Also you can use [`ignore`](#ignore) option. Just look at the example below.
|
| 736 |
+
|
| 737 |
+
```js
|
| 738 |
+
first/
|
| 739 |
+
├── file.md
|
| 740 |
+
└── second/
|
| 741 |
+
└── file.txt
|
| 742 |
+
```
|
| 743 |
+
|
| 744 |
+
If you don't want to read the `second` directory, you must write the following pattern: `!**/second` or `!**/second/**`.
|
| 745 |
+
|
| 746 |
+
```js
|
| 747 |
+
fg.sync(['**/*.md', '!**/second']); // ['first/file.md']
|
| 748 |
+
fg.sync(['**/*.md'], { ignore: ['**/second/**'] }); // ['first/file.md']
|
| 749 |
+
```
|
| 750 |
+
|
| 751 |
+
> :warning: When you write `!**/second/**/*` it means that the directory will be **read**, but all the entries will not be included in the results.
|
| 752 |
+
|
| 753 |
+
You have to understand that if you write the pattern to exclude directories, then the directory will not be read under any circumstances.
|
| 754 |
+
|
| 755 |
+
## How to use UNC path?
|
| 756 |
+
|
| 757 |
+
You cannot use [Uniform Naming Convention (UNC)][unc_path] paths as patterns (due to syntax) directly, but you can use them as [`cwd`](#cwd) directory or use the `fg.convertPathToPattern` method.
|
| 758 |
+
|
| 759 |
+
```ts
|
| 760 |
+
// cwd
|
| 761 |
+
fg.sync('*', { cwd: '\\\\?\\C:\\Python27' /* or //?/C:/Python27 */ });
|
| 762 |
+
fg.sync('Python27/*', { cwd: '\\\\?\\C:\\' /* or //?/C:/ */ });
|
| 763 |
+
|
| 764 |
+
// .convertPathToPattern
|
| 765 |
+
fg.sync(fg.convertPathToPattern('\\\\?\\c:\\Python27') + '/*');
|
| 766 |
+
```
|
| 767 |
+
|
| 768 |
+
## Compatible with `node-glob`?
|
| 769 |
+
|
| 770 |
+
| node-glob | fast-glob |
|
| 771 |
+
| :----------: | :-------: |
|
| 772 |
+
| `cwd` | [`cwd`](#cwd) |
|
| 773 |
+
| `root` | – |
|
| 774 |
+
| `dot` | [`dot`](#dot) |
|
| 775 |
+
| `nomount` | – |
|
| 776 |
+
| `mark` | [`markDirectories`](#markdirectories) |
|
| 777 |
+
| `nosort` | – |
|
| 778 |
+
| `nounique` | [`unique`](#unique) |
|
| 779 |
+
| `nobrace` | [`braceExpansion`](#braceexpansion) |
|
| 780 |
+
| `noglobstar` | [`globstar`](#globstar) |
|
| 781 |
+
| `noext` | [`extglob`](#extglob) |
|
| 782 |
+
| `nocase` | [`caseSensitiveMatch`](#casesensitivematch) |
|
| 783 |
+
| `matchBase` | [`baseNameMatch`](#basenamematch) |
|
| 784 |
+
| `nodir` | [`onlyFiles`](#onlyfiles) |
|
| 785 |
+
| `ignore` | [`ignore`](#ignore) |
|
| 786 |
+
| `follow` | [`followSymbolicLinks`](#followsymboliclinks) |
|
| 787 |
+
| `realpath` | – |
|
| 788 |
+
| `absolute` | [`absolute`](#absolute) |
|
| 789 |
+
|
| 790 |
+
## Benchmarks
|
| 791 |
+
|
| 792 |
+
You can see results [here](https://github.com/mrmlnc/fast-glob/actions/workflows/benchmark.yml?query=branch%3Amaster) for every commit into the `main` branch.
|
| 793 |
+
|
| 794 |
+
* **Product benchmark** – comparison with the main competitors.
|
| 795 |
+
* **Regress benchmark** – regression between the current version and the version from the npm registry.
|
| 796 |
+
|
| 797 |
+
## Changelog
|
| 798 |
+
|
| 799 |
+
See the [Releases section of our GitHub project][github_releases] for changelog for each release version.
|
| 800 |
+
|
| 801 |
+
## License
|
| 802 |
+
|
| 803 |
+
This software is released under the terms of the MIT license.
|
| 804 |
+
|
| 805 |
+
[bash_hackers_syntax_expansion_brace]: https://wiki.bash-hackers.org/syntax/expansion/brace
|
| 806 |
+
[github_releases]: https://github.com/mrmlnc/fast-glob/releases
|
| 807 |
+
[glob_definition]: https://en.wikipedia.org/wiki/Glob_(programming)
|
| 808 |
+
[glob_linux_man]: http://man7.org/linux/man-pages/man3/glob.3.html
|
| 809 |
+
[micromatch_backslashes]: https://github.com/micromatch/micromatch#backslashes
|
| 810 |
+
[micromatch_braces]: https://github.com/micromatch/braces
|
| 811 |
+
[micromatch_extended_globbing]: https://github.com/micromatch/micromatch#extended-globbing
|
| 812 |
+
[micromatch_extglobs]: https://github.com/micromatch/micromatch#extglobs
|
| 813 |
+
[micromatch_regex_character_classes]: https://github.com/micromatch/micromatch#regex-character-classes
|
| 814 |
+
[micromatch]: https://github.com/micromatch/micromatch
|
| 815 |
+
[node_js_fs_class_fs_dirent]: https://nodejs.org/api/fs.html#fs_class_fs_dirent
|
| 816 |
+
[node_js_fs_class_fs_stats]: https://nodejs.org/api/fs.html#fs_class_fs_stats
|
| 817 |
+
[node_js_stream_readable_streams]: https://nodejs.org/api/stream.html#stream_readable_streams
|
| 818 |
+
[node_js]: https://nodejs.org/en
|
| 819 |
+
[nodelib_fs_scandir_old_and_modern_modern]: https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode
|
| 820 |
+
[npm_normalize_path]: https://www.npmjs.com/package/normalize-path
|
| 821 |
+
[npm_unixify]: https://www.npmjs.com/package/unixify
|
| 822 |
+
[picomatch_matching_behavior]: https://github.com/micromatch/picomatch#matching-behavior-vs-bash
|
| 823 |
+
[picomatch_matching_special_characters_as_literals]: https://github.com/micromatch/picomatch#matching-special-characters-as-literals
|
| 824 |
+
[picomatch_posix_brackets]: https://github.com/micromatch/picomatch#posix-brackets
|
| 825 |
+
[regular_expressions_brackets]: https://www.regular-expressions.info/brackets.html
|
| 826 |
+
[unc_path]: https://learn.microsoft.com/openspecs/windows_protocols/ms-dtyp/62e862f4-2a51-452e-8eeb-dc4ff5ee33cc
|
| 827 |
+
[wikipedia_case_sensitivity]: https://en.wikipedia.org/wiki/Case_sensitivity
|
| 828 |
+
[nodejs_thread_pool]: https://nodejs.org/en/docs/guides/dont-block-the-event-loop
|
| 829 |
+
[libuv_thread_pool]: http://docs.libuv.org/en/v1.x/threadpool.html
|
| 830 |
+
[windows_naming_conventions]: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
node_modules/fast-glob/node_modules/glob-parent/CHANGELOG.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### [5.1.2](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) (2021-03-06)
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
### Bug Fixes
|
| 5 |
+
|
| 6 |
+
* eliminate ReDoS ([#36](https://github.com/gulpjs/glob-parent/issues/36)) ([f923116](https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366))
|
| 7 |
+
|
| 8 |
+
### [5.1.1](https://github.com/gulpjs/glob-parent/compare/v5.1.0...v5.1.1) (2021-01-27)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
### Bug Fixes
|
| 12 |
+
|
| 13 |
+
* unescape exclamation mark ([#26](https://github.com/gulpjs/glob-parent/issues/26)) ([a98874f](https://github.com/gulpjs/glob-parent/commit/a98874f1a59e407f4fb1beb0db4efa8392da60bb))
|
| 14 |
+
|
| 15 |
+
## [5.1.0](https://github.com/gulpjs/glob-parent/compare/v5.0.0...v5.1.0) (2021-01-27)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
### Features
|
| 19 |
+
|
| 20 |
+
* add `flipBackslashes` option to disable auto conversion of slashes (closes [#24](https://github.com/gulpjs/glob-parent/issues/24)) ([#25](https://github.com/gulpjs/glob-parent/issues/25)) ([eecf91d](https://github.com/gulpjs/glob-parent/commit/eecf91d5e3834ed78aee39c4eaaae654d76b87b3))
|
| 21 |
+
|
| 22 |
+
## [5.0.0](https://github.com/gulpjs/glob-parent/compare/v4.0.0...v5.0.0) (2021-01-27)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
### ⚠ BREAKING CHANGES
|
| 26 |
+
|
| 27 |
+
* Drop support for node <6 & bump dependencies
|
| 28 |
+
|
| 29 |
+
### Miscellaneous Chores
|
| 30 |
+
|
| 31 |
+
* Drop support for node <6 & bump dependencies ([896c0c0](https://github.com/gulpjs/glob-parent/commit/896c0c00b4e7362f60b96e7fc295ae929245255a))
|
| 32 |
+
|
| 33 |
+
## [4.0.0](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v4.0.0) (2021-01-27)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
### ⚠ BREAKING CHANGES
|
| 37 |
+
|
| 38 |
+
* question marks are valid path characters on Windows so avoid flagging as a glob when alone
|
| 39 |
+
* Update is-glob dependency
|
| 40 |
+
|
| 41 |
+
### Features
|
| 42 |
+
|
| 43 |
+
* hoist regexps and strings for performance gains ([4a80667](https://github.com/gulpjs/glob-parent/commit/4a80667c69355c76a572a5892b0f133c8e1f457e))
|
| 44 |
+
* question marks are valid path characters on Windows so avoid flagging as a glob when alone ([2a551dd](https://github.com/gulpjs/glob-parent/commit/2a551dd0dc3235e78bf3c94843d4107072d17841))
|
| 45 |
+
* Update is-glob dependency ([e41fcd8](https://github.com/gulpjs/glob-parent/commit/e41fcd895d1f7bc617dba45c9d935a7949b9c281))
|
| 46 |
+
|
| 47 |
+
## [3.1.0](https://github.com/gulpjs/glob-parent/compare/v3.0.1...v3.1.0) (2021-01-27)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
### Features
|
| 51 |
+
|
| 52 |
+
* allow basic win32 backslash use ([272afa5](https://github.com/gulpjs/glob-parent/commit/272afa5fd070fc0f796386a5993d4ee4a846988b))
|
| 53 |
+
* handle extglobs (parentheses) containing separators ([7db1bdb](https://github.com/gulpjs/glob-parent/commit/7db1bdb0756e55fd14619e8ce31aa31b17b117fd))
|
| 54 |
+
* new approach to braces/brackets handling ([8269bd8](https://github.com/gulpjs/glob-parent/commit/8269bd89290d99fac9395a354fb56fdcdb80f0be))
|
| 55 |
+
* pre-process braces/brackets sections ([9ef8a87](https://github.com/gulpjs/glob-parent/commit/9ef8a87f66b1a43d0591e7a8e4fc5a18415ee388))
|
| 56 |
+
* preserve escaped brace/bracket at end of string ([8cfb0ba](https://github.com/gulpjs/glob-parent/commit/8cfb0ba84202d51571340dcbaf61b79d16a26c76))
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
### Bug Fixes
|
| 60 |
+
|
| 61 |
+
* trailing escaped square brackets ([99ec9fe](https://github.com/gulpjs/glob-parent/commit/99ec9fecc60ee488ded20a94dd4f18b4f55c4ccf))
|
| 62 |
+
|
| 63 |
+
### [3.0.1](https://github.com/gulpjs/glob-parent/compare/v3.0.0...v3.0.1) (2021-01-27)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
### Features
|
| 67 |
+
|
| 68 |
+
* use path-dirname ponyfill ([cdbea5f](https://github.com/gulpjs/glob-parent/commit/cdbea5f32a58a54e001a75ddd7c0fccd4776aacc))
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
### Bug Fixes
|
| 72 |
+
|
| 73 |
+
* unescape glob-escaped dirnames on output ([598c533](https://github.com/gulpjs/glob-parent/commit/598c533bdf49c1428bc063aa9b8db40c5a86b030))
|
| 74 |
+
|
| 75 |
+
## [3.0.0](https://github.com/gulpjs/glob-parent/compare/v2.0.0...v3.0.0) (2021-01-27)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
### ⚠ BREAKING CHANGES
|
| 79 |
+
|
| 80 |
+
* update is-glob dependency
|
| 81 |
+
|
| 82 |
+
### Features
|
| 83 |
+
|
| 84 |
+
* update is-glob dependency ([5c5f8ef](https://github.com/gulpjs/glob-parent/commit/5c5f8efcee362a8e7638cf8220666acd8784f6bd))
|
| 85 |
+
|
| 86 |
+
## [2.0.0](https://github.com/gulpjs/glob-parent/compare/v1.3.0...v2.0.0) (2021-01-27)
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
### Features
|
| 90 |
+
|
| 91 |
+
* move up to dirname regardless of glob characters ([f97fb83](https://github.com/gulpjs/glob-parent/commit/f97fb83be2e0a9fc8d3b760e789d2ecadd6aa0c2))
|
| 92 |
+
|
| 93 |
+
## [1.3.0](https://github.com/gulpjs/glob-parent/compare/v1.2.0...v1.3.0) (2021-01-27)
|
| 94 |
+
|
| 95 |
+
## [1.2.0](https://github.com/gulpjs/glob-parent/compare/v1.1.0...v1.2.0) (2021-01-27)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
### Reverts
|
| 99 |
+
|
| 100 |
+
* feat: make regex test strings smaller ([dc80fa9](https://github.com/gulpjs/glob-parent/commit/dc80fa9658dca20549cfeba44bbd37d5246fcce0))
|
| 101 |
+
|
| 102 |
+
## [1.1.0](https://github.com/gulpjs/glob-parent/compare/v1.0.0...v1.1.0) (2021-01-27)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
### Features
|
| 106 |
+
|
| 107 |
+
* make regex test strings smaller ([cd83220](https://github.com/gulpjs/glob-parent/commit/cd832208638f45169f986d80fcf66e401f35d233))
|
| 108 |
+
|
| 109 |
+
## 1.0.0 (2021-01-27)
|
| 110 |
+
|
node_modules/fast-glob/node_modules/glob-parent/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The ISC License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2015, 2019 Elan Shanker
|
| 4 |
+
|
| 5 |
+
Permission to use, copy, modify, and/or distribute this software for any
|
| 6 |
+
purpose with or without fee is hereby granted, provided that the above
|
| 7 |
+
copyright notice and this permission notice appear in all copies.
|
| 8 |
+
|
| 9 |
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
| 10 |
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
| 11 |
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
| 12 |
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
| 13 |
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
| 14 |
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
| 15 |
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
node_modules/fast-glob/node_modules/glob-parent/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<p align="center">
|
| 2 |
+
<a href="https://gulpjs.com">
|
| 3 |
+
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
|
| 4 |
+
</a>
|
| 5 |
+
</p>
|
| 6 |
+
|
| 7 |
+
# glob-parent
|
| 8 |
+
|
| 9 |
+
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
|
| 10 |
+
|
| 11 |
+
Extract the non-magic parent path from a glob string.
|
| 12 |
+
|
| 13 |
+
## Usage
|
| 14 |
+
|
| 15 |
+
```js
|
| 16 |
+
var globParent = require('glob-parent');
|
| 17 |
+
|
| 18 |
+
globParent('path/to/*.js'); // 'path/to'
|
| 19 |
+
globParent('/root/path/to/*.js'); // '/root/path/to'
|
| 20 |
+
globParent('/*.js'); // '/'
|
| 21 |
+
globParent('*.js'); // '.'
|
| 22 |
+
globParent('**/*.js'); // '.'
|
| 23 |
+
globParent('path/{to,from}'); // 'path'
|
| 24 |
+
globParent('path/!(to|from)'); // 'path'
|
| 25 |
+
globParent('path/?(to|from)'); // 'path'
|
| 26 |
+
globParent('path/+(to|from)'); // 'path'
|
| 27 |
+
globParent('path/*(to|from)'); // 'path'
|
| 28 |
+
globParent('path/@(to|from)'); // 'path'
|
| 29 |
+
globParent('path/**/*'); // 'path'
|
| 30 |
+
|
| 31 |
+
// if provided a non-glob path, returns the nearest dir
|
| 32 |
+
globParent('path/foo/bar.js'); // 'path/foo'
|
| 33 |
+
globParent('path/foo/'); // 'path/foo'
|
| 34 |
+
globParent('path/foo'); // 'path' (see issue #3 for details)
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## API
|
| 38 |
+
|
| 39 |
+
### `globParent(maybeGlobString, [options])`
|
| 40 |
+
|
| 41 |
+
Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below.
|
| 42 |
+
|
| 43 |
+
#### options
|
| 44 |
+
|
| 45 |
+
```js
|
| 46 |
+
{
|
| 47 |
+
// Disables the automatic conversion of slashes for Windows
|
| 48 |
+
flipBackslashes: true
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Escaping
|
| 53 |
+
|
| 54 |
+
The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters:
|
| 55 |
+
|
| 56 |
+
- `?` (question mark) unless used as a path segment alone
|
| 57 |
+
- `*` (asterisk)
|
| 58 |
+
- `|` (pipe)
|
| 59 |
+
- `(` (opening parenthesis)
|
| 60 |
+
- `)` (closing parenthesis)
|
| 61 |
+
- `{` (opening curly brace)
|
| 62 |
+
- `}` (closing curly brace)
|
| 63 |
+
- `[` (opening bracket)
|
| 64 |
+
- `]` (closing bracket)
|
| 65 |
+
|
| 66 |
+
**Example**
|
| 67 |
+
|
| 68 |
+
```js
|
| 69 |
+
globParent('foo/[bar]/') // 'foo'
|
| 70 |
+
globParent('foo/\\[bar]/') // 'foo/[bar]'
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
## Limitations
|
| 74 |
+
|
| 75 |
+
### Braces & Brackets
|
| 76 |
+
This library attempts a quick and imperfect method of determining which path
|
| 77 |
+
parts have glob magic without fully parsing/lexing the pattern. There are some
|
| 78 |
+
advanced use cases that can trip it up, such as nested braces where the outer
|
| 79 |
+
pair is escaped and the inner one contains a path separator. If you find
|
| 80 |
+
yourself in the unlikely circumstance of being affected by this or need to
|
| 81 |
+
ensure higher-fidelity glob handling in your library, it is recommended that you
|
| 82 |
+
pre-process your input with [expand-braces] and/or [expand-brackets].
|
| 83 |
+
|
| 84 |
+
### Windows
|
| 85 |
+
Backslashes are not valid path separators for globs. If a path with backslashes
|
| 86 |
+
is provided anyway, for simple cases, glob-parent will replace the path
|
| 87 |
+
separator for you and return the non-glob parent path (now with
|
| 88 |
+
forward-slashes, which are still valid as Windows path separators).
|
| 89 |
+
|
| 90 |
+
This cannot be used in conjunction with escape characters.
|
| 91 |
+
|
| 92 |
+
```js
|
| 93 |
+
// BAD
|
| 94 |
+
globParent('C:\\Program Files \\(x86\\)\\*.ext') // 'C:/Program Files /(x86/)'
|
| 95 |
+
|
| 96 |
+
// GOOD
|
| 97 |
+
globParent('C:/Program Files\\(x86\\)/*.ext') // 'C:/Program Files (x86)'
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
If you are using escape characters for a pattern without path parts (i.e.
|
| 101 |
+
relative to `cwd`), prefix with `./` to avoid confusing glob-parent.
|
| 102 |
+
|
| 103 |
+
```js
|
| 104 |
+
// BAD
|
| 105 |
+
globParent('foo \\[bar]') // 'foo '
|
| 106 |
+
globParent('foo \\[bar]*') // 'foo '
|
| 107 |
+
|
| 108 |
+
// GOOD
|
| 109 |
+
globParent('./foo \\[bar]') // 'foo [bar]'
|
| 110 |
+
globParent('./foo \\[bar]*') // '.'
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
## License
|
| 114 |
+
|
| 115 |
+
ISC
|
| 116 |
+
|
| 117 |
+
[expand-braces]: https://github.com/jonschlinkert/expand-braces
|
| 118 |
+
[expand-brackets]: https://github.com/jonschlinkert/expand-brackets
|
| 119 |
+
|
| 120 |
+
[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg
|
| 121 |
+
[npm-url]: https://www.npmjs.com/package/glob-parent
|
| 122 |
+
[npm-image]: https://img.shields.io/npm/v/glob-parent.svg
|
| 123 |
+
|
| 124 |
+
[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=2&branchName=master
|
| 125 |
+
[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/glob-parent?branchName=master
|
| 126 |
+
|
| 127 |
+
[travis-url]: https://travis-ci.org/gulpjs/glob-parent
|
| 128 |
+
[travis-image]: https://img.shields.io/travis/gulpjs/glob-parent.svg?label=travis-ci
|
| 129 |
+
|
| 130 |
+
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/glob-parent
|
| 131 |
+
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/glob-parent.svg?label=appveyor
|
| 132 |
+
|
| 133 |
+
[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent
|
| 134 |
+
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg
|
| 135 |
+
|
| 136 |
+
[gitter-url]: https://gitter.im/gulpjs/gulp
|
| 137 |
+
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
|
node_modules/fast-glob/node_modules/glob-parent/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict';
|
| 2 |
+
|
| 3 |
+
var isGlob = require('is-glob');
|
| 4 |
+
var pathPosixDirname = require('path').posix.dirname;
|
| 5 |
+
var isWin32 = require('os').platform() === 'win32';
|
| 6 |
+
|
| 7 |
+
var slash = '/';
|
| 8 |
+
var backslash = /\\/g;
|
| 9 |
+
var enclosure = /[\{\[].*[\}\]]$/;
|
| 10 |
+
var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
|
| 11 |
+
var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* @param {string} str
|
| 15 |
+
* @param {Object} opts
|
| 16 |
+
* @param {boolean} [opts.flipBackslashes=true]
|
| 17 |
+
* @returns {string}
|
| 18 |
+
*/
|
| 19 |
+
module.exports = function globParent(str, opts) {
|
| 20 |
+
var options = Object.assign({ flipBackslashes: true }, opts);
|
| 21 |
+
|
| 22 |
+
// flip windows path separators
|
| 23 |
+
if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
|
| 24 |
+
str = str.replace(backslash, slash);
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
// special case for strings ending in enclosure containing path separator
|
| 28 |
+
if (enclosure.test(str)) {
|
| 29 |
+
str += slash;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// preserves full path in case of trailing path separator
|
| 33 |
+
str += 'a';
|
| 34 |
+
|
| 35 |
+
// remove path parts that are globby
|
| 36 |
+
do {
|
| 37 |
+
str = pathPosixDirname(str);
|
| 38 |
+
} while (isGlob(str) || globby.test(str));
|
| 39 |
+
|
| 40 |
+
// remove escape chars and return result
|
| 41 |
+
return str.replace(escaped, '$1');
|
| 42 |
+
};
|
node_modules/fast-glob/node_modules/glob-parent/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "glob-parent",
|
| 3 |
+
"version": "5.1.2",
|
| 4 |
+
"description": "Extract the non-magic parent path from a glob string.",
|
| 5 |
+
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
|
| 6 |
+
"contributors": [
|
| 7 |
+
"Elan Shanker (https://github.com/es128)",
|
| 8 |
+
"Blaine Bublitz <blaine.bublitz@gmail.com>"
|
| 9 |
+
],
|
| 10 |
+
"repository": "gulpjs/glob-parent",
|
| 11 |
+
"license": "ISC",
|
| 12 |
+
"engines": {
|
| 13 |
+
"node": ">= 6"
|
| 14 |
+
},
|
| 15 |
+
"main": "index.js",
|
| 16 |
+
"files": [
|
| 17 |
+
"LICENSE",
|
| 18 |
+
"index.js"
|
| 19 |
+
],
|
| 20 |
+
"scripts": {
|
| 21 |
+
"lint": "eslint .",
|
| 22 |
+
"pretest": "npm run lint",
|
| 23 |
+
"test": "nyc mocha --async-only",
|
| 24 |
+
"azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit",
|
| 25 |
+
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
| 26 |
+
},
|
| 27 |
+
"dependencies": {
|
| 28 |
+
"is-glob": "^4.0.1"
|
| 29 |
+
},
|
| 30 |
+
"devDependencies": {
|
| 31 |
+
"coveralls": "^3.0.11",
|
| 32 |
+
"eslint": "^2.13.1",
|
| 33 |
+
"eslint-config-gulp": "^3.0.1",
|
| 34 |
+
"expect": "^1.20.2",
|
| 35 |
+
"mocha": "^6.0.2",
|
| 36 |
+
"nyc": "^13.3.0"
|
| 37 |
+
},
|
| 38 |
+
"keywords": [
|
| 39 |
+
"glob",
|
| 40 |
+
"parent",
|
| 41 |
+
"strip",
|
| 42 |
+
"path",
|
| 43 |
+
"dirname",
|
| 44 |
+
"directory",
|
| 45 |
+
"base",
|
| 46 |
+
"wildcard"
|
| 47 |
+
]
|
| 48 |
+
}
|
node_modules/fast-glob/out/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="node" />
|
| 2 |
+
import * as taskManager from './managers/tasks';
|
| 3 |
+
import { Options as OptionsInternal } from './settings';
|
| 4 |
+
import { Entry as EntryInternal, FileSystemAdapter as FileSystemAdapterInternal, Pattern as PatternInternal } from './types';
|
| 5 |
+
type EntryObjectModePredicate = {
|
| 6 |
+
[TKey in keyof Pick<OptionsInternal, 'objectMode'>]-?: true;
|
| 7 |
+
};
|
| 8 |
+
type EntryStatsPredicate = {
|
| 9 |
+
[TKey in keyof Pick<OptionsInternal, 'stats'>]-?: true;
|
| 10 |
+
};
|
| 11 |
+
type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
|
| 12 |
+
declare function FastGlob(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): Promise<EntryInternal[]>;
|
| 13 |
+
declare function FastGlob(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Promise<string[]>;
|
| 14 |
+
declare namespace FastGlob {
|
| 15 |
+
type Options = OptionsInternal;
|
| 16 |
+
type Entry = EntryInternal;
|
| 17 |
+
type Task = taskManager.Task;
|
| 18 |
+
type Pattern = PatternInternal;
|
| 19 |
+
type FileSystemAdapter = FileSystemAdapterInternal;
|
| 20 |
+
const glob: typeof FastGlob;
|
| 21 |
+
const globSync: typeof sync;
|
| 22 |
+
const globStream: typeof stream;
|
| 23 |
+
const async: typeof FastGlob;
|
| 24 |
+
function sync(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): EntryInternal[];
|
| 25 |
+
function sync(source: PatternInternal | PatternInternal[], options?: OptionsInternal): string[];
|
| 26 |
+
function stream(source: PatternInternal | PatternInternal[], options?: OptionsInternal): NodeJS.ReadableStream;
|
| 27 |
+
function generateTasks(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Task[];
|
| 28 |
+
function isDynamicPattern(source: PatternInternal, options?: OptionsInternal): boolean;
|
| 29 |
+
function escapePath(source: string): PatternInternal;
|
| 30 |
+
function convertPathToPattern(source: string): PatternInternal;
|
| 31 |
+
namespace posix {
|
| 32 |
+
function escapePath(source: string): PatternInternal;
|
| 33 |
+
function convertPathToPattern(source: string): PatternInternal;
|
| 34 |
+
}
|
| 35 |
+
namespace win32 {
|
| 36 |
+
function escapePath(source: string): PatternInternal;
|
| 37 |
+
function convertPathToPattern(source: string): PatternInternal;
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
export = FastGlob;
|
node_modules/fast-glob/out/index.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
const taskManager = require("./managers/tasks");
|
| 3 |
+
const async_1 = require("./providers/async");
|
| 4 |
+
const stream_1 = require("./providers/stream");
|
| 5 |
+
const sync_1 = require("./providers/sync");
|
| 6 |
+
const settings_1 = require("./settings");
|
| 7 |
+
const utils = require("./utils");
|
| 8 |
+
async function FastGlob(source, options) {
|
| 9 |
+
assertPatternsInput(source);
|
| 10 |
+
const works = getWorks(source, async_1.default, options);
|
| 11 |
+
const result = await Promise.all(works);
|
| 12 |
+
return utils.array.flatten(result);
|
| 13 |
+
}
|
| 14 |
+
// https://github.com/typescript-eslint/typescript-eslint/issues/60
|
| 15 |
+
// eslint-disable-next-line no-redeclare
|
| 16 |
+
(function (FastGlob) {
|
| 17 |
+
FastGlob.glob = FastGlob;
|
| 18 |
+
FastGlob.globSync = sync;
|
| 19 |
+
FastGlob.globStream = stream;
|
| 20 |
+
FastGlob.async = FastGlob;
|
| 21 |
+
function sync(source, options) {
|
| 22 |
+
assertPatternsInput(source);
|
| 23 |
+
const works = getWorks(source, sync_1.default, options);
|
| 24 |
+
return utils.array.flatten(works);
|
| 25 |
+
}
|
| 26 |
+
FastGlob.sync = sync;
|
| 27 |
+
function stream(source, options) {
|
| 28 |
+
assertPatternsInput(source);
|
| 29 |
+
const works = getWorks(source, stream_1.default, options);
|
| 30 |
+
/**
|
| 31 |
+
* The stream returned by the provider cannot work with an asynchronous iterator.
|
| 32 |
+
* To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
|
| 33 |
+
* This affects performance (+25%). I don't see best solution right now.
|
| 34 |
+
*/
|
| 35 |
+
return utils.stream.merge(works);
|
| 36 |
+
}
|
| 37 |
+
FastGlob.stream = stream;
|
| 38 |
+
function generateTasks(source, options) {
|
| 39 |
+
assertPatternsInput(source);
|
| 40 |
+
const patterns = [].concat(source);
|
| 41 |
+
const settings = new settings_1.default(options);
|
| 42 |
+
return taskManager.generate(patterns, settings);
|
| 43 |
+
}
|
| 44 |
+
FastGlob.generateTasks = generateTasks;
|
| 45 |
+
function isDynamicPattern(source, options) {
|
| 46 |
+
assertPatternsInput(source);
|
| 47 |
+
const settings = new settings_1.default(options);
|
| 48 |
+
return utils.pattern.isDynamicPattern(source, settings);
|
| 49 |
+
}
|
| 50 |
+
FastGlob.isDynamicPattern = isDynamicPattern;
|
| 51 |
+
function escapePath(source) {
|
| 52 |
+
assertPatternsInput(source);
|
| 53 |
+
return utils.path.escape(source);
|
| 54 |
+
}
|
| 55 |
+
FastGlob.escapePath = escapePath;
|
| 56 |
+
function convertPathToPattern(source) {
|
| 57 |
+
assertPatternsInput(source);
|
| 58 |
+
return utils.path.convertPathToPattern(source);
|
| 59 |
+
}
|
| 60 |
+
FastGlob.convertPathToPattern = convertPathToPattern;
|
| 61 |
+
let posix;
|
| 62 |
+
(function (posix) {
|
| 63 |
+
function escapePath(source) {
|
| 64 |
+
assertPatternsInput(source);
|
| 65 |
+
return utils.path.escapePosixPath(source);
|
| 66 |
+
}
|
| 67 |
+
posix.escapePath = escapePath;
|
| 68 |
+
function convertPathToPattern(source) {
|
| 69 |
+
assertPatternsInput(source);
|
| 70 |
+
return utils.path.convertPosixPathToPattern(source);
|
| 71 |
+
}
|
| 72 |
+
posix.convertPathToPattern = convertPathToPattern;
|
| 73 |
+
})(posix = FastGlob.posix || (FastGlob.posix = {}));
|
| 74 |
+
let win32;
|
| 75 |
+
(function (win32) {
|
| 76 |
+
function escapePath(source) {
|
| 77 |
+
assertPatternsInput(source);
|
| 78 |
+
return utils.path.escapeWindowsPath(source);
|
| 79 |
+
}
|
| 80 |
+
win32.escapePath = escapePath;
|
| 81 |
+
function convertPathToPattern(source) {
|
| 82 |
+
assertPatternsInput(source);
|
| 83 |
+
return utils.path.convertWindowsPathToPattern(source);
|
| 84 |
+
}
|
| 85 |
+
win32.convertPathToPattern = convertPathToPattern;
|
| 86 |
+
})(win32 = FastGlob.win32 || (FastGlob.win32 = {}));
|
| 87 |
+
})(FastGlob || (FastGlob = {}));
|
| 88 |
+
function getWorks(source, _Provider, options) {
|
| 89 |
+
const patterns = [].concat(source);
|
| 90 |
+
const settings = new settings_1.default(options);
|
| 91 |
+
const tasks = taskManager.generate(patterns, settings);
|
| 92 |
+
const provider = new _Provider(settings);
|
| 93 |
+
return tasks.map(provider.read, provider);
|
| 94 |
+
}
|
| 95 |
+
function assertPatternsInput(input) {
|
| 96 |
+
const source = [].concat(input);
|
| 97 |
+
const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
|
| 98 |
+
if (!isValidSource) {
|
| 99 |
+
throw new TypeError('Patterns must be a string (non empty) or an array of strings');
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
module.exports = FastGlob;
|
node_modules/fast-glob/out/managers/tasks.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Settings from '../settings';
|
| 2 |
+
import { Pattern, PatternsGroup } from '../types';
|
| 3 |
+
export type Task = {
|
| 4 |
+
base: string;
|
| 5 |
+
dynamic: boolean;
|
| 6 |
+
patterns: Pattern[];
|
| 7 |
+
positive: Pattern[];
|
| 8 |
+
negative: Pattern[];
|
| 9 |
+
};
|
| 10 |
+
export declare function generate(input: Pattern[], settings: Settings): Task[];
|
| 11 |
+
/**
|
| 12 |
+
* Returns tasks grouped by basic pattern directories.
|
| 13 |
+
*
|
| 14 |
+
* Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
|
| 15 |
+
* This is necessary because directory traversal starts at the base directory and goes deeper.
|
| 16 |
+
*/
|
| 17 |
+
export declare function convertPatternsToTasks(positive: Pattern[], negative: Pattern[], dynamic: boolean): Task[];
|
| 18 |
+
export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
|
| 19 |
+
export declare function getNegativePatternsAsPositive(patterns: Pattern[], ignore: Pattern[]): Pattern[];
|
| 20 |
+
export declare function groupPatternsByBaseDirectory(patterns: Pattern[]): PatternsGroup;
|
| 21 |
+
export declare function convertPatternGroupsToTasks(positive: PatternsGroup, negative: Pattern[], dynamic: boolean): Task[];
|
| 22 |
+
export declare function convertPatternGroupToTask(base: string, positive: Pattern[], negative: Pattern[], dynamic: boolean): Task;
|
node_modules/fast-glob/out/managers/tasks.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
| 4 |
+
const utils = require("../utils");
|
| 5 |
+
function generate(input, settings) {
|
| 6 |
+
const patterns = processPatterns(input, settings);
|
| 7 |
+
const ignore = processPatterns(settings.ignore, settings);
|
| 8 |
+
const positivePatterns = getPositivePatterns(patterns);
|
| 9 |
+
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
| 10 |
+
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
|
| 11 |
+
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
|
| 12 |
+
const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
|
| 13 |
+
const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
|
| 14 |
+
return staticTasks.concat(dynamicTasks);
|
| 15 |
+
}
|
| 16 |
+
exports.generate = generate;
|
| 17 |
+
function processPatterns(input, settings) {
|
| 18 |
+
let patterns = input;
|
| 19 |
+
/**
|
| 20 |
+
* The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry
|
| 21 |
+
* and some problems with the micromatch package (see fast-glob issues: #365, #394).
|
| 22 |
+
*
|
| 23 |
+
* To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown
|
| 24 |
+
* in matching in the case of a large set of patterns after expansion.
|
| 25 |
+
*/
|
| 26 |
+
if (settings.braceExpansion) {
|
| 27 |
+
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
| 28 |
+
}
|
| 29 |
+
/**
|
| 30 |
+
* If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used
|
| 31 |
+
* at any nesting level.
|
| 32 |
+
*
|
| 33 |
+
* We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change
|
| 34 |
+
* the pattern in the filter before creating a regular expression. There is no need to change the patterns
|
| 35 |
+
* in the application. Only on the input.
|
| 36 |
+
*/
|
| 37 |
+
if (settings.baseNameMatch) {
|
| 38 |
+
patterns = patterns.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`);
|
| 39 |
+
}
|
| 40 |
+
/**
|
| 41 |
+
* This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion.
|
| 42 |
+
*/
|
| 43 |
+
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
| 44 |
+
}
|
| 45 |
+
/**
|
| 46 |
+
* Returns tasks grouped by basic pattern directories.
|
| 47 |
+
*
|
| 48 |
+
* Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
|
| 49 |
+
* This is necessary because directory traversal starts at the base directory and goes deeper.
|
| 50 |
+
*/
|
| 51 |
+
function convertPatternsToTasks(positive, negative, dynamic) {
|
| 52 |
+
const tasks = [];
|
| 53 |
+
const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
|
| 54 |
+
const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
|
| 55 |
+
const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
|
| 56 |
+
const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
|
| 57 |
+
tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
|
| 58 |
+
/*
|
| 59 |
+
* For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
|
| 60 |
+
* into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
|
| 61 |
+
*/
|
| 62 |
+
if ('.' in insideCurrentDirectoryGroup) {
|
| 63 |
+
tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
|
| 64 |
+
}
|
| 65 |
+
else {
|
| 66 |
+
tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
|
| 67 |
+
}
|
| 68 |
+
return tasks;
|
| 69 |
+
}
|
| 70 |
+
exports.convertPatternsToTasks = convertPatternsToTasks;
|
| 71 |
+
function getPositivePatterns(patterns) {
|
| 72 |
+
return utils.pattern.getPositivePatterns(patterns);
|
| 73 |
+
}
|
| 74 |
+
exports.getPositivePatterns = getPositivePatterns;
|
| 75 |
+
function getNegativePatternsAsPositive(patterns, ignore) {
|
| 76 |
+
const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
|
| 77 |
+
const positive = negative.map(utils.pattern.convertToPositivePattern);
|
| 78 |
+
return positive;
|
| 79 |
+
}
|
| 80 |
+
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
| 81 |
+
function groupPatternsByBaseDirectory(patterns) {
|
| 82 |
+
const group = {};
|
| 83 |
+
return patterns.reduce((collection, pattern) => {
|
| 84 |
+
const base = utils.pattern.getBaseDirectory(pattern);
|
| 85 |
+
if (base in collection) {
|
| 86 |
+
collection[base].push(pattern);
|
| 87 |
+
}
|
| 88 |
+
else {
|
| 89 |
+
collection[base] = [pattern];
|
| 90 |
+
}
|
| 91 |
+
return collection;
|
| 92 |
+
}, group);
|
| 93 |
+
}
|
| 94 |
+
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
| 95 |
+
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
| 96 |
+
return Object.keys(positive).map((base) => {
|
| 97 |
+
return convertPatternGroupToTask(base, positive[base], negative, dynamic);
|
| 98 |
+
});
|
| 99 |
+
}
|
| 100 |
+
exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
|
| 101 |
+
function convertPatternGroupToTask(base, positive, negative, dynamic) {
|
| 102 |
+
return {
|
| 103 |
+
dynamic,
|
| 104 |
+
positive,
|
| 105 |
+
negative,
|
| 106 |
+
base,
|
| 107 |
+
patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
|
| 108 |
+
};
|
| 109 |
+
}
|
| 110 |
+
exports.convertPatternGroupToTask = convertPatternGroupToTask;
|
node_modules/fast-glob/out/providers/async.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Task } from '../managers/tasks';
|
| 2 |
+
import { Entry, EntryItem, ReaderOptions } from '../types';
|
| 3 |
+
import ReaderAsync from '../readers/async';
|
| 4 |
+
import Provider from './provider';
|
| 5 |
+
export default class ProviderAsync extends Provider<Promise<EntryItem[]>> {
|
| 6 |
+
protected _reader: ReaderAsync;
|
| 7 |
+
read(task: Task): Promise<EntryItem[]>;
|
| 8 |
+
api(root: string, task: Task, options: ReaderOptions): Promise<Entry[]>;
|
| 9 |
+
}
|
node_modules/fast-glob/out/providers/async.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const async_1 = require("../readers/async");
|
| 4 |
+
const provider_1 = require("./provider");
|
| 5 |
+
class ProviderAsync extends provider_1.default {
|
| 6 |
+
constructor() {
|
| 7 |
+
super(...arguments);
|
| 8 |
+
this._reader = new async_1.default(this._settings);
|
| 9 |
+
}
|
| 10 |
+
async read(task) {
|
| 11 |
+
const root = this._getRootDirectory(task);
|
| 12 |
+
const options = this._getReaderOptions(task);
|
| 13 |
+
const entries = await this.api(root, task, options);
|
| 14 |
+
return entries.map((entry) => options.transform(entry));
|
| 15 |
+
}
|
| 16 |
+
api(root, task, options) {
|
| 17 |
+
if (task.dynamic) {
|
| 18 |
+
return this._reader.dynamic(root, options);
|
| 19 |
+
}
|
| 20 |
+
return this._reader.static(task.patterns, options);
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
exports.default = ProviderAsync;
|
node_modules/fast-glob/out/providers/filters/deep.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MicromatchOptions, EntryFilterFunction, Pattern } from '../../types';
|
| 2 |
+
import Settings from '../../settings';
|
| 3 |
+
export default class DeepFilter {
|
| 4 |
+
private readonly _settings;
|
| 5 |
+
private readonly _micromatchOptions;
|
| 6 |
+
constructor(_settings: Settings, _micromatchOptions: MicromatchOptions);
|
| 7 |
+
getFilter(basePath: string, positive: Pattern[], negative: Pattern[]): EntryFilterFunction;
|
| 8 |
+
private _getMatcher;
|
| 9 |
+
private _getNegativePatternsRe;
|
| 10 |
+
private _filter;
|
| 11 |
+
private _isSkippedByDeep;
|
| 12 |
+
private _getEntryLevel;
|
| 13 |
+
private _isSkippedSymbolicLink;
|
| 14 |
+
private _isSkippedByPositivePatterns;
|
| 15 |
+
private _isSkippedByNegativePatterns;
|
| 16 |
+
}
|
node_modules/fast-glob/out/providers/filters/deep.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const utils = require("../../utils");
|
| 4 |
+
const partial_1 = require("../matchers/partial");
|
| 5 |
+
class DeepFilter {
|
| 6 |
+
constructor(_settings, _micromatchOptions) {
|
| 7 |
+
this._settings = _settings;
|
| 8 |
+
this._micromatchOptions = _micromatchOptions;
|
| 9 |
+
}
|
| 10 |
+
getFilter(basePath, positive, negative) {
|
| 11 |
+
const matcher = this._getMatcher(positive);
|
| 12 |
+
const negativeRe = this._getNegativePatternsRe(negative);
|
| 13 |
+
return (entry) => this._filter(basePath, entry, matcher, negativeRe);
|
| 14 |
+
}
|
| 15 |
+
_getMatcher(patterns) {
|
| 16 |
+
return new partial_1.default(patterns, this._settings, this._micromatchOptions);
|
| 17 |
+
}
|
| 18 |
+
_getNegativePatternsRe(patterns) {
|
| 19 |
+
const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern);
|
| 20 |
+
return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
|
| 21 |
+
}
|
| 22 |
+
_filter(basePath, entry, matcher, negativeRe) {
|
| 23 |
+
if (this._isSkippedByDeep(basePath, entry.path)) {
|
| 24 |
+
return false;
|
| 25 |
+
}
|
| 26 |
+
if (this._isSkippedSymbolicLink(entry)) {
|
| 27 |
+
return false;
|
| 28 |
+
}
|
| 29 |
+
const filepath = utils.path.removeLeadingDotSegment(entry.path);
|
| 30 |
+
if (this._isSkippedByPositivePatterns(filepath, matcher)) {
|
| 31 |
+
return false;
|
| 32 |
+
}
|
| 33 |
+
return this._isSkippedByNegativePatterns(filepath, negativeRe);
|
| 34 |
+
}
|
| 35 |
+
_isSkippedByDeep(basePath, entryPath) {
|
| 36 |
+
/**
|
| 37 |
+
* Avoid unnecessary depth calculations when it doesn't matter.
|
| 38 |
+
*/
|
| 39 |
+
if (this._settings.deep === Infinity) {
|
| 40 |
+
return false;
|
| 41 |
+
}
|
| 42 |
+
return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
|
| 43 |
+
}
|
| 44 |
+
_getEntryLevel(basePath, entryPath) {
|
| 45 |
+
const entryPathDepth = entryPath.split('/').length;
|
| 46 |
+
if (basePath === '') {
|
| 47 |
+
return entryPathDepth;
|
| 48 |
+
}
|
| 49 |
+
const basePathDepth = basePath.split('/').length;
|
| 50 |
+
return entryPathDepth - basePathDepth;
|
| 51 |
+
}
|
| 52 |
+
_isSkippedSymbolicLink(entry) {
|
| 53 |
+
return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
|
| 54 |
+
}
|
| 55 |
+
_isSkippedByPositivePatterns(entryPath, matcher) {
|
| 56 |
+
return !this._settings.baseNameMatch && !matcher.match(entryPath);
|
| 57 |
+
}
|
| 58 |
+
_isSkippedByNegativePatterns(entryPath, patternsRe) {
|
| 59 |
+
return !utils.pattern.matchAny(entryPath, patternsRe);
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
exports.default = DeepFilter;
|
node_modules/fast-glob/out/providers/filters/entry.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Settings from '../../settings';
|
| 2 |
+
import { EntryFilterFunction, MicromatchOptions, Pattern } from '../../types';
|
| 3 |
+
export default class EntryFilter {
|
| 4 |
+
private readonly _settings;
|
| 5 |
+
private readonly _micromatchOptions;
|
| 6 |
+
readonly index: Map<string, undefined>;
|
| 7 |
+
constructor(_settings: Settings, _micromatchOptions: MicromatchOptions);
|
| 8 |
+
getFilter(positive: Pattern[], negative: Pattern[]): EntryFilterFunction;
|
| 9 |
+
private _filter;
|
| 10 |
+
private _isDuplicateEntry;
|
| 11 |
+
private _createIndexRecord;
|
| 12 |
+
private _onlyFileFilter;
|
| 13 |
+
private _onlyDirectoryFilter;
|
| 14 |
+
private _isSkippedByAbsoluteNegativePatterns;
|
| 15 |
+
private _isMatchToPatterns;
|
| 16 |
+
}
|
node_modules/fast-glob/out/providers/filters/entry.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const utils = require("../../utils");
|
| 4 |
+
class EntryFilter {
|
| 5 |
+
constructor(_settings, _micromatchOptions) {
|
| 6 |
+
this._settings = _settings;
|
| 7 |
+
this._micromatchOptions = _micromatchOptions;
|
| 8 |
+
this.index = new Map();
|
| 9 |
+
}
|
| 10 |
+
getFilter(positive, negative) {
|
| 11 |
+
const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions);
|
| 12 |
+
const negativeRe = utils.pattern.convertPatternsToRe(negative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }));
|
| 13 |
+
return (entry) => this._filter(entry, positiveRe, negativeRe);
|
| 14 |
+
}
|
| 15 |
+
_filter(entry, positiveRe, negativeRe) {
|
| 16 |
+
const filepath = utils.path.removeLeadingDotSegment(entry.path);
|
| 17 |
+
if (this._settings.unique && this._isDuplicateEntry(filepath)) {
|
| 18 |
+
return false;
|
| 19 |
+
}
|
| 20 |
+
if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
|
| 21 |
+
return false;
|
| 22 |
+
}
|
| 23 |
+
if (this._isSkippedByAbsoluteNegativePatterns(filepath, negativeRe)) {
|
| 24 |
+
return false;
|
| 25 |
+
}
|
| 26 |
+
const isDirectory = entry.dirent.isDirectory();
|
| 27 |
+
const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(filepath, negativeRe, isDirectory);
|
| 28 |
+
if (this._settings.unique && isMatched) {
|
| 29 |
+
this._createIndexRecord(filepath);
|
| 30 |
+
}
|
| 31 |
+
return isMatched;
|
| 32 |
+
}
|
| 33 |
+
_isDuplicateEntry(filepath) {
|
| 34 |
+
return this.index.has(filepath);
|
| 35 |
+
}
|
| 36 |
+
_createIndexRecord(filepath) {
|
| 37 |
+
this.index.set(filepath, undefined);
|
| 38 |
+
}
|
| 39 |
+
_onlyFileFilter(entry) {
|
| 40 |
+
return this._settings.onlyFiles && !entry.dirent.isFile();
|
| 41 |
+
}
|
| 42 |
+
_onlyDirectoryFilter(entry) {
|
| 43 |
+
return this._settings.onlyDirectories && !entry.dirent.isDirectory();
|
| 44 |
+
}
|
| 45 |
+
_isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
|
| 46 |
+
if (!this._settings.absolute) {
|
| 47 |
+
return false;
|
| 48 |
+
}
|
| 49 |
+
const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath);
|
| 50 |
+
return utils.pattern.matchAny(fullpath, patternsRe);
|
| 51 |
+
}
|
| 52 |
+
_isMatchToPatterns(filepath, patternsRe, isDirectory) {
|
| 53 |
+
// Trying to match files and directories by patterns.
|
| 54 |
+
const isMatched = utils.pattern.matchAny(filepath, patternsRe);
|
| 55 |
+
// A pattern with a trailling slash can be used for directory matching.
|
| 56 |
+
// To apply such pattern, we need to add a tralling slash to the path.
|
| 57 |
+
if (!isMatched && isDirectory) {
|
| 58 |
+
return utils.pattern.matchAny(filepath + '/', patternsRe);
|
| 59 |
+
}
|
| 60 |
+
return isMatched;
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
exports.default = EntryFilter;
|
node_modules/fast-glob/out/providers/filters/error.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Settings from '../../settings';
|
| 2 |
+
import { ErrorFilterFunction } from '../../types';
|
| 3 |
+
export default class ErrorFilter {
|
| 4 |
+
private readonly _settings;
|
| 5 |
+
constructor(_settings: Settings);
|
| 6 |
+
getFilter(): ErrorFilterFunction;
|
| 7 |
+
private _isNonFatalError;
|
| 8 |
+
}
|
node_modules/fast-glob/out/providers/filters/error.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const utils = require("../../utils");
|
| 4 |
+
class ErrorFilter {
|
| 5 |
+
constructor(_settings) {
|
| 6 |
+
this._settings = _settings;
|
| 7 |
+
}
|
| 8 |
+
getFilter() {
|
| 9 |
+
return (error) => this._isNonFatalError(error);
|
| 10 |
+
}
|
| 11 |
+
_isNonFatalError(error) {
|
| 12 |
+
return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
|
| 13 |
+
}
|
| 14 |
+
}
|
| 15 |
+
exports.default = ErrorFilter;
|
node_modules/fast-glob/out/providers/matchers/matcher.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Pattern, MicromatchOptions, PatternRe } from '../../types';
|
| 2 |
+
import Settings from '../../settings';
|
| 3 |
+
export type PatternSegment = StaticPatternSegment | DynamicPatternSegment;
|
| 4 |
+
type StaticPatternSegment = {
|
| 5 |
+
dynamic: false;
|
| 6 |
+
pattern: Pattern;
|
| 7 |
+
};
|
| 8 |
+
type DynamicPatternSegment = {
|
| 9 |
+
dynamic: true;
|
| 10 |
+
pattern: Pattern;
|
| 11 |
+
patternRe: PatternRe;
|
| 12 |
+
};
|
| 13 |
+
export type PatternSection = PatternSegment[];
|
| 14 |
+
export type PatternInfo = {
|
| 15 |
+
/**
|
| 16 |
+
* Indicates that the pattern has a globstar (more than a single section).
|
| 17 |
+
*/
|
| 18 |
+
complete: boolean;
|
| 19 |
+
pattern: Pattern;
|
| 20 |
+
segments: PatternSegment[];
|
| 21 |
+
sections: PatternSection[];
|
| 22 |
+
};
|
| 23 |
+
export default abstract class Matcher {
|
| 24 |
+
private readonly _patterns;
|
| 25 |
+
private readonly _settings;
|
| 26 |
+
private readonly _micromatchOptions;
|
| 27 |
+
protected readonly _storage: PatternInfo[];
|
| 28 |
+
constructor(_patterns: Pattern[], _settings: Settings, _micromatchOptions: MicromatchOptions);
|
| 29 |
+
private _fillStorage;
|
| 30 |
+
private _getPatternSegments;
|
| 31 |
+
private _splitSegmentsIntoSections;
|
| 32 |
+
}
|
| 33 |
+
export {};
|
node_modules/fast-glob/out/providers/matchers/matcher.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const utils = require("../../utils");
|
| 4 |
+
class Matcher {
|
| 5 |
+
constructor(_patterns, _settings, _micromatchOptions) {
|
| 6 |
+
this._patterns = _patterns;
|
| 7 |
+
this._settings = _settings;
|
| 8 |
+
this._micromatchOptions = _micromatchOptions;
|
| 9 |
+
this._storage = [];
|
| 10 |
+
this._fillStorage();
|
| 11 |
+
}
|
| 12 |
+
_fillStorage() {
|
| 13 |
+
for (const pattern of this._patterns) {
|
| 14 |
+
const segments = this._getPatternSegments(pattern);
|
| 15 |
+
const sections = this._splitSegmentsIntoSections(segments);
|
| 16 |
+
this._storage.push({
|
| 17 |
+
complete: sections.length <= 1,
|
| 18 |
+
pattern,
|
| 19 |
+
segments,
|
| 20 |
+
sections
|
| 21 |
+
});
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
_getPatternSegments(pattern) {
|
| 25 |
+
const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions);
|
| 26 |
+
return parts.map((part) => {
|
| 27 |
+
const dynamic = utils.pattern.isDynamicPattern(part, this._settings);
|
| 28 |
+
if (!dynamic) {
|
| 29 |
+
return {
|
| 30 |
+
dynamic: false,
|
| 31 |
+
pattern: part
|
| 32 |
+
};
|
| 33 |
+
}
|
| 34 |
+
return {
|
| 35 |
+
dynamic: true,
|
| 36 |
+
pattern: part,
|
| 37 |
+
patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
|
| 38 |
+
};
|
| 39 |
+
});
|
| 40 |
+
}
|
| 41 |
+
_splitSegmentsIntoSections(segments) {
|
| 42 |
+
return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
exports.default = Matcher;
|
node_modules/fast-glob/out/providers/matchers/partial.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Matcher from './matcher';
|
| 2 |
+
export default class PartialMatcher extends Matcher {
|
| 3 |
+
match(filepath: string): boolean;
|
| 4 |
+
}
|
node_modules/fast-glob/out/providers/matchers/partial.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const matcher_1 = require("./matcher");
|
| 4 |
+
class PartialMatcher extends matcher_1.default {
|
| 5 |
+
match(filepath) {
|
| 6 |
+
const parts = filepath.split('/');
|
| 7 |
+
const levels = parts.length;
|
| 8 |
+
const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
|
| 9 |
+
for (const pattern of patterns) {
|
| 10 |
+
const section = pattern.sections[0];
|
| 11 |
+
/**
|
| 12 |
+
* In this case, the pattern has a globstar and we must read all directories unconditionally,
|
| 13 |
+
* but only if the level has reached the end of the first group.
|
| 14 |
+
*
|
| 15 |
+
* fixtures/{a,b}/**
|
| 16 |
+
* ^ true/false ^ always true
|
| 17 |
+
*/
|
| 18 |
+
if (!pattern.complete && levels > section.length) {
|
| 19 |
+
return true;
|
| 20 |
+
}
|
| 21 |
+
const match = parts.every((part, index) => {
|
| 22 |
+
const segment = pattern.segments[index];
|
| 23 |
+
if (segment.dynamic && segment.patternRe.test(part)) {
|
| 24 |
+
return true;
|
| 25 |
+
}
|
| 26 |
+
if (!segment.dynamic && segment.pattern === part) {
|
| 27 |
+
return true;
|
| 28 |
+
}
|
| 29 |
+
return false;
|
| 30 |
+
});
|
| 31 |
+
if (match) {
|
| 32 |
+
return true;
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
return false;
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
exports.default = PartialMatcher;
|
node_modules/fast-glob/out/providers/provider.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Task } from '../managers/tasks';
|
| 2 |
+
import Settings from '../settings';
|
| 3 |
+
import { MicromatchOptions, ReaderOptions } from '../types';
|
| 4 |
+
import DeepFilter from './filters/deep';
|
| 5 |
+
import EntryFilter from './filters/entry';
|
| 6 |
+
import ErrorFilter from './filters/error';
|
| 7 |
+
import EntryTransformer from './transformers/entry';
|
| 8 |
+
export default abstract class Provider<T> {
|
| 9 |
+
protected readonly _settings: Settings;
|
| 10 |
+
readonly errorFilter: ErrorFilter;
|
| 11 |
+
readonly entryFilter: EntryFilter;
|
| 12 |
+
readonly deepFilter: DeepFilter;
|
| 13 |
+
readonly entryTransformer: EntryTransformer;
|
| 14 |
+
constructor(_settings: Settings);
|
| 15 |
+
abstract read(_task: Task): T;
|
| 16 |
+
protected _getRootDirectory(task: Task): string;
|
| 17 |
+
protected _getReaderOptions(task: Task): ReaderOptions;
|
| 18 |
+
protected _getMicromatchOptions(): MicromatchOptions;
|
| 19 |
+
}
|
node_modules/fast-glob/out/providers/provider.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const path = require("path");
|
| 4 |
+
const deep_1 = require("./filters/deep");
|
| 5 |
+
const entry_1 = require("./filters/entry");
|
| 6 |
+
const error_1 = require("./filters/error");
|
| 7 |
+
const entry_2 = require("./transformers/entry");
|
| 8 |
+
class Provider {
|
| 9 |
+
constructor(_settings) {
|
| 10 |
+
this._settings = _settings;
|
| 11 |
+
this.errorFilter = new error_1.default(this._settings);
|
| 12 |
+
this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
|
| 13 |
+
this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
|
| 14 |
+
this.entryTransformer = new entry_2.default(this._settings);
|
| 15 |
+
}
|
| 16 |
+
_getRootDirectory(task) {
|
| 17 |
+
return path.resolve(this._settings.cwd, task.base);
|
| 18 |
+
}
|
| 19 |
+
_getReaderOptions(task) {
|
| 20 |
+
const basePath = task.base === '.' ? '' : task.base;
|
| 21 |
+
return {
|
| 22 |
+
basePath,
|
| 23 |
+
pathSegmentSeparator: '/',
|
| 24 |
+
concurrency: this._settings.concurrency,
|
| 25 |
+
deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
|
| 26 |
+
entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
|
| 27 |
+
errorFilter: this.errorFilter.getFilter(),
|
| 28 |
+
followSymbolicLinks: this._settings.followSymbolicLinks,
|
| 29 |
+
fs: this._settings.fs,
|
| 30 |
+
stats: this._settings.stats,
|
| 31 |
+
throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
|
| 32 |
+
transform: this.entryTransformer.getTransformer()
|
| 33 |
+
};
|
| 34 |
+
}
|
| 35 |
+
_getMicromatchOptions() {
|
| 36 |
+
return {
|
| 37 |
+
dot: this._settings.dot,
|
| 38 |
+
matchBase: this._settings.baseNameMatch,
|
| 39 |
+
nobrace: !this._settings.braceExpansion,
|
| 40 |
+
nocase: !this._settings.caseSensitiveMatch,
|
| 41 |
+
noext: !this._settings.extglob,
|
| 42 |
+
noglobstar: !this._settings.globstar,
|
| 43 |
+
posix: true,
|
| 44 |
+
strictSlashes: false
|
| 45 |
+
};
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
exports.default = Provider;
|
node_modules/fast-glob/out/providers/stream.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="node" />
|
| 2 |
+
import { Readable } from 'stream';
|
| 3 |
+
import { Task } from '../managers/tasks';
|
| 4 |
+
import ReaderStream from '../readers/stream';
|
| 5 |
+
import { ReaderOptions } from '../types';
|
| 6 |
+
import Provider from './provider';
|
| 7 |
+
export default class ProviderStream extends Provider<Readable> {
|
| 8 |
+
protected _reader: ReaderStream;
|
| 9 |
+
read(task: Task): Readable;
|
| 10 |
+
api(root: string, task: Task, options: ReaderOptions): Readable;
|
| 11 |
+
}
|
node_modules/fast-glob/out/providers/stream.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const stream_1 = require("stream");
|
| 4 |
+
const stream_2 = require("../readers/stream");
|
| 5 |
+
const provider_1 = require("./provider");
|
| 6 |
+
class ProviderStream extends provider_1.default {
|
| 7 |
+
constructor() {
|
| 8 |
+
super(...arguments);
|
| 9 |
+
this._reader = new stream_2.default(this._settings);
|
| 10 |
+
}
|
| 11 |
+
read(task) {
|
| 12 |
+
const root = this._getRootDirectory(task);
|
| 13 |
+
const options = this._getReaderOptions(task);
|
| 14 |
+
const source = this.api(root, task, options);
|
| 15 |
+
const destination = new stream_1.Readable({ objectMode: true, read: () => { } });
|
| 16 |
+
source
|
| 17 |
+
.once('error', (error) => destination.emit('error', error))
|
| 18 |
+
.on('data', (entry) => destination.emit('data', options.transform(entry)))
|
| 19 |
+
.once('end', () => destination.emit('end'));
|
| 20 |
+
destination
|
| 21 |
+
.once('close', () => source.destroy());
|
| 22 |
+
return destination;
|
| 23 |
+
}
|
| 24 |
+
api(root, task, options) {
|
| 25 |
+
if (task.dynamic) {
|
| 26 |
+
return this._reader.dynamic(root, options);
|
| 27 |
+
}
|
| 28 |
+
return this._reader.static(task.patterns, options);
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
exports.default = ProviderStream;
|
node_modules/fast-glob/out/providers/sync.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Task } from '../managers/tasks';
|
| 2 |
+
import ReaderSync from '../readers/sync';
|
| 3 |
+
import { Entry, EntryItem, ReaderOptions } from '../types';
|
| 4 |
+
import Provider from './provider';
|
| 5 |
+
export default class ProviderSync extends Provider<EntryItem[]> {
|
| 6 |
+
protected _reader: ReaderSync;
|
| 7 |
+
read(task: Task): EntryItem[];
|
| 8 |
+
api(root: string, task: Task, options: ReaderOptions): Entry[];
|
| 9 |
+
}
|
node_modules/fast-glob/out/providers/sync.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const sync_1 = require("../readers/sync");
|
| 4 |
+
const provider_1 = require("./provider");
|
| 5 |
+
class ProviderSync extends provider_1.default {
|
| 6 |
+
constructor() {
|
| 7 |
+
super(...arguments);
|
| 8 |
+
this._reader = new sync_1.default(this._settings);
|
| 9 |
+
}
|
| 10 |
+
read(task) {
|
| 11 |
+
const root = this._getRootDirectory(task);
|
| 12 |
+
const options = this._getReaderOptions(task);
|
| 13 |
+
const entries = this.api(root, task, options);
|
| 14 |
+
return entries.map(options.transform);
|
| 15 |
+
}
|
| 16 |
+
api(root, task, options) {
|
| 17 |
+
if (task.dynamic) {
|
| 18 |
+
return this._reader.dynamic(root, options);
|
| 19 |
+
}
|
| 20 |
+
return this._reader.static(task.patterns, options);
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
exports.default = ProviderSync;
|
node_modules/fast-glob/out/providers/transformers/entry.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Settings from '../../settings';
|
| 2 |
+
import { EntryTransformerFunction } from '../../types';
|
| 3 |
+
export default class EntryTransformer {
|
| 4 |
+
private readonly _settings;
|
| 5 |
+
constructor(_settings: Settings);
|
| 6 |
+
getTransformer(): EntryTransformerFunction;
|
| 7 |
+
private _transform;
|
| 8 |
+
}
|
node_modules/fast-glob/out/providers/transformers/entry.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const utils = require("../../utils");
|
| 4 |
+
class EntryTransformer {
|
| 5 |
+
constructor(_settings) {
|
| 6 |
+
this._settings = _settings;
|
| 7 |
+
}
|
| 8 |
+
getTransformer() {
|
| 9 |
+
return (entry) => this._transform(entry);
|
| 10 |
+
}
|
| 11 |
+
_transform(entry) {
|
| 12 |
+
let filepath = entry.path;
|
| 13 |
+
if (this._settings.absolute) {
|
| 14 |
+
filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
|
| 15 |
+
filepath = utils.path.unixify(filepath);
|
| 16 |
+
}
|
| 17 |
+
if (this._settings.markDirectories && entry.dirent.isDirectory()) {
|
| 18 |
+
filepath += '/';
|
| 19 |
+
}
|
| 20 |
+
if (!this._settings.objectMode) {
|
| 21 |
+
return filepath;
|
| 22 |
+
}
|
| 23 |
+
return Object.assign(Object.assign({}, entry), { path: filepath });
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
exports.default = EntryTransformer;
|
node_modules/fast-glob/out/readers/async.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as fsWalk from '@nodelib/fs.walk';
|
| 2 |
+
import { Entry, ReaderOptions, Pattern } from '../types';
|
| 3 |
+
import Reader from './reader';
|
| 4 |
+
import ReaderStream from './stream';
|
| 5 |
+
export default class ReaderAsync extends Reader<Promise<Entry[]>> {
|
| 6 |
+
protected _walkAsync: typeof fsWalk.walk;
|
| 7 |
+
protected _readerStream: ReaderStream;
|
| 8 |
+
dynamic(root: string, options: ReaderOptions): Promise<Entry[]>;
|
| 9 |
+
static(patterns: Pattern[], options: ReaderOptions): Promise<Entry[]>;
|
| 10 |
+
}
|
node_modules/fast-glob/out/readers/async.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const fsWalk = require("@nodelib/fs.walk");
|
| 4 |
+
const reader_1 = require("./reader");
|
| 5 |
+
const stream_1 = require("./stream");
|
| 6 |
+
class ReaderAsync extends reader_1.default {
|
| 7 |
+
constructor() {
|
| 8 |
+
super(...arguments);
|
| 9 |
+
this._walkAsync = fsWalk.walk;
|
| 10 |
+
this._readerStream = new stream_1.default(this._settings);
|
| 11 |
+
}
|
| 12 |
+
dynamic(root, options) {
|
| 13 |
+
return new Promise((resolve, reject) => {
|
| 14 |
+
this._walkAsync(root, options, (error, entries) => {
|
| 15 |
+
if (error === null) {
|
| 16 |
+
resolve(entries);
|
| 17 |
+
}
|
| 18 |
+
else {
|
| 19 |
+
reject(error);
|
| 20 |
+
}
|
| 21 |
+
});
|
| 22 |
+
});
|
| 23 |
+
}
|
| 24 |
+
async static(patterns, options) {
|
| 25 |
+
const entries = [];
|
| 26 |
+
const stream = this._readerStream.static(patterns, options);
|
| 27 |
+
// After #235, replace it with an asynchronous iterator.
|
| 28 |
+
return new Promise((resolve, reject) => {
|
| 29 |
+
stream.once('error', reject);
|
| 30 |
+
stream.on('data', (entry) => entries.push(entry));
|
| 31 |
+
stream.once('end', () => resolve(entries));
|
| 32 |
+
});
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
exports.default = ReaderAsync;
|
node_modules/fast-glob/out/readers/reader.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="node" />
|
| 2 |
+
import * as fs from 'fs';
|
| 3 |
+
import * as fsStat from '@nodelib/fs.stat';
|
| 4 |
+
import Settings from '../settings';
|
| 5 |
+
import { Entry, ErrnoException, Pattern, ReaderOptions } from '../types';
|
| 6 |
+
export default abstract class Reader<T> {
|
| 7 |
+
protected readonly _settings: Settings;
|
| 8 |
+
protected readonly _fsStatSettings: fsStat.Settings;
|
| 9 |
+
constructor(_settings: Settings);
|
| 10 |
+
abstract dynamic(root: string, options: ReaderOptions): T;
|
| 11 |
+
abstract static(patterns: Pattern[], options: ReaderOptions): T;
|
| 12 |
+
protected _getFullEntryPath(filepath: string): string;
|
| 13 |
+
protected _makeEntry(stats: fs.Stats, pattern: Pattern): Entry;
|
| 14 |
+
protected _isFatalError(error: ErrnoException): boolean;
|
| 15 |
+
}
|