Skip to content
Snippets Groups Projects
Unverified Commit 6926dcbc authored by Emilio Jesus Gallego Arias's avatar Emilio Jesus Gallego Arias
Browse files

[build] Resurrect ide-project and collab addon

parent 56d1025f
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
.cache
/dist
/dist-cli
/dist-webpack
/bin
# Local build configuration file
......
......@@ -76,9 +76,9 @@ all:
@echo "Welcome to jsCoq makefile. Targets are:"
@echo ""
@echo " jscoq: build jsCoq [JavaScript and libraries]"
@echo " wacoq: build waCoq [JavaScript, frontend only; depends on wacoq-bin]"
@echo " wacoq: build waCoq [JavaScript and libraries]"
@echo ""
@echo " bundle: create JS bundles using esbuild"
@echo " bundle: create the core JS bundles using esbuild in dist"
@echo " typecheck: typecheck using tsc"
@echo ""
@echo " links: create links that allow to serve pages from the source tree"
......@@ -119,17 +119,19 @@ links-clean:
rm -f coq-pkgs backend/jsoo/jscoq_worker.bc.cjs backend/wasm/wacoq_worker.bc \
backend/wasm/dlllib_stubs.wasm backend/wasm/dllcoqrun_stubs.wasm
.PHONY:modules
.PHONY:modules bundle typecheck bundle-webpack
modules:
dune build node_modules
$(DUNE) build node_modules
.PHONY:bundle
bundle:
dune build dist dist-cli
$(DUNE) build dist dist-cli
bundle-webpack:
$(DUNE) build dist-webpack --no-buffer
.PHONY:typecheck
typecheck:
dune exec -- npm run typecheck
$(DUNE) build node_modules
$(DUNE) exec --context=$(BUILD_CONTEXT) -- npm run typecheck
# Build symbol database files for autocomplete
coq-pkgs/%.symb.json: coq-pkgs/%.coq-pkg
......
......@@ -62,6 +62,18 @@
(action
(run npm run esbuild)))
; Webpack build (legacy)
(rule
(targets (dir dist-webpack))
(mode (promote (until-clean)))
(deps
(source_tree backend)
(source_tree frontend)
webpack.config.js
node_modules)
(action
(run npm run webpack)))
; Just the worker
(alias
(name jscoq_worker)
......
// for images loaded via `file-loader`
__webpack_public_path__ = JsCoq.base_path + 'dist/addon/';
__webpack_public_path__ = JsCoq.base_path + 'dist-webpack/addon/';
......@@ -276,13 +276,13 @@ export class CoqManager {
async openProject(name) {
var pane = this.layout.createOutline();
await this._load('dist/ide-project.browser.js');
await this._load('dist-webpack/ide-project.browser.js');
this.project = ideProject.ProjectPanel.attach(this, pane, name);
}
async openCollab(documentKey) {
await this._load('dist/addon/collab.browser.js');
await this._load('dist-webpack/addon/collab.browser.js');
this.collab = {
hastebin: addonCollab.Hastebin.attach(this, documentKey?.hastebin),
p2p: addonCollab.CollabP2P.attach(this, documentKey?.p2p)
......
import os from 'os';
import webpack from 'webpack';
import fs from 'fs';
import path from 'path';
import { createRequire } from 'module';
import { VueLoaderPlugin } from 'vue-loader';
import TerserPlugin from 'terser-webpack-plugin';
const __dirname = path.resolve('.'),
__tmpdir = path.resolve(os.tmpdir()),
......@@ -60,8 +57,6 @@ const
plugins: [
new webpack.DefinePlugin({process: {browser: true, env: {}, cwd: () => "/"}}),
new webpack.ProvidePlugin({Buffer: ['buffer', 'Buffer']})
//new webpack.ProvidePlugin({process: 'process/browser.js',
// Buffer: ['buffer', 'Buffer']})]
]
},
// resources that only make sense in browser context
......@@ -77,73 +72,74 @@ export default (env, argv) => [
/**
* Multi-file Project UI
*/
// {
// name: 'ide-project',
// entry: './frontend/classic/js/ide-project.js',
// ...basics(argv),
// output: {
// filename: 'ide-project.browser.js',
// path: path.join(__dirname, 'dist'),
// library: 'ideProject',
// libraryTarget: 'umd'
// },
// externals: {
// fs: 'commonjs2 fs', child_process: 'commonjs2 child_process',
// 'wacoq-bin/dist/subproc': 'commonjs2'
// },
// module: {
// rules: [ts, css, scss, imgs, vuesfc]
// },
// resolve: {
// ...resolve,
// fallback: { "stream": require.resolve("stream-browserify") }
// },
// plugins: [new VueLoaderPlugin(),
// new webpack.ProvidePlugin({process: 'process/browser'})]
// },
{
name: 'ide-project',
entry: './frontend/classic/js/ide-project.js',
...basics(argv),
output: {
filename: 'ide-project.browser.js',
path: path.join(__dirname, 'dist-webpack'),
library: 'ideProject',
libraryTarget: 'umd'
},
externals: {
fs: 'commonjs2 fs',
child_process: 'commonjs2 child_process',
'wacoq-bin/dist/subproc': 'commonjs2'
},
module: {
rules: [ts, css, scss, imgs, vuesfc]
},
resolve: {
...resolve,
fallback: { "stream": require.resolve("stream-browserify") }
},
plugins: [new VueLoaderPlugin(),
new webpack.ProvidePlugin({process: 'process/browser'})]
},
/**
* Collaboration plugin
* (Hastebin)
*/
// {
// name: 'collab',
// entry: './frontend/classic/js/addon/collab/index.ts',
// ...basics(argv),
// output: {
// filename: 'collab.browser.js',
// path: path.join(__dirname, 'dist/addon'),
// library: 'addonCollab',
// libraryTarget: 'umd'
// },
// externals: {
// './codemirror6-adapter.js': '{}' /* cm6 (from firepad); not used */
// },
// resolve: {
// ...resolve,
// fallback: {
// "fs": false,
// "constants": require.resolve("constants-browserify"),
// "path": require.resolve("path-browserify"),
// "util": require.resolve("util/"),
// "assert": require.resolve("assert/")
// }
// },
// module: {
// rules: [ts, css, imgs, vuesfc],
// unknownContextCritical: false /* for `randombytes` */
// },
// optimization: {
// splitChunks: {
// cacheGroups: {
// roninVendor: {
// /* assume all async-import'ed modules are Ronin; there are too many to list */
// name: 'ronin-p2p'
// }
// }
// }
// },
// plugins: shims.plugins
// //[new webpack.ProvidePlugin({process: 'process/browser.js',
// // Buffer: ['buffer', 'Buffer']})]
// }
{
name: 'collab',
entry: './frontend/classic/js/addon/collab/index.ts',
...basics(argv),
output: {
filename: 'collab.browser.js',
path: path.join(__dirname, 'dist-webpack/addon'),
library: 'addonCollab',
libraryTarget: 'umd'
},
externals: {
'./codemirror6-adapter.js': '{}' /* cm6 (from firepad); not used */
},
resolve: {
...resolve,
fallback: {
"fs": false,
"constants": require.resolve("constants-browserify"),
"path": require.resolve("path-browserify"),
"util": require.resolve("util/"),
"assert": require.resolve("assert/")
}
},
module: {
rules: [ts, css, imgs, vuesfc],
unknownContextCritical: false /* for `randombytes` */
},
optimization: {
splitChunks: {
cacheGroups: {
roninVendor: {
/* assume all async-import'ed modules are Ronin; there are too many to list */
name: 'ronin-p2p'
}
}
}
},
plugins: shims.plugins
//[new webpack.ProvidePlugin({process: 'process/browser.js',
// Buffer: ['buffer', 'Buffer']})]
}
];
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment