1
0

Refactor and renaming

This commit is contained in:
Zef Hemel 2022-04-25 10:33:38 +02:00
parent 6a10cbd9b7
commit 44cf4c6a72
114 changed files with 20723 additions and 183 deletions

BIN
.DS_Store vendored

Binary file not shown.

48
.idea/codeStyles/Project.xml generated Normal file
View 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
View 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
View 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
View 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
View 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
View File

@ -0,0 +1,3 @@
{
"editor.formatOnSave": true
}

89
desktop/.gitignore vendored Normal file
View 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

File diff suppressed because it is too large Load Diff

103
desktop/package.json Normal file
View 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
View 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
View 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
View 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
View File

@ -2459,32 +2459,32 @@
"@parcel/core": "^2.3.2"
}
},
"node_modules/@silverbulletmd/common": {
"resolved": "packages/silverbullet-common",
"link": true
},
"node_modules/@silverbulletmd/plugos": {
"node_modules/@plugos/plugos": {
"resolved": "packages/plugos",
"link": true
},
"node_modules/@silverbulletmd/plugos-silverbullet-syscall": {
"node_modules/@plugos/plugos-silverbullet-syscall": {
"resolved": "packages/plugos-silverbullet-syscall",
"link": true
},
"node_modules/@silverbulletmd/plugos-syscall": {
"node_modules/@plugos/plugos-syscall": {
"resolved": "packages/plugos-syscall",
"link": true
},
"node_modules/@silverbulletmd/common": {
"resolved": "packages/common",
"link": true
},
"node_modules/@silverbulletmd/plugs": {
"resolved": "packages/plugs",
"link": true
},
"node_modules/@silverbulletmd/server": {
"resolved": "packages/silverbullet-server",
"resolved": "packages/server",
"link": true
},
"node_modules/@silverbulletmd/web": {
"resolved": "packages/silverbullet-web",
"resolved": "packages/web",
"link": true
},
"node_modules/@sindresorhus/is": {
@ -11020,8 +11020,12 @@
"node": ">=8"
}
},
"packages/common": {
"name": "@silverbulletmd/common",
"version": "1.0.0"
},
"packages/plugos": {
"name": "@silverbulletmd/plugos",
"name": "@plugos/plugos",
"version": "0.0.1",
"license": "MIT",
"dependencies": {
@ -11077,11 +11081,11 @@
}
},
"packages/plugos-silverbullet-syscall": {
"name": "@silverbulletmd/plugos-silverbullet-syscall",
"name": "@plugos/plugos-silverbullet-syscall",
"version": "1.0.0"
},
"packages/plugos-syscall": {
"name": "@silverbulletmd/plugos-syscall",
"name": "@plugos/plugos-syscall",
"version": "1.0.0"
},
"packages/plugs": {
@ -11109,11 +11113,7 @@
"node": ">= 14"
}
},
"packages/silverbullet-common": {
"name": "@silverbulletmd/common",
"version": "1.0.0"
},
"packages/silverbullet-server": {
"packages/server": {
"name": "@silverbulletmd/server",
"version": "0.0.1",
"license": "MIT",
@ -11125,6 +11125,67 @@
"@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",
"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",
"body-parser": "^1.19.2",
"buffer": "^6.0.3",
@ -11167,6 +11228,57 @@
}
},
"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",
"version": "0.0.1",
"license": "MIT",
@ -12933,10 +13045,7 @@
"nullthrows": "^1.1.1"
}
},
"@silverbulletmd/common": {
"version": "file:packages/silverbullet-common"
},
"@silverbulletmd/plugos": {
"@plugos/plugos": {
"version": "file:packages/plugos",
"requires": {
"@jest/globals": "^27.5.1",
@ -12984,12 +13093,15 @@
"yargs": "^17.3.1"
}
},
"@silverbulletmd/plugos-silverbullet-syscall": {
"@plugos/plugos-silverbullet-syscall": {
"version": "file:packages/plugos-silverbullet-syscall"
},
"@silverbulletmd/plugos-syscall": {
"@plugos/plugos-syscall": {
"version": "file:packages/plugos-syscall"
},
"@silverbulletmd/common": {
"version": "file:packages/common"
},
"@silverbulletmd/plugs": {
"version": "file:packages/plugs",
"requires": {
@ -13011,7 +13123,7 @@
}
},
"@silverbulletmd/server": {
"version": "file:packages/silverbullet-server",
"version": "file:packages/server",
"requires": {
"@codemirror/lang-javascript": "^0.19.7",
"@codemirror/lang-markdown": "^0.19.6",
@ -13026,6 +13138,7 @@
"@parcel/transformer-sass": "2.3.2",
"@parcel/transformer-webmanifest": "2.3.2",
"@parcel/validator-typescript": "2.3.2",
"@silverbulletmd/web": "^0.0.1",
"@types/cors": "^2.8.12",
"@types/events": "^3.0.0",
"@types/express": "^4.17.13",
@ -13057,7 +13170,7 @@
}
},
"@silverbulletmd/web": {
"version": "file:packages/silverbullet-web",
"version": "file:packages/web",
"requires": {
"@codemirror/autocomplete": "^0.19.1",
"@codemirror/closebrackets": "^0.19.1",

View File

@ -7,23 +7,13 @@
"@lezer/common": "https://github.com/zefhemel/common.git#046c880d1fcab713cadad327a5b7d8bb5de6522c"
},
"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",
"build": "parcel build packages/{silverbullet-web,silverbullet-server,plugos}",
"build": "parcel build packages/{web,server,plugos}",
"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"
},
"targets": {
"test": {
"source": [
"src/index.js"
],
"outputFormat": "commonjs",
"isLibrary": true,
"context": "electron-main"
}
},
"devDependencies": {
"@parcel/core": "2.3.2",
"@parcel/packager-raw-url": "2.3.2",

View File

@ -1,7 +1,7 @@
import * as plugos from "../plugos/types";
import { EndpointHookT } from "../plugos/hooks/endpoint";
import { CronHookT } from "../plugos/hooks/node_cron";
import { EventHookT } from "../plugos/hooks/event";
import * as plugos from "@plugos/plugos/types";
import { EndpointHookT } from "@plugos/plugos/hooks/endpoint";
import { CronHookT } from "@plugos/plugos/hooks/node_cron";
import { EventHookT } from "@plugos/plugos/hooks/event";
import { CommandHookT } from "@silverbulletmd/web/hooks/command";
import { SlashCommandHookT } from "@silverbulletmd/web/hooks/slash_command";

View File

@ -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 { PageMeta } from "../types";
import { SpacePrimitives } from "./space_primitives";
import { Plug } from "../../plugos/plug";
import { Plug } from "@plugos/plugos/plug";
export class DiskSpacePrimitives implements SpacePrimitives {
rootPath: string;

View File

@ -1,7 +1,7 @@
import { SpacePrimitives } from "./space_primitives";
import { EventHook } from "../../plugos/hooks/event";
import { EventHook } from "@plugos/plugos/hooks/event";
import { PageMeta } from "../types";
import { Plug } from "../../plugos/plug";
import { Plug } from "@plugos/plugos/plug";
import { trashPrefix } from "./constants";
export class EventedSpacePrimitives implements SpacePrimitives {

View File

@ -1,5 +1,5 @@
import { PageMeta } from "../types";
import { Plug } from "../../plugos/plug";
import { Plug } from "@plugos/plugos/plug";
import { SpacePrimitives } from "./space_primitives";
export class HttpSpacePrimitives implements SpacePrimitives {
@ -7,7 +7,6 @@ export class HttpSpacePrimitives implements SpacePrimitives {
private plugUrl: string;
constructor(url: string) {
console.log("UR", url);
this.pageUrl = url + "/fs";
this.plugUrl = url + "/plug";
}

View File

@ -1,7 +1,7 @@
import { SpacePrimitives } from "./space_primitives";
import { PageMeta } from "../types";
import Dexie, { Table } from "dexie";
import { Plug } from "../../plugos/plug";
import { Plug } from "@plugos/plugos/plug";
type Page = {
name: string;

View File

@ -1,7 +1,7 @@
import { SpacePrimitives } from "./space_primitives";
import { PageMeta } from "../types";
import { EventEmitter } from "../event";
import { Plug } from "../../plugos/plug";
import { EventEmitter } from "@plugos/plugos/event";
import { Plug } from "@plugos/plugos/plug";
import { Manifest } from "../manifest";
import { plugPrefix, trashPrefix } from "./constants";
import { safeRun } from "../util";

View File

@ -1,4 +1,4 @@
import { Plug } from "../../plugos/plug";
import { Plug } from "@plugos/plugos/plug";
import { PageMeta } from "../types";
export interface SpacePrimitives {

View File

@ -1,4 +1,4 @@
import { SysCallMapping } from "../../plugos/system";
import { SysCallMapping } from "@plugos/plugos/system";
import { parse } from "../parse_tree";
import { Language } from "@codemirror/language";
import type { ParseTree } from "../tree";

View File

@ -1,5 +1,5 @@
import { syscall } from "./syscall";
import { FilterOption } from "../silverbullet-common/types";
import { FilterOption } from "../common/types";
export function getCurrentPage(): Promise<string> {
return syscall("editor.getCurrentPage");

View File

@ -1,6 +1,6 @@
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> {
return syscall("markdown.parseMarkdown", text);

View File

@ -1,4 +1,4 @@
{
"name": "@silverbulletmd/plugos-silverbullet-syscall",
"name": "@plugos/plugos-silverbullet-syscall",
"version": "1.0.0"
}

View File

@ -1,5 +1,5 @@
import { syscall } from "./syscall";
import { PageMeta } from "../silverbullet-common/types";
import { PageMeta } from "../common/types";
export async function listPages(): Promise<PageMeta[]> {
return syscall("space.listPages");

View File

@ -1,4 +1,4 @@
{
"name": "@silverbulletmd/plugos-syscall",
"name": "@plugos/plugos-syscall",
"version": "1.0.0"
}

View File

@ -8,13 +8,13 @@ import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { Manifest } from "../types";
import YAML from "yaml";
import { preloadModules } from "../../silverbullet-common/preload_modules";
import { mkdirSync } from "fs";
async function compile(
filePath: string,
functionName: string,
debug: boolean,
excludeModules: string[],
meta = false
) {
let outFile = "_out.tmp";
@ -40,7 +40,7 @@ async function compile(
minify: !debug,
outfile: outFile,
metafile: true,
external: preloadModules,
external: excludeModules,
});
if (meta) {
@ -57,7 +57,11 @@ async function compile(
return mod;})()`;
}
async function bundle(manifestPath: string, sourceMaps: boolean) {
async function bundle(
manifestPath: string,
sourceMaps: boolean,
excludeModules: string[]
) {
const rootPath = path.dirname(manifestPath);
const manifest = YAML.parse(
(await readFile(manifestPath)).toString()
@ -70,7 +74,12 @@ async function bundle(manifestPath: string, sourceMaps: boolean) {
[filePath, jsFunctionName] = filePath.split(":");
}
def.code = await compile(filePath, jsFunctionName, sourceMaps);
def.code = await compile(
filePath,
jsFunctionName,
sourceMaps,
excludeModules
);
delete def.path;
}
return manifest;
@ -79,9 +88,10 @@ async function bundle(manifestPath: string, sourceMaps: boolean) {
async function buildManifest(
manifestPath: string,
distPath: string,
debug: boolean
debug: boolean,
excludeModules: string[]
) {
let generatedManifest = await bundle(manifestPath, debug);
let generatedManifest = await bundle(manifestPath, debug, excludeModules);
const outFile =
manifestPath.substring(
0,
@ -106,20 +116,31 @@ async function run() {
type: "string",
default: ".",
})
.option("exclude", {
type: "array",
default: [],
})
.parse();
if (args._.length === 0) {
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);
}
console.log("Args", args);
async function buildAll() {
mkdirSync(args.dist, { recursive: true });
for (const plugManifestPath of args._) {
let manifestPath = plugManifestPath as string;
try {
await buildManifest(manifestPath, args.dist, !!args.debug);
await buildManifest(
manifestPath,
args.dist,
!!args.debug,
args.exclude
);
} catch (e) {
console.error(`Error building ${manifestPath}:`, e);
}

View File

@ -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
let nodeModulesDir = __dirname;
export let nodeModulesDir = __dirname;
while (!fs.existsSync(nodeModulesDir + "/node_modules/vm2")) {
nodeModulesDir = path.dirname(nodeModulesDir);
}
export function createSandbox(plug: Plug<any>) {
export function createSandbox(
plug: Plug<any>,
preloadedModules: string[] = []
) {
let worker = new Worker(workerCode, {
eval: true,
workerData: path.join(nodeModulesDir, "node_modules"),
workerData: {
nodeModulesPath: path.join(nodeModulesDir, "node_modules"),
preloadedModules,
},
});
return new Sandbox(plug, new NodeWorkerWrapper(worker));
}

View File

@ -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(`${workerData}/vm2`);
const fetch = require(`${workerData}/node-fetch`);
const WebSocket = require(`${workerData}/ws`);
// console.log("Process env", process.env);
const { VM, VMScript } = require(`${nodeModulesPath}/vm2`);
let loadedFunctions = new Map<string, Function>();
let pendingRequests = new Map<
@ -26,14 +24,14 @@ let vm = new VM({
clearTimeout,
setInterval,
clearInterval,
fetch,
WebSocket,
fetch: require(`${nodeModulesPath}/node-fetch`),
WebSocket: require(`${nodeModulesPath}/ws`),
// This is only going to be called for pre-bundled modules, we won't allow
// arbitrary requiring of modules
require: (moduleName: string): any => {
// console.log("Loading", moduleName);
if (preloadModules.includes(moduleName)) {
return require(`${workerData}/${moduleName}`);
if (preloadedModules.includes(moduleName)) {
return require(`${nodeModulesPath}/${moduleName}`);
} else {
throw Error("Cannot import arbitrary modules");
}

View File

@ -1,5 +1,5 @@
{
"name": "@silverbulletmd/plugos",
"name": "@plugos/plugos",
"version": "0.0.1",
"license": "MIT",
"bin": {

View File

@ -1,5 +1,5 @@
import { Hook, Manifest, RuntimeEnvironment } from "./types";
import { EventEmitter } from "../silverbullet-common/event";
import { EventEmitter } from "./event";
import { SandboxFactory } from "./sandbox";
import { Plug } from "./plug";

View File

@ -1,5 +1,5 @@
{
"include": ["bin/*", "environments/*", "hooks/**", "syscalls/*", "*"],
"include": ["bin/*", "environments/*", "hooks/*", "syscalls/*", "*"],
"compilerOptions": {
"target": "esnext",
"strict": true,

View File

@ -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;

View File

@ -1,7 +1,14 @@
import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
import { batchSet, scanPrefixGlobal } from "@silverbulletmd/plugos-silverbullet-syscall/index";
import { collectNodesOfType, ParseTree, renderToText } from "@silverbulletmd/common/tree";
import {
batchSet,
scanPrefixGlobal,
} from "@plugos/plugos-silverbullet-syscall/index";
import {
collectNodesOfType,
ParseTree,
renderToText,
} from "@silverbulletmd/common/tree";
import { removeQueries } from "../query/util";
import { applyQuery, QueryProviderEvent } from "../query/engine";

View File

@ -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() {
await togglePrefix("# ");

View File

@ -3,9 +3,9 @@ import {
getCursor,
getText,
navigate as navigateTo,
openUrl
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
openUrl,
} from "@plugos/plugos-silverbullet-syscall/editor";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
import { nodeAtPos, ParseTree } from "@silverbulletmd/common/tree";
const materializedQueryPrefix = /<!--\s*#query\s+/;

View File

@ -4,32 +4,32 @@ import {
clearPageIndex as clearPageIndexSyscall,
clearPageIndexForPage,
scanPrefixGlobal,
set
} from "@silverbulletmd/plugos-silverbullet-syscall/index";
set,
} from "@plugos/plugos-silverbullet-syscall/index";
import {
flashNotification,
getCurrentPage,
getText,
matchBefore,
navigate,
prompt
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
prompt,
} from "@plugos/plugos-silverbullet-syscall/editor";
import { dispatch } from "@silverbulletmd/plugos-syscall/event";
import { dispatch } from "@plugos/plugos-syscall/event";
import {
deletePage as deletePageSyscall,
listPages,
readPage,
writePage
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
writePage,
} from "@plugos/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
import {
addParentPointers,
collectNodesMatching,
ParseTree,
renderToText,
replaceNodesMatching
replaceNodesMatching,
} from "@silverbulletmd/common/tree";
import { applyQuery, QueryProviderEvent } from "../query/engine";
import { PageMeta } from "@silverbulletmd/common/types";

View File

@ -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 {
console.log("I'm running on the server!", req);

View File

@ -1,6 +1,14 @@
import { listPages, readPage, writePage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
import { filterBox, navigate, prompt } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
import {
listPages,
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 { renderToText } from "@silverbulletmd/common/tree";
import { niceDate } from "./dates";

View File

@ -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() {
let currentValue = !!(await clientStore.get("enableDraftMode"));

View File

@ -1,6 +1,6 @@
// @ts-ignore
import emojis from "./emoji.json";
import { matchBefore } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { matchBefore } from "@plugos/plugos-silverbullet-syscall/editor";
const emojiMatcher = /\(([^\)]+)\)\s+(.+)$/;

View File

@ -1,8 +1,11 @@
import { readPage, writePage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
import { getCurrentPage, getText } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { readPage, writePage } from "@plugos/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
import {
getCurrentPage,
getText,
} from "@plugos/plugos-silverbullet-syscall/editor";
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";
type GhostConfig = {

View File

@ -1,6 +1,9 @@
import { run } from "@silverbulletmd/plugos-syscall/shell";
import { flashNotification, prompt } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
import { run } from "@plugos/plugos-syscall/shell";
import {
flashNotification,
prompt,
} from "@plugos/plugos-silverbullet-syscall/editor";
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
export async function commit(message?: string) {
if (!message) {

View File

@ -1,6 +1,6 @@
import { hideRhs } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
import * as clientStore from "@silverbulletmd/plugos-silverbullet-syscall/clientStore";
import { hideRhs } from "@plugos/plugos-silverbullet-syscall/editor";
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
import * as clientStore from "@plugos/plugos-silverbullet-syscall/clientStore";
export async function togglePreview() {
let currentValue = !!(await clientStore.get("enableMarkdownPreview"));

View File

@ -1,6 +1,6 @@
import MarkdownIt from "markdown-it";
import { getText, showRhs } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import * as clientStore from "@silverbulletmd/plugos-silverbullet-syscall/clientStore";
import { getText, showRhs } from "@plugos/plugos-silverbullet-syscall/editor";
import * as clientStore from "@plugos/plugos-silverbullet-syscall/clientStore";
import { cleanMarkdown } from "./util";
const css = `

View File

@ -1,5 +1,9 @@
import { findNodeOfType, renderToText, replaceNodesMatching } from "@silverbulletmd/common/tree";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
import {
findNodeOfType,
renderToText,
replaceNodesMatching,
} from "@silverbulletmd/common/tree";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
export function encodePageUrl(name: string): string {
return name.replaceAll(" ", "_");

View File

@ -1,7 +1,7 @@
import { Client4 } from "@mattermost/client";
import { applyQuery, QueryProviderEvent } from "../query/engine";
import { readPage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
import { readPage } from "@plugos/plugos-silverbullet-syscall/space";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
import { extractMeta } from "../query/data";
import { niceDate } from "../core/dates";
import { Post } from "@mattermost/types/lib/posts";

View File

@ -3,8 +3,8 @@
"version": "1.0.0",
"scripts": {
"generate": "lezer-generator query/query.grammar -o query/parse-query.js",
"watch": "plugos-bundle -w --dist dist */*.plug.yaml",
"build": "plugos-bundle --dist dist */*.plug.yaml"
"watch": "plugos-bundle -w --dist dist --exclude @lezer/lr yaml -- */*.plug.yaml",
"build": "plugos-bundle --dist dist --exclude @lezer/lr yaml -- */*.plug.yaml"
},
"dependencies": {
"@jest/globals": "^27.5.1",

View File

@ -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() {
let cursorPos = await getCursor();

View File

@ -2,8 +2,16 @@
// data:page@pos
import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
import { batchSet, scanPrefixGlobal } from "@silverbulletmd/plugos-silverbullet-syscall";
import { collectNodesOfType, findNodeOfType, ParseTree, replaceNodesMatching } from "@silverbulletmd/common/tree";
import {
batchSet,
scanPrefixGlobal,
} from "@plugos/plugos-silverbullet-syscall";
import {
collectNodesOfType,
findNodeOfType,
ParseTree,
replaceNodesMatching,
} from "@silverbulletmd/common/tree";
import { parse as parseYaml, parseAllDocuments } from "yaml";
import type { QueryProviderEvent } from "./engine";
import { applyQuery } from "./engine";

View File

@ -3,17 +3,17 @@ import {
getCurrentPage,
getText,
reloadPage,
save
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
save,
} from "@plugos/plugos-silverbullet-syscall/editor";
import { readPage, writePage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
import { readPage, writePage } from "@plugos/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
import { parseQuery } from "./engine";
import { replaceTemplateVars } from "../core/template";
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 { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
export async function updateMaterializedQueriesCommand() {
const currentPage = await getCurrentPage();

View File

@ -1,9 +1,17 @@
import type { ClickEvent, IndexTreeEvent } from "@silverbulletmd/web/app_event";
import { batchSet, scanPrefixGlobal } from "@silverbulletmd/plugos-silverbullet-syscall/index";
import { readPage, writePage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
import { dispatch, filterBox, getCursor, getText } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import {
batchSet,
scanPrefixGlobal,
} 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 {
addParentPointers,
collectNodesMatching,
@ -11,7 +19,7 @@ import {
findNodeOfType,
nodeAtPos,
ParseTree,
renderToText
renderToText,
} from "@silverbulletmd/common/tree";
import { removeQueries } from "../query/util";
import { applyQuery, QueryProviderEvent } from "../query/engine";

View File

@ -1,25 +1,25 @@
import express, { Express } from "express";
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 { System } from "@silverbulletmd/plugos/system";
import { System } from "@plugos/plugos/system";
import cors from "cors";
import { DiskSpacePrimitives } from "@silverbulletmd/common/spaces/disk_space_primitives";
import path from "path";
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 { eventSyscalls } from "@silverbulletmd/plugos/syscalls/event";
import { eventSyscalls } from "@plugos/plugos/syscalls/event";
import { ensurePageIndexTable, pageIndexSyscalls } from "./syscalls";
import knex, { Knex } from "knex";
import shellSyscalls from "@silverbulletmd/plugos/syscalls/shell.node";
import { NodeCronHook } from "@silverbulletmd/plugos/hooks/node_cron";
import shellSyscalls from "@plugos/plugos/syscalls/shell.node";
import { NodeCronHook } from "@plugos/plugos/hooks/node_cron";
import { markdownSyscalls } from "@silverbulletmd/common/syscalls/markdown";
import { EventedSpacePrimitives } from "@silverbulletmd/common/spaces/evented_space_primitives";
import { Space } from "@silverbulletmd/common/spaces/space";
import { safeRun, throttle } from "@silverbulletmd/common/util";
import { createSandbox } from "@silverbulletmd/plugos/environments/node_sandbox";
import { jwtSyscalls } from "@silverbulletmd/plugos/syscalls/jwt";
import { createSandbox } from "@plugos/plugos/environments/node_sandbox";
import { jwtSyscalls } from "@plugos/plugos/syscalls/jwt";
import buildMarkdown from "@silverbulletmd/web/parser";
import { loadMarkdownExtensions } from "@silverbulletmd/web/markdown_ext";
import http, { Server } from "http";

View File

@ -17,7 +17,7 @@
"isLibrary": true,
"context": "node",
"includeNodeModules": [
"@silverbulletmd/plugos",
"@plugos/plugos",
"@silverbulletmd/common",
"@silverbulletmd/web"
]
@ -31,6 +31,7 @@
"@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",
"body-parser": "^1.19.2",
"buffer": "^6.0.3",

View File

@ -3,7 +3,7 @@
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { ExpressServer } from "./api_server";
import path from "path";
import { nodeModulesDir } from "@plugos/plugos/environments/node_sandbox";
let args = yargs(hideBin(process.argv))
.option("port", {
@ -20,9 +20,11 @@ if (!args._.length) {
const pagesPath = args._[0] as string;
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) => {
console.error(e);
});

View File

@ -1,7 +1,10 @@
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 = {
page: string;

View File

@ -1,5 +1,5 @@
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";
export default (space: Space): SysCallMapping => {

View File

@ -1,5 +1,5 @@
import { Editor } from "./editor";
import { safeRun } from "../silverbullet-common/util";
import { safeRun } from "../common/util";
import { Space } from "@silverbulletmd/common/spaces/space";
import { HttpSpacePrimitives } from "@silverbulletmd/common/spaces/http_space_primitives";

View File

@ -1,4 +1,4 @@
import { isMacLike } from "../../silverbullet-common/util";
import { isMacLike } from "../../common/util";
import { FilterList } from "./filter";
import { faPersonRunning } from "@fortawesome/free-solid-svg-icons";
import { AppCommand } from "../hooks/command";

View File

@ -1,5 +1,5 @@
import { EditorView } from "@codemirror/view";
import * as util from "../../silverbullet-common/util";
import * as util from "../../common/util";
export function StatusBar({ editorView }: { editorView?: EditorView }) {
let wordCount = 0,

View File

@ -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 { indentWithTab, standardKeymap } from "@codemirror/commands";
import { history, historyKeymap } from "@codemirror/history";
@ -13,11 +17,11 @@ import {
KeyBinding,
keymap,
ViewPlugin,
ViewUpdate
ViewUpdate,
} from "@codemirror/view";
import React, { useEffect, useReducer } from "react";
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 * as commands from "./commands";
import { CommandPalette } from "./components/command_palette";
@ -37,9 +41,9 @@ import { indexerSyscalls } from "./syscalls";
import { spaceSyscalls } from "./syscalls/space";
import { Action, AppViewState, initialViewState } from "./types";
import { SilverBulletHooks } from "@silverbulletmd/common/manifest";
import { safeRun, throttle } from "../silverbullet-common/util";
import { System } from "../plugos/system";
import { EventHook } from "../plugos/hooks/event";
import { safeRun, throttle } from "../common/util";
import { System } from "@plugos/plugos/system";
import { EventHook } from "@plugos/plugos/hooks/event";
import { systemSyscalls } from "./syscalls/system";
import { Panel } from "./components/panel";
import { CommandHook } from "./hooks/command";

View File

@ -1,6 +1,6 @@
import { Hook, Manifest } from "@silverbulletmd/plugos/types";
import { System } from "@silverbulletmd/plugos/system";
import { EventEmitter } from "@silverbulletmd/common/event";
import { Hook, Manifest } from "@plugos/plugos/types";
import { System } from "@plugos/plugos/system";
import { EventEmitter } from "@plugos/plugos/event";
export type CommandDef = {
name: string;

View File

@ -1,8 +1,12 @@
import { Hook, Manifest } from "../../plugos/types";
import { System } from "../../plugos/system";
import { Completion, CompletionContext, CompletionResult } from "@codemirror/autocomplete";
import { Hook, Manifest } from "@plugos/plugos/types";
import { System } from "@plugos/plugos/system";
import {
Completion,
CompletionContext,
CompletionResult,
} from "@codemirror/autocomplete";
import { slashCommandRegexp } from "../types";
import { safeRun } from "../../silverbullet-common/util";
import { safeRun } from "../../common/util";
import { Editor } from "../editor";
export type SlashCommandDef = {

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -1,6 +1,6 @@
import { Tag } from "@codemirror/highlight";
import type { MarkdownConfig } from "@lezer/markdown";
import { System } from "@silverbulletmd/plugos/system";
import { System } from "@plugos/plugos/system";
import { Manifest } from "@silverbulletmd/common/manifest";
export type MDExt = {

View File

@ -1,4 +1,4 @@
import { safeRun } from "../silverbullet-common/util";
import { safeRun } from "../common/util";
function encodePageUrl(name: string): string {
return name.replaceAll(" ", "_");

View File

@ -1,12 +1,31 @@
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 * 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 { yaml } from "@codemirror/legacy-modes/mode/yaml";
import { javascriptLanguage, typescriptLanguage } from "@codemirror/lang-javascript";
import { MDExt, mdExtensionStyleTags, mdExtensionSyntaxConfig } from "./markdown_ext";
import {
javascriptLanguage,
typescriptLanguage,
} from "@codemirror/lang-javascript";
import {
MDExt,
mdExtensionStyleTags,
mdExtensionSyntaxConfig,
} from "./markdown_ext";
export const pageLinkRegex = /^\[\[([^\]]+)\]\]/;

Some files were not shown because too many files have changed in this diff Show More