add hw2
This commit is contained in:
		
							
								
								
									
										14
									
								
								node_modules/@nodelib/fs.walk/out/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								node_modules/@nodelib/fs.walk/out/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| /// <reference types="node" /> | ||||
| import type { Readable } from 'stream'; | ||||
| import type { Dirent, FileSystemAdapter } from '@nodelib/fs.scandir'; | ||||
| import { AsyncCallback } from './providers/async'; | ||||
| import Settings, { DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction, Options } from './settings'; | ||||
| import type { Entry } from './types'; | ||||
| declare function walk(directory: string, callback: AsyncCallback): void; | ||||
| declare function walk(directory: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; | ||||
| declare namespace walk { | ||||
|     function __promisify__(directory: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>; | ||||
| } | ||||
| declare function walkSync(directory: string, optionsOrSettings?: Options | Settings): Entry[]; | ||||
| declare function walkStream(directory: string, optionsOrSettings?: Options | Settings): Readable; | ||||
| export { walk, walkSync, walkStream, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, Options, DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction }; | ||||
							
								
								
									
										34
									
								
								node_modules/@nodelib/fs.walk/out/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								node_modules/@nodelib/fs.walk/out/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0; | ||||
| const async_1 = require("./providers/async"); | ||||
| const stream_1 = require("./providers/stream"); | ||||
| const sync_1 = require("./providers/sync"); | ||||
| const settings_1 = require("./settings"); | ||||
| exports.Settings = settings_1.default; | ||||
| function walk(directory, optionsOrSettingsOrCallback, callback) { | ||||
|     if (typeof optionsOrSettingsOrCallback === 'function') { | ||||
|         new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); | ||||
|         return; | ||||
|     } | ||||
|     new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); | ||||
| } | ||||
| exports.walk = walk; | ||||
| function walkSync(directory, optionsOrSettings) { | ||||
|     const settings = getSettings(optionsOrSettings); | ||||
|     const provider = new sync_1.default(directory, settings); | ||||
|     return provider.read(); | ||||
| } | ||||
| exports.walkSync = walkSync; | ||||
| function walkStream(directory, optionsOrSettings) { | ||||
|     const settings = getSettings(optionsOrSettings); | ||||
|     const provider = new stream_1.default(directory, settings); | ||||
|     return provider.read(); | ||||
| } | ||||
| exports.walkStream = walkStream; | ||||
| function getSettings(settingsOrOptions = {}) { | ||||
|     if (settingsOrOptions instanceof settings_1.default) { | ||||
|         return settingsOrOptions; | ||||
|     } | ||||
|     return new settings_1.default(settingsOrOptions); | ||||
| } | ||||
							
								
								
									
										12
									
								
								node_modules/@nodelib/fs.walk/out/providers/async.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								node_modules/@nodelib/fs.walk/out/providers/async.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| import AsyncReader from '../readers/async'; | ||||
| import type Settings from '../settings'; | ||||
| import type { Entry, Errno } from '../types'; | ||||
| export declare type AsyncCallback = (error: Errno, entries: Entry[]) => void; | ||||
| export default class AsyncProvider { | ||||
|     private readonly _root; | ||||
|     private readonly _settings; | ||||
|     protected readonly _reader: AsyncReader; | ||||
|     private readonly _storage; | ||||
|     constructor(_root: string, _settings: Settings); | ||||
|     read(callback: AsyncCallback): void; | ||||
| } | ||||
							
								
								
									
										30
									
								
								node_modules/@nodelib/fs.walk/out/providers/async.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								node_modules/@nodelib/fs.walk/out/providers/async.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const async_1 = require("../readers/async"); | ||||
| class AsyncProvider { | ||||
|     constructor(_root, _settings) { | ||||
|         this._root = _root; | ||||
|         this._settings = _settings; | ||||
|         this._reader = new async_1.default(this._root, this._settings); | ||||
|         this._storage = []; | ||||
|     } | ||||
|     read(callback) { | ||||
|         this._reader.onError((error) => { | ||||
|             callFailureCallback(callback, error); | ||||
|         }); | ||||
|         this._reader.onEntry((entry) => { | ||||
|             this._storage.push(entry); | ||||
|         }); | ||||
|         this._reader.onEnd(() => { | ||||
|             callSuccessCallback(callback, this._storage); | ||||
|         }); | ||||
|         this._reader.read(); | ||||
|     } | ||||
| } | ||||
| exports.default = AsyncProvider; | ||||
| function callFailureCallback(callback, error) { | ||||
|     callback(error); | ||||
| } | ||||
| function callSuccessCallback(callback, entries) { | ||||
|     callback(null, entries); | ||||
| } | ||||
							
								
								
									
										4
									
								
								node_modules/@nodelib/fs.walk/out/providers/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								node_modules/@nodelib/fs.walk/out/providers/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| import AsyncProvider from './async'; | ||||
| import StreamProvider from './stream'; | ||||
| import SyncProvider from './sync'; | ||||
| export { AsyncProvider, StreamProvider, SyncProvider }; | ||||
							
								
								
									
										9
									
								
								node_modules/@nodelib/fs.walk/out/providers/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								node_modules/@nodelib/fs.walk/out/providers/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.SyncProvider = exports.StreamProvider = exports.AsyncProvider = void 0; | ||||
| const async_1 = require("./async"); | ||||
| exports.AsyncProvider = async_1.default; | ||||
| const stream_1 = require("./stream"); | ||||
| exports.StreamProvider = stream_1.default; | ||||
| const sync_1 = require("./sync"); | ||||
| exports.SyncProvider = sync_1.default; | ||||
							
								
								
									
										12
									
								
								node_modules/@nodelib/fs.walk/out/providers/stream.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								node_modules/@nodelib/fs.walk/out/providers/stream.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| /// <reference types="node" /> | ||||
| import { Readable } from 'stream'; | ||||
| import AsyncReader from '../readers/async'; | ||||
| import type Settings from '../settings'; | ||||
| export default class StreamProvider { | ||||
|     private readonly _root; | ||||
|     private readonly _settings; | ||||
|     protected readonly _reader: AsyncReader; | ||||
|     protected readonly _stream: Readable; | ||||
|     constructor(_root: string, _settings: Settings); | ||||
|     read(): Readable; | ||||
| } | ||||
							
								
								
									
										34
									
								
								node_modules/@nodelib/fs.walk/out/providers/stream.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								node_modules/@nodelib/fs.walk/out/providers/stream.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const stream_1 = require("stream"); | ||||
| const async_1 = require("../readers/async"); | ||||
| class StreamProvider { | ||||
|     constructor(_root, _settings) { | ||||
|         this._root = _root; | ||||
|         this._settings = _settings; | ||||
|         this._reader = new async_1.default(this._root, this._settings); | ||||
|         this._stream = new stream_1.Readable({ | ||||
|             objectMode: true, | ||||
|             read: () => { }, | ||||
|             destroy: () => { | ||||
|                 if (!this._reader.isDestroyed) { | ||||
|                     this._reader.destroy(); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|     read() { | ||||
|         this._reader.onError((error) => { | ||||
|             this._stream.emit('error', error); | ||||
|         }); | ||||
|         this._reader.onEntry((entry) => { | ||||
|             this._stream.push(entry); | ||||
|         }); | ||||
|         this._reader.onEnd(() => { | ||||
|             this._stream.push(null); | ||||
|         }); | ||||
|         this._reader.read(); | ||||
|         return this._stream; | ||||
|     } | ||||
| } | ||||
| exports.default = StreamProvider; | ||||
							
								
								
									
										10
									
								
								node_modules/@nodelib/fs.walk/out/providers/sync.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								node_modules/@nodelib/fs.walk/out/providers/sync.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| import SyncReader from '../readers/sync'; | ||||
| import type Settings from '../settings'; | ||||
| import type { Entry } from '../types'; | ||||
| export default class SyncProvider { | ||||
|     private readonly _root; | ||||
|     private readonly _settings; | ||||
|     protected readonly _reader: SyncReader; | ||||
|     constructor(_root: string, _settings: Settings); | ||||
|     read(): Entry[]; | ||||
| } | ||||
							
								
								
									
										14
									
								
								node_modules/@nodelib/fs.walk/out/providers/sync.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								node_modules/@nodelib/fs.walk/out/providers/sync.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const sync_1 = require("../readers/sync"); | ||||
| class SyncProvider { | ||||
|     constructor(_root, _settings) { | ||||
|         this._root = _root; | ||||
|         this._settings = _settings; | ||||
|         this._reader = new sync_1.default(this._root, this._settings); | ||||
|     } | ||||
|     read() { | ||||
|         return this._reader.read(); | ||||
|     } | ||||
| } | ||||
| exports.default = SyncProvider; | ||||
							
								
								
									
										30
									
								
								node_modules/@nodelib/fs.walk/out/readers/async.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								node_modules/@nodelib/fs.walk/out/readers/async.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| /// <reference types="node" /> | ||||
| import { EventEmitter } from 'events'; | ||||
| import * as fsScandir from '@nodelib/fs.scandir'; | ||||
| import type Settings from '../settings'; | ||||
| import type { Entry, Errno } from '../types'; | ||||
| import Reader from './reader'; | ||||
| declare type EntryEventCallback = (entry: Entry) => void; | ||||
| declare type ErrorEventCallback = (error: Errno) => void; | ||||
| declare type EndEventCallback = () => void; | ||||
| export default class AsyncReader extends Reader { | ||||
|     protected readonly _settings: Settings; | ||||
|     protected readonly _scandir: typeof fsScandir.scandir; | ||||
|     protected readonly _emitter: EventEmitter; | ||||
|     private readonly _queue; | ||||
|     private _isFatalError; | ||||
|     private _isDestroyed; | ||||
|     constructor(_root: string, _settings: Settings); | ||||
|     read(): EventEmitter; | ||||
|     get isDestroyed(): boolean; | ||||
|     destroy(): void; | ||||
|     onEntry(callback: EntryEventCallback): void; | ||||
|     onError(callback: ErrorEventCallback): void; | ||||
|     onEnd(callback: EndEventCallback): void; | ||||
|     private _pushToQueue; | ||||
|     private _worker; | ||||
|     private _handleError; | ||||
|     private _handleEntry; | ||||
|     private _emitEntry; | ||||
| } | ||||
| export {}; | ||||
							
								
								
									
										97
									
								
								node_modules/@nodelib/fs.walk/out/readers/async.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								node_modules/@nodelib/fs.walk/out/readers/async.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,97 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const events_1 = require("events"); | ||||
| const fsScandir = require("@nodelib/fs.scandir"); | ||||
| const fastq = require("fastq"); | ||||
| const common = require("./common"); | ||||
| const reader_1 = require("./reader"); | ||||
| class AsyncReader extends reader_1.default { | ||||
|     constructor(_root, _settings) { | ||||
|         super(_root, _settings); | ||||
|         this._settings = _settings; | ||||
|         this._scandir = fsScandir.scandir; | ||||
|         this._emitter = new events_1.EventEmitter(); | ||||
|         this._queue = fastq(this._worker.bind(this), this._settings.concurrency); | ||||
|         this._isFatalError = false; | ||||
|         this._isDestroyed = false; | ||||
|         this._queue.drain = () => { | ||||
|             if (!this._isFatalError) { | ||||
|                 this._emitter.emit('end'); | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
|     read() { | ||||
|         this._isFatalError = false; | ||||
|         this._isDestroyed = false; | ||||
|         setImmediate(() => { | ||||
|             this._pushToQueue(this._root, this._settings.basePath); | ||||
|         }); | ||||
|         return this._emitter; | ||||
|     } | ||||
|     get isDestroyed() { | ||||
|         return this._isDestroyed; | ||||
|     } | ||||
|     destroy() { | ||||
|         if (this._isDestroyed) { | ||||
|             throw new Error('The reader is already destroyed'); | ||||
|         } | ||||
|         this._isDestroyed = true; | ||||
|         this._queue.killAndDrain(); | ||||
|     } | ||||
|     onEntry(callback) { | ||||
|         this._emitter.on('entry', callback); | ||||
|     } | ||||
|     onError(callback) { | ||||
|         this._emitter.once('error', callback); | ||||
|     } | ||||
|     onEnd(callback) { | ||||
|         this._emitter.once('end', callback); | ||||
|     } | ||||
|     _pushToQueue(directory, base) { | ||||
|         const queueItem = { directory, base }; | ||||
|         this._queue.push(queueItem, (error) => { | ||||
|             if (error !== null) { | ||||
|                 this._handleError(error); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|     _worker(item, done) { | ||||
|         this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { | ||||
|             if (error !== null) { | ||||
|                 done(error, undefined); | ||||
|                 return; | ||||
|             } | ||||
|             for (const entry of entries) { | ||||
|                 this._handleEntry(entry, item.base); | ||||
|             } | ||||
|             done(null, undefined); | ||||
|         }); | ||||
|     } | ||||
|     _handleError(error) { | ||||
|         if (this._isDestroyed || !common.isFatalError(this._settings, error)) { | ||||
|             return; | ||||
|         } | ||||
|         this._isFatalError = true; | ||||
|         this._isDestroyed = true; | ||||
|         this._emitter.emit('error', error); | ||||
|     } | ||||
|     _handleEntry(entry, base) { | ||||
|         if (this._isDestroyed || this._isFatalError) { | ||||
|             return; | ||||
|         } | ||||
|         const fullpath = entry.path; | ||||
|         if (base !== undefined) { | ||||
|             entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); | ||||
|         } | ||||
|         if (common.isAppliedFilter(this._settings.entryFilter, entry)) { | ||||
|             this._emitEntry(entry); | ||||
|         } | ||||
|         if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { | ||||
|             this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); | ||||
|         } | ||||
|     } | ||||
|     _emitEntry(entry) { | ||||
|         this._emitter.emit('entry', entry); | ||||
|     } | ||||
| } | ||||
| exports.default = AsyncReader; | ||||
							
								
								
									
										7
									
								
								node_modules/@nodelib/fs.walk/out/readers/common.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								node_modules/@nodelib/fs.walk/out/readers/common.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| import type { FilterFunction } from '../settings'; | ||||
| import type Settings from '../settings'; | ||||
| import type { Errno } from '../types'; | ||||
| export declare function isFatalError(settings: Settings, error: Errno): boolean; | ||||
| export declare function isAppliedFilter<T>(filter: FilterFunction<T> | null, value: T): boolean; | ||||
| export declare function replacePathSegmentSeparator(filepath: string, separator: string): string; | ||||
| export declare function joinPathSegments(a: string, b: string, separator: string): string; | ||||
							
								
								
									
										31
									
								
								node_modules/@nodelib/fs.walk/out/readers/common.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								node_modules/@nodelib/fs.walk/out/readers/common.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; | ||||
| function isFatalError(settings, error) { | ||||
|     if (settings.errorFilter === null) { | ||||
|         return true; | ||||
|     } | ||||
|     return !settings.errorFilter(error); | ||||
| } | ||||
| exports.isFatalError = isFatalError; | ||||
| function isAppliedFilter(filter, value) { | ||||
|     return filter === null || filter(value); | ||||
| } | ||||
| exports.isAppliedFilter = isAppliedFilter; | ||||
| function replacePathSegmentSeparator(filepath, separator) { | ||||
|     return filepath.split(/[/\\]/).join(separator); | ||||
| } | ||||
| exports.replacePathSegmentSeparator = replacePathSegmentSeparator; | ||||
| function joinPathSegments(a, b, separator) { | ||||
|     if (a === '') { | ||||
|         return b; | ||||
|     } | ||||
|     /** | ||||
|      * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). | ||||
|      */ | ||||
|     if (a.endsWith(separator)) { | ||||
|         return a + b; | ||||
|     } | ||||
|     return a + separator + b; | ||||
| } | ||||
| exports.joinPathSegments = joinPathSegments; | ||||
							
								
								
									
										6
									
								
								node_modules/@nodelib/fs.walk/out/readers/reader.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								node_modules/@nodelib/fs.walk/out/readers/reader.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| import type Settings from '../settings'; | ||||
| export default class Reader { | ||||
|     protected readonly _root: string; | ||||
|     protected readonly _settings: Settings; | ||||
|     constructor(_root: string, _settings: Settings); | ||||
| } | ||||
							
								
								
									
										11
									
								
								node_modules/@nodelib/fs.walk/out/readers/reader.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								node_modules/@nodelib/fs.walk/out/readers/reader.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const common = require("./common"); | ||||
| class Reader { | ||||
|     constructor(_root, _settings) { | ||||
|         this._root = _root; | ||||
|         this._settings = _settings; | ||||
|         this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); | ||||
|     } | ||||
| } | ||||
| exports.default = Reader; | ||||
							
								
								
									
										15
									
								
								node_modules/@nodelib/fs.walk/out/readers/sync.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								node_modules/@nodelib/fs.walk/out/readers/sync.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| import * as fsScandir from '@nodelib/fs.scandir'; | ||||
| import type { Entry } from '../types'; | ||||
| import Reader from './reader'; | ||||
| export default class SyncReader extends Reader { | ||||
|     protected readonly _scandir: typeof fsScandir.scandirSync; | ||||
|     private readonly _storage; | ||||
|     private readonly _queue; | ||||
|     read(): Entry[]; | ||||
|     private _pushToQueue; | ||||
|     private _handleQueue; | ||||
|     private _handleDirectory; | ||||
|     private _handleError; | ||||
|     private _handleEntry; | ||||
|     private _pushToStorage; | ||||
| } | ||||
							
								
								
									
										59
									
								
								node_modules/@nodelib/fs.walk/out/readers/sync.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								node_modules/@nodelib/fs.walk/out/readers/sync.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,59 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const fsScandir = require("@nodelib/fs.scandir"); | ||||
| const common = require("./common"); | ||||
| const reader_1 = require("./reader"); | ||||
| class SyncReader extends reader_1.default { | ||||
|     constructor() { | ||||
|         super(...arguments); | ||||
|         this._scandir = fsScandir.scandirSync; | ||||
|         this._storage = []; | ||||
|         this._queue = new Set(); | ||||
|     } | ||||
|     read() { | ||||
|         this._pushToQueue(this._root, this._settings.basePath); | ||||
|         this._handleQueue(); | ||||
|         return this._storage; | ||||
|     } | ||||
|     _pushToQueue(directory, base) { | ||||
|         this._queue.add({ directory, base }); | ||||
|     } | ||||
|     _handleQueue() { | ||||
|         for (const item of this._queue.values()) { | ||||
|             this._handleDirectory(item.directory, item.base); | ||||
|         } | ||||
|     } | ||||
|     _handleDirectory(directory, base) { | ||||
|         try { | ||||
|             const entries = this._scandir(directory, this._settings.fsScandirSettings); | ||||
|             for (const entry of entries) { | ||||
|                 this._handleEntry(entry, base); | ||||
|             } | ||||
|         } | ||||
|         catch (error) { | ||||
|             this._handleError(error); | ||||
|         } | ||||
|     } | ||||
|     _handleError(error) { | ||||
|         if (!common.isFatalError(this._settings, error)) { | ||||
|             return; | ||||
|         } | ||||
|         throw error; | ||||
|     } | ||||
|     _handleEntry(entry, base) { | ||||
|         const fullpath = entry.path; | ||||
|         if (base !== undefined) { | ||||
|             entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); | ||||
|         } | ||||
|         if (common.isAppliedFilter(this._settings.entryFilter, entry)) { | ||||
|             this._pushToStorage(entry); | ||||
|         } | ||||
|         if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { | ||||
|             this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); | ||||
|         } | ||||
|     } | ||||
|     _pushToStorage(entry) { | ||||
|         this._storage.push(entry); | ||||
|     } | ||||
| } | ||||
| exports.default = SyncReader; | ||||
							
								
								
									
										30
									
								
								node_modules/@nodelib/fs.walk/out/settings.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								node_modules/@nodelib/fs.walk/out/settings.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| import * as fsScandir from '@nodelib/fs.scandir'; | ||||
| import type { Entry, Errno } from './types'; | ||||
| export declare type FilterFunction<T> = (value: T) => boolean; | ||||
| export declare type DeepFilterFunction = FilterFunction<Entry>; | ||||
| export declare type EntryFilterFunction = FilterFunction<Entry>; | ||||
| export declare type ErrorFilterFunction = FilterFunction<Errno>; | ||||
| export interface Options { | ||||
|     basePath?: string; | ||||
|     concurrency?: number; | ||||
|     deepFilter?: DeepFilterFunction; | ||||
|     entryFilter?: EntryFilterFunction; | ||||
|     errorFilter?: ErrorFilterFunction; | ||||
|     followSymbolicLinks?: boolean; | ||||
|     fs?: Partial<fsScandir.FileSystemAdapter>; | ||||
|     pathSegmentSeparator?: string; | ||||
|     stats?: boolean; | ||||
|     throwErrorOnBrokenSymbolicLink?: boolean; | ||||
| } | ||||
| export default class Settings { | ||||
|     private readonly _options; | ||||
|     readonly basePath?: string; | ||||
|     readonly concurrency: number; | ||||
|     readonly deepFilter: DeepFilterFunction | null; | ||||
|     readonly entryFilter: EntryFilterFunction | null; | ||||
|     readonly errorFilter: ErrorFilterFunction | null; | ||||
|     readonly pathSegmentSeparator: string; | ||||
|     readonly fsScandirSettings: fsScandir.Settings; | ||||
|     constructor(_options?: Options); | ||||
|     private _getValue; | ||||
| } | ||||
							
								
								
									
										26
									
								
								node_modules/@nodelib/fs.walk/out/settings.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								node_modules/@nodelib/fs.walk/out/settings.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const path = require("path"); | ||||
| const fsScandir = require("@nodelib/fs.scandir"); | ||||
| class Settings { | ||||
|     constructor(_options = {}) { | ||||
|         this._options = _options; | ||||
|         this.basePath = this._getValue(this._options.basePath, undefined); | ||||
|         this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY); | ||||
|         this.deepFilter = this._getValue(this._options.deepFilter, null); | ||||
|         this.entryFilter = this._getValue(this._options.entryFilter, null); | ||||
|         this.errorFilter = this._getValue(this._options.errorFilter, null); | ||||
|         this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); | ||||
|         this.fsScandirSettings = new fsScandir.Settings({ | ||||
|             followSymbolicLinks: this._options.followSymbolicLinks, | ||||
|             fs: this._options.fs, | ||||
|             pathSegmentSeparator: this._options.pathSegmentSeparator, | ||||
|             stats: this._options.stats, | ||||
|             throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink | ||||
|         }); | ||||
|     } | ||||
|     _getValue(option, value) { | ||||
|         return option !== null && option !== void 0 ? option : value; | ||||
|     } | ||||
| } | ||||
| exports.default = Settings; | ||||
							
								
								
									
										8
									
								
								node_modules/@nodelib/fs.walk/out/types/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								node_modules/@nodelib/fs.walk/out/types/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| /// <reference types="node" /> | ||||
| import type * as scandir from '@nodelib/fs.scandir'; | ||||
| export declare type Entry = scandir.Entry; | ||||
| export declare type Errno = NodeJS.ErrnoException; | ||||
| export interface QueueItem { | ||||
|     directory: string; | ||||
|     base?: string; | ||||
| } | ||||
							
								
								
									
										2
									
								
								node_modules/@nodelib/fs.walk/out/types/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								node_modules/@nodelib/fs.walk/out/types/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
		Reference in New Issue
	
	Block a user
	 nik
					nik