Skip to content

Commit

Permalink
Update monaco-editor-core to 1.96.3 (#14737)
Browse files Browse the repository at this point in the history
Fixes #14726

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
  • Loading branch information
tsmaeder authored Jan 30, 2025
1 parent 0619818 commit b63b8d5
Show file tree
Hide file tree
Showing 51 changed files with 627 additions and 271 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ const webpack = require('webpack');
const yargs = require('yargs');
const resolvePackagePath = require('resolve-package-path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CompressionPlugin = require('compression-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { MonacoWebpackPlugin } = require('@theia/native-webpack-plugin/lib/monaco-webpack-plugins.js');
const outputPath = path.resolve(__dirname, 'lib', 'frontend');
const { mode, staticCompression } = yargs.option('mode', {
Expand Down Expand Up @@ -99,7 +100,8 @@ const plugins = [
new webpack.ProvidePlugin({
// the Buffer class doesn't exist in the browser but some dependencies rely on it
Buffer: ['buffer', 'Buffer']
})
}),
new MonacoWebpackPlugin()
];
// it should go after copy-plugin in order to compress monaco as well
if (staticCompression) {
Expand Down Expand Up @@ -171,6 +173,10 @@ module.exports = [{
test: /source-map-support/,
loader: 'ignore-loader'
},
{
test: /\\.d\\.ts$/,
loader: 'ignore-loader'
},
{
test: /\\.js$/,
enforce: 'pre',
Expand Down Expand Up @@ -240,6 +246,7 @@ module.exports = [{
filename: "[name].css",
chunkFilename: "[id].css",
}),
new MonacoWebpackPlugin(),
],
devtool: 'source-map',
entry: {
Expand Down Expand Up @@ -345,6 +352,7 @@ const yargs = require('yargs');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const NativeWebpackPlugin = require('@theia/native-webpack-plugin');
const { MonacoWebpackPlugin } = require('@theia/native-webpack-plugin/lib/monaco-webpack-plugins.js');
const { mode } = yargs.option('mode', {
description: "Mode to use",
Expand Down Expand Up @@ -441,6 +449,10 @@ const config = {
name: 'native/[name].[ext]'
}
},
{
test: /\\.d\\.ts$/,
loader: 'ignore-loader'
},
{
test: /\\.js$/,
enforce: 'pre',
Expand All @@ -460,7 +472,8 @@ const config = {
// Optional node dependencies can be safely ignored
new webpack.IgnorePlugin({
checkResource: resource => ignoredResources.has(resource)
})
}),
new MonacoWebpackPlugin()
],
optimization: {
// Split and reuse code across the various entry points
Expand Down
32 changes: 0 additions & 32 deletions dev-packages/cli/patches/@theia+monaco-editor-core+1.83.101.patch

This file was deleted.

26 changes: 26 additions & 0 deletions dev-packages/native-webpack-plugin/src/monaco-webpack-plugins.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// *****************************************************************************
// Copyright (C) 2023 TypeFox and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

import * as webpack from 'webpack';

export class MonacoWebpackPlugin {
apply(compiler: webpack.Compiler): void {
compiler.hooks.contextModuleFactory.tap('MonacoBuildPlugin', cmf => {
cmf.hooks.contextModuleFiles.tap('MonacoBuildPlugin', files => files.filter(file => !file.endsWith('.d.ts')));

});
}
}
2 changes: 1 addition & 1 deletion examples/api-samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@theia/file-search": "1.57.0",
"@theia/filesystem": "1.57.0",
"@theia/monaco": "1.57.0",
"@theia/monaco-editor-core": "1.83.101",
"@theia/monaco-editor-core": "1.96.302",
"@theia/output": "1.57.0",
"@theia/ovsx-client": "1.57.0",
"@theia/search-in-workspace": "1.57.0",
Expand Down
10 changes: 3 additions & 7 deletions examples/api-tests/src/monaco-api.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************

const { IOpenerService } = require('@theia/monaco-editor-core/esm/vs/platform/opener/common/opener');

// @ts-check
describe('Monaco API', async function () {
this.timeout(5000);
Expand Down Expand Up @@ -149,14 +151,8 @@ describe('Monaco API', async function () {
});

it('OpenerService.open', async () => {
const hoverContribution = monacoEditor.getControl().getContribution('editor.contrib.hover');
assert.isDefined(hoverContribution);
if (!('_openerService' in hoverContribution)) {
assert.fail('hoverContribution does not have OpenerService');
return;
}
/** @type {import('@theia/monaco-editor-core/esm/vs/editor/browser/services/openerService').OpenerService} */
const openerService = hoverContribution['_openerService'];
const openerService = StandaloneServices.get(IOpenerService);

let opened = false;
const id = '__test:OpenerService.open';
Expand Down
3 changes: 2 additions & 1 deletion examples/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"watch:compile": "tsc -b -w"
},
"devDependencies": {
"@theia/cli": "1.57.0"
"@theia/cli": "1.57.0",
"@theia/native-webpack-plugin": "1.57.0"
}
}
5 changes: 4 additions & 1 deletion examples/browser/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"extends": "../../configs/base.tsconfig",
"include": [],
"include": [ ],
"compilerOptions": {
"composite": true
},
"references": [
{
"path": "../../dev-packages/cli"
},
{
"path": "../../dev-packages/native-webpack-plugin"
},
{
"path": "../../packages/ai-anthropic"
},
Expand Down
1 change: 1 addition & 0 deletions examples/browser/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ configs[0].module.rules.push({
loader: require.resolve('@theia/application-manager/lib/expose-loader')
});


module.exports = [
...configs,
nodeConfig.config
Expand Down
6 changes: 4 additions & 2 deletions examples/electron/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ const nodeConfig = require('./gen-webpack.node.config.js');
* Expose bundled modules on window.theia.moduleName namespace, e.g.
* window['theia']['@theia/core/lib/common/uri'].
* Such syntax can be used by external code, for instance, for testing.
config.module.rules.push({
*/
configs[0].module.rules.push({
test: /\.js$/,
loader: require.resolve('@theia/application-manager/lib/expose-loader')
}); */
});


module.exports = [
...configs,
Expand Down
Loading

0 comments on commit b63b8d5

Please sign in to comment.