push all website files

This commit is contained in:
Jacob Levine
2019-01-06 13:14:45 -06:00
parent d7301e26c3
commit d2d5d4c04e
15662 changed files with 2166516 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
/// <reference types="node" />
import * as fs from 'fs';
import FileSystem from './fs';
import { FilterFunction } from '@mrmlnc/readdir-enhanced';
import { Entry } from '../types/entries';
import { Pattern } from '../types/patterns';
export default class FileSystemStream extends FileSystem<NodeJS.ReadableStream> {
/**
* Use stream API to read entries for Task.
*/
read(patterns: string[], filter: FilterFunction): NodeJS.ReadableStream;
/**
* Return entry for the provided path.
*/
getEntry(filepath: string, pattern: Pattern): Promise<Entry | null>;
/**
* Return fs.Stats for the provided path.
*/
getStat(filepath: string): Promise<fs.Stats>;
}

View File

@@ -0,0 +1,64 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var stream = require("stream");
var fsStat = require("@nodelib/fs.stat");
var fs_1 = require("./fs");
var FileSystemStream = /** @class */ (function (_super) {
__extends(FileSystemStream, _super);
function FileSystemStream() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Use stream API to read entries for Task.
*/
FileSystemStream.prototype.read = function (patterns, filter) {
var _this = this;
var filepaths = patterns.map(this.getFullEntryPath, this);
var transform = new stream.Transform({ objectMode: true });
transform._transform = function (index, _enc, done) {
return _this.getEntry(filepaths[index], patterns[index]).then(function (entry) {
if (entry !== null && filter(entry)) {
transform.push(entry);
}
if (index === filepaths.length - 1) {
transform.end();
}
done();
});
};
for (var i = 0; i < filepaths.length; i++) {
transform.write(i);
}
return transform;
};
/**
* Return entry for the provided path.
*/
FileSystemStream.prototype.getEntry = function (filepath, pattern) {
var _this = this;
return this.getStat(filepath)
.then(function (stat) { return _this.makeEntry(stat, pattern); })
.catch(function () { return null; });
};
/**
* Return fs.Stats for the provided path.
*/
FileSystemStream.prototype.getStat = function (filepath) {
return fsStat.stat(filepath, { throwErrorOnBrokenSymlinks: false });
};
return FileSystemStream;
}(fs_1.default));
exports.default = FileSystemStream;

View File

@@ -0,0 +1,20 @@
/// <reference types="node" />
import * as fs from 'fs';
import FileSystem from './fs';
import { FilterFunction } from '@mrmlnc/readdir-enhanced';
import { Entry } from '../types/entries';
import { Pattern } from '../types/patterns';
export default class FileSystemSync extends FileSystem<Entry[]> {
/**
* Use sync API to read entries for Task.
*/
read(patterns: string[], filter: FilterFunction): Entry[];
/**
* Return entry for the provided path.
*/
getEntry(filepath: string, pattern: Pattern): Entry | null;
/**
* Return fs.Stats for the provided path.
*/
getStat(filepath: string): fs.Stats;
}

View File

@@ -0,0 +1,59 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var fsStat = require("@nodelib/fs.stat");
var fs_1 = require("./fs");
var FileSystemSync = /** @class */ (function (_super) {
__extends(FileSystemSync, _super);
function FileSystemSync() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Use sync API to read entries for Task.
*/
FileSystemSync.prototype.read = function (patterns, filter) {
var _this = this;
var entries = [];
patterns.forEach(function (pattern) {
var filepath = _this.getFullEntryPath(pattern);
var entry = _this.getEntry(filepath, pattern);
if (entry === null || !filter(entry)) {
return;
}
entries.push(entry);
});
return entries;
};
/**
* Return entry for the provided path.
*/
FileSystemSync.prototype.getEntry = function (filepath, pattern) {
try {
var stat = this.getStat(filepath);
return this.makeEntry(stat, pattern);
}
catch (err) {
return null;
}
};
/**
* Return fs.Stats for the provided path.
*/
FileSystemSync.prototype.getStat = function (filepath) {
return fsStat.statSync(filepath, { throwErrorOnBrokenSymlinks: false });
};
return FileSystemSync;
}(fs_1.default));
exports.default = FileSystemSync;

View File

@@ -0,0 +1,22 @@
/// <reference types="node" />
import * as fs from 'fs';
import { FilterFunction } from '@mrmlnc/readdir-enhanced';
import { IOptions } from '../managers/options';
import { Entry } from '../types/entries';
import { Pattern } from '../types/patterns';
export default abstract class FileSystem<T> {
private readonly options;
constructor(options: IOptions);
/**
* The main logic of reading the entries that must be implemented by each adapter.
*/
abstract read(filepaths: string[], filter: FilterFunction): T;
/**
* Return full path to entry.
*/
getFullEntryPath(filepath: string): string;
/**
* Return an implementation of the Entry interface.
*/
makeEntry(stat: fs.Stats, pattern: Pattern): Entry;
}

View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path = require("path");
var FileSystem = /** @class */ (function () {
function FileSystem(options) {
this.options = options;
}
/**
* Return full path to entry.
*/
FileSystem.prototype.getFullEntryPath = function (filepath) {
return path.resolve(this.options.cwd, filepath);
};
/**
* Return an implementation of the Entry interface.
*/
FileSystem.prototype.makeEntry = function (stat, pattern) {
return Object.assign(stat, {
path: pattern,
depth: pattern.split('/').length
});
};
return FileSystem;
}());
exports.default = FileSystem;