🆙 chokidar@2.1.7

This commit is contained in:
Benjamin Pasero 2019-07-03 15:16:17 +02:00
parent f5d3ca0944
commit f7ff421b11
8 changed files with 1612 additions and 652 deletions

View file

@ -47,7 +47,7 @@
"spdlog": "^0.9.0",
"sudo-prompt": "9.0.0",
"v8-inspect-profiler": "^0.0.20",
"vscode-chokidar": "1.6.5",
"vscode-chokidar": "2.1.7",
"vscode-proxy-agent": "0.4.0",
"vscode-ripgrep": "^1.3.1",
"vscode-sqlite3": "4.0.7",

View file

@ -17,7 +17,7 @@
"onigasm-umd": "^2.2.2",
"semver": "^5.5.0",
"spdlog": "^0.9.0",
"vscode-chokidar": "1.6.5",
"vscode-chokidar": "2.1.7",
"vscode-proxy-agent": "0.4.0",
"vscode-ripgrep": "^1.3.1",
"vscode-textmate": "^4.1.1",

File diff suppressed because it is too large Load diff

View file

@ -5,84 +5,196 @@
declare module 'vscode-chokidar' {
// TypeScript Version: 3.0
import * as fs from "fs";
import { EventEmitter } from "events";
/**
* takes paths to be watched recursively and options
* The object's keys are all the directories (using absolute paths unless the `cwd` option was
* used), and the values are arrays of the names of the items contained in each directory.
*/
export function watch(paths: string | string[], options: IOptions): FSWatcher;
export interface IOptions {
/**
* (regexp or function) files to be ignored. This function or regexp is tested against the whole path, not just filename.
* If it is a function with two arguments, it gets called twice per path - once with a single argument (the path), second time with two arguments (the path and the fs.Stats object of that path).
*/
ignored?: any;
/**
* (default: false). Indicates whether the process should continue to run as long as files are being watched.
*/
persistent?: boolean;
/**
* (default: false). Indicates whether to watch files that don't have read permissions.
*/
ignorePermissionErrors?: boolean;
/**
* (default: false). Indicates whether chokidar should ignore the initial add events or not.
*/
ignoreInitial?: boolean;
/**
* (default: 100). Interval of file system polling.
*/
interval?: number;
/**
* (default: 300). Interval of file system polling for binary files (see extensions in src/is-binary).
*/
binaryInterval?: number;
/**
* (default: false on Windows, true on Linux and OS X). Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU utilization, consider setting this to false.
*/
usePolling?: boolean;
/**
* (default: true on OS X). Whether to use the fsevents watching interface if available. When set to true explicitly and fsevents is available this supercedes the usePolling setting. When set to false on OS X, usePolling: true becomes the default.
*/
useFsEvents?: boolean;
/**
* (default: true). When false, only the symlinks themselves will be watched for changes instead of following the link references and bubbling events through the link's path.
*/
followSymlinks?: boolean;
/**
* (default: false). If set to true then the strings passed to .watch() and .add() are treated as literal path names, even if they look like globs.
*/
disableGlobbing?: boolean;
export interface WatchedPaths {
[directory: string]: string[];
}
export interface FSWatcher {
export class FSWatcher extends EventEmitter implements fs.FSWatcher {
add(fileDirOrGlob: string): void;
add(filesDirsOrGlobs: Array<string>): void;
unwatch(fileDirOrGlob: string): void;
unwatch(filesDirsOrGlobs: Array<string>): void;
readonly options?: WatchOptions;
/**
* Listen for an FS event. Available events: add, addDir, change, unlink, unlinkDir, error. Additionally all is available which gets emitted for every non-error event.
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
*/
on(event: string, clb: (type: string, path: string) => void): void;
on(event: string, clb: (error: Error) => void): void;
constructor(options?: WatchOptions);
/**
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
* string.
*/
add(paths: string | string[]): void;
/**
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
* string.
*/
unwatch(paths: string | string[]): void;
/**
* 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 values are arrays of the names of the items contained in
* each directory.
*/
getWatched(): WatchedPaths;
/**
* Removes all listeners from watched files.
*/
close(): void;
options: IOptions;
on(event: 'add' | 'addDir' | 'change', listener: (path: string, stats?: fs.Stats) => void): this;
on(event: 'all', listener: (eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string, stats?: fs.Stats) => void): this;
/**
* Error occured
*/
on(event: 'error', listener: (error: Error) => void): this;
/**
* Exposes the native Node `fs.FSWatcher events`
*/
on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this;
/**
* Fires when the initial scan is complete
*/
on(event: 'ready', listener: () => void): this;
on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this;
on(event: string, listener: (...args: any[]) => void): this;
}
export interface WatchOptions {
/**
* Indicates whether the process should continue to run as long as files are being watched. If
* set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`,
* even if the process continues to run.
*/
persistent?: boolean;
/**
* ([anymatch](https://github.com/es128/anymatch)-compatible definition) Defines files/paths to
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
* with two arguments is provided, it gets called twice per path - once with a single argument
* (the path), second time with two arguments (the path and the
* [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
*/
ignored?: any;
/**
* If set to `false` then `add`/`addDir` events are also emitted for matching paths while
* instantiating the watching as chokidar discovers these file paths (before the `ready` event).
*/
ignoreInitial?: boolean;
/**
* When `false`, only the symlinks themselves will be watched for changes instead of following
* the link references and bubbling events through the link's path.
*/
followSymlinks?: boolean;
/**
* The base directory from which watch `paths` are to be derived. Paths emitted with events will
* be relative to this.
*/
cwd?: string;
/**
* If set to true then the strings passed to .watch() and .add() are treated as literal path
* names, even if they look like globs. Default: false.
*/
disableGlobbing?: boolean;
/**
* Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU
* utilization, consider setting this to `false`. It is typically necessary to **set this to
* `true` to successfully watch files over a network**, and it may be necessary to successfully
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
* the `useFsEvents` default.
*/
usePolling?: boolean;
/**
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on
* OS X, `usePolling: true` becomes the default.
*/
useFsEvents?: boolean;
/**
* If relying upon the [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object that
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
* provided even in cases where it wasn't already available from the underlying watch events.
*/
alwaysStat?: boolean;
/**
* If set, limits how many levels of subdirectories will be traversed.
*/
depth?: number;
/**
* Interval of file system polling.
*/
interval?: number;
/**
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
*/
binaryInterval?: number;
/**
* Indicates whether to watch files that don't have read permissions if possible. If watching
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
* silently.
*/
ignorePermissionErrors?: boolean;
/**
* `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts
* that occur when using editors that use "atomic writes" instead of writing directly to the
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
* you can override it by setting `atomic` to a custom value, in milliseconds.
*/
atomic?: boolean | number;
/**
* can be set to an object in order to adjust timing params:
*/
awaitWriteFinish?: AwaitWriteFinishOptions | boolean;
}
export interface AwaitWriteFinishOptions {
/**
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
*/
stabilityThreshold?: number;
/**
* File size polling interval.
*/
pollInterval?: number;
}
/**
* produces an instance of `FSWatcher`.
*/
export function watch(
paths: string | string[],
options?: WatchOptions
): FSWatcher;
}

View file

@ -109,7 +109,7 @@ export class ChokidarWatcherService implements IWatcherService {
this.log(`Use polling instead of fs.watch: Polling interval ${pollingInterval} ms`);
}
const watcherOpts: chokidar.IOptions = {
const watcherOpts: chokidar.WatchOptions = {
ignoreInitial: true,
ignorePermissionErrors: true,
followSymlinks: true, // this is the default of chokidar and supports file events through symlinks
@ -149,7 +149,7 @@ export class ChokidarWatcherService implements IWatcherService {
this._watcherCount++;
// Detect if for some reason the native watcher library fails to load
if (isMacintosh && !chokidarWatcher.options.useFsEvents) {
if (isMacintosh && chokidarWatcher.options && !chokidarWatcher.options.useFsEvents) {
this.warn('Watcher is not using native fsevents library and is falling back to unefficient polling.');
}
@ -293,15 +293,15 @@ export class ChokidarWatcherService implements IWatcherService {
}
private log(message: string) {
this._onLogMessage.fire({ type: 'trace', message: `[File Watcher (chockidar)] ` + message });
this._onLogMessage.fire({ type: 'trace', message: `[File Watcher (chokidar)] ` + message });
}
private warn(message: string) {
this._onLogMessage.fire({ type: 'warn', message: `[File Watcher (chockidar)] ` + message });
this._onLogMessage.fire({ type: 'warn', message: `[File Watcher (chokidar)] ` + message });
}
private error(message: string) {
this._onLogMessage.fire({ type: 'error', message: `[File Watcher (chockidar)] ` + message });
this._onLogMessage.fire({ type: 'error', message: `[File Watcher (chokidar)] ` + message });
}
}

View file

@ -55,7 +55,7 @@ async function assertFileEvents(actuals: IDiskFileChange[], expected: IDiskFileC
actuals.length = 0;
}
suite('Chockidar normalizeRoots', () => {
suite('Chokidar normalizeRoots', () => {
test('should not impacts roots that don\'t overlap', () => {
if (platform.isWindows) {
assertNormalizedRootPath(['C:\\a'], ['C:\\a']);
@ -116,9 +116,9 @@ suite('Chockidar normalizeRoots', () => {
});
});
suite.skip('Chockidar watching', () => {
suite.skip('Chokidar watching', () => {
const tmpdir = os.tmpdir();
const testDir = path.join(tmpdir, 'chockidartest-' + Date.now());
const testDir = path.join(tmpdir, 'chokidartest-' + Date.now());
const aFolder = path.join(testDir, 'a');
const bFolder = path.join(testDir, 'b');
const b2Folder = path.join(bFolder, 'b2');

File diff suppressed because it is too large Load diff

View file

@ -5628,7 +5628,7 @@ methods@~1.1.2:
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=
micromatch@^2.1.5, micromatch@^2.3.7:
micromatch@^2.3.7:
version "2.3.11"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=
@ -6110,18 +6110,18 @@ normalize-path@^1.0.0:
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379"
integrity sha1-MtDkcvkf80VwHBWoMRAY07CpA3k=
normalize-path@^2.0.0, normalize-path@^2.1.1:
normalize-path@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a"
integrity sha1-R4hqwWYnYNQmG32XnSQXCdPOP3o=
normalize-path@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9"
integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=
dependencies:
remove-trailing-separator "^1.0.1"
normalize-path@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a"
integrity sha1-R4hqwWYnYNQmG32XnSQXCdPOP3o=
normalize-path@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
@ -6729,6 +6729,11 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
picomatch@^2.0.4:
version "2.0.7"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.0.7.tgz#514169d8c7cd0bdbeecc8a2609e34a7163de69f6"
integrity sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA==
pify@^2.0.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
@ -9161,6 +9166,11 @@ upath@^1.0.5, upath@^1.1.0:
resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd"
integrity sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==
upath@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.2.tgz#3db658600edaeeccbe6db5e684d67ee8c2acd068"
integrity sha512-kXpym8nmDmlCBr7nKdIx8P2jNBa+pBpIUFRnKJ4dr8htyYGJFokkr2ZvERRtUN+9SY+JqXouNgUPtv6JQva/2Q==
uri-js@^4.2.1, uri-js@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
@ -9433,41 +9443,44 @@ vsce@1.48.0:
yauzl "^2.3.1"
yazl "^2.2.2"
vscode-anymatch@1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/vscode-anymatch/-/vscode-anymatch-1.3.3.tgz#0613d31a949c8025473bbdad848d219f47a44f86"
integrity sha512-LQ4vF4BWb9gwAvbMtN+3HC4HKDxLd+ZyWmAjACOdD05O/ZMcgvvnjO24GseEIQ6cWn8gW+Ft08gHFihnQy1eSw==
vscode-anymatch@3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/vscode-anymatch/-/vscode-anymatch-3.0.3.tgz#5a79101e6df7e659a1f070367bc42f190eb4ae76"
integrity sha512-qQgfbzJJ5nNShh4jjC3BBekY4d8emcxHFgnqcXwsB/PUKvJPCg7AZYXM7hqS7EDnKrX9tsIFwFMihZ7yut92Qg==
dependencies:
micromatch "^2.1.5"
normalize-path "^2.0.0"
normalize-path "^3.0.0"
picomatch "^2.0.4"
vscode-chokidar@1.6.5:
version "1.6.5"
resolved "https://registry.yarnpkg.com/vscode-chokidar/-/vscode-chokidar-1.6.5.tgz#f38a1f909fa364a5429a4d4d70ecb40a15b54d0b"
integrity sha512-bc5dNF8tW2R+oesYT/Au//qumyd/0HTwSRqVXcg8ADQW1MsWKFwv+IxfSIuCHckaEy4I81GpSDaRWVGQqtsELw==
vscode-chokidar@2.1.7:
version "2.1.7"
resolved "https://registry.yarnpkg.com/vscode-chokidar/-/vscode-chokidar-2.1.7.tgz#c5b31eb87402f4779bb4170915245bdcb6f7854b"
integrity sha512-uSNEQetPjAlgIAHmcF9E6M+KCw0f842rsEnJ64aamUAV6TO7gkXNCvLSzb4MuLsPU7ZQyCa++DrLQFjvciK5dg==
dependencies:
async-each "^1.0.0"
glob-parent "^2.0.0"
inherits "^2.0.1"
async-each "^1.0.1"
braces "^2.3.2"
glob-parent "^3.1.0"
inherits "^2.0.3"
is-binary-path "^1.0.0"
is-glob "^2.0.0"
is-glob "^4.0.0"
normalize-path "^3.0.0"
path-is-absolute "^1.0.0"
readdirp "^2.0.0"
vscode-anymatch "1.3.3"
readdirp "^2.2.1"
upath "^1.1.1"
vscode-anymatch "3.0.3"
optionalDependencies:
vscode-fsevents "0.3.10"
vscode-fsevents "1.2.12"
vscode-debugprotocol@1.35.0:
version "1.35.0"
resolved "https://registry.yarnpkg.com/vscode-debugprotocol/-/vscode-debugprotocol-1.35.0.tgz#565140cd42945e30c6c85cafb38c631457d4a46c"
integrity sha512-+OMm11R1bGYbpIJ5eQIkwoDGFF4GvBz3Ztl6/VM+/RNNb2Gjk2c0Ku+oMmfhlTmTlPCpgHBsH4JqVCbUYhu5bA==
vscode-fsevents@0.3.10:
version "0.3.10"
resolved "https://registry.yarnpkg.com/vscode-fsevents/-/vscode-fsevents-0.3.10.tgz#65a586c3c6df3080bea20482146963a0f3a2c58d"
integrity sha512-iNlCKNgEB9A2JZkLf4h4sJlOS1u0lbe4QjM0Dr0PHaTmsttkJEfOaQeci2Ja1wUA7hUUAF6sNbei/Qp2DacFLw==
vscode-fsevents@1.2.12:
version "1.2.12"
resolved "https://registry.yarnpkg.com/vscode-fsevents/-/vscode-fsevents-1.2.12.tgz#01a71a01f90ee95ca822c34427aba437a17c03a7"
integrity sha512-bH/jRdDpSesGpqiVLjp6gHLSKUOh7oNvppzZ17JIrdbRYCcDmV7dIWR5gQc27DFy0RD9JDT+t+ixMid94MkM1A==
dependencies:
nan "^2.10.0"
nan "^2.14.0"
vscode-nls-dev@3.2.5:
version "3.2.5"