This commit is contained in:
2022-09-30 05:39:11 +00:00
parent 41ee9463ae
commit 4687fa49bc
11418 changed files with 1312504 additions and 0 deletions

24
buildfiles/node_modules/stat-mode/LICENSE generated vendored Normal file
View File

@ -0,0 +1,24 @@
(The MIT License)
Copyright (c) 2016 Nathan Rajlich <n@n8.io>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

182
buildfiles/node_modules/stat-mode/README.md generated vendored Normal file
View File

@ -0,0 +1,182 @@
stat-mode
=========
### Offers convenient getters and setters for the stat `mode`
[![Build Status](https://github.com/TooTallNate/stat-mode/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/stat-mode/actions?workflow=Node+CI)
You know that `mode` property on the `fs.Stat` object that you probably
usually just ignore? Well there's acutally a lot of information packed
into that number.
The specific information includes:
* What the ["file type"](http://en.wikipedia.org/wiki/Unix_file_types) of file it is
* Whether or not the [`setuid` and `setgid` bits](http://en.wikipedia.org/wiki/Setuid) are set
* Whether or not the [`sticky` bit](http://en.wikipedia.org/wiki/Sticky_bit) is set
* The [_read_, _write_, and _execute_ permissions for the _owner_, _group_ and _others_](http://en.wikipedia.org/wiki/File_system_permissions)
This module helps you extract that information.
All the getters are also setters, which change the `mode` property
appropriately. This is useful for when you have to build up your
own `fs.Stat` object for whatever reason (like when implementing a
FUSE filesystem.
Installation
------------
``` bash
$ npm install stat-mode
```
Example
-------
So given some arbitrary file (let's say `/bin/echo`):
``` bash
$ ls -l /bin/echo
-rwxr-xr-x 1 root wheel 14128 Aug 11 2013 /bin/echo
```
We can inspect it using the `fs.stat()` call and creating a `Mode` instance
on top of it.
``` javascript
var fs = require('fs');
var Mode = require('stat-mode');
fs.stat('/bin/echo', function (err, stat) {
if (err) throw err;
// create a "Mode" instance on top of the `stat` object
var mode = new Mode(stat);
// you can check what kind of file it is:
mode.isDirectory();
// false
mode.isFIFO();
// false
mode.isFile();
// true
// and you can also check individual owner, group and others permissions
mode.owner.read;
// true
mode.owner.write;
// true
mode.owner.execute;
// true
mode.group.read;
// true
mode.group.write;
// false
mode.group.execute;
// true
mode.others.read;
// true
mode.others.write;
// false
mode.others.execute;
// true
// the `toString()` output resembes the `ls -l` output:
mode.toString();
// '-rwxr-xr-x'
});
```
API
---
### new Mode(Object stat) → Mode
You must pass in "stat" object to the `Mode` constructor. The "stat"
object can be a real `fs.Stat` instance, or really any Object with a
`mode` property.
#### mode.isDirectory([Boolean set]) → Boolean
Returns `true` if the mode's file type is "directory", `false` otherwise.
If you pass `true` to the function, then the mode will be set to "directory".
#### mode.isFile([Boolean set]) → Boolean
Returns `true` if the mode's file type is "file", `false` otherwise.
If you pass `true` to the function, then the mode will be set to "file".
#### mode.isBlockDevice([Boolean set]) → Boolean
Returns `true` if the mode's file type is "block device", `false` otherwise.
If you pass `true` to the function, then the mode will be set to "block device".
#### mode.isCharacterDevice([Boolean set]) → Boolean
Returns `true` if the mode's file type is "character device", `false` otherwise.
If you pass `true` to the function, then the mode will be set to "character
device".
#### mode.isSymbolicLink([Boolean set]) → Boolean
Returns `true` if the mode's file type is "symbolic link", `false` otherwise.
If you pass `true` to the function, then the mode will be set to "symbolic link".
#### mode.isFIFO([Boolean set]) → Boolean
Returns `true` if the mode's file type is "FIFO", `false` otherwise.
If you pass `true` to the function, then the mode will be set to "FIFO".
#### mode.isSocket([Boolean set]) → Boolean
Returns `true` if the mode's file type is "socket", `false` otherwise.
If you pass `true` to the function, then the mode will be set to "socket".
#### mode.owner.read → Boolean [Getter/Setter]
`true` if the mode is "owner read" rights, `false` otherwise.
#### mode.owner.write → Boolean [Getter/Setter]
`true` if the mode is "owner write" rights, `false` otherwise.
#### mode.owner.execute → Boolean [Getter/Setter]
`true` if the mode is "owner execute" rights, `false` otherwise.
#### mode.group.read → Boolean [Getter/Setter]
`true` if the mode is "group read" rights, `false` otherwise.
#### mode.group.write → Boolean [Getter/Setter]
`true` if the mode is "group write" rights, `false` otherwise.
#### mode.group.execute → Boolean [Getter/Setter]
`true` if the mode is "group execute" rights, `false` otherwise.
#### mode.others.read → Boolean [Getter/Setter]
`true` if the mode is "others read" rights, `false` otherwise.
#### mode.others.write → Boolean [Getter/Setter]
`true` if the mode is "others write" rights, `false` otherwise.
#### mode.others.execute → Boolean [Getter/Setter]
`true` if the mode is "others execute" rights, `false` otherwise.

77
buildfiles/node_modules/stat-mode/dist/src/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,77 @@
/// <reference types="node" />
import { Stats } from 'fs';
declare function createMode(stat?: number | createMode.StatsMode): createMode.Mode;
declare namespace createMode {
type StatsMode = Pick<Stats, 'mode'>;
function isStatsMode(v: any): v is StatsMode;
class RWX {
protected static r: number;
protected static w: number;
protected static x: number;
private stat;
constructor(stat: StatsMode);
get read(): boolean;
set read(v: boolean);
get write(): boolean;
set write(v: boolean);
get execute(): boolean;
set execute(v: boolean);
}
class Owner extends RWX {
protected static r: number;
protected static w: number;
protected static x: number;
}
class Group extends RWX {
protected static r: number;
protected static w: number;
protected static x: number;
}
class Others extends RWX {
protected static r: number;
protected static w: number;
protected static x: number;
}
class Mode {
owner: Owner;
group: Group;
others: Others;
private stat;
constructor(stat?: number | StatsMode);
private checkModeProperty;
isDirectory(v?: boolean): boolean;
isFile(v?: boolean): boolean;
isBlockDevice(v?: boolean): boolean;
isCharacterDevice(v?: boolean): boolean;
isSymbolicLink(v?: boolean): boolean;
isFIFO(v?: boolean): boolean;
isSocket(v?: boolean): boolean;
/**
* Returns an octal representation of the `mode`, eg. "0754".
*
* http://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation
*
* @return {String}
* @api public
*/
toOctal(): string;
/**
* Returns a String representation of the `mode`.
* The output resembles something similar to what `ls -l` would output.
*
* http://en.wikipedia.org/wiki/Unix_file_types
*
* @return {String}
* @api public
*/
toString(): string;
valueOf(): number;
get setuid(): boolean;
set setuid(v: boolean);
get setgid(): boolean;
set setgid(v: boolean);
get sticky(): boolean;
set sticky(v: boolean);
}
}
export = createMode;

257
buildfiles/node_modules/stat-mode/dist/src/index.js generated vendored Normal file
View File

@ -0,0 +1,257 @@
"use strict";
/**
* Constants (defined in `stat.h`).
*/
const S_IFMT = 61440; /* 0170000 type of file */
const S_IFIFO = 4096; /* 0010000 named pipe (fifo) */
const S_IFCHR = 8192; /* 0020000 character special */
const S_IFDIR = 16384; /* 0040000 directory */
const S_IFBLK = 24576; /* 0060000 block special */
const S_IFREG = 32768; /* 0100000 regular */
const S_IFLNK = 40960; /* 0120000 symbolic link */
const S_IFSOCK = 49152; /* 0140000 socket */
const S_IFWHT = 57344; /* 0160000 whiteout */
const S_ISUID = 2048; /* 0004000 set user id on execution */
const S_ISGID = 1024; /* 0002000 set group id on execution */
const S_ISVTX = 512; /* 0001000 save swapped text even after use */
const S_IRUSR = 256; /* 0000400 read permission, owner */
const S_IWUSR = 128; /* 0000200 write permission, owner */
const S_IXUSR = 64; /* 0000100 execute/search permission, owner */
const S_IRGRP = 32; /* 0000040 read permission, group */
const S_IWGRP = 16; /* 0000020 write permission, group */
const S_IXGRP = 8; /* 0000010 execute/search permission, group */
const S_IROTH = 4; /* 0000004 read permission, others */
const S_IWOTH = 2; /* 0000002 write permission, others */
const S_IXOTH = 1; /* 0000001 execute/search permission, others */
function createMode(stat) {
return new createMode.Mode(stat);
}
(function (createMode) {
function isStatsMode(v) {
return v && typeof v.mode === 'number';
}
createMode.isStatsMode = isStatsMode;
class RWX {
constructor(stat) {
this.stat = stat;
}
get read() {
return Boolean(this.stat.mode & this.constructor.r);
}
set read(v) {
if (v) {
this.stat.mode |= this.constructor.r;
}
else {
this.stat.mode &= ~this.constructor.r;
}
}
get write() {
return Boolean(this.stat.mode & this.constructor.w);
}
set write(v) {
if (v) {
this.stat.mode |= this.constructor.w;
}
else {
this.stat.mode &= ~this.constructor.w;
}
}
get execute() {
return Boolean(this.stat.mode & this.constructor.x);
}
set execute(v) {
if (v) {
this.stat.mode |= this.constructor.x;
}
else {
this.stat.mode &= ~this.constructor.x;
}
}
}
createMode.RWX = RWX;
class Owner extends RWX {
}
Owner.r = S_IRUSR;
Owner.w = S_IWUSR;
Owner.x = S_IXUSR;
createMode.Owner = Owner;
class Group extends RWX {
}
Group.r = S_IRGRP;
Group.w = S_IWGRP;
Group.x = S_IXGRP;
createMode.Group = Group;
class Others extends RWX {
}
Others.r = S_IROTH;
Others.w = S_IWOTH;
Others.x = S_IXOTH;
createMode.Others = Others;
class Mode {
constructor(stat) {
if (typeof stat === 'number') {
this.stat = { mode: stat };
}
else if (isStatsMode(stat)) {
this.stat = stat;
}
else {
this.stat = { mode: 0 };
}
this.owner = new Owner(this.stat);
this.group = new Group(this.stat);
this.others = new Others(this.stat);
}
checkModeProperty(property, set) {
const { mode } = this.stat;
if (set) {
this.stat.mode = ((mode | S_IFMT) & property) | (mode & ~S_IFMT);
}
return (mode & S_IFMT) === property;
}
isDirectory(v) {
return this.checkModeProperty(S_IFDIR, v);
}
isFile(v) {
return this.checkModeProperty(S_IFREG, v);
}
isBlockDevice(v) {
return this.checkModeProperty(S_IFBLK, v);
}
isCharacterDevice(v) {
return this.checkModeProperty(S_IFCHR, v);
}
isSymbolicLink(v) {
return this.checkModeProperty(S_IFLNK, v);
}
isFIFO(v) {
return this.checkModeProperty(S_IFIFO, v);
}
isSocket(v) {
return this.checkModeProperty(S_IFSOCK, v);
}
/**
* Returns an octal representation of the `mode`, eg. "0754".
*
* http://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation
*
* @return {String}
* @api public
*/
toOctal() {
const octal = this.stat.mode & 4095 /* 07777 */;
return `0000${octal.toString(8)}`.slice(-4);
}
/**
* Returns a String representation of the `mode`.
* The output resembles something similar to what `ls -l` would output.
*
* http://en.wikipedia.org/wiki/Unix_file_types
*
* @return {String}
* @api public
*/
toString() {
const str = [];
// file type
if (this.isDirectory()) {
str.push('d');
}
else if (this.isFile()) {
str.push('-');
}
else if (this.isBlockDevice()) {
str.push('b');
}
else if (this.isCharacterDevice()) {
str.push('c');
}
else if (this.isSymbolicLink()) {
str.push('l');
}
else if (this.isFIFO()) {
str.push('p');
}
else if (this.isSocket()) {
str.push('s');
}
else {
const mode = this.valueOf();
const err = new TypeError(`Unexpected "file type": mode=${mode}`);
//err.stat = this.stat;
//err.mode = mode;
throw err;
}
// owner read, write, execute
str.push(this.owner.read ? 'r' : '-');
str.push(this.owner.write ? 'w' : '-');
if (this.setuid) {
str.push(this.owner.execute ? 's' : 'S');
}
else {
str.push(this.owner.execute ? 'x' : '-');
}
// group read, write, execute
str.push(this.group.read ? 'r' : '-');
str.push(this.group.write ? 'w' : '-');
if (this.setgid) {
str.push(this.group.execute ? 's' : 'S');
}
else {
str.push(this.group.execute ? 'x' : '-');
}
// others read, write, execute
str.push(this.others.read ? 'r' : '-');
str.push(this.others.write ? 'w' : '-');
if (this.sticky) {
str.push(this.others.execute ? 't' : 'T');
}
else {
str.push(this.others.execute ? 'x' : '-');
}
return str.join('');
}
valueOf() {
return this.stat.mode;
}
get setuid() {
return Boolean(this.stat.mode & S_ISUID);
}
set setuid(v) {
if (v) {
this.stat.mode |= S_ISUID;
}
else {
this.stat.mode &= ~S_ISUID;
}
}
get setgid() {
return Boolean(this.stat.mode & S_ISGID);
}
set setgid(v) {
if (v) {
this.stat.mode |= S_ISGID;
}
else {
this.stat.mode &= ~S_ISGID;
}
}
get sticky() {
return Boolean(this.stat.mode & S_ISVTX);
}
set sticky(v) {
if (v) {
this.stat.mode |= S_ISVTX;
}
else {
this.stat.mode &= ~S_ISVTX;
}
}
}
createMode.Mode = Mode;
// So that `instanceof` checks work as expected
createMode.prototype = Mode.prototype;
})(createMode || (createMode = {}));
module.exports = createMode;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

90
buildfiles/node_modules/stat-mode/package.json generated vendored Normal file
View File

@ -0,0 +1,90 @@
{
"_from": "stat-mode@^1.0.0",
"_id": "stat-mode@1.0.0",
"_inBundle": false,
"_integrity": "sha512-jH9EhtKIjuXZ2cWxmXS8ZP80XyC3iasQxMDV8jzhNJpfDb7VbQLVW4Wvsxz9QZvzV+G4YoSfBUVKDOyxLzi/sg==",
"_location": "/stat-mode",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "stat-mode@^1.0.0",
"name": "stat-mode",
"escapedName": "stat-mode",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/builder-util"
],
"_resolved": "https://registry.npmjs.org/stat-mode/-/stat-mode-1.0.0.tgz",
"_shasum": "68b55cb61ea639ff57136f36b216a291800d1465",
"_spec": "stat-mode@^1.0.0",
"_where": "/home/shihaam/www/freezer.shihaam.me/node_modules/builder-util",
"author": {
"name": "Nathan Rajlich",
"email": "nathan@tootallnate.net",
"url": "http://n8.io/"
},
"bugs": {
"url": "https://github.com/TooTallNate/stat-mode/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Offers convenient getters and setters for the stat `mode`",
"devDependencies": {
"@types/escodegen": "^0.0.6",
"@types/esprima": "^4.0.2",
"@types/mocha": "^5.2.7",
"@types/node": "^10.5.3",
"@typescript-eslint/eslint-plugin": "1.6.0",
"@typescript-eslint/parser": "1.1.0",
"cpy-cli": "^2.0.0",
"eslint": "5.16.0",
"eslint-config-airbnb": "17.1.0",
"eslint-config-prettier": "4.1.0",
"eslint-import-resolver-typescript": "1.1.1",
"eslint-plugin-import": "2.16.0",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-react": "7.12.4",
"mocha": "^6.2.0",
"rimraf": "^3.0.0",
"typescript": "^3.5.3"
},
"engines": {
"node": ">= 6"
},
"files": [
"dist/src"
],
"homepage": "https://github.com/TooTallNate/stat-mode",
"keywords": [
"stat",
"mode",
"owner",
"group",
"others",
"chmod",
"octal",
"symbolic",
"permissions"
],
"license": "MIT",
"main": "dist/src/index",
"name": "stat-mode",
"repository": {
"type": "git",
"url": "git://github.com/TooTallNate/stat-mode.git"
},
"scripts": {
"build": "tsc",
"postbuild": "cpy --parents src test '!**/*.ts' dist",
"prebuild": "rimraf dist",
"prepublishOnly": "npm run build",
"test": "mocha --reporter spec dist/test/test*.js",
"test-lint": "eslint src --ext .js,.ts"
},
"typings": "dist/src/index",
"version": "1.0.0"
}