Skip to content

Commit

Permalink
core: bump nsfw to ^2.1.2
Browse files Browse the repository at this point in the history
Improvements have been made to the library. Notably a bug was fixed
where some folders were not picked up by the watchers if created too
quickly and an issue on Windows was fixed where watching didn't work at
all.

This commit updates our code to use the new typings distributed by
`nsfw` itself and re-enables file watching testing on Windows.

Signed-off-by: Paul Maréchal <[email protected]>
  • Loading branch information
paul-marechal committed Mar 26, 2021
1 parent faecec0 commit 9c746c8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 68 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/node/logger-cli-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class LogLevelCliContribution implements CliContribution {
}

protected watchLogConfigFile(filename: string): Promise<void> {
return nsfw(filename, async (events: nsfw.ChangeEvent[]) => {
return nsfw(filename, async (events: nsfw.FileChangeEvent[]) => {
try {
for (const event of events) {
switch (event.action) {
Expand Down
49 changes: 0 additions & 49 deletions packages/core/src/typings/nsfw/index.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/filesystem/compile.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"mv": [
"src/typings/mv"
],
"nsfw": [
"src/typings/nsfw"
],
"trash": [
"src/typings/trash"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
if (process.platform === 'win32') {
this.skip();
}
const actualUris = new Set<string>();

const watcherClient = {
Expand Down Expand Up @@ -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<void> {
if (process.platform === 'win32') {
this.skip();
}
const actualUris = new Set<string>();

const watcherClient = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!));
Expand Down
17 changes: 11 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9491,7 +9491,7 @@ [email protected]:
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==
Expand Down Expand Up @@ -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==

[email protected]:
version "0.1.8"
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.8.tgz#55fb8deb699070707fb67f91a460f0448294c77d"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 9c746c8

Please sign in to comment.