Cleanup and build
parent
7352c6c612
commit
7e591c6f44
|
@ -1,12 +0,0 @@
|
|||
export default {
|
||||
extensionsToTreatAsEsm: [".ts"],
|
||||
preset: "ts-jest/presets/default-esm", // or other ESM presets
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
useESM: true,
|
||||
},
|
||||
},
|
||||
moduleNameMapper: {
|
||||
"^(\\.{1,2}/.*)\\.js$": "$1",
|
||||
},
|
||||
};
|
56
package.json
56
package.json
|
@ -5,11 +5,16 @@
|
|||
"resolutions": {
|
||||
"@lezer/common": "https://github.com/zefhemel/common.git#046c880d1fcab713cadad327a5b7d8bb5de6522c"
|
||||
},
|
||||
"bin": {
|
||||
"plugbox-bundle": "./dist/bundler/plugbox-bundle.js"
|
||||
},
|
||||
"scripts": {
|
||||
"watch": "parcel watch",
|
||||
"build": "parcel build",
|
||||
"clean": "rm -rf dist",
|
||||
"server": "nodemon dist/server/server.js pages"
|
||||
"plugs": "node dist/bundler/plugbox-bundle.js plugs/core/core.plug.json webapp/generated/core.plug.json",
|
||||
"server": "nodemon dist/server/server.js pages",
|
||||
"test": "jest"
|
||||
},
|
||||
"targets": {
|
||||
"webapp": {
|
||||
|
@ -25,6 +30,21 @@
|
|||
"outputFormat": "commonjs",
|
||||
"isLibrary": true,
|
||||
"context": "node"
|
||||
},
|
||||
"bundler": {
|
||||
"source": "plugbox/bin/plugbox-bundle.ts",
|
||||
"outputFormat": "commonjs",
|
||||
"isLibrary": true,
|
||||
"context": "node"
|
||||
},
|
||||
"test": {
|
||||
"source": [
|
||||
"plugbox/runtime.test.ts",
|
||||
"server/api.test.ts"
|
||||
],
|
||||
"outputFormat": "commonjs",
|
||||
"isLibrary": true,
|
||||
"context": "node"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -37,32 +57,33 @@
|
|||
"@fortawesome/fontawesome-svg-core": "1.3.0",
|
||||
"@fortawesome/free-solid-svg-icons": "6.0.0",
|
||||
"@fortawesome/react-fontawesome": "0.1.17",
|
||||
"@jest/globals": "^27.5.1",
|
||||
"@parcel/optimizer-data-url": "2.3.2",
|
||||
"@parcel/service-worker": "^2.3.2",
|
||||
"@parcel/transformer-inline-string": "2.3.2",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/express": "^4.17.13",
|
||||
"dexie": "^3.2.1",
|
||||
"idb": "^7.0.0",
|
||||
"jest": "^27.5.1",
|
||||
"lodash": "^4.17.21",
|
||||
"nodemon": "^2.0.15",
|
||||
"parcel": "^2.3.2",
|
||||
"socket.io-client": "^4.4.1",
|
||||
"ts-jest": "^27.1.3",
|
||||
"express": "^4.17.3",
|
||||
"vm2": "^3.9.9",
|
||||
"yargs": "^17.3.1",
|
||||
"better-sqlite3": "^7.5.0",
|
||||
"body-parser": "^1.19.2",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"buffer": "^6.0.3",
|
||||
"cors": "^2.8.5",
|
||||
"dexie": "^3.2.1",
|
||||
"esbuild": "^0.14.27",
|
||||
"express": "^4.17.3",
|
||||
"idb": "^7.0.0",
|
||||
"jest": "^27.5.1",
|
||||
"knex": "^1.0.4",
|
||||
"lodash": "^4.17.21",
|
||||
"nodemon": "^2.0.15",
|
||||
"parcel": "^2.3.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"buffer": "^6.0.3",
|
||||
"knex": "^1.0.4",
|
||||
"cors": "^2.8.5",
|
||||
"socket.io": "^4.4.1",
|
||||
"socket.io-client": "^4.4.1"
|
||||
"socket.io-client": "^4.4.1",
|
||||
"ts-jest": "^27.1.3",
|
||||
"vm2": "^3.9.9",
|
||||
"yargs": "^17.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/packager-raw-url": "2.3.2",
|
||||
|
@ -78,8 +99,11 @@
|
|||
"@types/react-dom": "^17.0.11",
|
||||
"@vscode/sqlite3": "^5.0.7",
|
||||
"assert": "^2.0.0",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"events": "^3.3.0",
|
||||
"os-browserify": "^0.3.0",
|
||||
"parcel": "^2.3.2",
|
||||
"path-browserify": "^1.0.1",
|
||||
"prettier": "^2.5.1",
|
||||
"querystring-es3": "^0.2.1",
|
||||
"stream-browserify": "^3.0.0",
|
||||
|
|
|
@ -6,8 +6,9 @@ import path from "path";
|
|||
|
||||
import yargs from "yargs";
|
||||
import { hideBin } from "yargs/helpers";
|
||||
import {Manifest} from "../types";
|
||||
|
||||
async function compile(filePath, functionName, debug) {
|
||||
async function compile(filePath : string, functionName : string, debug: boolean) {
|
||||
let outFile = "out.js";
|
||||
|
||||
let inFile = filePath;
|
||||
|
@ -44,13 +45,13 @@ export default ${functionName};`
|
|||
return jsCode.substring(0, jsCode.length - 2);
|
||||
}
|
||||
|
||||
async function bundle(manifestPath, sourceMaps) {
|
||||
async function bundle(manifestPath: string, sourceMaps: boolean) {
|
||||
const rootPath = path.dirname(manifestPath);
|
||||
const manifest = JSON.parse((await readFile(manifestPath)).toString());
|
||||
const manifest = JSON.parse((await readFile(manifestPath)).toString()) as Manifest<any>;
|
||||
|
||||
for (let [name, def] of Object.entries(manifest.functions)) {
|
||||
let jsFunctionName = def.functionName,
|
||||
filePath = path.join(rootPath, def.path);
|
||||
let jsFunctionName = "default",
|
||||
filePath = path.join(rootPath, def.path!);
|
||||
if (filePath.indexOf(":") !== -1) {
|
||||
[filePath, jsFunctionName] = filePath.split(":");
|
||||
}
|
||||
|
@ -67,8 +68,8 @@ async function run() {
|
|||
})
|
||||
.parse();
|
||||
|
||||
let generatedManifest = await bundle(args._[0], !!args.debug);
|
||||
await writeFile(args._[1], JSON.stringify(generatedManifest, null, 2));
|
||||
let generatedManifest = await bundle(args._[0] as string, !!args.debug);
|
||||
await writeFile(args._[1] as string, JSON.stringify(generatedManifest, null, 2));
|
||||
}
|
||||
|
||||
run().catch((e) => {
|
|
@ -65,7 +65,7 @@ parentPort.on("message", (data : any) => {
|
|||
result: result,
|
||||
});
|
||||
} catch (e : any) {
|
||||
console.log("ERROR", e);
|
||||
// console.log("ERROR", e);
|
||||
parentPort.postMessage({
|
||||
type: "result",
|
||||
id: data.id,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { IndexEvent } from "../../webapp/src/app_event";
|
||||
import { pageLinkRegex } from "../../webapp/src/constant";
|
||||
import { IndexEvent } from "../../webapp/app_event";
|
||||
import { pageLinkRegex } from "../../webapp/constant";
|
||||
import { syscall } from "./lib/syscall";
|
||||
|
||||
const wikilinkRegex = new RegExp(pageLinkRegex, "g");
|
||||
|
|
|
@ -116,6 +116,9 @@ export class SocketServer {
|
|||
}
|
||||
|
||||
close() {
|
||||
(this.apis.get("index")! as IndexApi).db.destroy();
|
||||
console.log("Closing server");
|
||||
(this.apis.get("index")! as IndexApi).db.destroy().catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
126
yarn.lock
126
yarn.lock
|
@ -3005,6 +3005,132 @@ es6-object-assign@^1.1.0:
|
|||
resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c"
|
||||
integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=
|
||||
|
||||
esbuild-android-64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.27.tgz#b868bbd9955a92309c69df628d8dd1945478b45c"
|
||||
integrity sha512-LuEd4uPuj/16Y8j6kqy3Z2E9vNY9logfq8Tq+oTE2PZVuNs3M1kj5Qd4O95ee66yDGb3isaOCV7sOLDwtMfGaQ==
|
||||
|
||||
esbuild-android-arm64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.27.tgz#e7d6430555e8e9c505fd87266bbc709f25f1825c"
|
||||
integrity sha512-E8Ktwwa6vX8q7QeJmg8yepBYXaee50OdQS3BFtEHKrzbV45H4foMOeEE7uqdjGQZFBap5VAqo7pvjlyA92wznQ==
|
||||
|
||||
esbuild-darwin-64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.27.tgz#4dc7484127564e89b4445c0a560a3cb50b3d68e1"
|
||||
integrity sha512-czw/kXl/1ZdenPWfw9jDc5iuIYxqUxgQ/Q+hRd4/3udyGGVI31r29LCViN2bAJgGvQkqyLGVcG03PJPEXQ5i2g==
|
||||
|
||||
esbuild-darwin-arm64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.27.tgz#469e59c665f84a8ed323166624c5e7b9b2d22ac1"
|
||||
integrity sha512-BEsv2U2U4o672oV8+xpXNxN9bgqRCtddQC6WBh4YhXKDcSZcdNh7+6nS+DM2vu7qWIWNA4JbRG24LUUYXysimQ==
|
||||
|
||||
esbuild-freebsd-64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.27.tgz#895df03bf5f87094a56c9a5815bf92e591903d70"
|
||||
integrity sha512-7FeiFPGBo+ga+kOkDxtPmdPZdayrSzsV9pmfHxcyLKxu+3oTcajeZlOO1y9HW+t5aFZPiv7czOHM4KNd0tNwCA==
|
||||
|
||||
esbuild-freebsd-arm64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.27.tgz#0b72a41a6b8655e9a8c5608f2ec1afdcf6958441"
|
||||
integrity sha512-8CK3++foRZJluOWXpllG5zwAVlxtv36NpHfsbWS7TYlD8S+QruXltKlXToc/5ZNzBK++l6rvRKELu/puCLc7jA==
|
||||
|
||||
esbuild-linux-32@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.27.tgz#43b8ba3803b0bbe7f051869c6a8bf6de1e95de28"
|
||||
integrity sha512-qhNYIcT+EsYSBClZ5QhLzFzV5iVsP1YsITqblSaztr3+ZJUI+GoK8aXHyzKd7/CKKuK93cxEMJPpfi1dfsOfdw==
|
||||
|
||||
esbuild-linux-64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.27.tgz#dc8072097327ecfadba1735562824ce8c05dd0bd"
|
||||
integrity sha512-ESjck9+EsHoTaKWlFKJpPZRN26uiav5gkI16RuI8WBxUdLrrAlYuYSndxxKgEn1csd968BX/8yQZATYf/9+/qg==
|
||||
|
||||
esbuild-linux-arm64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.27.tgz#c52b58cbe948426b1559910f521b0a3f396f10b8"
|
||||
integrity sha512-no6Mi17eV2tHlJnqBHRLekpZ2/VYx+NfGxKcBE/2xOMYwctsanCaXxw4zapvNrGE9X38vefVXLz6YCF8b1EHiQ==
|
||||
|
||||
esbuild-linux-arm@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.27.tgz#df869dbd67d4ee3a04b3c7273b6bd2b233e78a18"
|
||||
integrity sha512-JnnmgUBdqLQO9hoNZQqNHFWlNpSX82vzB3rYuCJMhtkuaWQEmQz6Lec1UIxJdC38ifEghNTBsF9bbe8dFilnCw==
|
||||
|
||||
esbuild-linux-mips64le@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.27.tgz#a2b646d9df368b01aa970a7b8968be6dd6b01d19"
|
||||
integrity sha512-NolWP2uOvIJpbwpsDbwfeExZOY1bZNlWE/kVfkzLMsSgqeVcl5YMen/cedRe9mKnpfLli+i0uSp7N+fkKNU27A==
|
||||
|
||||
esbuild-linux-ppc64le@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.27.tgz#9a21af766a0292578a3009c7408b8509cac7cefd"
|
||||
integrity sha512-/7dTjDvXMdRKmsSxKXeWyonuGgblnYDn0MI1xDC7J1VQXny8k1qgNp6VmrlsawwnsymSUUiThhkJsI+rx0taNA==
|
||||
|
||||
esbuild-linux-riscv64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.27.tgz#344a27f91568056a5903ad5841b447e00e78d740"
|
||||
integrity sha512-D+aFiUzOJG13RhrSmZgrcFaF4UUHpqj7XSKrIiCXIj1dkIkFqdrmqMSOtSs78dOtObWiOrFCDDzB24UyeEiNGg==
|
||||
|
||||
esbuild-linux-s390x@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.27.tgz#73a7309bd648a07ef58f069658f989a5096130db"
|
||||
integrity sha512-CD/D4tj0U4UQjELkdNlZhQ8nDHU5rBn6NGp47Hiz0Y7/akAY5i0oGadhEIg0WCY/HYVXFb3CsSPPwaKcTOW3bg==
|
||||
|
||||
esbuild-netbsd-64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.27.tgz#482a587cdbd18a6c264a05136596927deb46c30a"
|
||||
integrity sha512-h3mAld69SrO1VoaMpYl3a5FNdGRE/Nqc+E8VtHOag4tyBwhCQXxtvDDOAKOUQexBGca0IuR6UayQ4ntSX5ij1Q==
|
||||
|
||||
esbuild-openbsd-64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.27.tgz#e99f8cdc63f1628747b63edd124d53cf7796468d"
|
||||
integrity sha512-xwSje6qIZaDHXWoPpIgvL+7fC6WeubHHv18tusLYMwL+Z6bEa4Pbfs5IWDtQdHkArtfxEkIZz77944z8MgDxGw==
|
||||
|
||||
esbuild-sunos-64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.27.tgz#8611d825bcb8239c78d57452e83253a71942f45c"
|
||||
integrity sha512-/nBVpWIDjYiyMhuqIqbXXsxBc58cBVH9uztAOIfWShStxq9BNBik92oPQPJ57nzWXRNKQUEFWr4Q98utDWz7jg==
|
||||
|
||||
esbuild-windows-32@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.27.tgz#c06374206d4d92dd31d4fda299b09f51a35e82f6"
|
||||
integrity sha512-Q9/zEjhZJ4trtWhFWIZvS/7RUzzi8rvkoaS9oiizkHTTKd8UxFwn/Mm2OywsAfYymgUYm8+y2b+BKTNEFxUekw==
|
||||
|
||||
esbuild-windows-64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.27.tgz#756631c1d301dfc0d1a887deed2459ce4079582f"
|
||||
integrity sha512-b3y3vTSl5aEhWHK66ngtiS/c6byLf6y/ZBvODH1YkBM+MGtVL6jN38FdHUsZasCz9gFwYs/lJMVY9u7GL6wfYg==
|
||||
|
||||
esbuild-windows-arm64@0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.27.tgz#ad7e187193dcd18768b16065a950f4441d7173f4"
|
||||
integrity sha512-I/reTxr6TFMcR5qbIkwRGvldMIaiBu2+MP0LlD7sOlNXrfqIl9uNjsuxFPGEG4IRomjfQ5q8WT+xlF/ySVkqKg==
|
||||
|
||||
esbuild@^0.14.27:
|
||||
version "0.14.27"
|
||||
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.27.tgz#41fe0f1b6b68b9f77cac025009bc54bb96e616f1"
|
||||
integrity sha512-MZQt5SywZS3hA9fXnMhR22dv0oPGh6QtjJRIYbgL1AeqAoQZE+Qn5ppGYQAoHv/vq827flj4tIJ79Mrdiwk46Q==
|
||||
optionalDependencies:
|
||||
esbuild-android-64 "0.14.27"
|
||||
esbuild-android-arm64 "0.14.27"
|
||||
esbuild-darwin-64 "0.14.27"
|
||||
esbuild-darwin-arm64 "0.14.27"
|
||||
esbuild-freebsd-64 "0.14.27"
|
||||
esbuild-freebsd-arm64 "0.14.27"
|
||||
esbuild-linux-32 "0.14.27"
|
||||
esbuild-linux-64 "0.14.27"
|
||||
esbuild-linux-arm "0.14.27"
|
||||
esbuild-linux-arm64 "0.14.27"
|
||||
esbuild-linux-mips64le "0.14.27"
|
||||
esbuild-linux-ppc64le "0.14.27"
|
||||
esbuild-linux-riscv64 "0.14.27"
|
||||
esbuild-linux-s390x "0.14.27"
|
||||
esbuild-netbsd-64 "0.14.27"
|
||||
esbuild-openbsd-64 "0.14.27"
|
||||
esbuild-sunos-64 "0.14.27"
|
||||
esbuild-windows-32 "0.14.27"
|
||||
esbuild-windows-64 "0.14.27"
|
||||
esbuild-windows-arm64 "0.14.27"
|
||||
|
||||
escalade@^3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
|
||||
|
|
Loading…
Reference in New Issue