FIN INIT
This commit is contained in:
10
node_modules/fast-glob/out/readers/async.d.ts
generated
vendored
Normal file
10
node_modules/fast-glob/out/readers/async.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import * as fsWalk from '@nodelib/fs.walk';
|
||||
import { Entry, ReaderOptions, Pattern } from '../types';
|
||||
import Reader from './reader';
|
||||
import ReaderStream from './stream';
|
||||
export default class ReaderAsync extends Reader<Promise<Entry[]>> {
|
||||
protected _walkAsync: typeof fsWalk.walk;
|
||||
protected _readerStream: ReaderStream;
|
||||
dynamic(root: string, options: ReaderOptions): Promise<Entry[]>;
|
||||
static(patterns: Pattern[], options: ReaderOptions): Promise<Entry[]>;
|
||||
}
|
35
node_modules/fast-glob/out/readers/async.js
generated
vendored
Normal file
35
node_modules/fast-glob/out/readers/async.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fsWalk = require("@nodelib/fs.walk");
|
||||
const reader_1 = require("./reader");
|
||||
const stream_1 = require("./stream");
|
||||
class ReaderAsync extends reader_1.default {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._walkAsync = fsWalk.walk;
|
||||
this._readerStream = new stream_1.default(this._settings);
|
||||
}
|
||||
dynamic(root, options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._walkAsync(root, options, (error, entries) => {
|
||||
if (error === null) {
|
||||
resolve(entries);
|
||||
}
|
||||
else {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
async static(patterns, options) {
|
||||
const entries = [];
|
||||
const stream = this._readerStream.static(patterns, options);
|
||||
// After #235, replace it with an asynchronous iterator.
|
||||
return new Promise((resolve, reject) => {
|
||||
stream.once('error', reject);
|
||||
stream.on('data', (entry) => entries.push(entry));
|
||||
stream.once('end', () => resolve(entries));
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = ReaderAsync;
|
15
node_modules/fast-glob/out/readers/reader.d.ts
generated
vendored
Normal file
15
node_modules/fast-glob/out/readers/reader.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
import * as fsStat from '@nodelib/fs.stat';
|
||||
import Settings from '../settings';
|
||||
import { Entry, ErrnoException, Pattern, ReaderOptions } from '../types';
|
||||
export default abstract class Reader<T> {
|
||||
protected readonly _settings: Settings;
|
||||
protected readonly _fsStatSettings: fsStat.Settings;
|
||||
constructor(_settings: Settings);
|
||||
abstract dynamic(root: string, options: ReaderOptions): T;
|
||||
abstract static(patterns: Pattern[], options: ReaderOptions): T;
|
||||
protected _getFullEntryPath(filepath: string): string;
|
||||
protected _makeEntry(stats: fs.Stats, pattern: Pattern): Entry;
|
||||
protected _isFatalError(error: ErrnoException): boolean;
|
||||
}
|
33
node_modules/fast-glob/out/readers/reader.js
generated
vendored
Normal file
33
node_modules/fast-glob/out/readers/reader.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const fsStat = require("@nodelib/fs.stat");
|
||||
const utils = require("../utils");
|
||||
class Reader {
|
||||
constructor(_settings) {
|
||||
this._settings = _settings;
|
||||
this._fsStatSettings = new fsStat.Settings({
|
||||
followSymbolicLink: this._settings.followSymbolicLinks,
|
||||
fs: this._settings.fs,
|
||||
throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
|
||||
});
|
||||
}
|
||||
_getFullEntryPath(filepath) {
|
||||
return path.resolve(this._settings.cwd, filepath);
|
||||
}
|
||||
_makeEntry(stats, pattern) {
|
||||
const entry = {
|
||||
name: pattern,
|
||||
path: pattern,
|
||||
dirent: utils.fs.createDirentFromStats(pattern, stats)
|
||||
};
|
||||
if (this._settings.stats) {
|
||||
entry.stats = stats;
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
_isFatalError(error) {
|
||||
return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
|
||||
}
|
||||
}
|
||||
exports.default = Reader;
|
14
node_modules/fast-glob/out/readers/stream.d.ts
generated
vendored
Normal file
14
node_modules/fast-glob/out/readers/stream.d.ts
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
import * as fsStat from '@nodelib/fs.stat';
|
||||
import * as fsWalk from '@nodelib/fs.walk';
|
||||
import { Pattern, ReaderOptions } from '../types';
|
||||
import Reader from './reader';
|
||||
export default class ReaderStream extends Reader<Readable> {
|
||||
protected _walkStream: typeof fsWalk.walkStream;
|
||||
protected _stat: typeof fsStat.stat;
|
||||
dynamic(root: string, options: ReaderOptions): Readable;
|
||||
static(patterns: Pattern[], options: ReaderOptions): Readable;
|
||||
private _getEntry;
|
||||
private _getStat;
|
||||
}
|
55
node_modules/fast-glob/out/readers/stream.js
generated
vendored
Normal file
55
node_modules/fast-glob/out/readers/stream.js
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const stream_1 = require("stream");
|
||||
const fsStat = require("@nodelib/fs.stat");
|
||||
const fsWalk = require("@nodelib/fs.walk");
|
||||
const reader_1 = require("./reader");
|
||||
class ReaderStream extends reader_1.default {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._walkStream = fsWalk.walkStream;
|
||||
this._stat = fsStat.stat;
|
||||
}
|
||||
dynamic(root, options) {
|
||||
return this._walkStream(root, options);
|
||||
}
|
||||
static(patterns, options) {
|
||||
const filepaths = patterns.map(this._getFullEntryPath, this);
|
||||
const stream = new stream_1.PassThrough({ objectMode: true });
|
||||
stream._write = (index, _enc, done) => {
|
||||
return this._getEntry(filepaths[index], patterns[index], options)
|
||||
.then((entry) => {
|
||||
if (entry !== null && options.entryFilter(entry)) {
|
||||
stream.push(entry);
|
||||
}
|
||||
if (index === filepaths.length - 1) {
|
||||
stream.end();
|
||||
}
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
};
|
||||
for (let i = 0; i < filepaths.length; i++) {
|
||||
stream.write(i);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
_getEntry(filepath, pattern, options) {
|
||||
return this._getStat(filepath)
|
||||
.then((stats) => this._makeEntry(stats, pattern))
|
||||
.catch((error) => {
|
||||
if (options.errorFilter(error)) {
|
||||
return null;
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
_getStat(filepath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._stat(filepath, this._fsStatSettings, (error, stats) => {
|
||||
return error === null ? resolve(stats) : reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = ReaderStream;
|
12
node_modules/fast-glob/out/readers/sync.d.ts
generated
vendored
Normal file
12
node_modules/fast-glob/out/readers/sync.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import * as fsStat from '@nodelib/fs.stat';
|
||||
import * as fsWalk from '@nodelib/fs.walk';
|
||||
import { Entry, Pattern, ReaderOptions } from '../types';
|
||||
import Reader from './reader';
|
||||
export default class ReaderSync extends Reader<Entry[]> {
|
||||
protected _walkSync: typeof fsWalk.walkSync;
|
||||
protected _statSync: typeof fsStat.statSync;
|
||||
dynamic(root: string, options: ReaderOptions): Entry[];
|
||||
static(patterns: Pattern[], options: ReaderOptions): Entry[];
|
||||
private _getEntry;
|
||||
private _getStat;
|
||||
}
|
43
node_modules/fast-glob/out/readers/sync.js
generated
vendored
Normal file
43
node_modules/fast-glob/out/readers/sync.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fsStat = require("@nodelib/fs.stat");
|
||||
const fsWalk = require("@nodelib/fs.walk");
|
||||
const reader_1 = require("./reader");
|
||||
class ReaderSync extends reader_1.default {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._walkSync = fsWalk.walkSync;
|
||||
this._statSync = fsStat.statSync;
|
||||
}
|
||||
dynamic(root, options) {
|
||||
return this._walkSync(root, options);
|
||||
}
|
||||
static(patterns, options) {
|
||||
const entries = [];
|
||||
for (const pattern of patterns) {
|
||||
const filepath = this._getFullEntryPath(pattern);
|
||||
const entry = this._getEntry(filepath, pattern, options);
|
||||
if (entry === null || !options.entryFilter(entry)) {
|
||||
continue;
|
||||
}
|
||||
entries.push(entry);
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
_getEntry(filepath, pattern, options) {
|
||||
try {
|
||||
const stats = this._getStat(filepath);
|
||||
return this._makeEntry(stats, pattern);
|
||||
}
|
||||
catch (error) {
|
||||
if (options.errorFilter(error)) {
|
||||
return null;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
_getStat(filepath) {
|
||||
return this._statSync(filepath, this._fsStatSettings);
|
||||
}
|
||||
}
|
||||
exports.default = ReaderSync;
|
Reference in New Issue
Block a user