@theia/userstorage 1.34.2 → 1.34.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,68 +1,68 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { inject, injectable } from '@theia/core/shared/inversify';
18
- import URI from '@theia/core/lib/common/uri';
19
- import { DisposableCollection } from '@theia/core/lib/common/disposable';
20
- import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
21
- import { FileSystemProvider } from '@theia/filesystem/lib/common/files';
22
- import { FileService, FileServiceContribution } from '@theia/filesystem/lib/browser/file-service';
23
- import { DelegatingFileSystemProvider } from '@theia/filesystem/lib/common/delegating-file-system-provider';
24
- import { UserStorageUri } from './user-storage-uri';
25
-
26
- @injectable()
27
- export class UserStorageContribution implements FileServiceContribution {
28
-
29
- @inject(EnvVariablesServer)
30
- protected readonly environments: EnvVariablesServer;
31
-
32
- registerFileSystemProviders(service: FileService): void {
33
- service.onWillActivateFileSystemProvider(event => {
34
- if (event.scheme === UserStorageUri.scheme) {
35
- event.waitUntil((async () => {
36
- const provider = await this.createProvider(service);
37
- service.registerProvider(UserStorageUri.scheme, provider);
38
- })());
39
- }
40
- });
41
- }
42
-
43
- protected async createProvider(service: FileService): Promise<FileSystemProvider> {
44
- const delegate = await service.activateProvider('file');
45
- const configDirUri = new URI(await this.environments.getConfigDirUri());
46
- return new DelegatingFileSystemProvider(delegate, {
47
- uriConverter: {
48
- to: resource => {
49
- const relativePath = UserStorageUri.relative(resource);
50
- if (relativePath) {
51
- return configDirUri.resolve(relativePath).normalizePath();
52
- }
53
- return undefined;
54
- },
55
- from: resource => {
56
- const relativePath = configDirUri.relative(resource);
57
- if (relativePath) {
58
- return UserStorageUri.resolve(relativePath);
59
- }
60
- return undefined;
61
- }
62
- }
63
- }, new DisposableCollection(
64
- delegate.watch(configDirUri, { excludes: [], recursive: true })
65
- ));
66
- }
67
-
68
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { inject, injectable } from '@theia/core/shared/inversify';
18
+ import URI from '@theia/core/lib/common/uri';
19
+ import { DisposableCollection } from '@theia/core/lib/common/disposable';
20
+ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
21
+ import { FileSystemProvider } from '@theia/filesystem/lib/common/files';
22
+ import { FileService, FileServiceContribution } from '@theia/filesystem/lib/browser/file-service';
23
+ import { DelegatingFileSystemProvider } from '@theia/filesystem/lib/common/delegating-file-system-provider';
24
+ import { UserStorageUri } from './user-storage-uri';
25
+
26
+ @injectable()
27
+ export class UserStorageContribution implements FileServiceContribution {
28
+
29
+ @inject(EnvVariablesServer)
30
+ protected readonly environments: EnvVariablesServer;
31
+
32
+ registerFileSystemProviders(service: FileService): void {
33
+ service.onWillActivateFileSystemProvider(event => {
34
+ if (event.scheme === UserStorageUri.scheme) {
35
+ event.waitUntil((async () => {
36
+ const provider = await this.createProvider(service);
37
+ service.registerProvider(UserStorageUri.scheme, provider);
38
+ })());
39
+ }
40
+ });
41
+ }
42
+
43
+ protected async createProvider(service: FileService): Promise<FileSystemProvider> {
44
+ const delegate = await service.activateProvider('file');
45
+ const configDirUri = new URI(await this.environments.getConfigDirUri());
46
+ return new DelegatingFileSystemProvider(delegate, {
47
+ uriConverter: {
48
+ to: resource => {
49
+ const relativePath = UserStorageUri.relative(resource);
50
+ if (relativePath) {
51
+ return configDirUri.resolve(relativePath).normalizePath();
52
+ }
53
+ return undefined;
54
+ },
55
+ from: resource => {
56
+ const relativePath = configDirUri.relative(resource);
57
+ if (relativePath) {
58
+ return UserStorageUri.resolve(relativePath);
59
+ }
60
+ return undefined;
61
+ }
62
+ }
63
+ }, new DisposableCollection(
64
+ delegate.watch(configDirUri, { excludes: [], recursive: true })
65
+ ));
66
+ }
67
+
68
+ }
@@ -1,24 +1,24 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { ContainerModule } from '@theia/core/shared/inversify';
18
- import { FileServiceContribution } from '@theia/filesystem/lib/browser/file-service';
19
- import { UserStorageContribution } from './user-storage-contribution';
20
-
21
- export default new ContainerModule(bind => {
22
- bind(UserStorageContribution).toSelf().inSingletonScope();
23
- bind(FileServiceContribution).toService(UserStorageContribution);
24
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ContainerModule } from '@theia/core/shared/inversify';
18
+ import { FileServiceContribution } from '@theia/filesystem/lib/browser/file-service';
19
+ import { UserStorageContribution } from './user-storage-contribution';
20
+
21
+ export default new ContainerModule(bind => {
22
+ bind(UserStorageContribution).toSelf().inSingletonScope();
23
+ bind(FileServiceContribution).toService(UserStorageContribution);
24
+ });
@@ -1,19 +1,19 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import URI from '@theia/core/lib/common/uri';
18
-
19
- export const UserStorageUri = new URI('user-storage:/user');
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import URI from '@theia/core/lib/common/uri';
18
+
19
+ export const UserStorageUri = new URI('user-storage:/user');
@@ -1,29 +1,29 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- /* note: this bogus test file is required so that
18
- we are able to run mocha unit tests on this
19
- package, without having any actual unit tests in it.
20
- This way a coverage report will be generated,
21
- showing 0% coverage, instead of no report.
22
- This file can be removed once we have real unit
23
- tests in place. */
24
-
25
- describe('userstorage package', () => {
26
-
27
- it('support code coverage statistics', () => true);
28
-
29
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /* note: this bogus test file is required so that
18
+ we are able to run mocha unit tests on this
19
+ package, without having any actual unit tests in it.
20
+ This way a coverage report will be generated,
21
+ showing 0% coverage, instead of no report.
22
+ This file can be removed once we have real unit
23
+ tests in place. */
24
+
25
+ describe('userstorage package', () => {
26
+
27
+ it('support code coverage statistics', () => true);
28
+
29
+ });