Skip to content

Commit c79a1f6

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. This is however yet to be tested. 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 3e5ce53 commit c79a1f6

File tree

14 files changed

+120
-48
lines changed

14 files changed

+120
-48
lines changed

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
@@ -173,26 +173,6 @@ module.exports = {
173173
{
174174
test: /\\.plist$/,
175175
loader: "file-loader",
176-
},
177-
{
178-
test: /\\.js$/,
179-
// include only es6 dependencies to transpile them to es5 classes
180-
include: /vscode-ws-jsonrpc|vscode-jsonrpc|vscode-languageserver-protocol|vscode-languageserver-types/,
181-
use: {
182-
loader: 'babel-loader',
183-
options: {
184-
presets: ['@babel/preset-env'],
185-
plugins: [
186-
// reuse runtime babel lib instead of generating it in each js file
187-
'@babel/plugin-transform-runtime',
188-
// ensure that classes are transpiled
189-
'@babel/plugin-transform-classes'
190-
],
191-
// see https://github.com/babel/babel/issues/8900#issuecomment-431240426
192-
sourceType: 'unambiguous',
193-
cacheDirectory: true
194-
}
195-
}
196176
}
197177
]
198178
},

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
@@ -976,7 +976,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {
976976
decorations.push(node.decorationData);
977977
}
978978
if (this.decorations.has(node.id)) {
979-
decorations.push(...this.decorations.get(node.id));
979+
decorations.push(...this.decorations.get(node.id) || []);
980980
}
981981
return decorations.sort(TreeDecoration.Data.comparePriority);
982982
}

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
@@ -296,8 +296,9 @@ export class PluginContributionHandler {
296296
}
297297
}
298298

299-
if (contributions.colors) {
300-
pushContribution('colors', () => this.colors.register(...contributions.colors));
299+
const colors = contributions.colors;
300+
if (colors) {
301+
pushContribution('colors', () => this.colors.register(...colors));
301302
}
302303

303304
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)