[vscode-spring-cli] Switch the build to webpack

This commit is contained in:
aboyko
2024-05-17 19:13:59 -04:00
parent cdc292a22e
commit 6f76f4e288
8 changed files with 3765 additions and 120 deletions

View File

@@ -1,4 +1,5 @@
out
dist
node_modules
target
*.log

View File

@@ -6,17 +6,17 @@
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"name": "Spring CLI Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"preLaunchTask": "npm: watch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: watch"
"${workspaceFolder}/dist/**/*.js"
]
}
]
}

View File

@@ -6,7 +6,22 @@
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"problemMatcher": {
"owner": "typescript",
"pattern":[
{
"regexp": "\\[tsl\\] ERROR",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "\\w+",
"endsPattern": "webpack .* compiled"
}
},
"isBackground": true,
"presentation": {
"reveal": "never"

View File

@@ -8,4 +8,9 @@
# Extensions
.gitignore
**/*.map
**/*.map
node_modules
out/
src/
tsconfig.json
webpack.config.js

File diff suppressed because it is too large Load Diff

View File

@@ -161,26 +161,31 @@
}
]
},
"main": "./out/extension",
"main": "./dist/extension",
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "npm run compile && tsc -watch -p .",
"vscode:prepublish": "npm run package",
"webpack": "webpack --mode development",
"package": "webpack --mode production --devtool hidden-source-map",
"compile": "webpack --mode development",
"watch": "webpack --mode development --watch",
"clean": "rm -fr node_modules out *.vsix package-lock.json",
"vsce-package": "vsce package",
"vsce-pre-release-package": "vsce package --pre-release"
},
"dependencies": {
"vscode-languageclient": "^9.0.1",
"js-yaml": "^4.1.0",
"lodash.debounce": "^4.0.8",
"js-yaml": "^4.1.0"
"vscode-languageclient": "^9.0.1"
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
"@types/lodash.debounce": "^4.0.9",
"@types/node": "^18.8.0",
"@types/vscode": "1.75.0",
"@vscode/vsce": "^2.26.1",
"ts-loader": "^9.5.1",
"typescript": "^4.8.0",
"@vscode/vsce": "^2.22.0"
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
}
}

View File

@@ -48,7 +48,7 @@ export class Cli {
"--file",
uri.fsPath
];
return this.fetchJson("Running guide", uri.fsPath, args, cwd || path.dirname(uri.fsPath), true);
return this.fetchJson("Applying guide", uri.fsPath, args, cwd || path.dirname(uri.fsPath), true);
}
aiAdd(question: string, cwd: string): Thenable<Uri> {

View File

@@ -0,0 +1,51 @@
//@ts-check
'use strict';
const path = require('path');
const webpack = require('webpack');
/**@type {import('webpack').Configuration}*/
const config = {
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
output: {
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
path: path.resolve(__dirname, 'dist'),
filename: 'extension.js',
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../[resource-path]'
},
devtool: 'source-map',
externals: {
vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
},
resolve: {
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
mainFields: ['browser', 'module', 'main'], // look for `browser` entry point in imported node modules
extensions: ['.ts', '.js'],
alias: {
// provides alternate implementation for node module and source files
},
fallback: {
// Webpack 5 no longer polyfills Node.js core modules automatically.
// see https://webpack.js.org/configuration/resolve/#resolvefallback
// for the list of Node.js core module polyfills.
}
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
}
]
}
};
module.exports = config;