8000 chore(deps): update to `theia@1.41.0` by kittaakos · Pull Request #2211 · arduino/arduino-ide · GitHub
[go: up one dir, main page]

Skip to content

chore(deps): update to theia@1.41.0 #2211

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

Merged
merged 5 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
chore(deps): update to theia@1.41.0
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta committed Sep 29, 2023
commit 92a1352d132deaded2326eab62c04f8e2ddd354f
40 changes: 20 additions & 20 deletions arduino-ide-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@
},
"dependencies": {
"@grpc/grpc-js": "^1.8.14",
"@theia/application-package": "1.39.0",
"@theia/core": "1.39.0",
"@theia/debug": "1.39.0",
"@theia/editor": "1.39.0",
"@theia/electron": "1.39.0",
"@theia/filesystem": "1.39.0",
"@theia/keymaps": "1.39.0",
"@theia/markers": "1.39.0",
"@theia/messages": "1.39.0",
"@theia/monaco": "1.39.0",
"@theia/application-package": "1.41.0",
"@theia/core": "1.41.0",
"@theia/debug": "1.41.0",
"@theia/editor": "1.41.0",
"@theia/electron": "1.41.0",
"@theia/filesystem": "1.41.0",
"@theia/keymaps": "1.41.0",
"@theia/markers": "1.41.0",
"@theia/messages": "1.41.0",
"@theia/monaco": "1.41.0",
"@theia/monaco-editor-core": "1.72.3",
"@theia/navigator": "1.39.0",
"@theia/outline-view": "1.39.0",
"@theia/output": "1.39.0",
"@theia/plugin-ext": "1.39.0",
"@theia/preferences": "1.39.0",
"@theia/scm": "1.39.0",
"@theia/search-in-workspace": "1.39.0",
"@theia/terminal": "1.39.0",
"@theia/typehierarchy": "1.39.0",
"@theia/workspace": "1.39.0",
"@theia/navigator": "1.41.0",
"@theia/outline-view": "1.41.0",
"@theia/output": "1.41.0",
"@theia/plugin-ext": "1.41.0",
"@theia/preferences": "1.41.0",
"@theia/scm": "1.41.0",
"@theia/search-in-workspace": "1.41.0",
"@theia/terminal": "1.41.0",
"@theia/typehierarchy": "1.41.0",
"@theia/workspace": "1.41.0",
"@tippyjs/react": "^4.2.5",
"@types/auth0-js": "^9.14.0",
"@types/btoa": "^1.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function createServer(
}

export async function startServer(server: http.Server): Promise<string> {
let portTimer: NodeJS.Timer;
let portTimer: NodeJS.Timeout;

function cancelPortTimer() {
clearTimeout(portTimer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import { HostedPluginReader as TheiaHostedPluginReader } from '@theia/plugin-ext

@injectable()
export class HostedPluginReader extends TheiaHostedPluginReader {
override readContribution(
override async readContribution(
plugin: PluginPackage
): PluginContribution | undefined {
): Promise<PluginContribution | undefined> {
const scanner = this.scanner.getScanner(plugin);
const contributions = scanner.getContribution(plugin);
const contributions = await scanner.getContribution(plugin);
return this.filterContribution(plugin.name, contributions);
}

private filterContribution(
pluginName: string,
contributions: PluginContribution | undefined
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { promises as fs, constants } from 'node:fs';
import { injectable, inject } from '@theia/core/shared/inversify';
import { FileUri } from '@theia/core/lib/node';
import { inject, injectable } from '@theia/core/shared/inversify';
import { DefaultWorkspaceServer as TheiaDefaultWorkspaceServer } from '@theia/workspace/lib/node/default-workspace-server';
import { SketchesService } from '../../../common/protocol';
import { FileUri } from '@theia/core/lib/node';
import { IsTempSketch } from '../../is-temp-sketch';

@injectable()
Expand All @@ -21,26 +20,6 @@ export class DefaultWorkspaceServer extends TheiaDefaultWorkspaceServer {
return uri;
}

/**
* This is the async re-implementation of the default Theia behavior.
*/
override async getRecentWorkspaces(): Promise<string[]> {
const listUri: string[] = [];
const data = await this.readRecentWorkspacePathsFromUserHome();
if (data && data.recentRoots) {
await Promise.all(
data.recentRoots
.filter((element) => Boolean(element))
.map(async (element) => {
if (await this.exists(element)) {
listUri.push(element);
}
})
);
}
return listUri;
}

protected override async writeToUserHome(
data: RecentWorkspacePathsData
): Promise<void> {
Expand Down Expand Up @@ -69,15 +48,6 @@ export class DefaultWorkspaceServer extends TheiaDefaultWorkspaceServer {
recentRoots,
};
}

private async exists(uri: string): Promise<boolean> {
try {
await fs.access(FileUri.fsPath(uri), constants.R_OK | constants.W_OK);
return true;
} catch {
return false;
}
}
}

// Remove after https://github.com/eclipse-theia/theia/pull/11603
Expand Down
30 changes: 15 additions & 15 deletions electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
"license": "AGPL-3.0-or-later",
"main": "./src-gen/backend/electron-main.js",
"dependencies": {
"@theia/core": "1.39.0",
"@theia/debug": "1.39.0",
"@theia/editor": "1.39.0",
"@theia/electron": "1.39.0",
"@theia/filesystem": "1.39.0",
"@theia/keymaps": "1.39.0",
"@theia/messages": "1.39.0",
"@theia/monaco": "1.39.0",
"@theia/navigator": "1.39.0",
"@theia/plugin-ext": "1.39.0",
"@theia/plugin-ext-vscode": "1.39.0",
"@theia/preferences": "1.39.0",
"@theia/terminal": "1.39.0",
"@theia/workspace": "1.39.0",
"@theia/core": "1.41.0",
"@theia/debug": "1.41.0",
"@theia/editor": "1.41.0",
"@theia/electron": "1.41.0",
"@theia/filesystem": "1.41.0",
"@theia/keymaps": "1.41.0",
"@theia/messages": "1.41.0",
"@theia/monaco": "1.41.0",
"@theia/navigator": "1.41.0",
"@theia/plugin-ext": "1.41.0",
"@theia/plugin-ext-vscode": "1.41.0",
"@theia/preferences": "1.41.0",
"@theia/terminal": "1.41.0",
"@theia/workspace": "1.41.0",
"arduino-ide-extension": "2.2.2"
},
"devDependencies": {
"@theia/cli": "1.39.0",
"@theia/cli": "1.41.0",
"7zip-min": "^1.4.4",
"chmodr": "^1.2.0",
"compression-webpack-plugin": "^9.0.0",
Expand Down
56 changes: 9 additions & 47 deletions electron-app/webpack.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
const chmodr = require('chmodr');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('node:path');
const fs = require('node:fs/promises');

const isWindows = process.platform === 'win32';
const isMacOS = process.platform === 'darwin';

/**
* @param {string} target the name of the `npm` package to resolve.
*/
function resolvePackagePath(target, baseDir = __dirname) {
const resolvePackageJsonPath = require('resolve-package-path');
const packageJsonPath = resolvePackageJsonPath(target, baseDir);
Expand All @@ -23,9 +22,11 @@ function resolvePackagePath(target, baseDir = __dirname) {
// restore file permissions after webpack copy
// https://github.com/webpack-contrib/copy-webpack-plugin/issues/35#issuecomment-1407280257
class PermissionsPlugin {
constructor(targetPath, patchTheia12780 = false) {
/**
* @param {string} targetPath
*/
constructor(targetPath) {
this.targetPath = targetPath;
this.patchTheia12780 = patchTheia12780;
}

/**
Expand All @@ -34,20 +35,6 @@ class PermissionsPlugin {
apply(compiler) {
compiler.hooks.afterEmit.tap('PermissionsPlugin', () => {
return new Promise(async (resolve, reject) => {
if (this.patchTheia12780) {
let trashBinaryFilename = undefined;
if (isWindows) {
trashBinaryFilename = 'windows-trash.exe';
} else if (isMacOS) {
trashBinaryFilename = 'macos-trash';
}
if (trashBinaryFilename) {
await fs.chmod(
path.join(__dirname, 'lib', 'backend', trashBinaryFilename),
0o755
);
}
}
chmodr(this.targetPath, 0o755, (err) =>
err ? reject(err) : resolve(undefined)
);
Expand All @@ -59,18 +46,9 @@ class PermissionsPlugin {
/**
* Creates webpack plugins to copy all required resources (binaries, plotter app, translation files, etc.) to the appropriate location.
* @param {string} targetPath where to copy the resources
* @param {boolean|undefined} [patchTheia12780=true] to apply patch for https://github.com/eclipse-theia/theia/issues/12780. Only required in the production app.
* @param {string|undefined} [baseDir=__dirname] to calculate the modules from. Defaults to `__dirname`
*/
function createCopyArduinoResourcesPlugins(
targetPath,
patchTheia12780 = false,
baseDir = __dirname
) {
const trashBinariesPath = path.join(
resolvePackagePath('trash', baseDir),
'lib'
);
function createCopyArduinoResourcesPlugins(targetPath, baseDir = __dirname) {
const copyOptions = {
patterns: [
// binaries
Expand All @@ -96,25 +74,9 @@ function createCopyArduinoResourcesPlugins(
},
],
};

if (patchTheia12780) {
// workaround for https://github.com/eclipse-theia/theia/issues/12780
// copy the Windows (`windows-trash.exe`) and macOS (`macos-trash`) executables for `trash`
if (isWindows) {
copyOptions.patterns.push({
from: path.join(trashBinariesPath, 'windows-trash.exe'),
to: path.resolve(__dirname, 'lib', 'backend'),
});
} else if (isMacOS) {
copyOptions.patterns.push({
from: path.join(trashBinariesPath, 'macos-trash'),
to: path.resolve(__dirname, 'lib', 'backend'),
});
}
}
return [
new CopyWebpackPlugin(copyOptions),
new PermissionsPlugin(targetPath, patchTheia12780),
new PermissionsPlugin(targetPath),
];
}

Expand Down
11 changes: 1 addition & 10 deletions electron-app/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,11 @@ mainWindowConfig.plugins?.push(
);
const preloadConfig = frontend[2];

// Taken from https://github.com/eclipse-theia/theia-blueprint/blob/022878d5488c47650fb17b5fdf49a28be88465fe/applications/electron/webpack.config.js#L18-L21
if (process.platform !== 'win32') {
// For some reason, blueprint wants to bundle the `.node` files directly without going through `@vscode/windows-ca-certs`
backend.ignoredResources.add(
'@vscode/windows-ca-certs/build/Release/crypt32.node'
);
}

// Copy all the IDE2 binaries and the plotter web app.
// XXX: For whatever reason it is important to use `unshift` instead of `push`, and execute the additional webpack plugins before the Theia contributed ones kick in. Otherwise ours do not work.
backend.config.plugins.unshift(
...createCopyArduinoResourcesPlugins(
path.resolve(__dirname, 'lib', 'backend', 'resources'),
true
path.resolve(__dirname, 'lib', 'backend', 'resources')
)
);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"node": ">=18.17.0 <21"
},
"devDependencies": {
"@theia/cli": "1.39.0",
"@theia/cli": "1.41.0",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"@xhmikosr/downloader": "^13.0.1",
Expand Down
Loading
0