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
+1 -1
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;
+9 -2
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";
+6 -1
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("# ");
+3 -3
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+/;
+10 -10
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";
+4 -1
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);
+11 -3
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";
+1 -1
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"));
+1 -1
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+(.+)$/;
+7 -4
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 = {
+6 -3
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) {
+3 -3
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"));
+2 -2
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 = `
+6 -2
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(" ", "_");
+2 -2
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";
+2 -2
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",
+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();
+10 -2
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";
+6 -6
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();
+13 -5
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";