Skip to content
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

Improve webview build and code sharing #530

Merged
merged 5 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions appland-findings/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
3 changes: 1 addition & 2 deletions appland-findings/dist/main.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions appland-findings/dist/main.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* @license MIT
*/

/*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */

/*! https://mths.be/punycode v1.4.1 by @mathias */

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
Expand Down
6 changes: 3 additions & 3 deletions appland-findings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"webpack-cli": "^4.6"
},
"dependencies": {
"@appland/components": "^3.5.0",
"@appland/components": "^3.25.1",
"url": "^0.11",
"vue": "^2.7",
"vue-template-compiler": "^2.7",
"url": "^0.11"
"vue-template-compiler": "^2.7"
},
"packageManager": "[email protected]"
ahtrotta marked this conversation as resolved.
Show resolved Hide resolved
}
93 changes: 54 additions & 39 deletions appland-findings/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,66 @@
/* eslint-disable */
const path = require('path');

module.exports = {
module.exports = (env, argv) => {
const isProduction = argv.mode === 'production'

let config = {
entry: './main.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js',
devtoolModuleFilenameTemplate: '[resource-path]',
library: 'AppLandWeb',
path: path.resolve(__dirname, 'dist'),
filename: 'main.js',
devtoolModuleFilenameTemplate: '[resource-path]',
library: 'AppLandWeb',
},
devtool: 'source-map',
resolve: {
extensions: ['.js', '.mjs'],
alias: {
vue: path.resolve('./node_modules/vue'),
vuex: path.resolve('./node_modules/vuex'),
},
fallback: {
crypto: 'crypto-js',
},
extensions: ['.js', '.mjs'],
alias: {
messagePublisher: path.resolve('../appland-shared/messagePublisher.js'),
vsCodeBridge: path.resolve('../appland-shared/vsCodeBridge.js'),
vue: path.resolve('./node_modules/vue'),
vuex: path.resolve('./node_modules/vuex'),
},
fallback: {
crypto: 'crypto-js',
assert: false,
buffer: false,
http: false,
https: false,
}
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {},
},
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.html$/i,
loader: 'html-loader',
},
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {},
},
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.html$/i,
loader: 'html-loader',
},
{
test: /\.(svg|ttf)$/i,
use: [
{
test: /\.(svg|ttf)$/i,
use: [
{
loader: 'file-loader',
},
],
loader: 'file-loader',
},
],
],
},
],
},
};
}

if (!isProduction) {
config.devtool = 'source-map'
}

return config
}
4 changes: 2 additions & 2 deletions appland-findings/webview.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Vue from 'vue';
import {VAnalysisFindings, VFindingDetails} from '@appland/components';
import '@appland/diagrams/dist/style.css';
import MessagePublisher from './messagePublisher';
import vscode from './vsCodeBridge';
import MessagePublisher from 'messagePublisher';
import vscode from 'vsCodeBridge';

export function mountWebview() {
const messages = new MessagePublisher(vscode);
Expand Down
Loading