init
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
node_modules/
|
||||
lib/
|
||||
src-gen/
|
||||
plugins/
|
||||
169
gen-webpack.config.js
Normal file
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* Don't touch this file. It will be renerated by theia build.
|
||||
* To customize webpack configuration change /home/noah/Documents/html/theia-tauri/webpack.config.js
|
||||
*/
|
||||
// @ts-check
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const yargs = require('yargs');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
||||
const CompressionPlugin = require('@theia/compression-webpack-plugin')
|
||||
|
||||
const outputPath = path.resolve(__dirname, 'lib');
|
||||
const { mode, staticCompression } = yargs.option('mode', {
|
||||
description: "Mode to use",
|
||||
choices: ["development", "production"],
|
||||
default: "production"
|
||||
}).option('static-compression', {
|
||||
description: 'Controls whether to enable compression of static artifacts.',
|
||||
type: 'boolean',
|
||||
default: true
|
||||
}).argv;
|
||||
const development = mode === 'development';
|
||||
|
||||
const monacoEditorCorePath = development ? '/home/noah/Documents/html/theia-tauri/node_modules/@theia/monaco-editor-core/dev/vs' : '/home/noah/Documents/html/theia-tauri/node_modules/@theia/monaco-editor-core/min/vs';
|
||||
const monacoCssLanguagePath = '/home/noah/Documents/html/theia-tauri/node_modules/monaco-css/release/min';
|
||||
const monacoHtmlLanguagePath = '/home/noah/Documents/html/theia-tauri/node_modules/monaco-html/release/min';
|
||||
|
||||
const plugins = [new CopyWebpackPlugin([
|
||||
{
|
||||
from: monacoEditorCorePath,
|
||||
to: 'vs'
|
||||
},
|
||||
{
|
||||
from: monacoCssLanguagePath,
|
||||
to: 'vs/language/css'
|
||||
},
|
||||
{
|
||||
from: monacoHtmlLanguagePath,
|
||||
to: 'vs/language/html'
|
||||
}
|
||||
])];
|
||||
// it should go after copy-plugin in order to compress monaco as well
|
||||
if (staticCompression) {
|
||||
plugins.push(new CompressionPlugin({
|
||||
// enable reuse of compressed artifacts for incremental development
|
||||
cache: development
|
||||
}));
|
||||
}
|
||||
plugins.push(new CircularDependencyPlugin({
|
||||
exclude: /(node_modules|examples)[\\|/]./,
|
||||
failOnError: false // https://github.com/nodejs/readable-stream/issues/280#issuecomment-297076462
|
||||
}));
|
||||
|
||||
module.exports = {
|
||||
entry: path.resolve(__dirname, 'src-gen/frontend/index.js'),
|
||||
output: {
|
||||
filename: 'bundle.js',
|
||||
path: outputPath
|
||||
},
|
||||
target: 'web',
|
||||
mode,
|
||||
node: {
|
||||
fs: 'empty',
|
||||
child_process: 'empty',
|
||||
net: 'empty',
|
||||
crypto: 'empty'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /worker-main\.js$/,
|
||||
loader: 'worker-loader',
|
||||
options: {
|
||||
name: 'worker-ext.[hash].js'
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
exclude: /materialcolors\.css$|\.useable\.css$/,
|
||||
loader: 'style-loader!css-loader'
|
||||
},
|
||||
{
|
||||
test: /materialcolors\.css$|\.useable\.css$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'style-loader/useable',
|
||||
options: {
|
||||
singleton: true,
|
||||
attrs: { id: 'theia-theme' },
|
||||
}
|
||||
},
|
||||
'css-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.(ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
|
||||
loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
|
||||
},
|
||||
{
|
||||
test: /\.(jpg|png|gif)$/,
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[hash].[ext]',
|
||||
}
|
||||
},
|
||||
{
|
||||
// see https://github.com/eclipse-theia/theia/issues/556
|
||||
test: /source-map-support/,
|
||||
loader: 'ignore-loader'
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
enforce: 'pre',
|
||||
loader: 'source-map-loader',
|
||||
exclude: /jsonc-parser|fast-plist|onigasm|(monaco-editor.*)/
|
||||
},
|
||||
{
|
||||
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: "url-loader?limit=10000&mimetype=application/font-woff"
|
||||
},
|
||||
{
|
||||
test: /node_modules[\\|/](vscode-languageserver-types|vscode-uri|jsonc-parser)/,
|
||||
use: { loader: 'umd-compat-loader' }
|
||||
},
|
||||
{
|
||||
test: /\.wasm$/,
|
||||
loader: "file-loader",
|
||||
type: "javascript/auto",
|
||||
},
|
||||
{
|
||||
test: /\.plist$/,
|
||||
loader: "file-loader",
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
// include only es6 dependencies to transpile them to es5 classes
|
||||
include: /monaco-languageclient|vscode-ws-jsonrpc|vscode-jsonrpc|vscode-languageserver-protocol|vscode-languageserver-types|vscode-languageclient/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env'],
|
||||
plugins: [
|
||||
// reuse runtime babel lib instead of generating it in each js file
|
||||
'@babel/plugin-transform-runtime',
|
||||
// ensure that classes are transpiled
|
||||
'@babel/plugin-transform-classes'
|
||||
],
|
||||
// see https://github.com/babel/babel/issues/8900#issuecomment-431240426
|
||||
sourceType: 'unambiguous',
|
||||
cacheDirectory: true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js'],
|
||||
alias: {
|
||||
'vs': path.resolve(outputPath, monacoEditorCorePath),
|
||||
'vscode': require.resolve('monaco-languageclient/lib/vscode-compatibility')
|
||||
}
|
||||
},
|
||||
devtool: 'source-map',
|
||||
plugins,
|
||||
stats: {
|
||||
warnings: true
|
||||
}
|
||||
};
|
||||
51
package.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "theia",
|
||||
"bin": "src-gen/backend/main.js",
|
||||
"pkg": {
|
||||
"assets": [
|
||||
"lib/**/*",
|
||||
"plugins/**/*"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@theia/callhierarchy": "next",
|
||||
"@theia/file-search": "next",
|
||||
"@theia/git": "next",
|
||||
"@theia/json": "next",
|
||||
"@theia/markers": "next",
|
||||
"@theia/messages": "next",
|
||||
"@theia/mini-browser": "next",
|
||||
"@theia/navigator": "next",
|
||||
"@theia/outline-view": "next",
|
||||
"@theia/plugin-ext-vscode": "next",
|
||||
"@theia/preferences": "next",
|
||||
"@theia/preview": "next",
|
||||
"@theia/search-in-workspace": "next",
|
||||
"@theia/terminal": "next"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@theia/cli": "next",
|
||||
"pkg": "^4.4.8",
|
||||
"tauri": "^0.6.2"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "yarn theia:clean && yarn theia:build && yarn theia:download:plugins",
|
||||
"theia:clean": "theia clean",
|
||||
"theia:build": "theia build",
|
||||
"theia:download:plugins": "theia download:plugins",
|
||||
"theia:package": "pkg package.json -t node10 --output src-tauri/theia-binaries/theia"
|
||||
},
|
||||
"theiaPluginsDir": "plugins",
|
||||
"theiaPlugins": {
|
||||
"vscode-builtin-css": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/css-1.39.1-prel.vsix",
|
||||
"vscode-builtin-html": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/html-1.39.1-prel.vsix",
|
||||
"vscode-builtin-javascript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/javascript-1.39.1-prel.vsix",
|
||||
"vscode-builtin-json": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/json-1.39.1-prel.vsix",
|
||||
"vscode-builtin-markdown": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/markdown-1.39.1-prel.vsix",
|
||||
"vscode-builtin-npm": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/npm-1.39.1-prel.vsix",
|
||||
"vscode-builtin-scss": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/scss-1.39.1-prel.vsix",
|
||||
"vscode-builtin-typescript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/typescript-1.39.1-prel.vsix",
|
||||
"vscode-builtin-typescript-language-features": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/typescript-language-features-1.39.1-prel.vsix"
|
||||
}
|
||||
}
|
||||
14
src-tauri/.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
tauri.js
|
||||
config.json
|
||||
bundle.json
|
||||
|
||||
loading-placeholder/index.tauri.html
|
||||
theia-binaries/
|
||||
1562
src-tauri/Cargo.lock
generated
Normal file
26
src-tauri/Cargo.toml
Normal file
@@ -0,0 +1,26 @@
|
||||
[package]
|
||||
name = "app"
|
||||
version = "0.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = [ "you" ]
|
||||
license = ""
|
||||
repository = ""
|
||||
default-run = "app"
|
||||
edition = "2018"
|
||||
build = "src/build.rs"
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
tauri = { version = "0.5", features = [ "all-api", "edge" ] }
|
||||
|
||||
[target."cfg(windows)".build-dependencies]
|
||||
winres = "0.1"
|
||||
|
||||
[features]
|
||||
embedded-server = [ "tauri/embedded-server" ]
|
||||
no-server = [ "tauri/no-server" ]
|
||||
|
||||
[[bin]]
|
||||
name = "app"
|
||||
path = "src/main.rs"
|
||||
BIN
src-tauri/icons/128x128.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src-tauri/icons/128x128@2x.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
src-tauri/icons/32x32.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
src-tauri/icons/Square107x107Logo.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src-tauri/icons/Square142x142Logo.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
src-tauri/icons/Square150x150Logo.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
src-tauri/icons/Square284x284Logo.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
src-tauri/icons/Square30x30Logo.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src-tauri/icons/Square310x310Logo.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
src-tauri/icons/Square44x44Logo.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src-tauri/icons/Square71x71Logo.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
src-tauri/icons/Square89x89Logo.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
src-tauri/icons/StoreLogo.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
src-tauri/icons/icon.icns
Normal file
BIN
src-tauri/icons/icon.ico
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
src-tauri/icons/icon.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
11
src-tauri/loading-placeholder/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
Loading Theia...
|
||||
</body>
|
||||
</html>
|
||||
48
src-tauri/package.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "theia",
|
||||
"bin": "src-gen/backend/main.js",
|
||||
"pkg": {
|
||||
"assets": ["src-gen/frontend/*", "lib/**/*", "plugins/**/*"]
|
||||
},
|
||||
"dependencies": {
|
||||
"@theia/callhierarchy": "next",
|
||||
"@theia/file-search": "next",
|
||||
"@theia/git": "next",
|
||||
"@theia/json": "next",
|
||||
"@theia/markers": "next",
|
||||
"@theia/messages": "next",
|
||||
"@theia/mini-browser": "next",
|
||||
"@theia/navigator": "next",
|
||||
"@theia/outline-view": "next",
|
||||
"@theia/plugin-ext-vscode": "next",
|
||||
"@theia/preferences": "next",
|
||||
"@theia/preview": "next",
|
||||
"@theia/search-in-workspace": "next",
|
||||
"@theia/terminal": "next"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@theia/cli": "next",
|
||||
"pkg": "^4.4.8",
|
||||
"tauri": "^0.6.2"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "yarn run clean && yarn build && yarn run download:plugins",
|
||||
"clean": "theia clean",
|
||||
"build": "theia build --mode development",
|
||||
"start": "theia start --plugins=local-dir:plugins",
|
||||
"download:plugins": "theia download:plugins"
|
||||
},
|
||||
"theiaPluginsDir": "plugins",
|
||||
"theiaPlugins": {
|
||||
"vscode-builtin-css": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/css-1.39.1-prel.vsix",
|
||||
"vscode-builtin-html": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/html-1.39.1-prel.vsix",
|
||||
"vscode-builtin-javascript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/javascript-1.39.1-prel.vsix",
|
||||
"vscode-builtin-json": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/json-1.39.1-prel.vsix",
|
||||
"vscode-builtin-markdown": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/markdown-1.39.1-prel.vsix",
|
||||
"vscode-builtin-npm": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/npm-1.39.1-prel.vsix",
|
||||
"vscode-builtin-scss": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/scss-1.39.1-prel.vsix",
|
||||
"vscode-builtin-typescript": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/typescript-1.39.1-prel.vsix",
|
||||
"vscode-builtin-typescript-language-features": "https://github.com/theia-ide/vscode-builtin-extensions/releases/download/v1.39.1-prel/typescript-language-features-1.39.1-prel.vsix"
|
||||
}
|
||||
}
|
||||
13
src-tauri/rustfmt.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
max_width = 100
|
||||
hard_tabs = false
|
||||
tab_spaces = 2
|
||||
newline_style = "Auto"
|
||||
use_small_heuristics = "Default"
|
||||
reorder_imports = true
|
||||
reorder_modules = true
|
||||
remove_nested_parens = true
|
||||
edition = "2018"
|
||||
merge_derives = true
|
||||
use_try_shorthand = false
|
||||
use_field_init_shorthand = false
|
||||
force_explicit_abi = true
|
||||
16
src-tauri/src/build.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
#[cfg(windows)]
|
||||
extern crate winres;
|
||||
|
||||
#[cfg(windows)]
|
||||
fn main() {
|
||||
if std::path::Path::new("icons/icon.ico").exists() {
|
||||
let mut res = winres::WindowsResource::new();
|
||||
res.set_icon("icons/icon.ico");
|
||||
res.compile().expect("Unable to find visual studio tools");
|
||||
} else {
|
||||
panic!("No Icon.ico found. Please add one or check the path");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn main() {}
|
||||
10
src-tauri/src/cmd.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(tag = "cmd", rename_all = "camelCase")]
|
||||
pub enum Cmd {
|
||||
// your custom commands
|
||||
// multiple arguments are allowed
|
||||
// note that rename_all = "camelCase": you need to use "myCustomCommand" on JS
|
||||
MyCustomCommand { argument: String },
|
||||
}
|
||||
53
src-tauri/src/main.rs
Normal file
@@ -0,0 +1,53 @@
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
use std::{
|
||||
io::{BufRead, BufReader},
|
||||
process::{Command, Stdio},
|
||||
};
|
||||
use tauri::Handle;
|
||||
mod cmd;
|
||||
|
||||
fn main() {
|
||||
tauri::AppBuilder::new()
|
||||
.setup(|_webview, _| {
|
||||
let handle_clone = _webview.handle().clone();
|
||||
std::thread::spawn(move || {
|
||||
spawn_theia_server(&handle_clone);
|
||||
});
|
||||
// .join().unwrap();
|
||||
})
|
||||
.build()
|
||||
.run();
|
||||
}
|
||||
|
||||
fn spawn_theia_server<T: 'static>(handle: &Handle<T>) {
|
||||
let binary_name = tauri::api::command::binary_command("theia".to_string()).unwrap();
|
||||
let binary_path = tauri::api::command::relative_command(binary_name).unwrap();
|
||||
let stdout = Command::new(binary_path)
|
||||
// It doesn't source plugins from inside the pkg binary for some reason, so this doesn't work
|
||||
// .args(&["--plugins=local-dir:plugins"])
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()
|
||||
.expect("Failed to start theia server")
|
||||
.stdout
|
||||
.expect("Failed to get theia server stdout");
|
||||
let reader = BufReader::new(stdout);
|
||||
let mut webview_started = false;
|
||||
reader
|
||||
.lines()
|
||||
.filter_map(|line| line.ok())
|
||||
.for_each(|line| {
|
||||
if line.starts_with("root INFO Theia app listening on ") {
|
||||
let url = line.chars().skip(33).collect::<String>().replace(".", "");
|
||||
if !webview_started {
|
||||
webview_started = true;
|
||||
handle
|
||||
.dispatch(move |webview| webview.eval(&format!("window.location.replace('{}')", url)))
|
||||
.expect("failed to initialize app");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
61
src-tauri/tauri.conf.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"build": {
|
||||
"distDir": "./loading-placeholder",
|
||||
"devPath": "./loading-placeholder",
|
||||
"beforeDevCommand": "",
|
||||
"beforeBuildCommand": ""
|
||||
},
|
||||
"ctx": {},
|
||||
"tauri": {
|
||||
"embeddedServer": {
|
||||
"active": true
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"identifier": "com.tauri.dev",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"resources": [],
|
||||
"externalBin": ["theia-binaries/theia"],
|
||||
"copyright": "",
|
||||
"category": "DeveloperTool",
|
||||
"shortDescription": "",
|
||||
"longDescription": "",
|
||||
"deb": {
|
||||
"depends": [],
|
||||
"useBootstrapper": false
|
||||
},
|
||||
"osx": {
|
||||
"frameworks": [],
|
||||
"minimumSystemVersion": "",
|
||||
"useBootstrapper": false
|
||||
},
|
||||
"exceptionDomain": ""
|
||||
},
|
||||
"whitelist": {
|
||||
"all": true
|
||||
},
|
||||
"window": {
|
||||
"title": "Tauri App",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"resizable": true,
|
||||
"fullscreen": false
|
||||
},
|
||||
"security": {
|
||||
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'"
|
||||
},
|
||||
"edge": {
|
||||
"active": true
|
||||
},
|
||||
"inliner": {
|
||||
"active": true
|
||||
}
|
||||
}
|
||||
}
|
||||
17
webpack.config.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* This file can be edited to customize webpack configuration.
|
||||
* To reset delete this file and rerun theia build again.
|
||||
*/
|
||||
// @ts-check
|
||||
const config = require('./gen-webpack.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({
|
||||
test: /\.js$/,
|
||||
loader: require.resolve('@theia/application-manager/lib/expose-loader')
|
||||
}); */
|
||||
|
||||
module.exports = config;
|
||||