Skip to content

Commit dbb9ae3

Browse files
Transpile theia to es6
Transpiles theia to es6. To keep support of es5 based vscode extensions, the @es5ClassCompat tag was used. The tag was also applied to be used with theia es5 plugins. Contributed on behalf of STMicroelectronics Signed-off-by: Simon Graband <sgraband@eclipsesource.com> Co-authored-by: Paul Maréchal <paul.marechal@ericsson.com>
1 parent 9648953 commit dbb9ae3

File tree

14 files changed

+92
-45
lines changed

14 files changed

+92
-45
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- [core] added support for `resourceDirName` and `resourcePath` context keys [#9499](https://github.com/eclipse-theia/theia/pull/9499)
1616
- [core] added support for a unique id for non-command toolbar items [#9586](https://github.com/eclipse-theia/theia/pull/9586)
1717
- [core] fixed incorrectly wrapped disposable [#9376](https://github.com/eclipse-theia/theia/pull/9376)
18+
- [core] transpile theia to es6 [#9436](https://github.com/eclipse-theia/theia/pull/9436) - Contributed on behalf of STMicroelectronics
1819
- [debug] fixed handling when `supportSetVariable` is disabled [#9616](https://github.com/eclipse-theia/theia/pull/9616)
1920
- [editor-preview] refactored `editor-preview` resolving outstanding bugs [#9518](https://github.com/eclipse-theia/theia/pull/9518)
2021
- rewrote `editor-preview`-package classes as extensions of `editor`-package classes

configs/base.tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"resolveJsonModule": true,
1515
"module": "commonjs",
1616
"moduleResolution": "node",
17-
"target": "es5",
17+
"target": "es6",
1818
"jsx": "react",
1919
"lib": [
2020
"es6",

dev-packages/application-manager/src/generator/webpack-generator.ts

-20
Original file line numberDiff line numberDiff line change
@@ -195,26 +195,6 @@ module.exports = {
195195
{
196196
test: /\\.plist$/,
197197
type: 'asset/resource'
198-
},
199-
{
200-
test: /\\.js$/,
201-
// include only es6 dependencies to transpile them to es5 classes
202-
include: /vscode-ws-jsonrpc|vscode-jsonrpc|vscode-languageserver-protocol|vscode-languageserver-types/,
203-
use: {
204-
loader: 'babel-loader',
205-
options: {
206-
presets: ['@babel/preset-env'],
207-
plugins: [
208-
// reuse runtime babel lib instead of generating it in each js file
209-
'@babel/plugin-transform-runtime',
210-
// ensure that classes are transpiled
211-
'@babel/plugin-transform-classes'
212-
],
213-
// see https://github.com/babel/babel/issues/8900#issuecomment-431240426
214-
sourceType: 'unambiguous',
215-
cacheDirectory: true
216-
}
217-
}
218198
}
219199
]
220200
},

packages/core/src/browser/navigatable.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ export namespace NavigatableWidget {
4545
return arg instanceof BaseWidget && Navigatable.is(arg);
4646
}
4747
export function* getAffected<T extends Widget>(
48-
widgets: IterableIterator<T> | ArrayLike<T>,
48+
widgets: Iterable<T>,
4949
context: MaybeArray<URI>
5050
): IterableIterator<[URI, T & NavigatableWidget]> {
5151
const uris = Array.isArray(context) ? context : [context];
5252
return get(widgets, resourceUri => uris.some(uri => uri.isEqualOrParent(resourceUri)));
5353
}
5454
export function* get<T extends Widget>(
55-
widgets: IterableIterator<T> | ArrayLike<T>,
55+
widgets: Iterable<T>,
5656
filter: (resourceUri: URI) => boolean = () => true
5757
): IterableIterator<[URI, T & NavigatableWidget]> {
5858
for (const widget of widgets) {

packages/core/src/browser/saveable.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ export namespace SaveableWidget {
161161
export function is(widget: Widget | undefined): widget is SaveableWidget {
162162
return !!widget && 'closeWithoutSaving' in widget;
163163
}
164-
export function getDirty<T extends Widget>(widgets: IterableIterator<T> | ArrayLike<T>): IterableIterator<SaveableWidget & T> {
164+
export function getDirty<T extends Widget>(widgets: Iterable<T>): IterableIterator<SaveableWidget & T> {
165165
return get(widgets, Saveable.isDirty);
166166
}
167167
export function* get<T extends Widget>(
168-
widgets: IterableIterator<T> | ArrayLike<T>,
168+
widgets: Iterable<T>,
169169
filter: (widget: T) => boolean = () => true
170170
): IterableIterator<SaveableWidget & T> {
171171
for (const widget of widgets) {

packages/core/src/browser/tree/tree-widget.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {
989989
decorations.push(node.decorationData);
990990
}
991991
if (this.decorations.has(node.id)) {
992-
decorations.push(...this.decorations.get(node.id));
992+
decorations.push(...this.decorations.get(node.id) || []);
993993
}
994994
return decorations.sort(TreeDecoration.Data.comparePriority);
995995
}

packages/monaco/src/typings/monaco/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ declare module monaco.actions {
525525
* Retrieves all the registered menu items for the given menu.
526526
* @param menuId - see https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L67
527527
*/
528-
getMenuItems(menuId: 7 /* EditorContext */ | 8 /* EditorContextPeek */ | 25 /* MenubarSelectionMenu */): IMenuItem | ISubmenuItem[];
528+
getMenuItems(menuId: 7 /* EditorContext */ | 8 /* EditorContextPeek */ | 25 /* MenubarSelectionMenu */): Iterable<IMenuItem> | Iterable<ISubmenuItem>;
529529
}
530530

531531
// https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L51

packages/plugin-ext/src/main/browser/plugin-contribution-handler.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,9 @@ export class PluginContributionHandler {
299299
}
300300
}
301301

302-
if (contributions.colors) {
303-
pushContribution('colors', () => this.colors.register(...contributions.colors));
302+
const colors = contributions.colors;
303+
if (colors) {
304+
pushContribution('colors', () => this.colors.register(...colors));
304305
}
305306

306307
if (contributions.taskDefinitions) {

packages/plugin-ext/src/main/browser/view/tree-view-widget.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
281281
});
282282

283283
const children = this.getCaption(node);
284-
return React.createElement('div', attrs, ...children);
284+
return React.createElement('div', attrs, children);
285285
}
286286

287287
protected getCaption(node: TreeNode): React.ReactNode {

packages/plugin-ext/src/plugin/command-registry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class CommandRegistryImpl implements CommandRegistryExt {
102102
// Using the KnownCommand exclusions, convert the commands manually
103103
return KnownCommands.map(id, args, (mappedId: string, mappedArgs: any[] | undefined, mappedResult: KnownCommands.ConversionFunction) => {
104104
const mr: KnownCommands.ConversionFunction = mappedResult;
105-
return this.proxy.$executeCommand(mappedId, ...mappedArgs).then((result: any) => {
105+
return this.proxy.$executeCommand(mappedId, ...mappedArgs || []).then((result: any) => {
106106
if (!result) {
107107
return undefined;
108108
}

0 commit comments

Comments
 (0)