1
0

Make stuff work with npm

This commit is contained in:
Zef Hemel 2022-04-25 11:24:13 +02:00
parent 44cf4c6a72
commit d52d81a909
32 changed files with 1471 additions and 10639 deletions

6187
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,8 @@
"build": "parcel build packages/{web,server,plugos}",
"plugs": "cd packages/plugs && npm run watch",
"server": "cd packages/server && npm start",
"test": "jest packages/*/dist/test"
"test": "jest packages/*/dist/test",
"publish-all": "npm publish --access public --ws"
},
"devDependencies": {
"@parcel/core": "2.3.2",

View File

@ -1,4 +1,9 @@
{
"name": "@silverbulletmd/common",
"version": "1.0.0"
"author": {
"name": "Zef Hemel",
"email": "zef@zef.me"
},
"version": "0.0.1",
"license": "MIT"
}

View File

@ -1,4 +1,9 @@
{
"name": "@plugos/plugos-silverbullet-syscall",
"version": "1.0.0"
"name": "@silverbulletmd/plugos-silverbullet-syscall",
"author": {
"name": "Zef Hemel",
"email": "zef@zef.me"
},
"version": "0.0.1",
"license": "MIT"
}

View File

@ -1,4 +1,9 @@
{
"name": "@plugos/plugos-syscall",
"version": "1.0.0"
"author": {
"name": "Zef Hemel",
"email": "zef@zef.me"
},
"version": "0.0.1",
"license": "MIT"
}

View File

@ -33,7 +33,7 @@ let vm = new VM({
if (preloadedModules.includes(moduleName)) {
return require(`${nodeModulesPath}/${moduleName}`);
} else {
throw Error("Cannot import arbitrary modules");
throw Error(`Cannot import arbitrary modules like ${moduleName}`);
}
},
self: {

View File

@ -1,5 +1,9 @@
{
"name": "@plugos/plugos",
"author": {
"name": "Zef Hemel",
"email": "zef@zef.me"
},
"version": "0.0.1",
"license": "MIT",
"bin": {

View File

@ -1,116 +0,0 @@
Arguments:
/Users/zef/.nvm/versions/node/v16.13.2/bin/node /opt/homebrew/Cellar/yarn/1.22.18/libexec/bin/yarn.js install
PATH:
/Users/zef/.nvm/versions/node/v16.13.2/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/zef/.local/share/solana/install/active_release/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/zef/.cargo/bin:/Users/zef/git/silverbullet/node_modules/.bin
Yarn version:
1.22.18
Node version:
16.13.2
Platform:
darwin arm64
Trace:
SyntaxError: /Users/zef/git/silverbullet/plugos/package.json: Unexpected token ] in JSON at position 755
at JSON.parse (<anonymous>)
at /opt/homebrew/Cellar/yarn/1.22.18/libexec/lib/cli.js:1625:59
at Generator.next (<anonymous>)
at step (/opt/homebrew/Cellar/yarn/1.22.18/libexec/lib/cli.js:310:30)
at /opt/homebrew/Cellar/yarn/1.22.18/libexec/lib/cli.js:321:13
npm manifest:
{
"name": "plugos",
"version": "0.0.1",
"license": "MIT",
"bin": {
"plugos-bundle": "./dist/plugos-bundle.js",
"plugos-server": "./dist/plugos-server.js"
},
"scripts": {
"watch": "rm -rf .parcel-cache && parcel watch",
"build": "parcel build",
"clean": "rm -rf dist",
"test": "jest"
},
"files": [
"dist"
],
"targets": {
"plugos": {
"source": [
"bin/plugos-bundle.ts",
"bin/plugos-server.ts"
],
"outputFormat": "commonjs",
"isLibrary": true,
"context": "node"
},
"test": {
"source": [
"runtime.test.ts",
"feature/endpoint.test.ts",
"syscall/store.knex_node.test.ts",
"syscall/store.dexie_browser.test.ts",
],
"outputFormat": "commonjs",
"isLibrary": true,
"context": "node"
}
},
"dependencies": {
"@jest/globals": "^27.5.1",
"@parcel/optimizer-data-url": "2.3.2",
"@parcel/service-worker": "^2.3.2",
"@parcel/transformer-inline-string": "2.3.2",
"@types/cors": "^2.8.12",
"@types/express": "^4.17.13",
"better-sqlite3": "^7.5.0",
"body-parser": "^1.19.2",
"cors": "^2.8.5",
"esbuild": "^0.14.27",
"express": "^4.17.3",
"fake-indexeddb": "^3.1.7",
"jest": "^27.5.1",
"knex": "^1.0.4",
"node-cron": "^3.0.0",
"node-fetch": "2",
"parcel": "^2.3.2",
"supertest": "^6.2.2",
"vm2": "^3.9.9",
"yaml": "^1.10.2",
"yargs": "^17.3.1"
},
"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/events": "^3.0.0",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.21",
"@types/node-cron": "^3.0.1",
"@types/node-fetch": "^2.6.1",
"@types/react": "^17.0.39",
"@types/react-dom": "^17.0.11",
"@types/supertest": "^2.0.11",
"@types/yaml": "^1.9.7",
"@vscode/sqlite3": "^5.0.7",
"assert": "^2.0.0",
"events": "^3.3.0",
"parcel": "^2.3.2",
"prettier": "^2.5.1",
"typescript": "^4.6.2"
}
}
yarn manifest:
No manifest
Lockfile:
No lockfile

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import { insertAtCursor } from "@plugos/plugos-silverbullet-syscall/editor";
import { insertAtCursor } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
const dateMatchRegex = /(\d{4}\-\d{2}\-\d{2})/g;

View File

@ -3,7 +3,7 @@ import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
import {
batchSet,
scanPrefixGlobal,
} from "@plugos/plugos-silverbullet-syscall/index";
} from "@silverbulletmd/plugos-silverbullet-syscall/index";
import {
collectNodesOfType,
ParseTree,

View File

@ -3,7 +3,7 @@ import {
getText,
insertAtPos,
replaceRange,
} from "@plugos/plugos-silverbullet-syscall/editor";
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
export async function toggleH1() {
await togglePrefix("# ");

View File

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

View File

@ -5,7 +5,7 @@ import {
clearPageIndexForPage,
scanPrefixGlobal,
set,
} from "@plugos/plugos-silverbullet-syscall/index";
} from "@silverbulletmd/plugos-silverbullet-syscall/index";
import {
flashNotification,
getCurrentPage,
@ -13,7 +13,7 @@ import {
matchBefore,
navigate,
prompt,
} from "@plugos/plugos-silverbullet-syscall/editor";
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { dispatch } from "@plugos/plugos-syscall/event";
import {
@ -21,9 +21,9 @@ import {
listPages,
readPage,
writePage,
} from "@plugos/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
import {
addParentPointers,
collectNodesMatching,

View File

@ -2,13 +2,13 @@ import {
listPages,
readPage,
writePage,
} from "@plugos/plugos-silverbullet-syscall/space";
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
import {
filterBox,
navigate,
prompt,
} from "@plugos/plugos-silverbullet-syscall/editor";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { parseMarkdown } from "@silverbulletmd/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 "@plugos/plugos-silverbullet-syscall/clientStore";
import * as clientStore from "@silverbulletmd/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 "@plugos/plugos-silverbullet-syscall/editor";
import { matchBefore } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
const emojiMatcher = /\(([^\)]+)\)\s+(.+)$/;

View File

@ -1,11 +1,14 @@
import { readPage, writePage } from "@plugos/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
import {
readPage,
writePage,
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
import {
getCurrentPage,
getText,
} from "@plugos/plugos-silverbullet-syscall/editor";
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { cleanMarkdown } from "../markdown/util";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
import { extractMeta } from "../query/data";
type GhostConfig = {

View File

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

View File

@ -1,6 +1,6 @@
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";
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";
export async function togglePreview() {
let currentValue = !!(await clientStore.get("enableMarkdownPreview"));

View File

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

View File

@ -3,7 +3,7 @@ import {
renderToText,
replaceNodesMatching,
} from "@silverbulletmd/common/tree";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
import { parseMarkdown } from "@silverbulletmd/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 "@plugos/plugos-silverbullet-syscall/space";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
import { readPage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
import { extractMeta } from "../query/data";
import { niceDate } from "../core/dates";
import { Post } from "@mattermost/types/lib/posts";

View File

@ -1,11 +1,19 @@
{
"name": "@silverbulletmd/plugs",
"version": "1.0.0",
"author": {
"name": "Zef Hemel",
"email": "zef@zef.me"
},
"version": "0.0.1",
"license": "MIT",
"scripts": {
"generate": "lezer-generator query/query.grammar -o query/parse-query.js",
"watch": "plugos-bundle -w --dist dist --exclude @lezer/lr yaml -- */*.plug.yaml",
"build": "plugos-bundle --dist dist --exclude @lezer/lr yaml -- */*.plug.yaml"
},
"files": [
"dist"
],
"dependencies": {
"@jest/globals": "^27.5.1",
"@lezer/generator": "^0.15.4",

View File

@ -2,7 +2,7 @@ import {
getCursor,
insertAtCursor,
moveCursor,
} from "@plugos/plugos-silverbullet-syscall/editor";
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
export async function insertQuery() {
let cursorPos = await getCursor();

View File

@ -5,7 +5,7 @@ import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
import {
batchSet,
scanPrefixGlobal,
} from "@plugos/plugos-silverbullet-syscall";
} from "@silverbulletmd/plugos-silverbullet-syscall";
import {
collectNodesOfType,
findNodeOfType,

View File

@ -4,16 +4,19 @@ import {
getText,
reloadPage,
save,
} from "@plugos/plugos-silverbullet-syscall/editor";
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { readPage, writePage } from "@plugos/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@plugos/plugos-silverbullet-syscall/system";
import {
readPage,
writePage,
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
import { parseQuery } from "./engine";
import { replaceTemplateVars } from "../core/template";
import { queryRegex, removeQueries } from "./util";
import { dispatch } from "@plugos/plugos-syscall/event";
import { replaceAsync } from "../lib/util";
import { parseMarkdown } from "@plugos/plugos-silverbullet-syscall/markdown";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
export async function updateMaterializedQueriesCommand() {
const currentPage = await getCurrentPage();

View File

@ -3,15 +3,18 @@ import type { ClickEvent, IndexTreeEvent } from "@silverbulletmd/web/app_event";
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";
} 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 "@plugos/plugos-silverbullet-syscall/editor";
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import {
addParentPointers,
collectNodesMatching,

View File

@ -35,7 +35,12 @@ export class ExpressServer {
private port: number;
private server?: Server;
constructor(port: number, rootPath: string, distDir: string) {
constructor(
port: number,
rootPath: string,
distDir: string,
preloadedModules: string[]
) {
this.port = port;
this.app = express();
this.rootPath = rootPath;
@ -78,7 +83,9 @@ export class ExpressServer {
plugLoaded: (plugName, plug) => {
safeRun(async () => {
console.log("Plug load", plugName);
await this.system.load(plugName, plug, createSandbox);
await this.system.load(plugName, plug, (p) =>
createSandbox(p, preloadedModules)
);
});
throttledRebuildMdExtensions();
},

View File

@ -1,5 +1,9 @@
{
"name": "@silverbulletmd/server",
"author": {
"name": "Zef Hemel",
"email": "zef@zef.me"
},
"version": "0.0.1",
"license": "MIT",
"bin": {
@ -31,7 +35,7 @@
"@codemirror/stream-parser": "^0.19.9",
"@jest/globals": "^27.5.1",
"@lezer/markdown": "^0.15.0",
"@silverbulletmd/web": "^0.0.1",
"@silverbulletmd/web": "^0.0.2",
"better-sqlite3": "^7.5.0",
"body-parser": "^1.19.2",
"buffer": "^6.0.3",

View File

@ -4,6 +4,7 @@ import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { ExpressServer } from "./api_server";
import { nodeModulesDir } from "@plugos/plugos/environments/node_sandbox";
import { preloadModules } from "@silverbulletmd/common/preload_modules";
let args = yargs(hideBin(process.argv))
.option("port", {
@ -18,13 +19,15 @@ if (!args._.length) {
}
const pagesPath = args._[0] as string;
const port = args.port;
const webappDistDir = `${nodeModulesDir}/node_modules/@silverbulletmd/web/dist`;
// console.log("This is where the static files live", webappDistDir);
const expressServer = new ExpressServer(port, pagesPath, webappDistDir);
const expressServer = new ExpressServer(
port,
pagesPath,
webappDistDir,
preloadModules
);
expressServer.start().catch((e) => {
console.error(e);
});

View File

@ -1,6 +1,10 @@
{
"name": "@silverbulletmd/web",
"version": "0.0.1",
"author": {
"name": "Zef Hemel",
"email": "zef@zef.me"
},
"version": "0.0.2",
"license": "MIT",
"scripts": {
"watch": "rm -rf .parcel-cache && parcel watch",
@ -18,6 +22,9 @@
"context": "browser"
}
},
"files": [
"dist"
],
"dependencies": {
"@codemirror/autocomplete": "^0.19.1",
"@codemirror/closebrackets": "^0.19.1",