mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-12 13:41:40 +00:00
update
This commit is contained in:
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;
|
13
node_modules/fast-glob/out/readers/stream.d.ts
generated
vendored
Normal file
13
node_modules/fast-glob/out/readers/stream.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/// <reference types="node" />
|
||||
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<NodeJS.ReadableStream> {
|
||||
protected _walkStream: typeof fsWalk.walkStream;
|
||||
protected _stat: typeof fsStat.stat;
|
||||
dynamic(root: string, options: ReaderOptions): NodeJS.ReadableStream;
|
||||
static(patterns: Pattern[], options: ReaderOptions): NodeJS.ReadableStream;
|
||||
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