define-variable-webpack-plugin
Version:
Enhancement of Webpack DefinePlugin to store defined things in actual variables.
58 lines (57 loc) • 1.66 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const constants_1 = __importDefault(require("constants"));
class Stats {
constructor(config) {
Object.keys(config).forEach(k => {
this[k] = config[k];
});
}
static genericStats(content) {
const t = new Date();
return new Stats({
atime: t,
birthtime: t,
blksize: 4096,
ctime: t,
dev: 8675309,
gid: 20,
ino: 44700000,
mode: 33188,
mtime: t,
nlink: 1,
rdev: 0,
size: content.length,
uid: 501,
});
}
checkModeProperty(p) {
// tslint:disable-next-line:no-bitwise
return (this.mode & constants_1.default.S_IFMT) === p;
}
isDirectory() {
return this.checkModeProperty(constants_1.default.S_IFDIR);
}
isFile() {
return this.checkModeProperty(constants_1.default.S_IFREG);
}
isBlockDevice() {
return this.checkModeProperty(constants_1.default.S_IFBLK);
}
isCharacterDevice() {
return this.checkModeProperty(constants_1.default.S_IFCHR);
}
isSymbolicLink() {
return this.checkModeProperty(constants_1.default.S_IFLNK);
}
isFIFO() {
return this.checkModeProperty(constants_1.default.S_IFIFO);
}
isSocket() {
return this.checkModeProperty(constants_1.default.S_IFSOCK);
}
}
exports.Stats = Stats;
;