diff --git a/.gitignore b/.gitignore
index 174f84b..7c3fdba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ index.d.ts
*.ignore.js
*.ignore.js.map
dist
+.mypy_cache
diff --git a/app-dist b/app-dist
new file mode 120000
index 0000000..4228c60
--- /dev/null
+++ b/app-dist
@@ -0,0 +1 @@
+../terminus
\ No newline at end of file
diff --git a/index.html b/index.html
index 8b02058..5133ec8 100644
--- a/index.html
+++ b/index.html
@@ -1 +1 @@
-
Terminus
\ No newline at end of file
+Terminus
\ No newline at end of file
diff --git a/index.pug b/index.pug
index d3c7fda..174e0bc 100644
--- a/index.pug
+++ b/index.pug
@@ -4,7 +4,7 @@ html
base(href='dist/')
meta(name='viewport', content='initial-scale=1, minimal-ui, shrink-to-fit=no')
link(href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400", rel="stylesheet")
- script(src='index.js')
+ script(src='index.js', defer)
title Terminus
body
.terminal
diff --git a/manage.py b/manage.py
new file mode 100755
index 0000000..b3c9744
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+ """Run administrative tasks."""
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'terminus.settings')
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError as exc:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ ) from exc
+ execute_from_command_line(sys.argv)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/package.json b/package.json
index 95c2079..8a7841e 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,7 @@
"bootstrap": "^4.3.1",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
+ "constants-browserify": "^1.0.0",
"core-js": "^3.8.3",
"crypto-browserify": "^3.12.0",
"css-loader": "^2.1.0",
@@ -31,6 +32,7 @@
"source-code-pro": "^2.30.1",
"source-sans-pro": "^2.45.0",
"stream-browserify": "^3.0.0",
+ "string_decoder": "^1.3.0",
"style-loader": "^0.23.1",
"typescript": "3.3.3333",
"val-loader": "^1.1.1",
diff --git a/poetry.lock b/poetry.lock
new file mode 100644
index 0000000..ebbbf52
--- /dev/null
+++ b/poetry.lock
@@ -0,0 +1,111 @@
+[[package]]
+name = "asgiref"
+version = "3.3.4"
+description = "ASGI specs, helper code, and adapters"
+category = "main"
+optional = false
+python-versions = ">=3.6"
+
+[package.dependencies]
+typing-extensions = {version = "*", markers = "python_version < \"3.8\""}
+
+[package.extras]
+tests = ["pytest", "pytest-asyncio", "mypy (>=0.800)"]
+
+[[package]]
+name = "django"
+version = "3.2.3"
+description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design."
+category = "main"
+optional = false
+python-versions = ">=3.6"
+
+[package.dependencies]
+asgiref = ">=3.3.2,<4"
+pytz = "*"
+sqlparse = ">=0.2.2"
+
+[package.extras]
+argon2 = ["argon2-cffi (>=19.1.0)"]
+bcrypt = ["bcrypt"]
+
+[[package]]
+name = "django-rest-framework"
+version = "0.1.0"
+description = "alias."
+category = "main"
+optional = false
+python-versions = "*"
+
+[package.dependencies]
+djangorestframework = "*"
+
+[[package]]
+name = "djangorestframework"
+version = "3.12.4"
+description = "Web APIs for Django, made easy."
+category = "main"
+optional = false
+python-versions = ">=3.5"
+
+[package.dependencies]
+django = ">=2.2"
+
+[[package]]
+name = "pytz"
+version = "2021.1"
+description = "World timezone definitions, modern and historical"
+category = "main"
+optional = false
+python-versions = "*"
+
+[[package]]
+name = "sqlparse"
+version = "0.4.1"
+description = "A non-validating SQL parser."
+category = "main"
+optional = false
+python-versions = ">=3.5"
+
+[[package]]
+name = "typing-extensions"
+version = "3.10.0.0"
+description = "Backported and Experimental Type Hints for Python 3.5+"
+category = "main"
+optional = false
+python-versions = "*"
+
+[metadata]
+lock-version = "1.1"
+python-versions = "^3.7"
+content-hash = "d745493eff37d4b0b0b9e932d7f14cd1266603161ca3f04ffb50596f03ee9d89"
+
+[metadata.files]
+asgiref = [
+ {file = "asgiref-3.3.4-py3-none-any.whl", hash = "sha256:92906c611ce6c967347bbfea733f13d6313901d54dcca88195eaeb52b2a8e8ee"},
+ {file = "asgiref-3.3.4.tar.gz", hash = "sha256:d1216dfbdfb63826470995d31caed36225dcaf34f182e0fa257a4dd9e86f1b78"},
+]
+django = [
+ {file = "Django-3.2.3-py3-none-any.whl", hash = "sha256:7e0a1393d18c16b503663752a8b6790880c5084412618990ce8a81cc908b4962"},
+ {file = "Django-3.2.3.tar.gz", hash = "sha256:13ac78dbfd189532cad8f383a27e58e18b3d33f80009ceb476d7fcbfc5dcebd8"},
+]
+django-rest-framework = [
+ {file = "django-rest-framework-0.1.0.tar.gz", hash = "sha256:47a8f496fa69e3b6bd79f68dd7a1527d907d6b77f009e9db7cf9bb21cc565e4a"},
+]
+djangorestframework = [
+ {file = "djangorestframework-3.12.4-py3-none-any.whl", hash = "sha256:6d1d59f623a5ad0509fe0d6bfe93cbdfe17b8116ebc8eda86d45f6e16e819aaf"},
+ {file = "djangorestframework-3.12.4.tar.gz", hash = "sha256:f747949a8ddac876e879190df194b925c177cdeb725a099db1460872f7c0a7f2"},
+]
+pytz = [
+ {file = "pytz-2021.1-py2.py3-none-any.whl", hash = "sha256:eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798"},
+ {file = "pytz-2021.1.tar.gz", hash = "sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da"},
+]
+sqlparse = [
+ {file = "sqlparse-0.4.1-py3-none-any.whl", hash = "sha256:017cde379adbd6a1f15a61873f43e8274179378e95ef3fede90b5aa64d304ed0"},
+ {file = "sqlparse-0.4.1.tar.gz", hash = "sha256:0f91fd2e829c44362cbcfab3e9ae12e22badaa8a29ad5ff599f9ec109f0454e8"},
+]
+typing-extensions = [
+ {file = "typing_extensions-3.10.0.0-py2-none-any.whl", hash = "sha256:0ac0f89795dd19de6b97debb0c6af1c70987fd80a2d62d1958f7e56fcc31b497"},
+ {file = "typing_extensions-3.10.0.0-py3-none-any.whl", hash = "sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84"},
+ {file = "typing_extensions-3.10.0.0.tar.gz", hash = "sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342"},
+]
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..3f1bfe8
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,16 @@
+[tool.poetry]
+name = "terminus-web"
+version = "0.1.0"
+description = ""
+authors = ["Your Name "]
+
+[tool.poetry.dependencies]
+python = "^3.7"
+Django = "^3.2.3"
+django-rest-framework = "^0.1.0"
+
+[tool.poetry.dev-dependencies]
+
+[build-system]
+requires = ["poetry-core>=1.0.0"]
+build-backend = "poetry.core.masonry.api"
diff --git a/terminal-styles.scss b/terminal-styles.scss
new file mode 100644
index 0000000..e69de29
diff --git a/terminal.d.ts b/terminal.d.ts
index d882a19..bcddd7a 100644
--- a/terminal.d.ts
+++ b/terminal.d.ts
@@ -6,6 +6,7 @@ import '@fortawesome/fontawesome-free/css/fontawesome.css';
import 'source-code-pro/source-code-pro.css';
import 'source-sans-pro/source-sans-pro.css';
import { Duplex } from 'stream-browserify';
+import './terminal-styles.scss';
export declare class Socket extends Duplex {
webSocket: WebSocket;
constructor();
diff --git a/terminal.pug b/terminal.pug
index 3930d56..6ae399c 100644
--- a/terminal.pug
+++ b/terminal.pug
@@ -1,5 +1,5 @@
doctype html
-html
+html.terminus
head
meta(charset='UTF-8')
script(src='./terminal.js')
diff --git a/terminal.ts b/terminal.ts
index 2cf7c96..cc93aba 100644
--- a/terminal.ts
+++ b/terminal.ts
@@ -8,6 +8,7 @@ import * as yaml from 'js-yaml'
import { Duplex } from 'stream-browserify'
import { Buffer } from 'buffer'
+import './terminal-styles.scss'
export class Socket extends Duplex {
webSocket: WebSocket
@@ -22,10 +23,10 @@ export class Socket extends Duplex {
connect () {
this.webSocket = new WebSocket('ws://localhost:9001/')
this.webSocket.onopen = event => {
- this.emit('connect')
+ this['emit']('connect')
}
this.webSocket.onmessage = async event => {
- this.emit('data', Buffer.from(await event.data.arrayBuffer()))
+ this['emit']('data', Buffer.from(await event.data.arrayBuffer()))
}
}
@@ -69,6 +70,8 @@ async function start () {
terminal:
font: "Source Code Pro"
autoOpen: true
+ rightClick: menu
+ copyOnSelect: false
appearance:
vibrancy: false
pluginBlacklist: []
@@ -94,20 +97,20 @@ async function start () {
mkdirSync: path => {
console.warn('mock mkdirSync', path)
},
- stat: (path, cb) => {
- if ([
- 'resources/builtin-plugins',
- 'resources/builtin-plugins/terminus-core/package.json',
- 'resources/builtin-plugins/terminus-ssh/package.json',
- 'resources/builtin-plugins/terminus-settings/package.json',
- 'resources/builtin-plugins/terminus-terminal/package.json',
- ].includes(path)) {
- cb(null, {})
- } else {
- console.warn('mock stat', path)
- cb('ENOEXIST')
- }
- },
+ // stat: (path, cb) => {
+ // if ([
+ // 'resources/builtin-plugins',
+ // 'resources/builtin-plugins/terminus-core/package.json',
+ // 'resources/builtin-plugins/terminus-ssh/package.json',
+ // 'resources/builtin-plugins/terminus-settings/package.json',
+ // 'resources/builtin-plugins/terminus-terminal/package.json',
+ // ].includes(path)) {
+ // cb(null, {})
+ // } else {
+ // console.warn('mock stat', path)
+ // cb('ENOEXIST')
+ // }
+ // },
writeFileSync: () => null,
readFileSync: (path) => {
if (path === 'app-path/config.yaml') {
@@ -116,31 +119,22 @@ async function start () {
return ''
},
readFile: (path, enc, cb) => {
- if ([
- 'resources/builtin-plugins/terminus-core/package.json',
- 'resources/builtin-plugins/terminus-ssh/package.json',
- 'resources/builtin-plugins/terminus-terminal/package.json',
- 'resources/builtin-plugins/terminus-settings/package.json',
- ].includes(path)) {
- cb(null, '{ "keywords": ["terminus-builtin-plugin"], "author": "" }')
- } else {
- console.warn('mock readFile', path)
- cb('UNKNOWN', null)
- }
- },
- readdir: (path, cb) => {
- if (path === 'resources/builtin-plugins') {
- cb(null, [
- 'terminus-core',
- 'terminus-ssh',
- 'terminus-settings',
- 'terminus-terminal',
- ])
- } else {
- console.warn('mock readdir', path)
- cb(null, [])
- }
+ console.warn('mock readFile', path)
+ cb('UNKNOWN', null)
},
+ // readdir: (path, cb) => {
+ // if (path === 'resources/builtin-plugins') {
+ // cb(null, [
+ // 'terminus-core',
+ // 'terminus-ssh',
+ // 'terminus-settings',
+ // 'terminus-terminal',
+ // ])
+ // } else {
+ // console.warn('mock readdir', path)
+ // cb(null, [])
+ // }
+ // },
constants: {},
},
'@electron/remote': {
@@ -149,6 +143,7 @@ async function start () {
getPath: () => 'app-path',
getWindow: () => ({
reload: () => null,
+ setTrafficLightPosition: () => null,
}),
},
screen: {
@@ -221,10 +216,6 @@ async function start () {
clearLine: stream => stream.write('\r'),
},
zlib: require('browserify-zlib'),
- util: {
- ...require('util'),
- promisify: () => null,
- },
'any-promise': Promise,
net: {
Socket,
@@ -256,7 +247,7 @@ async function start () {
},
'readable-stream': {},
os: {
- platform: () => 'linux',
+ platform: () => 'web',
homedir: () => '/home',
},
'mz/child_process': {
@@ -287,6 +278,7 @@ async function start () {
},
},
dns: {},
+ util: require('util'),
keytar: {
getPassword: () => null,
},
@@ -316,17 +308,18 @@ async function start () {
Object.assign(window, {
require: (path) => {
if (mocks[path]) {
+ console.warn('requiring mock', path)
return mocks[path]
}
if (builtins[path]) {
return builtins[path]
}
- console.warn('requiring', path)
+ console.error('requiring real module', path)
},
process: {
env: { XWEB: 1, LOGNAME: 'root' },
argv: ['terminus'],
- platform: 'linux',
+ platform: 'darwin',
on: () => null,
stdout: {},
stderr: {},
@@ -351,29 +344,58 @@ async function start () {
window['__dirname'] = '__dirname'
window['setImmediate'] = setTimeout
mocks.module['prototype'] = { require: window['require'] }
+ window['terminusConfig'] = configContent
- let pluginCode = {
- core: await import(/* webpackChunkName: "app" */ '../terminus/terminus-core/dist/index.js'),
- ssh: await import(/* webpackChunkName: "app" */ '../terminus/terminus-ssh/dist/index.js'),
- settings: await import(/* webpackChunkName: "app" */ '../terminus/terminus-settings/dist/index.js'),
- terminal: await import(/* webpackChunkName: "app" */ '../terminus/terminus-terminal/dist/index.js'),
- }
+ require('util').promisify = () => null
- function loadPlugin (name) {
- let code = `(function (exports, require, module) { \n${pluginCode[name].default}\n })`
+ // let plugins: Record = {}
+ // plugins.core = builtins['terminus-core'] = await import(/* webpackChunkName: "app" */ '../terminus/terminus-core/dist/index.js')
+ // plugins.settings = builtins['terminus-settings'] = await import(/* webpackChunkName: "app" */ '../terminus/terminus-settings/dist/index.js')
+ // plugins.terminal = builtins['terminus-terminal'] = await import(/* webpackChunkName: "app" */ '../terminus/terminus-terminal/dist/index.js')
+ // plugins['community-color-schemes'] = builtins['terminus-community-color-schemes'] = await import(/* webpackChunkName: "app" */ '../terminus/terminus-community-color-schemes/dist/index.js')
+ // plugins.ssh = builtins['terminus-ssh'] = await import(/* webpackChunkName: "app" */ '../terminus/terminus-ssh/dist/index.js')
+ // plugins.web = builtins['terminus-web'] = await import(/* webpackChunkName: "app" */ '../terminus/terminus-web/dist/index.js')
+
+ async function loadPlugin (name, file = 'index.js') {
+ let code = await (await fetch(`../app-dist/${name}/dist/${file}`)).text()
+ code = `(function (exports, require, module) { \n${code}\n })`
let m = eval(code)
let module = { exports: {} }
m(module.exports, window['require'], module)
return module.exports
}
- for (const plugin of ['core', 'settings', 'terminal', 'ssh']) {
- builtins[`resources/builtin-plugins/terminus-${plugin}`] = builtins[`terminus-${plugin}`] = loadPlugin(plugin)
+ const pluginModules = []
+ for (const plugin of [
+ 'terminus-core',
+ 'terminus-settings',
+ 'terminus-terminal',
+ 'terminus-ssh',
+ 'terminus-community-color-schemes',
+ 'terminus-web',
+ ]) {
+ console.log(`Loading ${plugin}`)
+ const mod = await loadPlugin(plugin)
+ builtins[`resources/builtin-plugins/${plugin}`] = builtins[plugin] = mod
+ pluginModules.push(mod)
+ console.log(mod)
}
- await import(/* webpackChunkName: "app" */ '../terminus/app/dist/preload.js')
+ // for (const name of ['core', 'settings', 'terminal', 'ssh', 'community-color-schemes', 'web']) {
+ // plugins[name].pluginName = name
+ // builtins[`resources/builtin-plugins/terminus-${name}`] = plugins[name]
+ // }
+
+ // await import(/* webpackChunkName: "app" */ '../terminus/app/dist/preload.js')
+ // document.querySelector('app-root')['style'].display = 'flex'
+
+ // await import(/* webpackChunkName: "app" */ '../terminus/app/dist/bundle-web.js')
+ // window['bootstrapTerminus'](Object.values(plugins), { config })
+
+ await loadPlugin('app', 'preload.js')
+ await loadPlugin('app', 'bundle-web.js')
document.querySelector('app-root')['style'].display = 'flex'
- await import(/* webpackChunkName: "app" */ '../terminus/app/dist/bundle.js')
+ window['bootstrapTerminus'](pluginModules, { config })
}
start()
diff --git a/terminus/__init__.py b/terminus/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/terminus/asgi.py b/terminus/asgi.py
new file mode 100644
index 0000000..aa7791b
--- /dev/null
+++ b/terminus/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for terminus project.
+
+It exposes the ASGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'terminus.settings')
+
+application = get_asgi_application()
diff --git a/terminus/settings.py b/terminus/settings.py
new file mode 100644
index 0000000..ab8fa91
--- /dev/null
+++ b/terminus/settings.py
@@ -0,0 +1,125 @@
+"""
+Django settings for terminus project.
+
+Generated by 'django-admin startproject' using Django 3.2.3.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/3.2/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/3.2/ref/settings/
+"""
+
+from pathlib import Path
+
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve().parent.parent
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'django-insecure-jw3fshufj(1$iv+&9bie=r%27+^e2sz0!_gq38*5p5!csrms'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+MIDDLEWARE = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'terminus.urls'
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'terminus.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': BASE_DIR / 'db.sqlite3',
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/3.2/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/3.2/howto/static-files/
+
+STATIC_URL = '/static/'
+
+# Default primary key field type
+# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
+
+DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
diff --git a/terminus/urls.py b/terminus/urls.py
new file mode 100644
index 0000000..3da1918
--- /dev/null
+++ b/terminus/urls.py
@@ -0,0 +1,21 @@
+"""terminus URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/3.2/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.urls import include, path
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path
+
+urlpatterns = [
+ path('admin/', admin.site.urls),
+]
diff --git a/terminus/wsgi.py b/terminus/wsgi.py
new file mode 100644
index 0000000..39c7ea2
--- /dev/null
+++ b/terminus/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for terminus project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'terminus.settings')
+
+application = get_wsgi_application()
diff --git a/webpack.config.js b/webpack.config.js
index 94157a0..ea80ae2 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -33,10 +33,25 @@ module.exports = {
extensions: ['.ts', '.js'],
fallback: {
stream: require.resolve('stream-browserify'),
- assert: require.resolve('assert'),
- util: require.resolve('util'),
+ assert: require.resolve('assert/'),
+ constants: require.resolve('constants-browserify'),
+ util: require.resolve('util/'),
+ zlib: require.resolve('browserify-zlib'),
},
},
+ externals: {
+ 'dns': 'commonjs dns',
+ 'tls': 'commonjs tls',
+ 'tty': 'commonjs tty',
+ 'crypto': 'commonjs crypto',
+ 'querystring': 'commonjs querystring',
+ 'https': 'commonjs https',
+ 'http': 'commonjs http',
+ 'url': 'commonjs url',
+ 'terminus-core': 'commonjs terminus-core',
+ 'terminus-terminal': 'commonjs terminus-terminal',
+ 'terminus-settings': 'commonjs terminus-settings',
+ },
module: {
rules: [
{
@@ -49,7 +64,7 @@ module.exports = {
},
},
{ test: /terminus\/app\/dist/, use: ['script-loader'] },
- { test: /dist\/index/, use: ['raw-loader'] },
+ // { test: /dist\/index/, use: ['raw-loader'] },
{
test: /\.(ttf|eot|otf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: {
@@ -73,3 +88,31 @@ module.exports = {
],
}
}
+
+
+const externals = [
+ '@electron/remote',
+ 'any-promise',
+ 'child_process',
+ 'electron-promise-ipc',
+ 'electron',
+ 'fontmanager-redux',
+ 'fs',
+ 'keytar',
+ 'hterm-umdjs',
+ 'macos-native-processlist',
+ 'native-process-working-directory',
+ 'net',
+ 'os',
+ 'path',
+ 'readline',
+ 'serialport',
+ 'socksv5',
+ 'windows-native-registry',
+ 'windows-process-tree',
+ 'windows-process-tree/build/Release/windows_process_tree.node',
+]
+
+for (const k of externals) {
+ module.exports.externals[k] = `commonjs ${k}`
+}
diff --git a/yarn.lock b/yarn.lock
index e840753..6a7ef10 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -344,11 +344,6 @@ arr-union@^3.1.0:
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=
-array-filter@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83"
- integrity sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=
-
array-find-index@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1"
@@ -359,6 +354,17 @@ array-unique@^0.3.2:
resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428"
integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=
+array.prototype.filter@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/array.prototype.filter/-/array.prototype.filter-1.0.0.tgz#24d63e38983cdc6bf023a3c574b2f2a3f384c301"
+ integrity sha512-TfO1gz+tLm+Bswq0FBOXPqAchtCr2Rn48T8dLJoRFl8NoEosjZmzptmuo1X8aZBzZcqsR1W8U761tjACJtngTQ==
+ dependencies:
+ call-bind "^1.0.2"
+ define-properties "^1.1.3"
+ es-abstract "^1.18.0"
+ es-array-method-boxes-properly "^1.0.0"
+ is-string "^1.0.5"
+
asap@~2.0.3:
version "2.0.6"
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46"
@@ -415,11 +421,11 @@ atob@^2.1.1:
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
available-typed-arrays@^1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz#6b098ca9d8039079ee3f77f7b783c4480ba513f5"
- integrity sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ==
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.3.tgz#fb7d02445bfedefad79fad1fe47931163a227198"
+ integrity sha512-CuPhFULixV/d89POo1UG4GqGbR7dmrefY2ZdmsYakeR4gOSJXoF7tfeaiqMHGOMrlTiJoeEs87fpLsBYmE2BMw==
dependencies:
- array-filter "^1.0.0"
+ array.prototype.filter "^1.0.0"
awesome-typescript-loader@^5.2.1:
version "5.2.1"
@@ -872,6 +878,11 @@ constantinople@^3.0.1:
babel-types "^6.26.0"
babylon "^6.18.0"
+constants-browserify@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75"
+ integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=
+
copy-descriptor@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
@@ -1155,7 +1166,7 @@ error-ex@^1.2.0:
dependencies:
is-arrayish "^0.2.1"
-es-abstract@^1.18.0-next.1, es-abstract@^1.18.0-next.2:
+es-abstract@^1.18.0, es-abstract@^1.18.0-next.1, es-abstract@^1.18.0-next.2:
version "1.18.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0.tgz#ab80b359eecb7ede4c298000390bc5ac3ec7b5a4"
integrity sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==
@@ -1177,6 +1188,11 @@ es-abstract@^1.18.0-next.1, es-abstract@^1.18.0-next.2:
string.prototype.trimstart "^1.0.4"
unbox-primitive "^1.0.0"
+es-array-method-boxes-properly@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e"
+ integrity sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==
+
es-module-lexer@^0.4.0:
version "0.4.1"
resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.4.1.tgz#dda8c6a14d8f340a24e34331e0fab0cb50438e0e"
@@ -3570,7 +3586,7 @@ string.prototype.trimstart@^1.0.4:
call-bind "^1.0.2"
define-properties "^1.1.3"
-string_decoder@^1.1.1:
+string_decoder@^1.1.1, string_decoder@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==