Skip to content

Commit

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

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <[email protected]>
  • Loading branch information
tsmaeder committed Jan 17, 2025
1 parent 7e73dda commit d9630fc
Show file tree
Hide file tree
Showing 48 changed files with 635 additions and 257 deletions.
17 changes: 16 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "download plugins",
"program": "${workspaceFolder}/dev-packages/cli/lib/theia.js",
"request": "launch",
"args": [
"build",
"--mode development"
],
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"cwd": "${workspaceFolder}/examples/browser"
},
{
"type": "node",
"request": "attach",
Expand All @@ -28,6 +42,7 @@
"protocol": "inspector",
"args": [
".",
"c:\\users\\thomas",
"--log-level=debug",
"--hostname=localhost",
"--no-cluster",
Expand Down Expand Up @@ -177,4 +192,4 @@
"stopAll": true
}
]
}
}
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 @@ -432,6 +440,10 @@ const config = {
name: 'native/[name].[ext]'
}
},
{
test: /\\.d\\.ts$/,
loader: 'ignore-loader'
},
{
test: /\\.js$/,
enforce: 'pre',
Expand All @@ -451,7 +463,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.

28 changes: 28 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,28 @@
// *****************************************************************************
// 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) {
compiler.hooks.contextModuleFactory.tap('MonacoBuildPlugin', cmf => {
cmf.hooks.contextModuleFiles.tap('MonacoBuildPlugin', files => files.filter(file => {
return !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.3",
"@theia/output": "1.57.0",
"@theia/ovsx-client": "1.57.0",
"@theia/search-in-workspace": "1.57.0",
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
10 changes: 10 additions & 0 deletions examples/browser/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
* To reset delete this file and rerun theia build again.
*/
// @ts-check
const webpack = require('webpack');
const configs = require('./gen-webpack.config.js');
const nodeConfig = require('./gen-webpack.node.config.js');
const { fileURLToPath } = require('url');
const { MonacoWebpackPlugin } = require('@theia/native-webpack-plugin/lib/monaco-webpack-plugins.js');

/**
* Expose bundled modules on window.theia.moduleName namespace, e.g.
Expand All @@ -16,6 +19,13 @@ configs[0].module.rules.push({
loader: require.resolve('@theia/application-manager/lib/expose-loader')
});

const plugin2 = new MonacoWebpackPlugin();

// @ts-ignore
configs[0].plugins.push(plugin2);
// @ts-ignore
configs[1].plugins.push(plugin2);

module.exports = [
...configs,
nodeConfig.config
Expand Down
9 changes: 7 additions & 2 deletions examples/electron/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
* To reset delete this file and rerun theia build again.
*/
// @ts-check
const webpack = require('webpack');
const configs = require('./gen-webpack.config.js');
const nodeConfig = require('./gen-webpack.node.config.js');

const { MonacoWebpackPlugin } = require('@theia/native-webpack-plugin/lib/monaco-webpack-plugins.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 d9630fc

Please sign in to comment.