From bd9327994db462e2d46c214347cd293178e3cc3b Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 13 Dec 2022 13:02:48 +0800 Subject: [PATCH] chore: add custom exthost process sample (#50) --- configs/webpack.ext-host.config.js | 5 +- configs/webpack.worker-host.config.js | 3 +- scripts/extensions.json | 162 +++----------------------- src/extension/ext-host.ts | 8 ++ src/extension/worker-host.ts | 1 + 5 files changed, 29 insertions(+), 150 deletions(-) create mode 100644 src/extension/ext-host.ts create mode 100644 src/extension/worker-host.ts diff --git a/configs/webpack.ext-host.config.js b/configs/webpack.ext-host.config.js index 7d2f5e8..9c4b68f 100644 --- a/configs/webpack.ext-host.config.js +++ b/configs/webpack.ext-host.config.js @@ -6,10 +6,11 @@ const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const { resolveTSConfig } = require('./utils'); const tsConfigPath = path.join(__dirname, '../tsconfig.json'); +const srcDir = path.join(__dirname, '../src', 'extension'); const distDir = path.join(__dirname, '../hosted'); module.exports = { - entry: require.resolve('@opensumi/ide-extension/lib/hosted/ext.process.js'), + entry: path.join(srcDir, './ext-host'), target: 'node', output: { filename: 'ext.process.js', @@ -72,7 +73,7 @@ module.exports = { }, ], resolveLoader: { - modules: [path.join(__dirname, './node_modules')], + modules: [path.join(__dirname, '../node_modules')], extensions: ['.ts', '.tsx', '.js', '.json', '.less'], mainFields: ['loader', 'main'], moduleExtensions: ['-loader'], diff --git a/configs/webpack.worker-host.config.js b/configs/webpack.worker-host.config.js index 85537d1..cb713ba 100644 --- a/configs/webpack.worker-host.config.js +++ b/configs/webpack.worker-host.config.js @@ -7,9 +7,10 @@ const { resolveTSConfig } = require('./utils'); const tsConfigPath = path.join(__dirname, '..', 'tsconfig.json'); const distDir = path.join(__dirname, '..', 'dist'); +const srcDir = path.join(__dirname, '..', 'src', 'extension'); module.exports = { - entry: require.resolve('@opensumi/ide-extension/lib/hosted/worker.host-preload.js'), + entry: path.join(srcDir, 'worker-host'), output: { filename: 'worker-host.js', path: distDir, diff --git a/scripts/extensions.json b/scripts/extensions.json index 7cc9f7c..8b6c280 100644 --- a/scripts/extensions.json +++ b/scripts/extensions.json @@ -2,42 +2,14 @@ "version": "3.0.0", "extensions": { "vscode": [ - { - "name": "node-debug", - "version": "1.41.1" - }, - { - "name": "node-debug2", - "version": "1.42.4" - }, { "name": "typescript-language-features", "version": "1.60.0" }, - { - "name": "bat", - "version": "1.55.2" - }, - { - "name": "clojure", - "version": "1.55.2" - }, - { - "name": "coffeescript", - "version": "1.55.2" - }, { "name": "configuration-editing", "version": "1.55.2" }, - { - "name": "cpp", - "version": "1.55.2" - }, - { - "name": "csharp", - "version": "1.55.2" - }, { "name": "css", "version": "1.55.2" @@ -46,21 +18,13 @@ "name": "css-language-features", "version": "1.55.2" }, - { - "name": "debug-auto-launch", - "version": "1.55.2" - }, - { - "name": "docker", - "version": "1.55.2" - }, { "name": "emmet", "version": "1.55.2" }, { - "name": "fsharp", - "version": "1.55.2" + "name": "git", + "version": "1.62.3" }, { "name": "git-ui", @@ -70,34 +34,6 @@ "name": "git-base", "version": "1.64.0-next.68976705968" }, - { - "name": "go", - "version": "1.55.2" - }, - { - "name": "groovy", - "version": "1.55.2" - }, - { - "name": "grunt", - "version": "1.55.2" - }, - { - "name": "gulp", - "version": "1.55.2" - }, - { - "name": "handlebars", - "version": "1.55.2" - }, - { - "name": "hlsl", - "version": "1.55.2" - }, - { - "name": "git", - "version": "1.55.2" - }, { "name": "html", "version": "1.55.2" @@ -106,14 +42,6 @@ "name": "html-language-features", "version": "1.55.2" }, - { - "name": "ini", - "version": "1.55.2" - }, - { - "name": "jake", - "version": "1.55.2" - }, { "name": "java", "version": "1.55.2" @@ -138,62 +66,14 @@ "name": "log", "version": "1.55.2" }, - { - "name": "lua", - "version": "1.55.2" - }, - { - "name": "make", - "version": "1.55.2" - }, - { - "name": "markdown-basics", - "version": "1.55.2" - }, { "name": "merge-conflict", "version": "1.55.2" }, - { - "name": "objective-c", - "version": "1.55.2" - }, - { - "name": "perl", - "version": "1.55.2" - }, - { - "name": "php", - "version": "1.55.2" - }, - { - "name": "php-language-features", - "version": "1.55.2" - }, - { - "name": "powershell", - "version": "1.55.2" - }, - { - "name": "pug", - "version": "1.55.2" - }, { "name": "python", "version": "1.55.2" }, - { - "name": "r", - "version": "1.55.2" - }, - { - "name": "razor", - "version": "1.55.2" - }, - { - "name": "ruby", - "version": "1.55.2" - }, { "name": "rust", "version": "1.55.2" @@ -207,19 +87,15 @@ "version": "1.55.2" }, { - "name": "shaderlab", - "version": "1.55.2" - }, - { - "name": "shellscript", - "version": "1.55.2" + "name": "typescript", + "version": "1.60.0" }, { - "name": "sql", + "name": "xml", "version": "1.55.2" }, { - "name": "swift", + "name": "yaml", "version": "1.55.2" }, { @@ -262,35 +138,27 @@ "name": "theme-tomorrow-night-blue", "version": "1.55.2" }, - { - "name": "typescript", - "version": "1.60.0" - }, - { - "name": "vb", - "version": "1.55.2" - }, { "name": "vscode-theme-seti", "version": "1.55.2" - }, - { - "name": "xml", - "version": "1.55.2" - }, + } + ], + "ms-vscode": [ { - "name": "yaml", - "version": "1.55.2" + "name": "js-debug", + "version": "1.67.2" } ], "vscode-icons-team": [ { - "name": "vscode-icons" + "name": "vscode-icons", + "version": "11.11.0" } ], "opensumi": [ { - "name": "opensumi-default-themes" + "name": "opensumi-default-themes", + "version": "2.5.7" } ] } diff --git a/src/extension/ext-host.ts b/src/extension/ext-host.ts new file mode 100644 index 0000000..0715bee --- /dev/null +++ b/src/extension/ext-host.ts @@ -0,0 +1,8 @@ +import { extProcessInit } from '@opensumi/ide-extension/lib/hosted/ext.process-base.js'; + +(async () => { + await extProcessInit({ + builtinCommands: [], + customVSCodeEngineVersion: '1.67.0', + }); +})(); diff --git a/src/extension/worker-host.ts b/src/extension/worker-host.ts new file mode 100644 index 0000000..5816f0d --- /dev/null +++ b/src/extension/worker-host.ts @@ -0,0 +1 @@ +import '@opensumi/ide-extension/lib/hosted/worker.host-preload';