prepare for flow typing, add start of plugin sys

master
Drake 2 years ago
parent 64e5a9f113
commit db20d53d5a

@ -0,0 +1,10 @@
import esbuild from 'esbuild'
import flow from 'esbuild-plugin-flow'
esbuild.build({
entryPoints: ['src/index.js'],
outfile: 'dist/build.js',
bundle: true,
minify: true,
plugins: [flow(/\.flow\.jsx\.js?$/)]
})

@ -4,13 +4,15 @@
"description": "a devilesque client mod 😈",
"main": "src/index.js",
"scripts": {
"build": "esbuild src/index.js --bundle --minify --outfile=dist/build.js"
"build": "node build.mjs"
},
"author": "Drake",
"license": "BSD-3-Clause",
"devDependencies": {
"demonpatcher": "^0.0.5",
"esbuild": "^0.14.10",
"esbuild-plugin-flow": "github:dalcib/esbuild-plugin-flow",
"flow-bin": "^0.169.0",
"idb-keyval": "^6.0.3"
}
}

@ -3,11 +3,15 @@ lockfileVersion: 5.3
specifiers:
demonpatcher: ^0.0.5
esbuild: ^0.14.10
esbuild-plugin-flow: github:dalcib/esbuild-plugin-flow
flow-bin: ^0.169.0
idb-keyval: ^6.0.3
devDependencies:
demonpatcher: 0.0.5
esbuild: 0.14.10
esbuild-plugin-flow: github.com/dalcib/esbuild-plugin-flow/56171dea9250e707880a90582f73a82f69af64fb
flow-bin: 0.169.0
idb-keyval: 6.0.3
packages:
@ -185,12 +189,57 @@ packages:
esbuild-windows-arm64: 0.14.10
dev: true
/flow-bin/0.169.0:
resolution: {integrity: sha512-CflYPrd4KiMh5RyvoJbkM5Az1PKDzFBCu3tHqNcZkHeCbYgtLAcYVTs1w8aKDXfTiBSPZ7B9u5KT5RdmsY2mzQ==}
engines: {node: '>=0.10.0'}
hasBin: true
dev: true
/flow-parser/0.169.0:
resolution: {integrity: sha512-X1DFb6wxXpZLLqM9NX0Wm+4xoN6xAyJn8OwuiHsV0JJvLfD18Z+wbgJ1lM7ykTVINdu8v7Mu0gIzWMvnhKWBkA==}
engines: {node: '>=0.4.0'}
dev: true
/flow-remove-types/2.169.0:
resolution: {integrity: sha512-j0ThzmK2gyCc77MokOTgUMB7k1t5QqvN9yoeQcUyWQ+lmIbQBiJlOVgw1IyrI//4OZ4s73qrfKA73pqozEirzQ==}
engines: {node: '>=4'}
hasBin: true
dependencies:
flow-parser: 0.169.0
pirates: 3.0.2
vlq: 0.2.3
dev: true
/idb-keyval/6.0.3:
resolution: {integrity: sha512-yh8V7CnE6EQMu9YDwQXhRxwZh4nv+8xm/HV4ZqK4IiYFJBWYGjJuykADJbSP+F/GDXUBwCSSNn/14IpGL81TuA==}
dependencies:
safari-14-idb-fix: 3.0.0
dev: true
/node-modules-regexp/1.0.0:
resolution: {integrity: sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=}
engines: {node: '>=0.10.0'}
dev: true
/pirates/3.0.2:
resolution: {integrity: sha512-c5CgUJq6H2k6MJz72Ak1F5sN9n9wlSlJyEnwvpm9/y3WB4E3pHBDT2c6PEiS1vyJvq2bUxUAIu0EGf8Cx4Ic7Q==}
engines: {node: '>= 4'}
dependencies:
node-modules-regexp: 1.0.0
dev: true
/safari-14-idb-fix/3.0.0:
resolution: {integrity: sha512-eBNFLob4PMq8JA1dGyFn6G97q3/WzNtFK4RnzT1fnLq+9RyrGknzYiM/9B12MnKAxuj1IXr7UKYtTNtjyKMBog==}
dev: true
/vlq/0.2.3:
resolution: {integrity: sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==}
dev: true
github.com/dalcib/esbuild-plugin-flow/56171dea9250e707880a90582f73a82f69af64fb:
resolution: {tarball: https://codeload.github.com/dalcib/esbuild-plugin-flow/tar.gz/56171dea9250e707880a90582f73a82f69af64fb}
name: esbuild-plugin-flow
version: 0.3.2
dependencies:
flow-remove-types: 2.169.0
dev: true

@ -0,0 +1,20 @@
import { get, set } from 'idb-keyval';
async function addPlugin(onStart, onStop, getMeta, metadata=null) {
if (metadata === null) metadata = getMeta(); // expected output: {name: "name", desc: "description", author: "author"}
const obj = { // whether the plugin is started or stopped isn't going to be stored in the iDB, so it can be accessed more easily by all components
metadata: metadata,
code: {
start: onStart,
stop: onStop
},
enabled: false // should plugins be enabled by default? not sure
}
const globalSettings = await get("demoncord");
if (globalSettings[metadata.name] !== undefined) {
console.log("[Demoncord] Cannot add plugin that already exists!")
return false
} else {
}
}
Loading…
Cancel
Save