Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: bump nsfw to ^2.1.2 #9267

Merged
merged 2 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -242,7 +242,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 @@ -16,6 +16,7 @@

import * as temp from 'temp';
import * as chai from 'chai';
import * as cp from 'child_process';
import * as fs from 'fs-extra';
import * as assert from 'assert';
import URI from '@theia/core/lib/common/uri';
Expand All @@ -36,7 +37,16 @@ describe('nsfw-filesystem-watcher', function (): void {
this.timeout(10000);

beforeEach(async () => {
root = FileUri.create(fs.realpathSync(temp.mkdirSync('node-fs-root')));
let tempPath = temp.mkdirSync('node-fs-root');
// Sometimes tempPath will use some Windows 8.3 short name in its path. This is a problem
// since NSFW always returns paths with long names. We need to convert here.
// See: https://stackoverflow.com/a/34473971/7983255
if (process.platform === 'win32') {
tempPath = cp.execSync(`powershell "(Get-Item -LiteralPath '${tempPath}').FullName"`, {
encoding: 'utf8',
}).trim();
}
root = FileUri.create(fs.realpathSync(tempPath));
watcherService = createNsfwFileSystemWatcherService();
watcherId = await watcherService.watchFileChanges(0, root.toString());
await sleep(2000);
Expand All @@ -48,9 +58,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 @@ -80,13 +87,10 @@ describe('nsfw-filesystem-watcher', function (): void {
expect(fs.readFileSync(FileUri.fsPath(root.resolve('foo').resolve('bar').resolve('baz.txt')), 'utf8')).to.be.equal('baz');
await sleep(2000);

assert.deepStrictEqual(expectedUris, [...actualUris]);
assert.deepStrictEqual([...actualUris], expectedUris);
});

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 All @@ -113,7 +117,7 @@ describe('nsfw-filesystem-watcher', function (): void {
expect(fs.readFileSync(FileUri.fsPath(root.resolve('foo').resolve('bar').resolve('baz.txt')), 'utf8')).to.be.equal('baz');
await sleep(2000);

assert.deepStrictEqual(0, actualUris.size);
assert.deepStrictEqual(actualUris.size, 0);
});

function createNsfwFileSystemWatcherService(): NsfwFileSystemWatcherService {
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
3 changes: 3 additions & 0 deletions packages/timeline/compile.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"references": [
{
"path": "../core/compile.tsconfig.json"
},
{
"path": "../navigator/compile.tsconfig.json"
}
]
}
3 changes: 2 additions & 1 deletion packages/timeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.12.0",
"description": "Theia - Timeline Extension",
"dependencies": {
"@theia/core": "1.12.0"
"@theia/core": "1.12.0",
"@theia/navigator": "1.12.0"
},
"publishConfig": {
"access": "public"
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