fixes and admin data

This commit is contained in:
2021-02-09 18:30:17 +01:00
parent 9dd4d10396
commit 93bff025e9
73 changed files with 1638 additions and 2411 deletions

21
node_modules/chokidar/README.md generated vendored
View File

@@ -1,11 +1,9 @@
# Chokidar [![Weekly downloads](https://img.shields.io/npm/dw/chokidar.svg)](https://github.com/paulmillr/chokidar) [![Yearly downloads](https://img.shields.io/npm/dy/chokidar.svg)](https://github.com/paulmillr/chokidar)
> A neat wrapper around Node.js fs.watch / fs.watchFile / FSEvents.
> Minimal and efficient cross-platform file watching library
[![NPM](https://nodei.co/npm/chokidar.png)](https://www.npmjs.com/package/chokidar)
Version 3 is out! Check out our blog post about it: [Chokidar 3: How to save 32TB of traffic every week](https://paulmillr.com/posts/chokidar-3-save-32tb-of-traffic/)
## Why?
Node.js `fs.watch`:
@@ -35,6 +33,8 @@ Initially made for **[Brunch](https://brunch.io/)** (an ultra-swift web app buil
and [many others](https://www.npmjs.com/browse/depended/chokidar).
It has proven itself in production environments.
Version 3 is out! Check out our blog post about it: [Chokidar 3: How to save 32TB of traffic every week](https://paulmillr.com/posts/chokidar-3-save-32tb-of-traffic/)
## How?
Chokidar does still rely on the Node.js core `fs` module, but when using
@@ -74,7 +74,7 @@ chokidar.watch('.').on('all', (event, path) => {
## API
```javascript
// Example of a more typical implementation structure:
// Example of a more typical implementation structure
// Initialize watcher.
const watcher = chokidar.watch('file, dir, glob, or array', {
@@ -253,9 +253,9 @@ Available events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `ready`,
`raw`, `error`.
Additionally `all` is available which gets emitted with the underlying event
name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully.
* `.unwatch(path / paths)`: **async** Stop watching files, directories, or glob patterns.
* `.unwatch(path / paths)`: Stop watching files, directories, or glob patterns.
Takes an array of strings or just one string. Use with `await` to ensure bugs don't happen.
* `.close()`: Removes all listeners from watched files. Asynchronous, returns Promise.
* `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise.
* `.getWatched()`: Returns an object representing all the paths on the file
system being watched by this `FSWatcher` instance. The object's keys are all the
directories (using absolute paths unless the `cwd` option was used), and the
@@ -286,7 +286,8 @@ execute a command on each change, or get a stdio stream of change events.
## Changelog
For more detailed changelog, see [`full_changelog.md`](.github/full_changelog.md).
- **v3.4 (Apr 26, 2020):** Support for directory-based symlinks. Macos file replacement fixes.
- **v3.5 (Jan 6, 2021):** Support for ARM Macs with Apple Silicon. Fixes for deleted symlinks.
- **v3.4 (Apr 26, 2020):** Support for directory-based symlinks. Fixes for macos file replacement.
- **v3.3 (Nov 2, 2019):** `FSWatcher#close()` method became async. That fixes IO race conditions related to close method.
- **v3.2 (Oct 1, 2019):** Improve Linux RAM usage by 50%. Race condition fixes. Windows glob fixes. Improve stability by using tight range of dependency versions.
- **v3.1 (Sep 16, 2019):** dotfiles are no longer filtered out by default. Use `ignored` option if needed. Improve initial Linux scan time by 50%.
@@ -295,6 +296,12 @@ For more detailed changelog, see [`full_changelog.md`](.github/full_changelog.md
- **v1 (Apr 7, 2015):** Glob support, symlink support, tons of bugfixes. Node 0.8+ is supported
- **v0.1 (Apr 20, 2012):** Initial release, extracted from [Brunch](https://github.com/brunch/brunch/blob/9847a065aea300da99bd0753f90354cde9de1261/src/helpers.coffee#L66)
## Also
Why was chokidar named this way? What's the meaning behind it?
>Chowkidar is a transliteration of a Hindi word meaning 'watchman, gatekeeper', चौकीदार. This ultimately comes from Sanskrit _ चतुष्क_ (crossway, quadrangle, consisting-of-four).
## License
MIT (c) Paul Miller (<https://paulmillr.com>), see [LICENSE](LICENSE) file.

33
node_modules/chokidar/index.js generated vendored
View File

@@ -34,6 +34,7 @@ const {
REPLACER_RE,
SLASH,
SLASH_SLASH,
BRACE_START,
BANG,
ONE_DOT,
@@ -96,11 +97,20 @@ const unifyPaths = (paths_) => {
return paths.map(normalizePathToUnix);
};
// If SLASH_SLASH occurs at the beginning of path, it is not replaced
// because "//StoragePC/DrivePool/Movies" is a valid network path
const toUnix = (string) => {
let str = string.replace(BACK_SLASH_RE, SLASH);
let prepend = false;
if (str.startsWith(SLASH_SLASH)) {
prepend = true;
}
while (str.match(DOUBLE_SLASH_RE)) {
str = str.replace(DOUBLE_SLASH_RE, SLASH);
}
if (prepend) {
str = SLASH + str;
}
return str;
};
@@ -854,6 +864,15 @@ _remove(directory, item, isDirectory) {
const wasTracked = parent.has(item);
parent.remove(item);
// Fixes issue #1042 -> Relative paths were detected and added as symlinks
// (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612),
// but never removed from the map in case the path was deleted.
// This leads to an incorrect state if the path was recreated:
// https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553
if (this._symlinkPaths.has(fullPath)) {
this._symlinkPaths.delete(fullPath);
}
// If we wait for this file to be fully written, cancel the wait.
let relPath = path;
if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path);
@@ -876,16 +895,24 @@ _remove(directory, item, isDirectory) {
}
/**
*
* Closes all watchers for a path
* @param {Path} path
*/
_closePath(path) {
this._closeFile(path)
const dir = sysPath.dirname(path);
this._getWatchedDir(dir).remove(sysPath.basename(path));
}
/**
* Closes only file-specific watchers
* @param {Path} path
*/
_closeFile(path) {
const closers = this._closers.get(path);
if (!closers) return;
closers.forEach(closer => closer());
this._closers.delete(path);
const dir = sysPath.dirname(path);
this._getWatchedDir(dir).remove(sysPath.basename(path));
}
/**

View File

@@ -41,6 +41,7 @@ exports.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
exports.REPLACER_RE = /^\.[/\\]/;
exports.SLASH = '/';
exports.SLASH_SLASH = '//';
exports.BRACE_START = '{';
exports.BANG = '!';
exports.ONE_DOT = '.';
@@ -59,3 +60,4 @@ exports.IDENTITY_FN = val => val;
exports.isWindows = platform === 'win32';
exports.isMacos = platform === 'darwin';
exports.isLinux = platform === 'linux';

View File

@@ -103,7 +103,7 @@ const createFSEventsInstance = (path, callback) => {
* @param {Function} rawEmitter - passes data to listeners of the 'raw' event
* @returns {Function} closer
*/
function setFSEventsListener(path, realPath, listener, rawEmitter, fsw) {
function setFSEventsListener(path, realPath, listener, rawEmitter) {
let watchPath = sysPath.extname(path) ? sysPath.dirname(path) : path;
const parentPath = sysPath.dirname(watchPath);
let cont = FSEventsWatchers.get(watchPath);
@@ -146,7 +146,7 @@ function setFSEventsListener(path, realPath, listener, rawEmitter, fsw) {
listeners: new Set([filteredListener]),
rawEmitter,
watcher: createFSEventsInstance(watchPath, (fullPath, flags) => {
if (fsw.closed) return;
if (!cont.listeners.size) return;
const info = fsevents.getInfo(fullPath, flags);
cont.listeners.forEach(list => {
list(fullPath, flags, info);
@@ -242,7 +242,6 @@ async checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts
try {
const stats = await stat(path)
if (this.fsw.closed) return;
if (this.fsw.closed) return;
if (sameTypes(info, stats)) {
this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
} else {
@@ -300,8 +299,7 @@ handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opt
* @returns {Function} closer for the watcher instance
*/
_watchWithFsEvents(watchPath, realPath, transform, globFilter) {
if (this.fsw.closed) return;
if (this.fsw._isIgnored(watchPath)) return;
if (this.fsw.closed || this.fsw._isIgnored(watchPath)) return;
const opts = this.fsw.options;
const watchCallback = async (fullPath, flags, info) => {
if (this.fsw.closed) return;
@@ -353,8 +351,7 @@ _watchWithFsEvents(watchPath, realPath, transform, globFilter) {
watchPath,
realPath,
watchCallback,
this.fsw._emitRaw,
this.fsw
this.fsw._emitRaw
);
this.fsw._emitReady();

View File

@@ -6,6 +6,7 @@ const { promisify } = require('util');
const isBinaryPath = require('is-binary-path');
const {
isWindows,
isLinux,
EMPTY_FN,
EMPTY_STR,
KEY_LISTENERS,
@@ -356,8 +357,7 @@ _handleFile(file, stats, initialAdd) {
// if the file is already being watched, do nothing
if (parent.has(basename)) return;
// kick off the watcher
const closer = this._watchWithNodeFs(file, async (path, newStats) => {
const listener = async (path, newStats) => {
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return;
if (!newStats || newStats.mtimeMs === 0) {
try {
@@ -369,12 +369,18 @@ _handleFile(file, stats, initialAdd) {
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
this.fsw._emit(EV_CHANGE, file, newStats);
}
prevStats = newStats;
if (isLinux && prevStats.ino !== newStats.ino) {
this.fsw._closeFile(path)
prevStats = newStats;
this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener));
} else {
prevStats = newStats;
}
} catch (error) {
// Fix issues where mtime is null but file is still present
this.fsw._remove(dirname, basename);
}
// add is about to be emitted if file not already tracked in parent
// add is about to be emitted if file not already tracked in parent
} else if (parent.has(basename)) {
// Check that change event was not fired because of changed only accessTime.
const at = newStats.atimeMs;
@@ -384,7 +390,9 @@ _handleFile(file, stats, initialAdd) {
}
prevStats = newStats;
}
});
}
// kick off the watcher
const closer = this._watchWithNodeFs(file, listener);
// emit an add event if we're supposed to
if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
@@ -595,13 +603,14 @@ async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
const follow = this.fsw.options.followSymlinks && !path.includes(STAR) && !path.includes(BRACE_START);
let closer;
if (stats.isDirectory()) {
const absPath = sysPath.resolve(path);
const targetPath = follow ? await fsrealpath(path) : path;
if (this.fsw.closed) return;
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
if (this.fsw.closed) return;
// preserve this symlink's target path
if (path !== targetPath && targetPath !== undefined) {
this.fsw._symlinkPaths.set(targetPath, true);
if (absPath !== targetPath && targetPath !== undefined) {
this.fsw._symlinkPaths.set(absPath, targetPath);
}
} else if (stats.isSymbolicLink()) {
const targetPath = follow ? await fsrealpath(path) : path;

158
node_modules/chokidar/package.json generated vendored
View File

@@ -1,34 +1,61 @@
{
"name": "chokidar",
"description": "A neat wrapper around node.js fs.watch / fs.watchFile / fsevents.",
"version": "3.4.0",
"homepage": "https://github.com/paulmillr/chokidar",
"author": "Paul Miller (https://paulmillr.com)",
"contributors": [
"Paul Miller (https://paulmillr.com)",
"Elan Shanker"
],
"engines": {
"node": ">= 8.10.0"
"_from": "chokidar@^3.2.2",
"_id": "chokidar@3.5.1",
"_inBundle": false,
"_integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==",
"_location": "/chokidar",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "chokidar@^3.2.2",
"name": "chokidar",
"escapedName": "chokidar",
"rawSpec": "^3.2.2",
"saveSpec": null,
"fetchSpec": "^3.2.2"
},
"main": "index.js",
"_requiredBy": [
"/nodemon"
],
"_resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz",
"_shasum": "ee9ce7bbebd2b79f49f304799d5468e31e14e68a",
"_spec": "chokidar@^3.2.2",
"_where": "C:\\Users\\Jonasz\\Desktop\\Menui\\menui_backend\\node_modules\\nodemon",
"author": {
"name": "Paul Miller",
"url": "https://paulmillr.com"
},
"bugs": {
"url": "https://github.com/paulmillr/chokidar/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Paul Miller",
"url": "https://paulmillr.com"
},
{
"name": "Elan Shanker"
}
],
"dependencies": {
"anymatch": "~3.1.1",
"braces": "~3.0.2",
"fsevents": "~2.3.1",
"glob-parent": "~5.1.0",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.4.0"
},
"optionalDependencies": {
"fsevents": "~2.1.2"
"readdirp": "~3.5.0"
},
"deprecated": false,
"description": "Minimal and efficient cross-platform file watching library",
"devDependencies": {
"@types/node": "^13",
"@types/node": "^14",
"chai": "^4.2",
"dtslint": "^3.3.0",
"eslint": "^6.6.0",
"eslint": "^7.0.0",
"mocha": "^7.0.0",
"nyc": "^15.0.0",
"rimraf": "^3.0.0",
@@ -36,25 +63,15 @@
"sinon-chai": "^3.3.0",
"upath": "^1.2.0"
},
"engines": {
"node": ">= 8.10.0"
},
"files": [
"index.js",
"lib/*.js",
"types/index.d.ts"
],
"repository": {
"type": "git",
"url": "git+https://github.com/paulmillr/chokidar.git"
},
"bugs": {
"url": "https://github.com/paulmillr/chokidar/issues"
},
"license": "MIT",
"scripts": {
"dtslint": "dtslint types",
"lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .",
"mocha": "mocha --exit --timeout 60000",
"test": "npm run lint && npm run mocha"
},
"homepage": "https://github.com/paulmillr/chokidar",
"keywords": [
"fs",
"watch",
@@ -64,57 +81,9 @@
"file",
"fsevents"
],
"types": "./types/index.d.ts",
"eslintConfig": {
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "script"
},
"env": {
"node": true,
"es6": true
},
"rules": {
"array-callback-return": "error",
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"no-lonely-if": "error",
"no-var": "error",
"object-shorthand": "error",
"prefer-arrow-callback": [
"error",
{
"allowNamedFunctions": true
}
],
"prefer-const": [
"error",
{
"ignoreReadBeforeAssign": true
}
],
"prefer-destructuring": [
"error",
{
"object": true,
"array": false
}
],
"prefer-spread": "error",
"prefer-template": "error",
"radix": "error",
"strict": "error",
"quotes": [
"error",
"single"
]
}
},
"license": "MIT",
"main": "index.js",
"name": "chokidar",
"nyc": {
"include": [
"index.js",
@@ -124,9 +93,20 @@
"html",
"text"
]
}
,"_resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz"
,"_integrity": "sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ=="
,"_from": "chokidar@3.4.0"
}
},
"optionalDependencies": {
"fsevents": "~2.3.1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/paulmillr/chokidar.git"
},
"scripts": {
"dtslint": "dtslint types",
"lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .",
"mocha": "mocha --exit --timeout 60000",
"test": "npm run lint && npm run mocha"
},
"types": "./types/index.d.ts",
"version": "3.5.1"
}