diff --git a/packages/core/package.json b/packages/core/package.json index 35daad23ed329..d99ca5b6b965b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -37,7 +37,7 @@ "jschardet": "^2.1.1", "lodash.debounce": "^4.0.8", "lodash.throttle": "^4.1.1", - "nsfw": "^1.2.9", + "nsfw": "^2.1.2", "p-debounce": "^2.1.0", "perfect-scrollbar": "^1.3.0", "react": "^16.8.0", diff --git a/packages/core/src/node/logger-cli-contribution.ts b/packages/core/src/node/logger-cli-contribution.ts index 098d9ced8ebf2..2a255984d1301 100644 --- a/packages/core/src/node/logger-cli-contribution.ts +++ b/packages/core/src/node/logger-cli-contribution.ts @@ -90,7 +90,7 @@ export class LogLevelCliContribution implements CliContribution { } protected watchLogConfigFile(filename: string): Promise { - return nsfw(filename, async (events: nsfw.ChangeEvent[]) => { + return nsfw(filename, async (events: nsfw.FileChangeEvent[]) => { try { for (const event of events) { switch (event.action) { diff --git a/packages/core/src/typings/nsfw/index.d.ts b/packages/core/src/typings/nsfw/index.d.ts deleted file mode 100644 index ea67f9db7a15a..0000000000000 --- a/packages/core/src/typings/nsfw/index.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************** - * Copyright (C) 2018 Ericsson and others. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the Eclipse - * Public License v. 2.0 are satisfied: GNU General Public License, version 2 - * with the GNU Classpath Exception which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - ********************************************************************************/ - -declare module 'nsfw' { - function nsfw(dir: string, eventHandler: (events: nsfw.ChangeEvent[]) => void, options?: nsfw.Options): Promise; - - namespace nsfw { - export interface NSFW { - start(): Promise; - stop(): Promise; - } - - export interface Options { - debounceMS?: number; - errorCallback?: (error: string) => void; - } - - export interface ChangeEvent { - action: number; - directory: string; - newDirectory?: string; - file?: string; - oldFile?: string; - newFile?: string; - } - - export enum actions { - CREATED, - DELETED, - MODIFIED, - RENAMED, - } - } - - export = nsfw; -} diff --git a/packages/filesystem/compile.tsconfig.json b/packages/filesystem/compile.tsconfig.json index 6bf6e997229f6..324e2d66da5ab 100644 --- a/packages/filesystem/compile.tsconfig.json +++ b/packages/filesystem/compile.tsconfig.json @@ -9,9 +9,6 @@ "mv": [ "src/typings/mv" ], - "nsfw": [ - "src/typings/nsfw" - ], "trash": [ "src/typings/trash" ] diff --git a/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-service.ts b/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-service.ts index 62fb47aa8199c..ab4f733b822e6 100644 --- a/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-service.ts +++ b/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-service.ts @@ -241,7 +241,7 @@ export class NsfwWatcher { }); } - protected handleNsfwEvents(events: nsfw.ChangeEvent[]): void { + protected handleNsfwEvents(events: nsfw.FileChangeEvent[]): void { // Only process events if someone is listening. if (this.isInUse()) { // This callback is async, but nsfw won't wait for it to finish before firing the next one. diff --git a/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.spec.ts b/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.spec.ts index b5eff6ac3e8b9..bda2cf995bc99 100644 --- a/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.spec.ts +++ b/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.spec.ts @@ -48,9 +48,6 @@ describe('nsfw-filesystem-watcher', function (): void { }); it('Should receive file changes events from in the workspace by default.', async function (): Promise { - if (process.platform === 'win32') { - this.skip(); - } const actualUris = new Set(); const watcherClient = { @@ -84,9 +81,6 @@ describe('nsfw-filesystem-watcher', function (): void { }); it('Should not receive file changes events from in the workspace by default if unwatched', async function (): Promise { - if (process.platform === 'win32') { - this.skip(); - } const actualUris = new Set(); const watcherClient = { diff --git a/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.ts b/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.ts index 703f32ba4a7fa..22ad1c8a20cfc 100644 --- a/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.ts +++ b/packages/filesystem/src/node/nsfw-watcher/nsfw-filesystem-watcher.ts @@ -117,7 +117,7 @@ export class NsfwFileSystemWatcherServer implements FileSystemWatcherServer { this.debug('Files ignored for watching', options.ignored); } - let watcher: nsfw.NSFW | undefined = await nsfw(fs.realpathSync(basePath), (events: nsfw.ChangeEvent[]) => { + let watcher: nsfw.NSFW | undefined = await nsfw(fs.realpathSync(basePath), (events: nsfw.FileChangeEvent[]) => { for (const event of events) { if (event.action === nsfw.actions.CREATED) { this.pushAdded(watcherId, this.resolvePath(event.directory, event.file!)); diff --git a/yarn.lock b/yarn.lock index 581a69323d86b..ebe0050251644 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9491,7 +9491,7 @@ mute-stream@0.0.8: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -nan@^2.0.0, nan@^2.12.1, nan@^2.14.0: +nan@^2.12.1, nan@^2.14.0: version "2.14.2" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== @@ -9576,6 +9576,11 @@ node-abi@^2.11.0, node-abi@^2.18.0, node-abi@^2.7.0: dependencies: semver "^5.4.1" +node-addon-api@*: + version "3.1.0" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.1.0.tgz#98b21931557466c6729e51cb77cd39c965f42239" + integrity sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw== + node-dir@0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.8.tgz#55fb8deb699070707fb67f91a460f0448294c77d" @@ -9809,12 +9814,12 @@ npmlog@^4.0.1, npmlog@^4.1.2: gauge "~2.7.3" set-blocking "~2.0.0" -nsfw@^1.2.9: - version "1.2.9" - resolved "https://registry.yarnpkg.com/nsfw/-/nsfw-1.2.9.tgz#e49ff5c12593cbcce3fcc90c533947eb4f15a99a" - integrity sha512-/2o89nygBRTTnGRxSHt2wjagbszyh36HlgF61Ec2iaJBTIIQ6QKcqp92EzVxxZX9U/6Qpy+LZL5i8532hXzAHg== +nsfw@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/nsfw/-/nsfw-2.1.2.tgz#4fa841e7f7122b60b2e1f61187d1b57ad3403428" + integrity sha512-zGPdt32aJ5b1laK9rvgXQmXGAagrx3VkcMt0JePtu6wBfzC1o4xLCM3kq7FxZxUnxyxYhODyBYzpt3H16FhaGA== dependencies: - nan "^2.0.0" + node-addon-api "*" nugget@^2.0.1: version "2.0.1"