Refactor and renaming
This commit is contained in:
parent
6a10cbd9b7
commit
44cf4c6a72
48
.idea/codeStyles/Project.xml
generated
Normal file
48
.idea/codeStyles/Project.xml
generated
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<HTMLCodeStyleSettings>
|
||||||
|
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||||
|
<option name="HTML_ENFORCE_QUOTES" value="true" />
|
||||||
|
</HTMLCodeStyleSettings>
|
||||||
|
<JSCodeStyleSettings version="0">
|
||||||
|
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||||
|
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||||
|
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||||
|
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||||
|
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||||
|
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||||
|
</JSCodeStyleSettings>
|
||||||
|
<TypeScriptCodeStyleSettings version="0">
|
||||||
|
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||||
|
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||||
|
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||||
|
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||||
|
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||||
|
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||||
|
</TypeScriptCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="HTML">
|
||||||
|
<option name="SOFT_MARGINS" value="80" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="INDENT_SIZE" value="2" />
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||||
|
<option name="TAB_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="JavaScript">
|
||||||
|
<option name="SOFT_MARGINS" value="80" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="INDENT_SIZE" value="2" />
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||||
|
<option name="TAB_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="TypeScript">
|
||||||
|
<option name="SOFT_MARGINS" value="80" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="INDENT_SIZE" value="2" />
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||||
|
<option name="TAB_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
17
.idea/dataSources.xml
generated
Normal file
17
.idea/dataSources.xml
generated
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="data" uuid="b34630b0-d7b1-473e-9067-ffd03fa15451">
|
||||||
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/pages/data.db</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
<libraries>
|
||||||
|
<library>
|
||||||
|
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.36.0.3/sqlite-jdbc-3.36.0.3.jar</url>
|
||||||
|
</library>
|
||||||
|
</libraries>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/misc.xml
generated
Normal file
8
.idea/misc.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="SwUserDefinedSpecifications">
|
||||||
|
<option name="specTypeByUrl">
|
||||||
|
<map />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/prettier.xml
generated
Normal file
6
.idea/prettier.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="PrettierConfiguration">
|
||||||
|
<option name="myRunOnSave" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
}
|
89
desktop/.gitignore
vendored
Normal file
89
desktop/.gitignore
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# Webpack
|
||||||
|
.webpack/
|
||||||
|
|
||||||
|
# Electron-Forge
|
||||||
|
out/
|
19905
desktop/package-lock.json
generated
Normal file
19905
desktop/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
103
desktop/package.json
Normal file
103
desktop/package.json
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"name": "desktop",
|
||||||
|
"productName": "Silver Bullet",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "My Electron application description",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "electron-forge start",
|
||||||
|
"package": "electron-forge package",
|
||||||
|
"make": "electron-forge make",
|
||||||
|
"publish": "electron-forge publish",
|
||||||
|
"lint": "echo \"No linting configured\""
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": {
|
||||||
|
"name": "Zef Hemel",
|
||||||
|
"email": "zef@zef.me"
|
||||||
|
},
|
||||||
|
"targets": {
|
||||||
|
"desktop": {
|
||||||
|
"source": [
|
||||||
|
"src/index.ts",
|
||||||
|
"src/preload.ts"
|
||||||
|
],
|
||||||
|
"outputFormat": "commonjs",
|
||||||
|
"isLibrary": true,
|
||||||
|
"context": "electron-main",
|
||||||
|
"includeNodeModules": [
|
||||||
|
"@plugos/plugos",
|
||||||
|
"@silverbulletmd/common",
|
||||||
|
"@silverbulletmd/web",
|
||||||
|
"@silverbulletmd/server"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"config": {
|
||||||
|
"forge": {
|
||||||
|
"packagerConfig": {},
|
||||||
|
"makers": [
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-squirrel",
|
||||||
|
"config": {
|
||||||
|
"name": "desktop"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-zip",
|
||||||
|
"platforms": [
|
||||||
|
"darwin"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-deb",
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-rpm",
|
||||||
|
"config": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"electron": "^18.0.3",
|
||||||
|
"electron-squirrel-startup": "^1.0.0",
|
||||||
|
"@codemirror/lang-javascript": "^0.19.7",
|
||||||
|
"@codemirror/lang-markdown": "^0.19.6",
|
||||||
|
"@codemirror/language": "^0.19.0",
|
||||||
|
"@codemirror/legacy-modes": "^0.19.1",
|
||||||
|
"@codemirror/stream-parser": "^0.19.9",
|
||||||
|
"@jest/globals": "^27.5.1",
|
||||||
|
"@lezer/markdown": "^0.15.0",
|
||||||
|
"better-sqlite3": "^7.5.0",
|
||||||
|
"body-parser": "^1.19.2",
|
||||||
|
"buffer": "^6.0.3",
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"dexie": "^3.2.1",
|
||||||
|
"events": "^3.3.0",
|
||||||
|
"express": "^4.17.3",
|
||||||
|
"fake-indexeddb": "^3.1.7",
|
||||||
|
"jest": "^27.5.1",
|
||||||
|
"jsonwebtoken": "^8.5.1",
|
||||||
|
"knex": "^1.0.4",
|
||||||
|
"node-cron": "^3.0.0",
|
||||||
|
"node-fetch": "2",
|
||||||
|
"node-watch": "^0.7.3",
|
||||||
|
"nodemon": "^2.0.15",
|
||||||
|
"vm2": "^3.9.9",
|
||||||
|
"ws": "^8.5.0",
|
||||||
|
"yaml": "^1.10.2",
|
||||||
|
"yargs": "^17.3.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@electron-forge/cli": "^6.0.0-beta.63",
|
||||||
|
"@electron-forge/maker-deb": "^6.0.0-beta.63",
|
||||||
|
"@electron-forge/maker-rpm": "^6.0.0-beta.63",
|
||||||
|
"@electron-forge/maker-squirrel": "^6.0.0-beta.63",
|
||||||
|
"@electron-forge/maker-zip": "^6.0.0-beta.63",
|
||||||
|
"electron": "18.0.3",
|
||||||
|
"electron-rebuild": "^3.2.7"
|
||||||
|
}
|
||||||
|
}
|
7
desktop/src/index.css
Normal file
7
desktop/src/index.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
|
||||||
|
Arial, sans-serif;
|
||||||
|
margin: auto;
|
||||||
|
max-width: 38rem;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
12
desktop/src/index.html
Normal file
12
desktop/src/index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>Hello World!</title>
|
||||||
|
<link rel="stylesheet" href="index.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>💖 Hello World!</h1>
|
||||||
|
<p>Welcome to your Electron application.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
116
desktop/src/index.ts
Normal file
116
desktop/src/index.ts
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
import { app, BrowserWindow, dialog, Menu } from "electron";
|
||||||
|
const path = require("path");
|
||||||
|
import { ExpressServer } from "@silverbulletmd/server/api_server";
|
||||||
|
import * as fs from "fs";
|
||||||
|
|
||||||
|
let mainWindow: BrowserWindow | undefined;
|
||||||
|
|
||||||
|
const mainMenuTemplate: Electron.MenuItemConstructorOptions[] = [
|
||||||
|
{
|
||||||
|
label: "File",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "Switch Folder",
|
||||||
|
click: async () => {
|
||||||
|
let result = await dialog.showOpenDialog(mainWindow!, {
|
||||||
|
properties: ["openDirectory"],
|
||||||
|
});
|
||||||
|
if (result.canceled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
openFolder(result.filePaths[0]).catch(console.error);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Exit",
|
||||||
|
click: () => {
|
||||||
|
app.quit();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ label: "Edit" },
|
||||||
|
{ label: "Tools", submenu: [{ label: "Sup" }] },
|
||||||
|
];
|
||||||
|
|
||||||
|
if (process.platform === "darwin") {
|
||||||
|
const name = "Fire Sale";
|
||||||
|
mainMenuTemplate.unshift({ label: name });
|
||||||
|
}
|
||||||
|
const mainMenu = Menu.buildFromTemplate(mainMenuTemplate);
|
||||||
|
Menu.setApplicationMenu(mainMenu);
|
||||||
|
|
||||||
|
const port = 3002;
|
||||||
|
const distDir = path.resolve(
|
||||||
|
`${__dirname}/../../packages/silverbullet-web/dist`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
||||||
|
if (require("electron-squirrel-startup")) {
|
||||||
|
// eslint-disable-line global-require
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentFolder = app.getPath("userData");
|
||||||
|
|
||||||
|
fs.mkdirSync(currentFolder, { recursive: true });
|
||||||
|
let server: ExpressServer | undefined;
|
||||||
|
|
||||||
|
async function openFolder(path: string) {
|
||||||
|
console.log("Opening folder", path);
|
||||||
|
if (server) {
|
||||||
|
await server.stop();
|
||||||
|
}
|
||||||
|
currentFolder = path;
|
||||||
|
console.log("Starting new server");
|
||||||
|
server = new ExpressServer(port, path, distDir);
|
||||||
|
await server.start();
|
||||||
|
console.log("Reloading page");
|
||||||
|
mainWindow!.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createWindow() {
|
||||||
|
// Create the browser window.
|
||||||
|
mainWindow = new BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
webPreferences: {
|
||||||
|
preload: path.join(__dirname, "preload.js"),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
await openFolder(currentFolder);
|
||||||
|
|
||||||
|
// and load the index.html of the app.
|
||||||
|
mainWindow.loadURL(`http://localhost:${port}`);
|
||||||
|
|
||||||
|
// Open the DevTools.
|
||||||
|
mainWindow.webContents.openDevTools();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method will be called when Electron has finished
|
||||||
|
// initialization and is ready to create browser windows.
|
||||||
|
// Some APIs can only be used after this event occurs.
|
||||||
|
app.on("ready", async () => {
|
||||||
|
await createWindow();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Quit when all windows are closed, except on macOS. There, it's common
|
||||||
|
// for applications and their menu bar to stay active until the user quits
|
||||||
|
// explicitly with Cmd + Q.
|
||||||
|
app.on("window-all-closed", () => {
|
||||||
|
if (process.platform !== "darwin") {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on("activate", () => {
|
||||||
|
// On OS X it's common to re-create a window in the app when the
|
||||||
|
// dock icon is clicked and there are no other windows open.
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
|
createWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// In this file you can include the rest of your app's specific main process
|
||||||
|
// code. You can also put them in separate files and import them here.
|
163
package-lock.json
generated
163
package-lock.json
generated
@ -2459,32 +2459,32 @@
|
|||||||
"@parcel/core": "^2.3.2"
|
"@parcel/core": "^2.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@silverbulletmd/common": {
|
"node_modules/@plugos/plugos": {
|
||||||
"resolved": "packages/silverbullet-common",
|
|
||||||
"link": true
|
|
||||||
},
|
|
||||||
"node_modules/@silverbulletmd/plugos": {
|
|
||||||
"resolved": "packages/plugos",
|
"resolved": "packages/plugos",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
"node_modules/@silverbulletmd/plugos-silverbullet-syscall": {
|
"node_modules/@plugos/plugos-silverbullet-syscall": {
|
||||||
"resolved": "packages/plugos-silverbullet-syscall",
|
"resolved": "packages/plugos-silverbullet-syscall",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
"node_modules/@silverbulletmd/plugos-syscall": {
|
"node_modules/@plugos/plugos-syscall": {
|
||||||
"resolved": "packages/plugos-syscall",
|
"resolved": "packages/plugos-syscall",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@silverbulletmd/common": {
|
||||||
|
"resolved": "packages/common",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
"node_modules/@silverbulletmd/plugs": {
|
"node_modules/@silverbulletmd/plugs": {
|
||||||
"resolved": "packages/plugs",
|
"resolved": "packages/plugs",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
"node_modules/@silverbulletmd/server": {
|
"node_modules/@silverbulletmd/server": {
|
||||||
"resolved": "packages/silverbullet-server",
|
"resolved": "packages/server",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
"node_modules/@silverbulletmd/web": {
|
"node_modules/@silverbulletmd/web": {
|
||||||
"resolved": "packages/silverbullet-web",
|
"resolved": "packages/web",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
"node_modules/@sindresorhus/is": {
|
"node_modules/@sindresorhus/is": {
|
||||||
@ -11020,8 +11020,12 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"packages/common": {
|
||||||
|
"name": "@silverbulletmd/common",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
"packages/plugos": {
|
"packages/plugos": {
|
||||||
"name": "@silverbulletmd/plugos",
|
"name": "@plugos/plugos",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -11077,11 +11081,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/plugos-silverbullet-syscall": {
|
"packages/plugos-silverbullet-syscall": {
|
||||||
"name": "@silverbulletmd/plugos-silverbullet-syscall",
|
"name": "@plugos/plugos-silverbullet-syscall",
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
},
|
},
|
||||||
"packages/plugos-syscall": {
|
"packages/plugos-syscall": {
|
||||||
"name": "@silverbulletmd/plugos-syscall",
|
"name": "@plugos/plugos-syscall",
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
},
|
},
|
||||||
"packages/plugs": {
|
"packages/plugs": {
|
||||||
@ -11109,11 +11113,7 @@
|
|||||||
"node": ">= 14"
|
"node": ">= 14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/silverbullet-common": {
|
"packages/server": {
|
||||||
"name": "@silverbulletmd/common",
|
|
||||||
"version": "1.0.0"
|
|
||||||
},
|
|
||||||
"packages/silverbullet-server": {
|
|
||||||
"name": "@silverbulletmd/server",
|
"name": "@silverbulletmd/server",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -11125,6 +11125,67 @@
|
|||||||
"@codemirror/stream-parser": "^0.19.9",
|
"@codemirror/stream-parser": "^0.19.9",
|
||||||
"@jest/globals": "^27.5.1",
|
"@jest/globals": "^27.5.1",
|
||||||
"@lezer/markdown": "^0.15.0",
|
"@lezer/markdown": "^0.15.0",
|
||||||
|
"@silverbulletmd/web": "^0.0.1",
|
||||||
|
"better-sqlite3": "^7.5.0",
|
||||||
|
"body-parser": "^1.19.2",
|
||||||
|
"buffer": "^6.0.3",
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"dexie": "^3.2.1",
|
||||||
|
"events": "^3.3.0",
|
||||||
|
"express": "^4.17.3",
|
||||||
|
"fake-indexeddb": "^3.1.7",
|
||||||
|
"jest": "^27.5.1",
|
||||||
|
"jsonwebtoken": "^8.5.1",
|
||||||
|
"knex": "^1.0.4",
|
||||||
|
"node-cron": "^3.0.0",
|
||||||
|
"node-fetch": "2",
|
||||||
|
"node-watch": "^0.7.3",
|
||||||
|
"nodemon": "^2.0.15",
|
||||||
|
"vm2": "^3.9.9",
|
||||||
|
"ws": "^8.5.0",
|
||||||
|
"yaml": "^1.10.2",
|
||||||
|
"yargs": "^17.3.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"silverbullet": "dist/server.js"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@parcel/packager-raw-url": "2.3.2",
|
||||||
|
"@parcel/service-worker": "2.3.2",
|
||||||
|
"@parcel/transformer-inline-string": "2.3.2",
|
||||||
|
"@parcel/transformer-sass": "2.3.2",
|
||||||
|
"@parcel/transformer-webmanifest": "2.3.2",
|
||||||
|
"@parcel/validator-typescript": "2.3.2",
|
||||||
|
"@types/cors": "^2.8.12",
|
||||||
|
"@types/events": "^3.0.0",
|
||||||
|
"@types/express": "^4.17.13",
|
||||||
|
"@types/jest": "^27.4.1",
|
||||||
|
"@types/node": "^17.0.21",
|
||||||
|
"@vscode/sqlite3": "^5.0.7",
|
||||||
|
"assert": "^2.0.0",
|
||||||
|
"parcel": "2.3.2",
|
||||||
|
"typescript": "^4.6.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"packages/silverbullet-common": {
|
||||||
|
"name": "@silverbulletmd/common",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"extraneous": true
|
||||||
|
},
|
||||||
|
"packages/silverbullet-server": {
|
||||||
|
"name": "@silverbulletmd/server",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"extraneous": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@codemirror/lang-javascript": "^0.19.7",
|
||||||
|
"@codemirror/lang-markdown": "^0.19.6",
|
||||||
|
"@codemirror/language": "^0.19.0",
|
||||||
|
"@codemirror/legacy-modes": "^0.19.1",
|
||||||
|
"@codemirror/stream-parser": "^0.19.9",
|
||||||
|
"@jest/globals": "^27.5.1",
|
||||||
|
"@lezer/markdown": "^0.15.0",
|
||||||
|
"@silverbulletmd/web": "^0.0.1",
|
||||||
"better-sqlite3": "^7.5.0",
|
"better-sqlite3": "^7.5.0",
|
||||||
"body-parser": "^1.19.2",
|
"body-parser": "^1.19.2",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
@ -11167,6 +11228,57 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/silverbullet-web": {
|
"packages/silverbullet-web": {
|
||||||
|
"name": "@silverbulletmd/web",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"extraneous": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@codemirror/autocomplete": "^0.19.1",
|
||||||
|
"@codemirror/closebrackets": "^0.19.1",
|
||||||
|
"@codemirror/commands": "^0.19.8",
|
||||||
|
"@codemirror/highlight": "^0.19.0",
|
||||||
|
"@codemirror/history": "^0.19.2",
|
||||||
|
"@codemirror/lang-html": "^0.19.4",
|
||||||
|
"@codemirror/lang-javascript": "^0.19.7",
|
||||||
|
"@codemirror/lang-markdown": "^0.19.6",
|
||||||
|
"@codemirror/language": "^0.19.0",
|
||||||
|
"@codemirror/legacy-modes": "^0.19.1",
|
||||||
|
"@codemirror/matchbrackets": "^0.19.4",
|
||||||
|
"@codemirror/search": "^0.19.9",
|
||||||
|
"@codemirror/state": "^0.19.7",
|
||||||
|
"@codemirror/stream-parser": "^0.19.9",
|
||||||
|
"@codemirror/text": "^0.19.6",
|
||||||
|
"@codemirror/view": "^0.19.42",
|
||||||
|
"@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",
|
||||||
|
"@lezer/markdown": "^0.15.0",
|
||||||
|
"fake-indexeddb": "^3.1.7",
|
||||||
|
"jest": "^27.5.1",
|
||||||
|
"knex": "^1.0.4",
|
||||||
|
"react": "^17.0.2",
|
||||||
|
"react-dom": "^17.0.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@parcel/packager-raw-url": "2.3.2",
|
||||||
|
"@parcel/service-worker": "2.3.2",
|
||||||
|
"@parcel/transformer-inline-string": "2.3.2",
|
||||||
|
"@parcel/transformer-sass": "2.3.2",
|
||||||
|
"@parcel/transformer-webmanifest": "2.3.2",
|
||||||
|
"@parcel/validator-typescript": "2.3.2",
|
||||||
|
"@types/cors": "^2.8.12",
|
||||||
|
"@types/events": "^3.0.0",
|
||||||
|
"@types/jest": "^27.4.1",
|
||||||
|
"@types/react": "^17.0.39",
|
||||||
|
"@types/react-dom": "^17.0.11",
|
||||||
|
"assert": "^2.0.0",
|
||||||
|
"parcel": "2.3.2",
|
||||||
|
"prettier": "^2.5.1",
|
||||||
|
"typescript": "^4.6.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"packages/web": {
|
||||||
"name": "@silverbulletmd/web",
|
"name": "@silverbulletmd/web",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -12933,10 +13045,7 @@
|
|||||||
"nullthrows": "^1.1.1"
|
"nullthrows": "^1.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@silverbulletmd/common": {
|
"@plugos/plugos": {
|
||||||
"version": "file:packages/silverbullet-common"
|
|
||||||
},
|
|
||||||
"@silverbulletmd/plugos": {
|
|
||||||
"version": "file:packages/plugos",
|
"version": "file:packages/plugos",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@jest/globals": "^27.5.1",
|
"@jest/globals": "^27.5.1",
|
||||||
@ -12984,12 +13093,15 @@
|
|||||||
"yargs": "^17.3.1"
|
"yargs": "^17.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@silverbulletmd/plugos-silverbullet-syscall": {
|
"@plugos/plugos-silverbullet-syscall": {
|
||||||
"version": "file:packages/plugos-silverbullet-syscall"
|
"version": "file:packages/plugos-silverbullet-syscall"
|
||||||
},
|
},
|
||||||
"@silverbulletmd/plugos-syscall": {
|
"@plugos/plugos-syscall": {
|
||||||
"version": "file:packages/plugos-syscall"
|
"version": "file:packages/plugos-syscall"
|
||||||
},
|
},
|
||||||
|
"@silverbulletmd/common": {
|
||||||
|
"version": "file:packages/common"
|
||||||
|
},
|
||||||
"@silverbulletmd/plugs": {
|
"@silverbulletmd/plugs": {
|
||||||
"version": "file:packages/plugs",
|
"version": "file:packages/plugs",
|
||||||
"requires": {
|
"requires": {
|
||||||
@ -13011,7 +13123,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@silverbulletmd/server": {
|
"@silverbulletmd/server": {
|
||||||
"version": "file:packages/silverbullet-server",
|
"version": "file:packages/server",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@codemirror/lang-javascript": "^0.19.7",
|
"@codemirror/lang-javascript": "^0.19.7",
|
||||||
"@codemirror/lang-markdown": "^0.19.6",
|
"@codemirror/lang-markdown": "^0.19.6",
|
||||||
@ -13026,6 +13138,7 @@
|
|||||||
"@parcel/transformer-sass": "2.3.2",
|
"@parcel/transformer-sass": "2.3.2",
|
||||||
"@parcel/transformer-webmanifest": "2.3.2",
|
"@parcel/transformer-webmanifest": "2.3.2",
|
||||||
"@parcel/validator-typescript": "2.3.2",
|
"@parcel/validator-typescript": "2.3.2",
|
||||||
|
"@silverbulletmd/web": "^0.0.1",
|
||||||
"@types/cors": "^2.8.12",
|
"@types/cors": "^2.8.12",
|
||||||
"@types/events": "^3.0.0",
|
"@types/events": "^3.0.0",
|
||||||
"@types/express": "^4.17.13",
|
"@types/express": "^4.17.13",
|
||||||
@ -13057,7 +13170,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@silverbulletmd/web": {
|
"@silverbulletmd/web": {
|
||||||
"version": "file:packages/silverbullet-web",
|
"version": "file:packages/web",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@codemirror/autocomplete": "^0.19.1",
|
"@codemirror/autocomplete": "^0.19.1",
|
||||||
"@codemirror/closebrackets": "^0.19.1",
|
"@codemirror/closebrackets": "^0.19.1",
|
||||||
|
16
package.json
16
package.json
@ -7,23 +7,13 @@
|
|||||||
"@lezer/common": "https://github.com/zefhemel/common.git#046c880d1fcab713cadad327a5b7d8bb5de6522c"
|
"@lezer/common": "https://github.com/zefhemel/common.git#046c880d1fcab713cadad327a5b7d8bb5de6522c"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "rm -rf .parcel-cache && parcel watch packages/{silverbullet-web,silverbullet-server,plugos} desktop",
|
"watch": "rm -rf .parcel-cache && parcel watch packages/{web,server,plugos} desktop",
|
||||||
"clean": "rm -rf .parcel-cache packages/*/dist",
|
"clean": "rm -rf .parcel-cache packages/*/dist",
|
||||||
"build": "parcel build packages/{silverbullet-web,silverbullet-server,plugos}",
|
"build": "parcel build packages/{web,server,plugos}",
|
||||||
"plugs": "cd packages/plugs && npm run watch",
|
"plugs": "cd packages/plugs && npm run watch",
|
||||||
"server": "cd packages/silverbullet-server && npm start",
|
"server": "cd packages/server && npm start",
|
||||||
"test": "jest packages/*/dist/test"
|
"test": "jest packages/*/dist/test"
|
||||||
},
|
},
|
||||||
"targets": {
|
|
||||||
"test": {
|
|
||||||
"source": [
|
|
||||||
"src/index.js"
|
|
||||||
],
|
|
||||||
"outputFormat": "commonjs",
|
|
||||||
"isLibrary": true,
|
|
||||||
"context": "electron-main"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@parcel/core": "2.3.2",
|
"@parcel/core": "2.3.2",
|
||||||
"@parcel/packager-raw-url": "2.3.2",
|
"@parcel/packager-raw-url": "2.3.2",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as plugos from "../plugos/types";
|
import * as plugos from "@plugos/plugos/types";
|
||||||
import { EndpointHookT } from "../plugos/hooks/endpoint";
|
import { EndpointHookT } from "@plugos/plugos/hooks/endpoint";
|
||||||
import { CronHookT } from "../plugos/hooks/node_cron";
|
import { CronHookT } from "@plugos/plugos/hooks/node_cron";
|
||||||
import { EventHookT } from "../plugos/hooks/event";
|
import { EventHookT } from "@plugos/plugos/hooks/event";
|
||||||
import { CommandHookT } from "@silverbulletmd/web/hooks/command";
|
import { CommandHookT } from "@silverbulletmd/web/hooks/command";
|
||||||
import { SlashCommandHookT } from "@silverbulletmd/web/hooks/slash_command";
|
import { SlashCommandHookT } from "@silverbulletmd/web/hooks/slash_command";
|
||||||
|
|
@ -1,8 +1,16 @@
|
|||||||
import { mkdir, readdir, readFile, stat, unlink, utimes, writeFile } from "fs/promises";
|
import {
|
||||||
|
mkdir,
|
||||||
|
readdir,
|
||||||
|
readFile,
|
||||||
|
stat,
|
||||||
|
unlink,
|
||||||
|
utimes,
|
||||||
|
writeFile,
|
||||||
|
} from "fs/promises";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import { PageMeta } from "../types";
|
import { PageMeta } from "../types";
|
||||||
import { SpacePrimitives } from "./space_primitives";
|
import { SpacePrimitives } from "./space_primitives";
|
||||||
import { Plug } from "../../plugos/plug";
|
import { Plug } from "@plugos/plugos/plug";
|
||||||
|
|
||||||
export class DiskSpacePrimitives implements SpacePrimitives {
|
export class DiskSpacePrimitives implements SpacePrimitives {
|
||||||
rootPath: string;
|
rootPath: string;
|
@ -1,7 +1,7 @@
|
|||||||
import { SpacePrimitives } from "./space_primitives";
|
import { SpacePrimitives } from "./space_primitives";
|
||||||
import { EventHook } from "../../plugos/hooks/event";
|
import { EventHook } from "@plugos/plugos/hooks/event";
|
||||||
import { PageMeta } from "../types";
|
import { PageMeta } from "../types";
|
||||||
import { Plug } from "../../plugos/plug";
|
import { Plug } from "@plugos/plugos/plug";
|
||||||
import { trashPrefix } from "./constants";
|
import { trashPrefix } from "./constants";
|
||||||
|
|
||||||
export class EventedSpacePrimitives implements SpacePrimitives {
|
export class EventedSpacePrimitives implements SpacePrimitives {
|
@ -1,5 +1,5 @@
|
|||||||
import { PageMeta } from "../types";
|
import { PageMeta } from "../types";
|
||||||
import { Plug } from "../../plugos/plug";
|
import { Plug } from "@plugos/plugos/plug";
|
||||||
import { SpacePrimitives } from "./space_primitives";
|
import { SpacePrimitives } from "./space_primitives";
|
||||||
|
|
||||||
export class HttpSpacePrimitives implements SpacePrimitives {
|
export class HttpSpacePrimitives implements SpacePrimitives {
|
||||||
@ -7,7 +7,6 @@ export class HttpSpacePrimitives implements SpacePrimitives {
|
|||||||
private plugUrl: string;
|
private plugUrl: string;
|
||||||
|
|
||||||
constructor(url: string) {
|
constructor(url: string) {
|
||||||
console.log("UR", url);
|
|
||||||
this.pageUrl = url + "/fs";
|
this.pageUrl = url + "/fs";
|
||||||
this.plugUrl = url + "/plug";
|
this.plugUrl = url + "/plug";
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
import { SpacePrimitives } from "./space_primitives";
|
import { SpacePrimitives } from "./space_primitives";
|
||||||
import { PageMeta } from "../types";
|
import { PageMeta } from "../types";
|
||||||
import Dexie, { Table } from "dexie";
|
import Dexie, { Table } from "dexie";
|
||||||
import { Plug } from "../../plugos/plug";
|
import { Plug } from "@plugos/plugos/plug";
|
||||||
|
|
||||||
type Page = {
|
type Page = {
|
||||||
name: string;
|
name: string;
|
@ -1,7 +1,7 @@
|
|||||||
import { SpacePrimitives } from "./space_primitives";
|
import { SpacePrimitives } from "./space_primitives";
|
||||||
import { PageMeta } from "../types";
|
import { PageMeta } from "../types";
|
||||||
import { EventEmitter } from "../event";
|
import { EventEmitter } from "@plugos/plugos/event";
|
||||||
import { Plug } from "../../plugos/plug";
|
import { Plug } from "@plugos/plugos/plug";
|
||||||
import { Manifest } from "../manifest";
|
import { Manifest } from "../manifest";
|
||||||
import { plugPrefix, trashPrefix } from "./constants";
|
import { plugPrefix, trashPrefix } from "./constants";
|
||||||
import { safeRun } from "../util";
|
import { safeRun } from "../util";
|
@ -1,4 +1,4 @@
|
|||||||
import { Plug } from "../../plugos/plug";
|
import { Plug } from "@plugos/plugos/plug";
|
||||||
import { PageMeta } from "../types";
|
import { PageMeta } from "../types";
|
||||||
|
|
||||||
export interface SpacePrimitives {
|
export interface SpacePrimitives {
|
@ -1,4 +1,4 @@
|
|||||||
import { SysCallMapping } from "../../plugos/system";
|
import { SysCallMapping } from "@plugos/plugos/system";
|
||||||
import { parse } from "../parse_tree";
|
import { parse } from "../parse_tree";
|
||||||
import { Language } from "@codemirror/language";
|
import { Language } from "@codemirror/language";
|
||||||
import type { ParseTree } from "../tree";
|
import type { ParseTree } from "../tree";
|
@ -1,5 +1,5 @@
|
|||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall";
|
||||||
import { FilterOption } from "../silverbullet-common/types";
|
import { FilterOption } from "../common/types";
|
||||||
|
|
||||||
export function getCurrentPage(): Promise<string> {
|
export function getCurrentPage(): Promise<string> {
|
||||||
return syscall("editor.getCurrentPage");
|
return syscall("editor.getCurrentPage");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall";
|
||||||
|
|
||||||
import type { ParseTree } from "../silverbullet-common/tree";
|
import type { ParseTree } from "../common/tree";
|
||||||
|
|
||||||
export async function parseMarkdown(text: string): Promise<ParseTree> {
|
export async function parseMarkdown(text: string): Promise<ParseTree> {
|
||||||
return syscall("markdown.parseMarkdown", text);
|
return syscall("markdown.parseMarkdown", text);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"name": "@silverbulletmd/plugos-silverbullet-syscall",
|
"name": "@plugos/plugos-silverbullet-syscall",
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall";
|
||||||
import { PageMeta } from "../silverbullet-common/types";
|
import { PageMeta } from "../common/types";
|
||||||
|
|
||||||
export async function listPages(): Promise<PageMeta[]> {
|
export async function listPages(): Promise<PageMeta[]> {
|
||||||
return syscall("space.listPages");
|
return syscall("space.listPages");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"name": "@silverbulletmd/plugos-syscall",
|
"name": "@plugos/plugos-syscall",
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,13 @@ import yargs from "yargs";
|
|||||||
import { hideBin } from "yargs/helpers";
|
import { hideBin } from "yargs/helpers";
|
||||||
import { Manifest } from "../types";
|
import { Manifest } from "../types";
|
||||||
import YAML from "yaml";
|
import YAML from "yaml";
|
||||||
import { preloadModules } from "../../silverbullet-common/preload_modules";
|
|
||||||
import { mkdirSync } from "fs";
|
import { mkdirSync } from "fs";
|
||||||
|
|
||||||
async function compile(
|
async function compile(
|
||||||
filePath: string,
|
filePath: string,
|
||||||
functionName: string,
|
functionName: string,
|
||||||
debug: boolean,
|
debug: boolean,
|
||||||
|
excludeModules: string[],
|
||||||
meta = false
|
meta = false
|
||||||
) {
|
) {
|
||||||
let outFile = "_out.tmp";
|
let outFile = "_out.tmp";
|
||||||
@ -40,7 +40,7 @@ async function compile(
|
|||||||
minify: !debug,
|
minify: !debug,
|
||||||
outfile: outFile,
|
outfile: outFile,
|
||||||
metafile: true,
|
metafile: true,
|
||||||
external: preloadModules,
|
external: excludeModules,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (meta) {
|
if (meta) {
|
||||||
@ -57,7 +57,11 @@ async function compile(
|
|||||||
return mod;})()`;
|
return mod;})()`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function bundle(manifestPath: string, sourceMaps: boolean) {
|
async function bundle(
|
||||||
|
manifestPath: string,
|
||||||
|
sourceMaps: boolean,
|
||||||
|
excludeModules: string[]
|
||||||
|
) {
|
||||||
const rootPath = path.dirname(manifestPath);
|
const rootPath = path.dirname(manifestPath);
|
||||||
const manifest = YAML.parse(
|
const manifest = YAML.parse(
|
||||||
(await readFile(manifestPath)).toString()
|
(await readFile(manifestPath)).toString()
|
||||||
@ -70,7 +74,12 @@ async function bundle(manifestPath: string, sourceMaps: boolean) {
|
|||||||
[filePath, jsFunctionName] = filePath.split(":");
|
[filePath, jsFunctionName] = filePath.split(":");
|
||||||
}
|
}
|
||||||
|
|
||||||
def.code = await compile(filePath, jsFunctionName, sourceMaps);
|
def.code = await compile(
|
||||||
|
filePath,
|
||||||
|
jsFunctionName,
|
||||||
|
sourceMaps,
|
||||||
|
excludeModules
|
||||||
|
);
|
||||||
delete def.path;
|
delete def.path;
|
||||||
}
|
}
|
||||||
return manifest;
|
return manifest;
|
||||||
@ -79,9 +88,10 @@ async function bundle(manifestPath: string, sourceMaps: boolean) {
|
|||||||
async function buildManifest(
|
async function buildManifest(
|
||||||
manifestPath: string,
|
manifestPath: string,
|
||||||
distPath: string,
|
distPath: string,
|
||||||
debug: boolean
|
debug: boolean,
|
||||||
|
excludeModules: string[]
|
||||||
) {
|
) {
|
||||||
let generatedManifest = await bundle(manifestPath, debug);
|
let generatedManifest = await bundle(manifestPath, debug, excludeModules);
|
||||||
const outFile =
|
const outFile =
|
||||||
manifestPath.substring(
|
manifestPath.substring(
|
||||||
0,
|
0,
|
||||||
@ -106,20 +116,31 @@ async function run() {
|
|||||||
type: "string",
|
type: "string",
|
||||||
default: ".",
|
default: ".",
|
||||||
})
|
})
|
||||||
|
.option("exclude", {
|
||||||
|
type: "array",
|
||||||
|
default: [],
|
||||||
|
})
|
||||||
.parse();
|
.parse();
|
||||||
if (args._.length === 0) {
|
if (args._.length === 0) {
|
||||||
console.log(
|
console.log(
|
||||||
"Usage: plugos-bundle [--debug] [--dist <path>] <manifest.plug.yaml> <manifest2.plug.yaml> ..."
|
"Usage: plugos-bundle [--debug] [--dist <path>] [--exclude package1 package2] -- <manifest.plug.yaml> <manifest2.plug.yaml> ..."
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("Args", args);
|
||||||
|
|
||||||
async function buildAll() {
|
async function buildAll() {
|
||||||
mkdirSync(args.dist, { recursive: true });
|
mkdirSync(args.dist, { recursive: true });
|
||||||
for (const plugManifestPath of args._) {
|
for (const plugManifestPath of args._) {
|
||||||
let manifestPath = plugManifestPath as string;
|
let manifestPath = plugManifestPath as string;
|
||||||
try {
|
try {
|
||||||
await buildManifest(manifestPath, args.dist, !!args.debug);
|
await buildManifest(
|
||||||
|
manifestPath,
|
||||||
|
args.dist,
|
||||||
|
!!args.debug,
|
||||||
|
args.exclude
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Error building ${manifestPath}:`, e);
|
console.error(`Error building ${manifestPath}:`, e);
|
||||||
}
|
}
|
||||||
|
@ -36,15 +36,21 @@ class NodeWorkerWrapper implements WorkerLike {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Look for the node_modules directory, to be passed to the worker to find e.g. the vm2 module
|
// Look for the node_modules directory, to be passed to the worker to find e.g. the vm2 module
|
||||||
let nodeModulesDir = __dirname;
|
export let nodeModulesDir = __dirname;
|
||||||
while (!fs.existsSync(nodeModulesDir + "/node_modules/vm2")) {
|
while (!fs.existsSync(nodeModulesDir + "/node_modules/vm2")) {
|
||||||
nodeModulesDir = path.dirname(nodeModulesDir);
|
nodeModulesDir = path.dirname(nodeModulesDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createSandbox(plug: Plug<any>) {
|
export function createSandbox(
|
||||||
|
plug: Plug<any>,
|
||||||
|
preloadedModules: string[] = []
|
||||||
|
) {
|
||||||
let worker = new Worker(workerCode, {
|
let worker = new Worker(workerCode, {
|
||||||
eval: true,
|
eval: true,
|
||||||
workerData: path.join(nodeModulesDir, "node_modules"),
|
workerData: {
|
||||||
|
nodeModulesPath: path.join(nodeModulesDir, "node_modules"),
|
||||||
|
preloadedModules,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return new Sandbox(plug, new NodeWorkerWrapper(worker));
|
return new Sandbox(plug, new NodeWorkerWrapper(worker));
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
import { preloadModules } from "../../silverbullet-common/preload_modules";
|
const {
|
||||||
|
parentPort,
|
||||||
|
workerData: { preloadedModules, nodeModulesPath },
|
||||||
|
} = require("worker_threads");
|
||||||
|
|
||||||
const { parentPort, workerData } = require("worker_threads");
|
const { VM, VMScript } = require(`${nodeModulesPath}/vm2`);
|
||||||
const { VM, VMScript } = require(`${workerData}/vm2`);
|
|
||||||
const fetch = require(`${workerData}/node-fetch`);
|
|
||||||
const WebSocket = require(`${workerData}/ws`);
|
|
||||||
|
|
||||||
// console.log("Process env", process.env);
|
|
||||||
|
|
||||||
let loadedFunctions = new Map<string, Function>();
|
let loadedFunctions = new Map<string, Function>();
|
||||||
let pendingRequests = new Map<
|
let pendingRequests = new Map<
|
||||||
@ -26,14 +24,14 @@ let vm = new VM({
|
|||||||
clearTimeout,
|
clearTimeout,
|
||||||
setInterval,
|
setInterval,
|
||||||
clearInterval,
|
clearInterval,
|
||||||
fetch,
|
fetch: require(`${nodeModulesPath}/node-fetch`),
|
||||||
WebSocket,
|
WebSocket: require(`${nodeModulesPath}/ws`),
|
||||||
// This is only going to be called for pre-bundled modules, we won't allow
|
// This is only going to be called for pre-bundled modules, we won't allow
|
||||||
// arbitrary requiring of modules
|
// arbitrary requiring of modules
|
||||||
require: (moduleName: string): any => {
|
require: (moduleName: string): any => {
|
||||||
// console.log("Loading", moduleName);
|
// console.log("Loading", moduleName);
|
||||||
if (preloadModules.includes(moduleName)) {
|
if (preloadedModules.includes(moduleName)) {
|
||||||
return require(`${workerData}/${moduleName}`);
|
return require(`${nodeModulesPath}/${moduleName}`);
|
||||||
} else {
|
} else {
|
||||||
throw Error("Cannot import arbitrary modules");
|
throw Error("Cannot import arbitrary modules");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@silverbulletmd/plugos",
|
"name": "@plugos/plugos",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Hook, Manifest, RuntimeEnvironment } from "./types";
|
import { Hook, Manifest, RuntimeEnvironment } from "./types";
|
||||||
import { EventEmitter } from "../silverbullet-common/event";
|
import { EventEmitter } from "./event";
|
||||||
import { SandboxFactory } from "./sandbox";
|
import { SandboxFactory } from "./sandbox";
|
||||||
import { Plug } from "./plug";
|
import { Plug } from "./plug";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"include": ["bin/*", "environments/*", "hooks/**", "syscalls/*", "*"],
|
"include": ["bin/*", "environments/*", "hooks/*", "syscalls/*", "*"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { insertAtCursor } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import { insertAtCursor } from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
|
|
||||||
const dateMatchRegex = /(\d{4}\-\d{2}\-\d{2})/g;
|
const dateMatchRegex = /(\d{4}\-\d{2}\-\d{2})/g;
|
||||||
|
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
||||||
|
|
||||||
import { batchSet, scanPrefixGlobal } from "@silverbulletmd/plugos-silverbullet-syscall/index";
|
import {
|
||||||
import { collectNodesOfType, ParseTree, renderToText } from "@silverbulletmd/common/tree";
|
batchSet,
|
||||||
|
scanPrefixGlobal,
|
||||||
|
} from "@plugos/plugos-silverbullet-syscall/index";
|
||||||
|
import {
|
||||||
|
collectNodesOfType,
|
||||||
|
ParseTree,
|
||||||
|
renderToText,
|
||||||
|
} from "@silverbulletmd/common/tree";
|
||||||
import { removeQueries } from "../query/util";
|
import { removeQueries } from "../query/util";
|
||||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
||||||
|
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
import { getCursor, getText, insertAtPos, replaceRange } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import {
|
||||||
|
getCursor,
|
||||||
|
getText,
|
||||||
|
insertAtPos,
|
||||||
|
replaceRange,
|
||||||
|
} from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
|
|
||||||
export async function toggleH1() {
|
export async function toggleH1() {
|
||||||
await togglePrefix("# ");
|
await togglePrefix("# ");
|
||||||
|
@ -3,9 +3,9 @@ import {
|
|||||||
getCursor,
|
getCursor,
|
||||||
getText,
|
getText,
|
||||||
navigate as navigateTo,
|
navigate as navigateTo,
|
||||||
openUrl
|
openUrl,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
|
||||||
import { nodeAtPos, ParseTree } from "@silverbulletmd/common/tree";
|
import { nodeAtPos, ParseTree } from "@silverbulletmd/common/tree";
|
||||||
|
|
||||||
const materializedQueryPrefix = /<!--\s*#query\s+/;
|
const materializedQueryPrefix = /<!--\s*#query\s+/;
|
||||||
|
@ -4,32 +4,32 @@ import {
|
|||||||
clearPageIndex as clearPageIndexSyscall,
|
clearPageIndex as clearPageIndexSyscall,
|
||||||
clearPageIndexForPage,
|
clearPageIndexForPage,
|
||||||
scanPrefixGlobal,
|
scanPrefixGlobal,
|
||||||
set
|
set,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/index";
|
} from "@plugos/plugos-silverbullet-syscall/index";
|
||||||
import {
|
import {
|
||||||
flashNotification,
|
flashNotification,
|
||||||
getCurrentPage,
|
getCurrentPage,
|
||||||
getText,
|
getText,
|
||||||
matchBefore,
|
matchBefore,
|
||||||
navigate,
|
navigate,
|
||||||
prompt
|
prompt,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
|
|
||||||
import { dispatch } from "@silverbulletmd/plugos-syscall/event";
|
import { dispatch } from "@plugos/plugos-syscall/event";
|
||||||
import {
|
import {
|
||||||
deletePage as deletePageSyscall,
|
deletePage as deletePageSyscall,
|
||||||
listPages,
|
listPages,
|
||||||
readPage,
|
readPage,
|
||||||
writePage
|
writePage,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
} from "@plugos/plugos-silverbullet-syscall/space";
|
||||||
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
|
||||||
import {
|
import {
|
||||||
addParentPointers,
|
addParentPointers,
|
||||||
collectNodesMatching,
|
collectNodesMatching,
|
||||||
ParseTree,
|
ParseTree,
|
||||||
renderToText,
|
renderToText,
|
||||||
replaceNodesMatching
|
replaceNodesMatching,
|
||||||
} from "@silverbulletmd/common/tree";
|
} from "@silverbulletmd/common/tree";
|
||||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
||||||
import { PageMeta } from "@silverbulletmd/common/types";
|
import { PageMeta } from "@silverbulletmd/common/types";
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import { EndpointRequest, EndpointResponse } from "@silverbulletmd/plugos/hooks/endpoint";
|
import {
|
||||||
|
EndpointRequest,
|
||||||
|
EndpointResponse,
|
||||||
|
} from "@plugos/plugos/hooks/endpoint";
|
||||||
|
|
||||||
export function endpointTest(req: EndpointRequest): EndpointResponse {
|
export function endpointTest(req: EndpointRequest): EndpointResponse {
|
||||||
console.log("I'm running on the server!", req);
|
console.log("I'm running on the server!", req);
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
import { listPages, readPage, writePage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
import {
|
||||||
import { filterBox, navigate, prompt } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
listPages,
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
readPage,
|
||||||
|
writePage,
|
||||||
|
} from "@plugos/plugos-silverbullet-syscall/space";
|
||||||
|
import {
|
||||||
|
filterBox,
|
||||||
|
navigate,
|
||||||
|
prompt,
|
||||||
|
} from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
|
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
|
||||||
import { extractMeta } from "../query/data";
|
import { extractMeta } from "../query/data";
|
||||||
import { renderToText } from "@silverbulletmd/common/tree";
|
import { renderToText } from "@silverbulletmd/common/tree";
|
||||||
import { niceDate } from "./dates";
|
import { niceDate } from "./dates";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as clientStore from "@silverbulletmd/plugos-silverbullet-syscall/clientStore";
|
import * as clientStore from "@plugos/plugos-silverbullet-syscall/clientStore";
|
||||||
|
|
||||||
export async function toggleMode() {
|
export async function toggleMode() {
|
||||||
let currentValue = !!(await clientStore.get("enableDraftMode"));
|
let currentValue = !!(await clientStore.get("enableDraftMode"));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import emojis from "./emoji.json";
|
import emojis from "./emoji.json";
|
||||||
import { matchBefore } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import { matchBefore } from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
|
|
||||||
const emojiMatcher = /\(([^\)]+)\)\s+(.+)$/;
|
const emojiMatcher = /\(([^\)]+)\)\s+(.+)$/;
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
import { readPage, writePage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
import { readPage, writePage } from "@plugos/plugos-silverbullet-syscall/space";
|
||||||
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
|
||||||
import { getCurrentPage, getText } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import {
|
||||||
|
getCurrentPage,
|
||||||
|
getText,
|
||||||
|
} from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
import { cleanMarkdown } from "../markdown/util";
|
import { cleanMarkdown } from "../markdown/util";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
|
||||||
import { extractMeta } from "../query/data";
|
import { extractMeta } from "../query/data";
|
||||||
|
|
||||||
type GhostConfig = {
|
type GhostConfig = {
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import { run } from "@silverbulletmd/plugos-syscall/shell";
|
import { run } from "@plugos/plugos-syscall/shell";
|
||||||
import { flashNotification, prompt } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import {
|
||||||
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
flashNotification,
|
||||||
|
prompt,
|
||||||
|
} from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
|
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
|
||||||
|
|
||||||
export async function commit(message?: string) {
|
export async function commit(message?: string) {
|
||||||
if (!message) {
|
if (!message) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { hideRhs } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import { hideRhs } from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
|
||||||
import * as clientStore from "@silverbulletmd/plugos-silverbullet-syscall/clientStore";
|
import * as clientStore from "@plugos/plugos-silverbullet-syscall/clientStore";
|
||||||
|
|
||||||
export async function togglePreview() {
|
export async function togglePreview() {
|
||||||
let currentValue = !!(await clientStore.get("enableMarkdownPreview"));
|
let currentValue = !!(await clientStore.get("enableMarkdownPreview"));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import MarkdownIt from "markdown-it";
|
import MarkdownIt from "markdown-it";
|
||||||
import { getText, showRhs } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import { getText, showRhs } from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
import * as clientStore from "@silverbulletmd/plugos-silverbullet-syscall/clientStore";
|
import * as clientStore from "@plugos/plugos-silverbullet-syscall/clientStore";
|
||||||
import { cleanMarkdown } from "./util";
|
import { cleanMarkdown } from "./util";
|
||||||
|
|
||||||
const css = `
|
const css = `
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import { findNodeOfType, renderToText, replaceNodesMatching } from "@silverbulletmd/common/tree";
|
import {
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
findNodeOfType,
|
||||||
|
renderToText,
|
||||||
|
replaceNodesMatching,
|
||||||
|
} from "@silverbulletmd/common/tree";
|
||||||
|
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
|
||||||
|
|
||||||
export function encodePageUrl(name: string): string {
|
export function encodePageUrl(name: string): string {
|
||||||
return name.replaceAll(" ", "_");
|
return name.replaceAll(" ", "_");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Client4 } from "@mattermost/client";
|
import { Client4 } from "@mattermost/client";
|
||||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
||||||
import { readPage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
import { readPage } from "@plugos/plugos-silverbullet-syscall/space";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
|
||||||
import { extractMeta } from "../query/data";
|
import { extractMeta } from "../query/data";
|
||||||
import { niceDate } from "../core/dates";
|
import { niceDate } from "../core/dates";
|
||||||
import { Post } from "@mattermost/types/lib/posts";
|
import { Post } from "@mattermost/types/lib/posts";
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"generate": "lezer-generator query/query.grammar -o query/parse-query.js",
|
"generate": "lezer-generator query/query.grammar -o query/parse-query.js",
|
||||||
"watch": "plugos-bundle -w --dist dist */*.plug.yaml",
|
"watch": "plugos-bundle -w --dist dist --exclude @lezer/lr yaml -- */*.plug.yaml",
|
||||||
"build": "plugos-bundle --dist dist */*.plug.yaml"
|
"build": "plugos-bundle --dist dist --exclude @lezer/lr yaml -- */*.plug.yaml"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jest/globals": "^27.5.1",
|
"@jest/globals": "^27.5.1",
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
import { getCursor, insertAtCursor, moveCursor } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import {
|
||||||
|
getCursor,
|
||||||
|
insertAtCursor,
|
||||||
|
moveCursor,
|
||||||
|
} from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
|
|
||||||
export async function insertQuery() {
|
export async function insertQuery() {
|
||||||
let cursorPos = await getCursor();
|
let cursorPos = await getCursor();
|
||||||
|
@ -2,8 +2,16 @@
|
|||||||
// data:page@pos
|
// data:page@pos
|
||||||
|
|
||||||
import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
||||||
import { batchSet, scanPrefixGlobal } from "@silverbulletmd/plugos-silverbullet-syscall";
|
import {
|
||||||
import { collectNodesOfType, findNodeOfType, ParseTree, replaceNodesMatching } from "@silverbulletmd/common/tree";
|
batchSet,
|
||||||
|
scanPrefixGlobal,
|
||||||
|
} from "@plugos/plugos-silverbullet-syscall";
|
||||||
|
import {
|
||||||
|
collectNodesOfType,
|
||||||
|
findNodeOfType,
|
||||||
|
ParseTree,
|
||||||
|
replaceNodesMatching,
|
||||||
|
} from "@silverbulletmd/common/tree";
|
||||||
import { parse as parseYaml, parseAllDocuments } from "yaml";
|
import { parse as parseYaml, parseAllDocuments } from "yaml";
|
||||||
import type { QueryProviderEvent } from "./engine";
|
import type { QueryProviderEvent } from "./engine";
|
||||||
import { applyQuery } from "./engine";
|
import { applyQuery } from "./engine";
|
||||||
|
@ -3,17 +3,17 @@ import {
|
|||||||
getCurrentPage,
|
getCurrentPage,
|
||||||
getText,
|
getText,
|
||||||
reloadPage,
|
reloadPage,
|
||||||
save
|
save,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
|
|
||||||
import { readPage, writePage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
import { readPage, writePage } from "@plugos/plugos-silverbullet-syscall/space";
|
||||||
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
|
||||||
import { parseQuery } from "./engine";
|
import { parseQuery } from "./engine";
|
||||||
import { replaceTemplateVars } from "../core/template";
|
import { replaceTemplateVars } from "../core/template";
|
||||||
import { queryRegex, removeQueries } from "./util";
|
import { queryRegex, removeQueries } from "./util";
|
||||||
import { dispatch } from "@silverbulletmd/plugos-syscall/event";
|
import { dispatch } from "@plugos/plugos-syscall/event";
|
||||||
import { replaceAsync } from "../lib/util";
|
import { replaceAsync } from "../lib/util";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
|
||||||
|
|
||||||
export async function updateMaterializedQueriesCommand() {
|
export async function updateMaterializedQueriesCommand() {
|
||||||
const currentPage = await getCurrentPage();
|
const currentPage = await getCurrentPage();
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
import type { ClickEvent, IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
import type { ClickEvent, IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
||||||
|
|
||||||
import { batchSet, scanPrefixGlobal } from "@silverbulletmd/plugos-silverbullet-syscall/index";
|
import {
|
||||||
import { readPage, writePage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
batchSet,
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
scanPrefixGlobal,
|
||||||
import { dispatch, filterBox, getCursor, getText } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "@plugos/plugos-silverbullet-syscall/index";
|
||||||
|
import { readPage, writePage } from "@plugos/plugos-silverbullet-syscall/space";
|
||||||
|
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
|
||||||
|
import {
|
||||||
|
dispatch,
|
||||||
|
filterBox,
|
||||||
|
getCursor,
|
||||||
|
getText,
|
||||||
|
} from "@plugos/plugos-silverbullet-syscall/editor";
|
||||||
import {
|
import {
|
||||||
addParentPointers,
|
addParentPointers,
|
||||||
collectNodesMatching,
|
collectNodesMatching,
|
||||||
@ -11,7 +19,7 @@ import {
|
|||||||
findNodeOfType,
|
findNodeOfType,
|
||||||
nodeAtPos,
|
nodeAtPos,
|
||||||
ParseTree,
|
ParseTree,
|
||||||
renderToText
|
renderToText,
|
||||||
} from "@silverbulletmd/common/tree";
|
} from "@silverbulletmd/common/tree";
|
||||||
import { removeQueries } from "../query/util";
|
import { removeQueries } from "../query/util";
|
||||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
import express, { Express } from "express";
|
import express, { Express } from "express";
|
||||||
import { SilverBulletHooks } from "@silverbulletmd/common/manifest";
|
import { SilverBulletHooks } from "@silverbulletmd/common/manifest";
|
||||||
import { EndpointHook } from "@silverbulletmd/plugos/hooks/endpoint";
|
import { EndpointHook } from "@plugos/plugos/hooks/endpoint";
|
||||||
import { readFile } from "fs/promises";
|
import { readFile } from "fs/promises";
|
||||||
import { System } from "@silverbulletmd/plugos/system";
|
import { System } from "@plugos/plugos/system";
|
||||||
import cors from "cors";
|
import cors from "cors";
|
||||||
import { DiskSpacePrimitives } from "@silverbulletmd/common/spaces/disk_space_primitives";
|
import { DiskSpacePrimitives } from "@silverbulletmd/common/spaces/disk_space_primitives";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import bodyParser from "body-parser";
|
import bodyParser from "body-parser";
|
||||||
import { EventHook } from "@silverbulletmd/plugos/hooks/event";
|
import { EventHook } from "@plugos/plugos/hooks/event";
|
||||||
import spaceSyscalls from "./syscalls/space";
|
import spaceSyscalls from "./syscalls/space";
|
||||||
import { eventSyscalls } from "@silverbulletmd/plugos/syscalls/event";
|
import { eventSyscalls } from "@plugos/plugos/syscalls/event";
|
||||||
import { ensurePageIndexTable, pageIndexSyscalls } from "./syscalls";
|
import { ensurePageIndexTable, pageIndexSyscalls } from "./syscalls";
|
||||||
import knex, { Knex } from "knex";
|
import knex, { Knex } from "knex";
|
||||||
import shellSyscalls from "@silverbulletmd/plugos/syscalls/shell.node";
|
import shellSyscalls from "@plugos/plugos/syscalls/shell.node";
|
||||||
import { NodeCronHook } from "@silverbulletmd/plugos/hooks/node_cron";
|
import { NodeCronHook } from "@plugos/plugos/hooks/node_cron";
|
||||||
import { markdownSyscalls } from "@silverbulletmd/common/syscalls/markdown";
|
import { markdownSyscalls } from "@silverbulletmd/common/syscalls/markdown";
|
||||||
import { EventedSpacePrimitives } from "@silverbulletmd/common/spaces/evented_space_primitives";
|
import { EventedSpacePrimitives } from "@silverbulletmd/common/spaces/evented_space_primitives";
|
||||||
import { Space } from "@silverbulletmd/common/spaces/space";
|
import { Space } from "@silverbulletmd/common/spaces/space";
|
||||||
import { safeRun, throttle } from "@silverbulletmd/common/util";
|
import { safeRun, throttle } from "@silverbulletmd/common/util";
|
||||||
import { createSandbox } from "@silverbulletmd/plugos/environments/node_sandbox";
|
import { createSandbox } from "@plugos/plugos/environments/node_sandbox";
|
||||||
import { jwtSyscalls } from "@silverbulletmd/plugos/syscalls/jwt";
|
import { jwtSyscalls } from "@plugos/plugos/syscalls/jwt";
|
||||||
import buildMarkdown from "@silverbulletmd/web/parser";
|
import buildMarkdown from "@silverbulletmd/web/parser";
|
||||||
import { loadMarkdownExtensions } from "@silverbulletmd/web/markdown_ext";
|
import { loadMarkdownExtensions } from "@silverbulletmd/web/markdown_ext";
|
||||||
import http, { Server } from "http";
|
import http, { Server } from "http";
|
@ -17,7 +17,7 @@
|
|||||||
"isLibrary": true,
|
"isLibrary": true,
|
||||||
"context": "node",
|
"context": "node",
|
||||||
"includeNodeModules": [
|
"includeNodeModules": [
|
||||||
"@silverbulletmd/plugos",
|
"@plugos/plugos",
|
||||||
"@silverbulletmd/common",
|
"@silverbulletmd/common",
|
||||||
"@silverbulletmd/web"
|
"@silverbulletmd/web"
|
||||||
]
|
]
|
||||||
@ -31,6 +31,7 @@
|
|||||||
"@codemirror/stream-parser": "^0.19.9",
|
"@codemirror/stream-parser": "^0.19.9",
|
||||||
"@jest/globals": "^27.5.1",
|
"@jest/globals": "^27.5.1",
|
||||||
"@lezer/markdown": "^0.15.0",
|
"@lezer/markdown": "^0.15.0",
|
||||||
|
"@silverbulletmd/web": "^0.0.1",
|
||||||
"better-sqlite3": "^7.5.0",
|
"better-sqlite3": "^7.5.0",
|
||||||
"body-parser": "^1.19.2",
|
"body-parser": "^1.19.2",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
@ -3,7 +3,7 @@
|
|||||||
import yargs from "yargs";
|
import yargs from "yargs";
|
||||||
import { hideBin } from "yargs/helpers";
|
import { hideBin } from "yargs/helpers";
|
||||||
import { ExpressServer } from "./api_server";
|
import { ExpressServer } from "./api_server";
|
||||||
import path from "path";
|
import { nodeModulesDir } from "@plugos/plugos/environments/node_sandbox";
|
||||||
|
|
||||||
let args = yargs(hideBin(process.argv))
|
let args = yargs(hideBin(process.argv))
|
||||||
.option("port", {
|
.option("port", {
|
||||||
@ -20,9 +20,11 @@ if (!args._.length) {
|
|||||||
const pagesPath = args._[0] as string;
|
const pagesPath = args._[0] as string;
|
||||||
|
|
||||||
const port = args.port;
|
const port = args.port;
|
||||||
const distDir = path.resolve(`${__dirname}/../../silverbullet-web/dist`);
|
const webappDistDir = `${nodeModulesDir}/node_modules/@silverbulletmd/web/dist`;
|
||||||
|
|
||||||
const expressServer = new ExpressServer(port, pagesPath, distDir);
|
// console.log("This is where the static files live", webappDistDir);
|
||||||
|
|
||||||
|
const expressServer = new ExpressServer(port, pagesPath, webappDistDir);
|
||||||
expressServer.start().catch((e) => {
|
expressServer.start().catch((e) => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
});
|
});
|
@ -1,7 +1,10 @@
|
|||||||
import { Knex } from "knex";
|
import { Knex } from "knex";
|
||||||
import { SysCallMapping } from "../../plugos/system";
|
import { SysCallMapping } from "@plugos/plugos/system";
|
||||||
|
|
||||||
import { ensureTable, storeSyscalls } from "../../plugos/syscalls/store.knex_node";
|
import {
|
||||||
|
ensureTable,
|
||||||
|
storeSyscalls,
|
||||||
|
} from "@plugos/plugos/syscalls/store.knex_node";
|
||||||
|
|
||||||
type IndexItem = {
|
type IndexItem = {
|
||||||
page: string;
|
page: string;
|
@ -1,5 +1,5 @@
|
|||||||
import { PageMeta } from "@silverbulletmd/common/types";
|
import { PageMeta } from "@silverbulletmd/common/types";
|
||||||
import { SysCallMapping } from "@silverbulletmd/plugos/system";
|
import { SysCallMapping } from "@plugos/plugos/system";
|
||||||
import { Space } from "@silverbulletmd/common/spaces/space";
|
import { Space } from "@silverbulletmd/common/spaces/space";
|
||||||
|
|
||||||
export default (space: Space): SysCallMapping => {
|
export default (space: Space): SysCallMapping => {
|
@ -1,5 +1,5 @@
|
|||||||
import { Editor } from "./editor";
|
import { Editor } from "./editor";
|
||||||
import { safeRun } from "../silverbullet-common/util";
|
import { safeRun } from "../common/util";
|
||||||
import { Space } from "@silverbulletmd/common/spaces/space";
|
import { Space } from "@silverbulletmd/common/spaces/space";
|
||||||
import { HttpSpacePrimitives } from "@silverbulletmd/common/spaces/http_space_primitives";
|
import { HttpSpacePrimitives } from "@silverbulletmd/common/spaces/http_space_primitives";
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
import { isMacLike } from "../../silverbullet-common/util";
|
import { isMacLike } from "../../common/util";
|
||||||
import { FilterList } from "./filter";
|
import { FilterList } from "./filter";
|
||||||
import { faPersonRunning } from "@fortawesome/free-solid-svg-icons";
|
import { faPersonRunning } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { AppCommand } from "../hooks/command";
|
import { AppCommand } from "../hooks/command";
|
@ -1,5 +1,5 @@
|
|||||||
import { EditorView } from "@codemirror/view";
|
import { EditorView } from "@codemirror/view";
|
||||||
import * as util from "../../silverbullet-common/util";
|
import * as util from "../../common/util";
|
||||||
|
|
||||||
export function StatusBar({ editorView }: { editorView?: EditorView }) {
|
export function StatusBar({ editorView }: { editorView?: EditorView }) {
|
||||||
let wordCount = 0,
|
let wordCount = 0,
|
@ -1,4 +1,8 @@
|
|||||||
import { autocompletion, completionKeymap, CompletionResult } from "@codemirror/autocomplete";
|
import {
|
||||||
|
autocompletion,
|
||||||
|
completionKeymap,
|
||||||
|
CompletionResult,
|
||||||
|
} from "@codemirror/autocomplete";
|
||||||
import { closeBrackets, closeBracketsKeymap } from "@codemirror/closebrackets";
|
import { closeBrackets, closeBracketsKeymap } from "@codemirror/closebrackets";
|
||||||
import { indentWithTab, standardKeymap } from "@codemirror/commands";
|
import { indentWithTab, standardKeymap } from "@codemirror/commands";
|
||||||
import { history, historyKeymap } from "@codemirror/history";
|
import { history, historyKeymap } from "@codemirror/history";
|
||||||
@ -13,11 +17,11 @@ import {
|
|||||||
KeyBinding,
|
KeyBinding,
|
||||||
keymap,
|
keymap,
|
||||||
ViewPlugin,
|
ViewPlugin,
|
||||||
ViewUpdate
|
ViewUpdate,
|
||||||
} from "@codemirror/view";
|
} from "@codemirror/view";
|
||||||
import React, { useEffect, useReducer } from "react";
|
import React, { useEffect, useReducer } from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import { createSandbox as createIFrameSandbox } from "../plugos/environments/webworker_sandbox";
|
import { createSandbox as createIFrameSandbox } from "@plugos/plugos/environments/webworker_sandbox";
|
||||||
import { AppEvent, ClickEvent } from "./app_event";
|
import { AppEvent, ClickEvent } from "./app_event";
|
||||||
import * as commands from "./commands";
|
import * as commands from "./commands";
|
||||||
import { CommandPalette } from "./components/command_palette";
|
import { CommandPalette } from "./components/command_palette";
|
||||||
@ -37,9 +41,9 @@ import { indexerSyscalls } from "./syscalls";
|
|||||||
import { spaceSyscalls } from "./syscalls/space";
|
import { spaceSyscalls } from "./syscalls/space";
|
||||||
import { Action, AppViewState, initialViewState } from "./types";
|
import { Action, AppViewState, initialViewState } from "./types";
|
||||||
import { SilverBulletHooks } from "@silverbulletmd/common/manifest";
|
import { SilverBulletHooks } from "@silverbulletmd/common/manifest";
|
||||||
import { safeRun, throttle } from "../silverbullet-common/util";
|
import { safeRun, throttle } from "../common/util";
|
||||||
import { System } from "../plugos/system";
|
import { System } from "@plugos/plugos/system";
|
||||||
import { EventHook } from "../plugos/hooks/event";
|
import { EventHook } from "@plugos/plugos/hooks/event";
|
||||||
import { systemSyscalls } from "./syscalls/system";
|
import { systemSyscalls } from "./syscalls/system";
|
||||||
import { Panel } from "./components/panel";
|
import { Panel } from "./components/panel";
|
||||||
import { CommandHook } from "./hooks/command";
|
import { CommandHook } from "./hooks/command";
|
@ -1,6 +1,6 @@
|
|||||||
import { Hook, Manifest } from "@silverbulletmd/plugos/types";
|
import { Hook, Manifest } from "@plugos/plugos/types";
|
||||||
import { System } from "@silverbulletmd/plugos/system";
|
import { System } from "@plugos/plugos/system";
|
||||||
import { EventEmitter } from "@silverbulletmd/common/event";
|
import { EventEmitter } from "@plugos/plugos/event";
|
||||||
|
|
||||||
export type CommandDef = {
|
export type CommandDef = {
|
||||||
name: string;
|
name: string;
|
@ -1,8 +1,12 @@
|
|||||||
import { Hook, Manifest } from "../../plugos/types";
|
import { Hook, Manifest } from "@plugos/plugos/types";
|
||||||
import { System } from "../../plugos/system";
|
import { System } from "@plugos/plugos/system";
|
||||||
import { Completion, CompletionContext, CompletionResult } from "@codemirror/autocomplete";
|
import {
|
||||||
|
Completion,
|
||||||
|
CompletionContext,
|
||||||
|
CompletionResult,
|
||||||
|
} from "@codemirror/autocomplete";
|
||||||
import { slashCommandRegexp } from "../types";
|
import { slashCommandRegexp } from "../types";
|
||||||
import { safeRun } from "../../silverbullet-common/util";
|
import { safeRun } from "../../common/util";
|
||||||
import { Editor } from "../editor";
|
import { Editor } from "../editor";
|
||||||
|
|
||||||
export type SlashCommandDef = {
|
export type SlashCommandDef = {
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
@ -1,6 +1,6 @@
|
|||||||
import { Tag } from "@codemirror/highlight";
|
import { Tag } from "@codemirror/highlight";
|
||||||
import type { MarkdownConfig } from "@lezer/markdown";
|
import type { MarkdownConfig } from "@lezer/markdown";
|
||||||
import { System } from "@silverbulletmd/plugos/system";
|
import { System } from "@plugos/plugos/system";
|
||||||
import { Manifest } from "@silverbulletmd/common/manifest";
|
import { Manifest } from "@silverbulletmd/common/manifest";
|
||||||
|
|
||||||
export type MDExt = {
|
export type MDExt = {
|
@ -1,4 +1,4 @@
|
|||||||
import { safeRun } from "../silverbullet-common/util";
|
import { safeRun } from "../common/util";
|
||||||
|
|
||||||
function encodePageUrl(name: string): string {
|
function encodePageUrl(name: string): string {
|
||||||
return name.replaceAll(" ", "_");
|
return name.replaceAll(" ", "_");
|
@ -1,12 +1,31 @@
|
|||||||
import { styleTags, tags as t } from "@codemirror/highlight";
|
import { styleTags, tags as t } from "@codemirror/highlight";
|
||||||
import { BlockContext, LeafBlock, LeafBlockParser, MarkdownConfig, parseCode, Table, TaskList } from "@lezer/markdown";
|
import {
|
||||||
|
BlockContext,
|
||||||
|
LeafBlock,
|
||||||
|
LeafBlockParser,
|
||||||
|
MarkdownConfig,
|
||||||
|
parseCode,
|
||||||
|
Table,
|
||||||
|
TaskList,
|
||||||
|
} from "@lezer/markdown";
|
||||||
import { commonmark, getCodeParser, mkLang } from "./markdown/markdown";
|
import { commonmark, getCodeParser, mkLang } from "./markdown/markdown";
|
||||||
import * as ct from "./customtags";
|
import * as ct from "./customtags";
|
||||||
import { Language, LanguageDescription, LanguageSupport } from "@codemirror/language";
|
import {
|
||||||
|
Language,
|
||||||
|
LanguageDescription,
|
||||||
|
LanguageSupport,
|
||||||
|
} from "@codemirror/language";
|
||||||
import { StreamLanguage } from "@codemirror/stream-parser";
|
import { StreamLanguage } from "@codemirror/stream-parser";
|
||||||
import { yaml } from "@codemirror/legacy-modes/mode/yaml";
|
import { yaml } from "@codemirror/legacy-modes/mode/yaml";
|
||||||
import { javascriptLanguage, typescriptLanguage } from "@codemirror/lang-javascript";
|
import {
|
||||||
import { MDExt, mdExtensionStyleTags, mdExtensionSyntaxConfig } from "./markdown_ext";
|
javascriptLanguage,
|
||||||
|
typescriptLanguage,
|
||||||
|
} from "@codemirror/lang-javascript";
|
||||||
|
import {
|
||||||
|
MDExt,
|
||||||
|
mdExtensionStyleTags,
|
||||||
|
mdExtensionSyntaxConfig,
|
||||||
|
} from "./markdown_ext";
|
||||||
|
|
||||||
export const pageLinkRegex = /^\[\[([^\]]+)\]\]/;
|
export const pageLinkRegex = /^\[\[([^\]]+)\]\]/;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user