@theia/application-package 1.48.0 → 1.48.1
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.
- package/README.md +25 -25
- package/lib/api.d.ts +5 -5
- package/lib/api.js +23 -23
- package/lib/application-package.d.ts +88 -88
- package/lib/application-package.js +262 -262
- package/lib/application-package.spec.d.ts +1 -1
- package/lib/application-package.spec.js +57 -57
- package/lib/application-props.d.ts +172 -172
- package/lib/application-props.js +102 -102
- package/lib/environment.d.ts +39 -39
- package/lib/environment.js +73 -73
- package/lib/extension-package-collector.d.ts +15 -15
- package/lib/extension-package-collector.js +76 -76
- package/lib/extension-package.d.ts +65 -65
- package/lib/extension-package.js +176 -176
- package/lib/index.d.ts +6 -6
- package/lib/index.js +24 -24
- package/lib/json-file.d.ts +3 -3
- package/lib/json-file.js +26 -26
- package/lib/npm-registry.d.ts +73 -73
- package/lib/npm-registry.js +101 -101
- package/package.json +4 -4
- package/src/api.ts +21 -21
- package/src/application-package.spec.ts +62 -62
- package/src/application-package.ts +334 -334
- package/src/application-props.ts +264 -264
- package/src/environment.ts +76 -76
- package/src/extension-package-collector.ts +83 -83
- package/src/extension-package.ts +223 -223
- package/src/index.ts +22 -22
- package/src/json-file.ts +25 -25
- package/src/npm-registry.ts +161 -161
package/src/extension-package.ts
CHANGED
|
@@ -1,223 +1,223 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 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-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import * as fs from 'fs-extra';
|
|
18
|
-
import * as paths from 'path';
|
|
19
|
-
import * as semver from 'semver';
|
|
20
|
-
import { NpmRegistry, PublishedNodePackage, NodePackage } from './npm-registry';
|
|
21
|
-
|
|
22
|
-
export interface Extension {
|
|
23
|
-
frontendPreload?: string;
|
|
24
|
-
frontendOnlyPreload?: string;
|
|
25
|
-
frontend?: string;
|
|
26
|
-
frontendOnly?: string;
|
|
27
|
-
frontendElectron?: string;
|
|
28
|
-
secondaryWindow?: string;
|
|
29
|
-
backend?: string;
|
|
30
|
-
backendElectron?: string;
|
|
31
|
-
electronMain?: string;
|
|
32
|
-
preload?: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ExtensionPackageOptions {
|
|
36
|
-
/**
|
|
37
|
-
* Alias to use in place of the original package's name.
|
|
38
|
-
*/
|
|
39
|
-
alias?: string
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export class ExtensionPackage {
|
|
43
|
-
|
|
44
|
-
protected _name: string;
|
|
45
|
-
|
|
46
|
-
constructor(
|
|
47
|
-
readonly raw: PublishedNodePackage & Partial<RawExtensionPackage>,
|
|
48
|
-
protected readonly registry: NpmRegistry,
|
|
49
|
-
options: ExtensionPackageOptions = {}
|
|
50
|
-
) {
|
|
51
|
-
this._name = options.alias ?? raw.name;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The name of the extension's package as defined in "dependencies" (might be aliased)
|
|
56
|
-
*/
|
|
57
|
-
get name(): string {
|
|
58
|
-
return this._name;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get version(): string {
|
|
62
|
-
if (this.raw.installed) {
|
|
63
|
-
return this.raw.installed.version;
|
|
64
|
-
}
|
|
65
|
-
if (this.raw.view) {
|
|
66
|
-
const latestVersion = this.raw.view.latestVersion;
|
|
67
|
-
if (latestVersion) {
|
|
68
|
-
return latestVersion;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return this.raw.version;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
get description(): string {
|
|
75
|
-
return this.raw.description || '';
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
get theiaExtensions(): Extension[] {
|
|
79
|
-
return this.raw.theiaExtensions || [];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
get installed(): boolean {
|
|
83
|
-
return !!this.raw.installed;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get dependent(): string | undefined {
|
|
87
|
-
if (!this.transitive) {
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
90
|
-
let current = this.parent!;
|
|
91
|
-
let parent = current.parent;
|
|
92
|
-
while (parent !== undefined) {
|
|
93
|
-
current = parent;
|
|
94
|
-
parent = current.parent;
|
|
95
|
-
}
|
|
96
|
-
return current.name;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
get transitive(): boolean {
|
|
100
|
-
return !!this.raw.installed && this.raw.installed.transitive;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
get parent(): ExtensionPackage | undefined {
|
|
104
|
-
if (this.raw.installed) {
|
|
105
|
-
return this.raw.installed.parent;
|
|
106
|
-
}
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
protected async view(): Promise<RawExtensionPackage.ViewState> {
|
|
111
|
-
if (this.raw.view === undefined) {
|
|
112
|
-
const raw = await RawExtensionPackage.view(this.registry, this.name, this.version);
|
|
113
|
-
this.raw.view = raw ? raw.view : new RawExtensionPackage.ViewState(this.registry);
|
|
114
|
-
}
|
|
115
|
-
return this.raw.view!;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
protected readme?: string;
|
|
119
|
-
async getReadme(): Promise<string> {
|
|
120
|
-
if (this.readme === undefined) {
|
|
121
|
-
this.readme = await this.resolveReadme();
|
|
122
|
-
}
|
|
123
|
-
return this.readme;
|
|
124
|
-
}
|
|
125
|
-
protected async resolveReadme(): Promise<string> {
|
|
126
|
-
const raw = await this.view();
|
|
127
|
-
if (raw && raw.readme) {
|
|
128
|
-
return raw.readme;
|
|
129
|
-
}
|
|
130
|
-
if (this.raw.installed) {
|
|
131
|
-
const readmePath = paths.resolve(this.raw.installed.packagePath, '..', 'README.md');
|
|
132
|
-
if (await fs.pathExists(readmePath)) {
|
|
133
|
-
return fs.readFile(readmePath, { encoding: 'utf8' });
|
|
134
|
-
}
|
|
135
|
-
return '';
|
|
136
|
-
}
|
|
137
|
-
return '';
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
getAuthor(): string {
|
|
141
|
-
if (this.raw.publisher) {
|
|
142
|
-
return this.raw.publisher.username;
|
|
143
|
-
}
|
|
144
|
-
if (typeof this.raw.author === 'string') {
|
|
145
|
-
return this.raw.author;
|
|
146
|
-
}
|
|
147
|
-
if (this.raw.author && this.raw.author.name) {
|
|
148
|
-
return this.raw.author.name;
|
|
149
|
-
}
|
|
150
|
-
if (!!this.raw.maintainers && this.raw.maintainers.length > 0) {
|
|
151
|
-
return this.raw.maintainers[0].username;
|
|
152
|
-
}
|
|
153
|
-
return '';
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface RawExtensionPackage extends PublishedNodePackage {
|
|
159
|
-
installed?: RawExtensionPackage.InstalledState
|
|
160
|
-
view?: RawExtensionPackage.ViewState
|
|
161
|
-
theiaExtensions: Extension[];
|
|
162
|
-
}
|
|
163
|
-
export namespace RawExtensionPackage {
|
|
164
|
-
export interface InstalledState {
|
|
165
|
-
version: string;
|
|
166
|
-
packagePath: string;
|
|
167
|
-
transitive: boolean;
|
|
168
|
-
parent?: ExtensionPackage;
|
|
169
|
-
}
|
|
170
|
-
export class ViewState {
|
|
171
|
-
readme?: string;
|
|
172
|
-
tags?: {
|
|
173
|
-
[tag: string]: string
|
|
174
|
-
};
|
|
175
|
-
constructor(
|
|
176
|
-
protected readonly registry: NpmRegistry
|
|
177
|
-
) { }
|
|
178
|
-
get latestVersion(): string | undefined {
|
|
179
|
-
if (this.tags) {
|
|
180
|
-
if (this.registry.props.next) {
|
|
181
|
-
const next = this.tags['next'];
|
|
182
|
-
if (next !== undefined) {
|
|
183
|
-
return next;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
const latest = this.tags['latest'];
|
|
187
|
-
if (this.registry.props.next || !semver.prerelease(latest)) {
|
|
188
|
-
return latest;
|
|
189
|
-
}
|
|
190
|
-
return undefined;
|
|
191
|
-
}
|
|
192
|
-
return undefined;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
export function is(pck: NodePackage | undefined): pck is RawExtensionPackage {
|
|
196
|
-
return PublishedNodePackage.is(pck) && !!pck.theiaExtensions;
|
|
197
|
-
}
|
|
198
|
-
export async function view(registry: NpmRegistry, name: string, version?: string): Promise<RawExtensionPackage | undefined> {
|
|
199
|
-
const result = await registry.view(name).catch(() => undefined);
|
|
200
|
-
if (!result) {
|
|
201
|
-
return undefined;
|
|
202
|
-
}
|
|
203
|
-
const tags = result['dist-tags'];
|
|
204
|
-
const versions = [tags['latest']];
|
|
205
|
-
if (registry.props.next) {
|
|
206
|
-
versions.push(tags['next']);
|
|
207
|
-
}
|
|
208
|
-
if (version) {
|
|
209
|
-
versions.push(tags[version], version);
|
|
210
|
-
}
|
|
211
|
-
for (const current of versions.reverse()) {
|
|
212
|
-
const raw = result.versions[current];
|
|
213
|
-
if (is(raw)) {
|
|
214
|
-
const viewState = new ViewState(registry);
|
|
215
|
-
viewState.readme = result.readme;
|
|
216
|
-
viewState.tags = tags;
|
|
217
|
-
raw.view = viewState;
|
|
218
|
-
return raw;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
return undefined;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import * as fs from 'fs-extra';
|
|
18
|
+
import * as paths from 'path';
|
|
19
|
+
import * as semver from 'semver';
|
|
20
|
+
import { NpmRegistry, PublishedNodePackage, NodePackage } from './npm-registry';
|
|
21
|
+
|
|
22
|
+
export interface Extension {
|
|
23
|
+
frontendPreload?: string;
|
|
24
|
+
frontendOnlyPreload?: string;
|
|
25
|
+
frontend?: string;
|
|
26
|
+
frontendOnly?: string;
|
|
27
|
+
frontendElectron?: string;
|
|
28
|
+
secondaryWindow?: string;
|
|
29
|
+
backend?: string;
|
|
30
|
+
backendElectron?: string;
|
|
31
|
+
electronMain?: string;
|
|
32
|
+
preload?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ExtensionPackageOptions {
|
|
36
|
+
/**
|
|
37
|
+
* Alias to use in place of the original package's name.
|
|
38
|
+
*/
|
|
39
|
+
alias?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class ExtensionPackage {
|
|
43
|
+
|
|
44
|
+
protected _name: string;
|
|
45
|
+
|
|
46
|
+
constructor(
|
|
47
|
+
readonly raw: PublishedNodePackage & Partial<RawExtensionPackage>,
|
|
48
|
+
protected readonly registry: NpmRegistry,
|
|
49
|
+
options: ExtensionPackageOptions = {}
|
|
50
|
+
) {
|
|
51
|
+
this._name = options.alias ?? raw.name;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The name of the extension's package as defined in "dependencies" (might be aliased)
|
|
56
|
+
*/
|
|
57
|
+
get name(): string {
|
|
58
|
+
return this._name;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get version(): string {
|
|
62
|
+
if (this.raw.installed) {
|
|
63
|
+
return this.raw.installed.version;
|
|
64
|
+
}
|
|
65
|
+
if (this.raw.view) {
|
|
66
|
+
const latestVersion = this.raw.view.latestVersion;
|
|
67
|
+
if (latestVersion) {
|
|
68
|
+
return latestVersion;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return this.raw.version;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
get description(): string {
|
|
75
|
+
return this.raw.description || '';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
get theiaExtensions(): Extension[] {
|
|
79
|
+
return this.raw.theiaExtensions || [];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
get installed(): boolean {
|
|
83
|
+
return !!this.raw.installed;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get dependent(): string | undefined {
|
|
87
|
+
if (!this.transitive) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
let current = this.parent!;
|
|
91
|
+
let parent = current.parent;
|
|
92
|
+
while (parent !== undefined) {
|
|
93
|
+
current = parent;
|
|
94
|
+
parent = current.parent;
|
|
95
|
+
}
|
|
96
|
+
return current.name;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
get transitive(): boolean {
|
|
100
|
+
return !!this.raw.installed && this.raw.installed.transitive;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
get parent(): ExtensionPackage | undefined {
|
|
104
|
+
if (this.raw.installed) {
|
|
105
|
+
return this.raw.installed.parent;
|
|
106
|
+
}
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
protected async view(): Promise<RawExtensionPackage.ViewState> {
|
|
111
|
+
if (this.raw.view === undefined) {
|
|
112
|
+
const raw = await RawExtensionPackage.view(this.registry, this.name, this.version);
|
|
113
|
+
this.raw.view = raw ? raw.view : new RawExtensionPackage.ViewState(this.registry);
|
|
114
|
+
}
|
|
115
|
+
return this.raw.view!;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
protected readme?: string;
|
|
119
|
+
async getReadme(): Promise<string> {
|
|
120
|
+
if (this.readme === undefined) {
|
|
121
|
+
this.readme = await this.resolveReadme();
|
|
122
|
+
}
|
|
123
|
+
return this.readme;
|
|
124
|
+
}
|
|
125
|
+
protected async resolveReadme(): Promise<string> {
|
|
126
|
+
const raw = await this.view();
|
|
127
|
+
if (raw && raw.readme) {
|
|
128
|
+
return raw.readme;
|
|
129
|
+
}
|
|
130
|
+
if (this.raw.installed) {
|
|
131
|
+
const readmePath = paths.resolve(this.raw.installed.packagePath, '..', 'README.md');
|
|
132
|
+
if (await fs.pathExists(readmePath)) {
|
|
133
|
+
return fs.readFile(readmePath, { encoding: 'utf8' });
|
|
134
|
+
}
|
|
135
|
+
return '';
|
|
136
|
+
}
|
|
137
|
+
return '';
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
getAuthor(): string {
|
|
141
|
+
if (this.raw.publisher) {
|
|
142
|
+
return this.raw.publisher.username;
|
|
143
|
+
}
|
|
144
|
+
if (typeof this.raw.author === 'string') {
|
|
145
|
+
return this.raw.author;
|
|
146
|
+
}
|
|
147
|
+
if (this.raw.author && this.raw.author.name) {
|
|
148
|
+
return this.raw.author.name;
|
|
149
|
+
}
|
|
150
|
+
if (!!this.raw.maintainers && this.raw.maintainers.length > 0) {
|
|
151
|
+
return this.raw.maintainers[0].username;
|
|
152
|
+
}
|
|
153
|
+
return '';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface RawExtensionPackage extends PublishedNodePackage {
|
|
159
|
+
installed?: RawExtensionPackage.InstalledState
|
|
160
|
+
view?: RawExtensionPackage.ViewState
|
|
161
|
+
theiaExtensions: Extension[];
|
|
162
|
+
}
|
|
163
|
+
export namespace RawExtensionPackage {
|
|
164
|
+
export interface InstalledState {
|
|
165
|
+
version: string;
|
|
166
|
+
packagePath: string;
|
|
167
|
+
transitive: boolean;
|
|
168
|
+
parent?: ExtensionPackage;
|
|
169
|
+
}
|
|
170
|
+
export class ViewState {
|
|
171
|
+
readme?: string;
|
|
172
|
+
tags?: {
|
|
173
|
+
[tag: string]: string
|
|
174
|
+
};
|
|
175
|
+
constructor(
|
|
176
|
+
protected readonly registry: NpmRegistry
|
|
177
|
+
) { }
|
|
178
|
+
get latestVersion(): string | undefined {
|
|
179
|
+
if (this.tags) {
|
|
180
|
+
if (this.registry.props.next) {
|
|
181
|
+
const next = this.tags['next'];
|
|
182
|
+
if (next !== undefined) {
|
|
183
|
+
return next;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const latest = this.tags['latest'];
|
|
187
|
+
if (this.registry.props.next || !semver.prerelease(latest)) {
|
|
188
|
+
return latest;
|
|
189
|
+
}
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
export function is(pck: NodePackage | undefined): pck is RawExtensionPackage {
|
|
196
|
+
return PublishedNodePackage.is(pck) && !!pck.theiaExtensions;
|
|
197
|
+
}
|
|
198
|
+
export async function view(registry: NpmRegistry, name: string, version?: string): Promise<RawExtensionPackage | undefined> {
|
|
199
|
+
const result = await registry.view(name).catch(() => undefined);
|
|
200
|
+
if (!result) {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
const tags = result['dist-tags'];
|
|
204
|
+
const versions = [tags['latest']];
|
|
205
|
+
if (registry.props.next) {
|
|
206
|
+
versions.push(tags['next']);
|
|
207
|
+
}
|
|
208
|
+
if (version) {
|
|
209
|
+
versions.push(tags[version], version);
|
|
210
|
+
}
|
|
211
|
+
for (const current of versions.reverse()) {
|
|
212
|
+
const raw = result.versions[current];
|
|
213
|
+
if (is(raw)) {
|
|
214
|
+
const viewState = new ViewState(registry);
|
|
215
|
+
viewState.readme = result.readme;
|
|
216
|
+
viewState.tags = tags;
|
|
217
|
+
raw.view = viewState;
|
|
218
|
+
return raw;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 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-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
export * from './npm-registry';
|
|
18
|
-
export * from './extension-package';
|
|
19
|
-
export * from './application-package';
|
|
20
|
-
export * from './application-props';
|
|
21
|
-
export * from './environment';
|
|
22
|
-
export * from './api';
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export * from './npm-registry';
|
|
18
|
+
export * from './extension-package';
|
|
19
|
+
export * from './application-package';
|
|
20
|
+
export * from './application-props';
|
|
21
|
+
export * from './environment';
|
|
22
|
+
export * from './api';
|
package/src/json-file.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 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-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import * as fs from 'fs';
|
|
18
|
-
import writeJsonFile = require('write-json-file');
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
function readJsonFile(path: string): any {
|
|
22
|
-
return JSON.parse(fs.readFileSync(path, { encoding: 'utf-8' }));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { writeJsonFile, readJsonFile };
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import * as fs from 'fs';
|
|
18
|
+
import writeJsonFile = require('write-json-file');
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
function readJsonFile(path: string): any {
|
|
22
|
+
return JSON.parse(fs.readFileSync(path, { encoding: 'utf-8' }));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { writeJsonFile, readJsonFile };
|