diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 06432852..9396c4d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,9 @@ on: jobs: release: runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # The OIDC ID token is used for authentication with JSR. steps: - name: Setup repo uses: actions/checkout@v3 @@ -18,6 +21,8 @@ jobs: run: deno task build - name: Bundle run: deno task bundle + - name: Publish to JSR + run: deno publish - name: Release uses: softprops/action-gh-release@v1 env: diff --git a/cmd/test/plug_test.ts b/cmd/test/plug_test.ts index f5de9980..8140774e 100644 --- a/cmd/test/plug_test.ts +++ b/cmd/test/plug_test.ts @@ -1,4 +1,4 @@ -import { datastore } from "$sb/syscalls.ts"; +import { datastore } from "@silverbulletmd/silverbullet/syscalls"; export async function run() { console.log("Hello from plug_test.ts"); diff --git a/common/common_system.ts b/common/common_system.ts index c2456bd7..947b0c03 100644 --- a/common/common_system.ts +++ b/common/common_system.ts @@ -54,9 +54,11 @@ export abstract class CommonSystem { console.log( "Loaded", Object.keys(this.scriptEnv.functions).length, - "functions and", + "functions,", Object.keys(this.scriptEnv.commands).length, - "commands from space-script", + "commands,", + Object.keys(this.scriptEnv.eventHandlers).length, + "event handlers from space-script", ); } catch (e: any) { console.error("Error loading space-script:", e.message); diff --git a/common/config.ts b/common/config.ts index 7141bf09..8cef6967 100644 --- a/common/config.ts +++ b/common/config.ts @@ -14,8 +14,8 @@ import type { import { parseExpression } from "$common/expression_parser.ts"; import type { System } from "$lib/plugos/system.ts"; import type { ConfigObject } from "../plugs/index/config.ts"; -import { deepObjectMerge } from "$sb/lib/json.ts"; -import type { ActionButton } from "$lib/web.ts"; +import { deepObjectMerge } from "@silverbulletmd/silverbullet/lib/json"; +import type { ActionButton } from "@silverbulletmd/silverbullet/type/client"; const yamlConfigRegex = /^(```+|~~~+)(ya?ml|space-config)\r?\n([\S\s]+?)\1/m; diff --git a/common/expression_parser.ts b/common/expression_parser.ts index db12353d..a183da0c 100644 --- a/common/expression_parser.ts +++ b/common/expression_parser.ts @@ -1,7 +1,7 @@ -import type { QueryExpression } from "$sb/types.ts"; -import { parseTreeToAST } from "$sb/lib/tree.ts"; +import type { QueryExpression } from "@silverbulletmd/silverbullet/types"; +import { parseTreeToAST } from "@silverbulletmd/silverbullet/lib/tree"; import { expressionLanguage } from "$common/template/template_parser.ts"; -import { expressionToKvQueryExpression } from "$sb/lib/parse-query.ts"; +import { expressionToKvQueryExpression } from "@silverbulletmd/silverbullet/lib/parse_query"; import { lezerToParseTree } from "$common/markdown_parser/parse_tree.ts"; export function parseExpression(s: string): QueryExpression { diff --git a/common/markdown_parser/parser.test.ts b/common/markdown_parser/parser.test.ts index b46ee82f..5379b3e4 100644 --- a/common/markdown_parser/parser.test.ts +++ b/common/markdown_parser/parser.test.ts @@ -3,7 +3,7 @@ import { collectNodesOfType, findNodeOfType, renderToText, -} from "$sb/lib/tree.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; import { assertEquals, assertNotEquals } from "@std/assert"; import { extendedMarkdownLanguage } from "./parser.ts"; diff --git a/common/query_functions.ts b/common/query_functions.ts index 3082f1e2..822f0fb5 100644 --- a/common/query_functions.ts +++ b/common/query_functions.ts @@ -1,15 +1,20 @@ -import type { FunctionMap, Query } from "$sb/types.ts"; +import type { FunctionMap, Query } from "@silverbulletmd/silverbullet/types"; import { builtinFunctions } from "$lib/builtin_query_functions.ts"; import type { System } from "$lib/plugos/system.ts"; import { LimitedMap } from "$lib/limited_map.ts"; -import { parsePageRef, positionOfLine } from "$sb/lib/page_ref.ts"; +import { + parsePageRef, + positionOfLine, +} from "@silverbulletmd/silverbullet/lib/page_ref"; import { parse } from "$common/markdown_parser/parse_tree.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; -import { traverseTree } from "$sb/lib/tree.ts"; -import { renderToText } from "$sb/lib/tree.ts"; -import { findNodeOfType } from "$sb/lib/tree.ts"; -import { isFederationPath } from "$sb/lib/resolve.ts"; -import { rewritePageRefs } from "$sb/lib/resolve.ts"; +import { traverseTree } from "@silverbulletmd/silverbullet/lib/tree"; +import { renderToText } from "@silverbulletmd/silverbullet/lib/tree"; +import { findNodeOfType } from "@silverbulletmd/silverbullet/lib/tree"; +import { + isFederationPath, + rewritePageRefs, +} from "@silverbulletmd/silverbullet/lib/resolve"; const pageCacheTtl = 10 * 1000; // 10s diff --git a/common/spaces/evented_space_primitives.ts b/common/spaces/evented_space_primitives.ts index b7ecbc9c..7d69a16a 100644 --- a/common/spaces/evented_space_primitives.ts +++ b/common/spaces/evented_space_primitives.ts @@ -1,4 +1,4 @@ -import type { FileMeta } from "$sb/types.ts"; +import type { FileMeta } from "@silverbulletmd/silverbullet/types"; import type { EventHook } from "$common/hooks/event.ts"; import { plugPrefix } from "$common/spaces/constants.ts"; diff --git a/common/syscalls/system.ts b/common/syscalls/system.ts index dfa69d61..94350edd 100644 --- a/common/syscalls/system.ts +++ b/common/syscalls/system.ts @@ -7,7 +7,7 @@ import type { CommonSystem } from "../common_system.ts"; import { version } from "../../version.ts"; import type { ParseTree } from "../../plug-api/lib/tree.ts"; import type { ConfigContainer } from "../config.ts"; -import type { Config } from "$type/config.ts"; +import type { Config } from "@silverbulletmd/silverbullet/type/config"; export function systemSyscalls( system: System, @@ -115,18 +115,13 @@ export function systemSyscalls( // Reload scripts locally await commonSystem.loadSpaceScripts(); if (client) { - // And we are in a hybrud mode, tell the server to do the same - if (system.env === "client") { - console.info( - "Sending syscall to server to trigger space script reload", - ); - await proxySyscall( - {}, - client.httpSpacePrimitives, - "system.loadSpaceScripts", - [], - ); - } + // Reload scripts remotely + await proxySyscall( + {}, + client.httpSpacePrimitives, + "system.loadSpaceScripts", + [], + ); } }, "system.loadSpaceStyles": async () => { diff --git a/common/template/render.ts b/common/template/render.ts index 1c7d0789..79855c75 100644 --- a/common/template/render.ts +++ b/common/template/render.ts @@ -1,6 +1,6 @@ import type { AST } from "../../plug-api/lib/tree.ts"; -import { evalQueryExpression } from "$sb/lib/query_expression.ts"; -import { expressionToKvQueryExpression } from "$sb/lib/parse-query.ts"; +import { evalQueryExpression } from "@silverbulletmd/silverbullet/lib/query_expression"; +import { expressionToKvQueryExpression } from "../../plug-api/lib/parse_query.ts"; import type { FunctionMap } from "../../plug-api/types.ts"; import { jsonToMDTable } from "../../plugs/template/util.ts"; diff --git a/deno.json b/deno.json index 96d9604d..f53b87a1 100644 --- a/deno.json +++ b/deno.json @@ -2,7 +2,24 @@ "name": "@silverbulletmd/silverbullet", "version": "0.0.1", "exports": { - "./syscalls": "./plug-api/syscalls.ts" + "./syscall": "./plug-api/syscall.ts", + "./syscalls": "./plug-api/syscalls.ts", + "./types": "./plug-api/types.ts", + "./lib/json": "./plug-api/lib/json.ts", + "./lib/tree": "./plug-api/lib/tree.ts", + "./lib/attribute": "./plug-api/lib/attribute.ts", + "./lib/parse_query": "./plug-api/lib/parse_query.ts", + "./lib/page_ref": "./plug-api/lib/page_ref.ts", + "./lib/resolve": "./plug-api/lib/resolve.ts", + "./lib/query_expression": "./plug-api/lib/query_expression.ts", + "./lib/yaml_page": "./plug-api/lib/yaml_page.ts", + "./lib/query": "./plug-api/lib/query.ts", + "./lib/frontmatter": "./plug-api/lib/frontmatter.ts", + "./lib/markdown": "./plug-api/lib/markdown.ts", + "./lib/tags": "./plug-api/lib/tags.ts", + "./type/config": "./type/config.ts", + "./type/rpc": "./type/rpc.ts", + "./type/client": "./type/client.ts" }, "publish": { "exclude": [ @@ -49,7 +66,7 @@ "cmd/test/test_space" ], "rules": { - "exclude": ["no-explicit-any"] + "exclude": ["no-explicit-any", "no-slow-types"] } }, "fmt": { @@ -69,10 +86,27 @@ "jsxImportSource": "https://esm.sh/preact@10.23.1" }, "imports": { + "@silverbulletmd/silverbullet/syscall": "./plug-api/syscall.ts", + "@silverbulletmd/silverbullet/syscalls": "./plug-api/syscalls.ts", + "@silverbulletmd/silverbullet/types": "./plug-api/types.ts", + "@silverbulletmd/silverbullet/lib/json": "./plug-api/lib/json.ts", + "@silverbulletmd/silverbullet/lib/tree": "./plug-api/lib/tree.ts", + "@silverbulletmd/silverbullet/lib/attribute": "./plug-api/lib/attribute.ts", + "@silverbulletmd/silverbullet/lib/parse_query": "./plug-api/lib/parse_query.ts", + "@silverbulletmd/silverbullet/lib/page_ref": "./plug-api/lib/page_ref.ts", + "@silverbulletmd/silverbullet/lib/resolve": "./plug-api/lib/resolve.ts", + "@silverbulletmd/silverbullet/lib/query_expression": "./plug-api/lib/query_expression.ts", + "@silverbulletmd/silverbullet/lib/yaml_page": "./plug-api/lib/yaml_page.ts", + "@silverbulletmd/silverbullet/lib/native_fetch": "./plug-api/lib/native_fetch.ts", + "@silverbulletmd/silverbullet/lib/query": "./plug-api/lib/query.ts", + "@silverbulletmd/silverbullet/lib/frontmatter": "./plug-api/lib/frontmatter.ts", + "@silverbulletmd/silverbullet/lib/markdown": "./plug-api/lib/markdown.ts", + "@silverbulletmd/silverbullet/lib/tags": "./plug-api/lib/tags.ts", + "@silverbulletmd/silverbullet/type/config": "./type/config.ts", + "@silverbulletmd/silverbullet/type/rpc": "./type/rpc.ts", + "@silverbulletmd/silverbullet/type/client": "./type/client.ts", "$common/": "./common/", "$lib/": "./lib/", - "$sb/": "./plug-api/", - "$type/": "./type/", "@codemirror/autocomplete": "https://esm.sh/@codemirror/autocomplete@6.17.0?external=@codemirror/state,@codemirror/commands,@lezer/common,@codemirror/view,@codemirror/language&target=es2022", "@codemirror/commands": "https://esm.sh/@codemirror/commands@6.6.0?external=@codemirror/state,@codemirror/view,@codemirror/language,@lezer/common&target=es2022", "@codemirror/lang-css": "https://esm.sh/@codemirror/lang-css@6.2.1?external=@codemirror/language,@codemirror/autocomplete,@codemirror/state,@lezer/common,@lezer/css&target=es2022", diff --git a/lib/data/datastore.ts b/lib/data/datastore.ts index 4f7c1629..a029e0b0 100644 --- a/lib/data/datastore.ts +++ b/lib/data/datastore.ts @@ -9,7 +9,7 @@ import type { import { builtinFunctions } from "../builtin_query_functions.ts"; import type { KvPrimitives } from "./kv_primitives.ts"; import { evalQueryExpression } from "../../plug-api/lib/query_expression.ts"; -import { deepObjectMerge } from "$sb/lib/json.ts"; +import { deepObjectMerge } from "@silverbulletmd/silverbullet/lib/json"; /** * This is the data store class you'll actually want to use, wrapping the primitives * in a more user-friendly way diff --git a/plug-api/lib/attribute.test.ts b/plug-api/lib/attribute.test.ts index 0cb48526..95a7a25b 100644 --- a/plug-api/lib/attribute.test.ts +++ b/plug-api/lib/attribute.test.ts @@ -1,6 +1,6 @@ -import "$sb/lib/syscall_mock.ts"; +import "./syscall_mock.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts"; -import { extractAttributes } from "$sb/lib/attribute.ts"; +import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute"; import { assertEquals } from "@std/assert"; import { renderToText } from "./tree.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; diff --git a/plug-api/lib/attribute.ts b/plug-api/lib/attribute.ts index 69c526a3..b9d0184c 100644 --- a/plug-api/lib/attribute.ts +++ b/plug-api/lib/attribute.ts @@ -5,7 +5,7 @@ import { replaceNodesMatchingAsync, } from "./tree.ts"; -import { cleanupJSON } from "$sb/lib/json.ts"; +import { cleanupJSON } from "@silverbulletmd/silverbullet/lib/json"; import { system, YAML } from "../syscalls.ts"; diff --git a/plug-api/lib/feed.test.ts b/plug-api/lib/feed.test.ts index 84909953..1d8e70b8 100644 --- a/plug-api/lib/feed.test.ts +++ b/plug-api/lib/feed.test.ts @@ -1,7 +1,7 @@ -import "$sb/lib/syscall_mock.ts"; +import "./syscall_mock.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts"; import { assertEquals } from "@std/assert"; -import { extractFeedItems } from "$sb/lib/feed.ts"; +import { extractFeedItems } from "./feed.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; const feedSample1 = `--- diff --git a/plug-api/lib/feed.ts b/plug-api/lib/feed.ts index 34ac2137..04ac28cd 100644 --- a/plug-api/lib/feed.ts +++ b/plug-api/lib/feed.ts @@ -9,7 +9,7 @@ import { * Feed parsing functionality (WIP) */ -import { extractAttributes } from "$sb/lib/attribute.ts"; +import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute"; export type FeedItem = { id: string; diff --git a/plug-api/lib/markdown.ts b/plug-api/lib/markdown.ts index 027f16f8..3f78a919 100644 --- a/plug-api/lib/markdown.ts +++ b/plug-api/lib/markdown.ts @@ -1,4 +1,8 @@ -import { findNodeOfType, type ParseTree, renderToText } from "$sb/lib/tree.ts"; +import { + findNodeOfType, + type ParseTree, + renderToText, +} from "@silverbulletmd/silverbullet/lib/tree"; export function stripMarkdown( tree: ParseTree, diff --git a/plug-api/lib/parse-query.ts b/plug-api/lib/parse_query.ts similarity index 98% rename from plug-api/lib/parse-query.ts rename to plug-api/lib/parse_query.ts index 227f2a25..b8bf387f 100644 --- a/plug-api/lib/parse-query.ts +++ b/plug-api/lib/parse_query.ts @@ -1,6 +1,6 @@ import { type AST, parseTreeToAST } from "./tree.ts"; import type { Query, QueryExpression } from "../types.ts"; -import { language } from "$sb/syscalls.ts"; +import { language } from "@silverbulletmd/silverbullet/syscalls"; export function astToKvQuery( node: AST, diff --git a/plug-api/lib/parser-query.test.ts b/plug-api/lib/parser_query.test.ts similarity index 99% rename from plug-api/lib/parser-query.test.ts rename to plug-api/lib/parser_query.test.ts index e53763fd..024ee1c5 100644 --- a/plug-api/lib/parser-query.test.ts +++ b/plug-api/lib/parser_query.test.ts @@ -1,7 +1,7 @@ import { parse } from "$common/markdown_parser/parse_tree.ts"; import { type AST, collectNodesOfType, parseTreeToAST } from "./tree.ts"; import { assert, assertEquals } from "@std/assert"; -import { astToKvQuery } from "$sb/lib/parse-query.ts"; +import { astToKvQuery } from "./parse_query.ts"; import { languageFor } from "$common/languages.ts"; function wrapQueryParse(query: string): AST | null { diff --git a/plug-api/lib/query_expression.test.ts b/plug-api/lib/query_expression.test.ts index b8272cb7..8414f215 100644 --- a/plug-api/lib/query_expression.test.ts +++ b/plug-api/lib/query_expression.test.ts @@ -1,4 +1,4 @@ -import { evalQueryExpression } from "$sb/lib/query_expression.ts"; +import { evalQueryExpression } from "@silverbulletmd/silverbullet/lib/query_expression"; import { assert, assertEquals } from "@std/assert"; Deno.test("Test query expression evaluation", async () => { diff --git a/plug-api/lib/resolve.test.ts b/plug-api/lib/resolve.test.ts index 6ecfc0fd..44f0ac7d 100644 --- a/plug-api/lib/resolve.test.ts +++ b/plug-api/lib/resolve.test.ts @@ -3,7 +3,7 @@ import { federatedPathToUrl, resolvePath, rewritePageRefs, -} from "$sb/lib/resolve.ts"; +} from "@silverbulletmd/silverbullet/lib/resolve"; import { assertEquals } from "@std/assert"; import { type ParseTree, renderToText } from "./tree.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts"; diff --git a/plug-api/lib/resolve.ts b/plug-api/lib/resolve.ts index 6ed30826..85070b51 100644 --- a/plug-api/lib/resolve.ts +++ b/plug-api/lib/resolve.ts @@ -47,11 +47,11 @@ export function federatedPathToUrl(path: string): string { return path; } -export function isFederationPath(path: string) { +export function isFederationPath(path: string): boolean { return path.startsWith("!"); } -export function isLocalPath(path: string) { +export function isLocalPath(path: string): boolean { return !path.includes("://") && !path.startsWith("mailto:"); } @@ -90,13 +90,13 @@ export function rewritePageRefs(tree: ParseTree, containerPageName: string) { export function rewritePageRefsInString( bodyText: string, containerPageName: string, -) { +): string { return bodyText.replaceAll(/\[\[(.+)\]\]/g, (_match, pageRefName) => { return `[[${resolvePath(containerPageName, "/" + pageRefName)}]]`; }); } -export function cleanPageRef(pageRef: string) { +export function cleanPageRef(pageRef: string): string { if (pageRef.startsWith("[[") && pageRef.endsWith("]]")) { return pageRef.slice(2, -2); } else { @@ -104,11 +104,11 @@ export function cleanPageRef(pageRef: string) { } } -export function folderName(path: string) { +export function folderName(path: string): string { return path.split("/").slice(0, -1).join("/"); } -export function absoluteToRelativePath(page: string, linkTo: string) { +export function absoluteToRelativePath(page: string, linkTo: string): string { // Remove leading / page = page.startsWith("/") ? page.slice(1) : page; linkTo = linkTo.startsWith("/") ? linkTo.slice(1) : linkTo; @@ -127,7 +127,7 @@ export function absoluteToRelativePath(page: string, linkTo: string) { return [...splitPage, ...splitLink].join("/"); } -export function relativeToAbsolutePath(page: string, linkTo: string) { +export function relativeToAbsolutePath(page: string, linkTo: string): string { // Remove leading / page = page.startsWith("/") ? page.slice(1) : page; linkTo = linkTo.startsWith("/") ? linkTo.slice(1) : linkTo; diff --git a/plug-api/lib/settings_page.ts b/plug-api/lib/settings_page.ts index 446ac10c..f5cd2b9d 100644 --- a/plug-api/lib/settings_page.ts +++ b/plug-api/lib/settings_page.ts @@ -1,5 +1,5 @@ -import { system } from "$sb/syscalls.ts"; -import { readYamlPage } from "$sb/lib/yaml_page.ts"; +import { system } from "@silverbulletmd/silverbullet/syscalls"; +import { readYamlPage } from "@silverbulletmd/silverbullet/lib/yaml_page"; /** * Retrieves a setting from the space configuration. diff --git a/plug-api/syscalls/editor.ts b/plug-api/syscalls/editor.ts index f06698e0..503b0405 100644 --- a/plug-api/syscalls/editor.ts +++ b/plug-api/syscalls/editor.ts @@ -1,7 +1,7 @@ import type { UploadFile } from "../types.ts"; import { syscall } from "../syscall.ts"; import type { PageRef } from "../lib/page_ref.ts"; -import type { FilterOption } from "../../lib/web.ts"; +import type { FilterOption } from "@silverbulletmd/silverbullet/type/client"; export function getCurrentPage(): Promise { return syscall("editor.getCurrentPage"); diff --git a/plug-api/syscalls/jsonschema.ts b/plug-api/syscalls/jsonschema.ts index 9eb4b922..317cafb2 100644 --- a/plug-api/syscalls/jsonschema.ts +++ b/plug-api/syscalls/jsonschema.ts @@ -1,4 +1,4 @@ -import { syscall } from "$sb/syscall.ts"; +import { syscall } from "../syscall.ts"; export function validateObject( schema: any, diff --git a/plug-api/syscalls/space.ts b/plug-api/syscalls/space.ts index 11928312..e06b9ec6 100644 --- a/plug-api/syscalls/space.ts +++ b/plug-api/syscalls/space.ts @@ -1,4 +1,5 @@ import { syscall } from "../syscall.ts"; + import type { AttachmentMeta, FileMeta, PageMeta } from "../types.ts"; export function listPages(unfiltered = false): Promise { diff --git a/plug-api/syscalls/system.ts b/plug-api/syscalls/system.ts index aca7f747..7a64e318 100644 --- a/plug-api/syscalls/system.ts +++ b/plug-api/syscalls/system.ts @@ -2,7 +2,7 @@ import type { CommandDef } from "../../lib/command.ts"; import type { SyscallMeta } from "../types.ts"; import type { ParseTree } from "../lib/tree.ts"; import { syscall } from "../syscall.ts"; -import type { Config } from "$type/config.ts"; +import type { Config } from "../../type/config.ts"; export function invokeFunction( name: string, diff --git a/plugs/editor/clean.ts b/plugs/editor/clean.ts index a7d18810..b19140f3 100644 --- a/plugs/editor/clean.ts +++ b/plugs/editor/clean.ts @@ -1,4 +1,4 @@ -import { debug, editor } from "$sb/syscalls.ts"; +import { debug, editor } from "@silverbulletmd/silverbullet/syscalls"; export async function cleanCommand() { if ( diff --git a/plugs/editor/command.ts b/plugs/editor/command.ts index f9e536a4..c81e7c10 100644 --- a/plugs/editor/command.ts +++ b/plugs/editor/command.ts @@ -1,4 +1,4 @@ -import { system } from "$sb/syscalls.ts"; +import { system } from "@silverbulletmd/silverbullet/syscalls"; import type { CompleteEvent } from "../../plug-api/types.ts"; export async function commandComplete(completeEvent: CompleteEvent) { diff --git a/plugs/editor/complete.ts b/plugs/editor/complete.ts index aef258be..53d76213 100644 --- a/plugs/editor/complete.ts +++ b/plugs/editor/complete.ts @@ -4,10 +4,10 @@ import type { FileMeta, PageMeta, QueryExpression, -} from "$sb/types.ts"; +} from "@silverbulletmd/silverbullet/types"; import { listFilesCached } from "../federation/federation.ts"; import { queryObjects } from "../index/plug_api.ts"; -import { folderName } from "$sb/lib/resolve.ts"; +import { folderName } from "@silverbulletmd/silverbullet/lib/resolve"; import type { LinkObject } from "../index/page_links.ts"; // A meta page is a page tagged with either #template or #meta diff --git a/plugs/editor/debug.ts b/plugs/editor/debug.ts index 83660774..74c8a7de 100644 --- a/plugs/editor/debug.ts +++ b/plugs/editor/debug.ts @@ -1,4 +1,4 @@ -import { debug, editor, markdown } from "$sb/syscalls.ts"; +import { debug, editor, markdown } from "@silverbulletmd/silverbullet/syscalls"; export async function parsePageCommand() { console.log( diff --git a/plugs/editor/editor.ts b/plugs/editor/editor.ts index cfe52538..5c824b2e 100644 --- a/plugs/editor/editor.ts +++ b/plugs/editor/editor.ts @@ -1,4 +1,4 @@ -import { clientStore, editor } from "$sb/syscalls.ts"; +import { clientStore, editor } from "@silverbulletmd/silverbullet/syscalls"; // Run on "editor:init" export async function setEditorMode() { diff --git a/plugs/editor/embed.ts b/plugs/editor/embed.ts index 5cc9efb9..a7214812 100644 --- a/plugs/editor/embed.ts +++ b/plugs/editor/embed.ts @@ -1,4 +1,4 @@ -import { YAML } from "$sb/syscalls.ts"; +import { YAML } from "@silverbulletmd/silverbullet/syscalls"; import type { WidgetContent } from "../../plug-api/types.ts"; type EmbedConfig = { diff --git a/plugs/editor/help.ts b/plugs/editor/help.ts index 1270734d..64c1b0cf 100644 --- a/plugs/editor/help.ts +++ b/plugs/editor/help.ts @@ -1,4 +1,4 @@ -import { editor } from "$sb/syscalls.ts"; +import { editor } from "@silverbulletmd/silverbullet/syscalls"; import { version } from "../../version.ts"; export async function versionCommand() { diff --git a/plugs/editor/link.ts b/plugs/editor/link.ts index ffa9e9aa..18c8023c 100644 --- a/plugs/editor/link.ts +++ b/plugs/editor/link.ts @@ -1,5 +1,9 @@ import { nodeAtPos } from "../../plug-api/lib/tree.ts"; -import { editor, events, markdown } from "$sb/syscalls.ts"; +import { + editor, + events, + markdown, +} from "@silverbulletmd/silverbullet/syscalls"; import { extractYoutubeVideoId } from "./embed.ts"; type UnfurlOption = { diff --git a/plugs/editor/navigate.ts b/plugs/editor/navigate.ts index 6738af96..7731d013 100644 --- a/plugs/editor/navigate.ts +++ b/plugs/editor/navigate.ts @@ -1,14 +1,24 @@ import type { ClickEvent } from "../../plug-api/types.ts"; -import { editor, markdown, system } from "$sb/syscalls.ts"; +import { + editor, + markdown, + system, +} from "@silverbulletmd/silverbullet/syscalls"; import { addParentPointers, findNodeOfType, findParentMatching, nodeAtPos, type ParseTree, -} from "$sb/lib/tree.ts"; -import { isLocalPath, resolvePath } from "$sb/lib/resolve.ts"; -import { looksLikePathWithExtension, parsePageRef } from "$sb/lib/page_ref.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; +import { + isLocalPath, + resolvePath, +} from "@silverbulletmd/silverbullet/lib/resolve"; +import { + looksLikePathWithExtension, + parsePageRef, +} from "@silverbulletmd/silverbullet/lib/page_ref"; import { tagPrefix } from "../index/constants.ts"; async function actionClickOrActionEnter( diff --git a/plugs/editor/outline.ts b/plugs/editor/outline.ts index 0cfc844f..87a51707 100644 --- a/plugs/editor/outline.ts +++ b/plugs/editor/outline.ts @@ -1,4 +1,4 @@ -import { editor } from "$sb/syscalls.ts"; +import { editor } from "@silverbulletmd/silverbullet/syscalls"; export async function moveItemUp() { const cursorPos = await editor.getCursor(); diff --git a/plugs/editor/page.ts b/plugs/editor/page.ts index 7f4dc60a..faf70175 100644 --- a/plugs/editor/page.ts +++ b/plugs/editor/page.ts @@ -1,5 +1,5 @@ -import { editor, space } from "$sb/syscalls.ts"; -import { isFederationPath } from "$sb/lib/resolve.ts"; +import { editor, space } from "@silverbulletmd/silverbullet/syscalls"; +import { isFederationPath } from "@silverbulletmd/silverbullet/lib/resolve"; export async function deletePage() { const pageName = await editor.getCurrentPage(); diff --git a/plugs/editor/stats.ts b/plugs/editor/stats.ts index 3e961b17..726a57fa 100644 --- a/plugs/editor/stats.ts +++ b/plugs/editor/stats.ts @@ -1,4 +1,4 @@ -import { editor, space } from "$sb/syscalls.ts"; +import { editor, space } from "@silverbulletmd/silverbullet/syscalls"; function countWords(str: string): number { const matches = str.match(/[\w\d\'-]+/gi); diff --git a/plugs/editor/text.ts b/plugs/editor/text.ts index 33125358..d75cd40d 100644 --- a/plugs/editor/text.ts +++ b/plugs/editor/text.ts @@ -1,4 +1,4 @@ -import { editor } from "$sb/syscalls.ts"; +import { editor } from "@silverbulletmd/silverbullet/syscalls"; export async function quoteSelection() { let text = await editor.getText(); diff --git a/plugs/editor/upload.ts b/plugs/editor/upload.ts index 33a1f308..608cafae 100644 --- a/plugs/editor/upload.ts +++ b/plugs/editor/upload.ts @@ -1,10 +1,10 @@ -import { editor, space, system } from "$sb/syscalls.ts"; -import type { UploadFile } from "$sb/types.ts"; +import { editor, space, system } from "@silverbulletmd/silverbullet/syscalls"; +import type { UploadFile } from "@silverbulletmd/silverbullet/types"; import { defaultLinkStyle, maximumAttachmentSize, } from "../../web/constants.ts"; -import { resolvePath } from "$sb/lib/resolve.ts"; +import { resolvePath } from "@silverbulletmd/silverbullet/lib/resolve"; export async function saveFile(file: UploadFile) { const maxSize = await system.getSpaceConfig( diff --git a/plugs/editor/vim.ts b/plugs/editor/vim.ts index f9021c00..3f4e055d 100644 --- a/plugs/editor/vim.ts +++ b/plugs/editor/vim.ts @@ -1,5 +1,5 @@ -import { readCodeBlockPage } from "$sb/lib/yaml_page.ts"; -import { clientStore, editor } from "$sb/syscalls.ts"; +import { readCodeBlockPage } from "@silverbulletmd/silverbullet/lib/yaml_page"; +import { clientStore, editor } from "@silverbulletmd/silverbullet/syscalls"; export async function toggleVimMode() { let vimMode = await clientStore.get("vimMode"); diff --git a/plugs/emoji/emoji.ts b/plugs/emoji/emoji.ts index 905525e1..27d0ca35 100644 --- a/plugs/emoji/emoji.ts +++ b/plugs/emoji/emoji.ts @@ -1,7 +1,7 @@ import emojiBlob from "./emoji.json" with { type: "json" }; import type { CompleteEvent } from "../../plug-api/types.ts"; -import { editor, system } from "$sb/syscalls.ts"; -import type { EmojiConfig } from "$lib/web.ts"; +import { editor, system } from "@silverbulletmd/silverbullet/syscalls"; +import type { EmojiConfig } from "@silverbulletmd/silverbullet/type/client"; let emojiConfig: EmojiConfig = { aliases: [] }; diff --git a/plugs/federation/federation.ts b/plugs/federation/federation.ts index 0e5d606d..6fee68cb 100644 --- a/plugs/federation/federation.ts +++ b/plugs/federation/federation.ts @@ -1,6 +1,6 @@ -import "$sb/lib/native_fetch.ts"; -import { federatedPathToUrl } from "$sb/lib/resolve.ts"; -import { datastore } from "$sb/syscalls.ts"; +import "@silverbulletmd/silverbullet/lib/native_fetch"; +import { federatedPathToUrl } from "@silverbulletmd/silverbullet/lib/resolve"; +import { datastore } from "@silverbulletmd/silverbullet/syscalls"; import type { FileMeta } from "../../plug-api/types.ts"; import { wildcardPathToRegex } from "./util.ts"; diff --git a/plugs/federation/library.ts b/plugs/federation/library.ts index 64982fd6..cc5b98d9 100644 --- a/plugs/federation/library.ts +++ b/plugs/federation/library.ts @@ -1,19 +1,17 @@ -import { editor, space, system } from "$sb/syscalls.ts"; +import { editor, space, system } from "@silverbulletmd/silverbullet/syscalls"; import { listFilesCached, readFile } from "./federation.ts"; -import { parsePageRef } from "$sb/lib/page_ref.ts"; -import { invokeFunction } from "$sb/syscalls/system.ts"; +import { parsePageRef } from "@silverbulletmd/silverbullet/lib/page_ref"; import { federatedPathToLocalPath, wildcardPathToRegex } from "./util.ts"; -import { confirm } from "$sb/syscalls/editor.ts"; -import type { LibraryDef } from "$type/config.ts"; +import type { LibraryDef } from "@silverbulletmd/silverbullet/type/config"; export async function updateLibrariesCommand() { if ( - await confirm( + await editor.confirm( "Are you sure you want to update all libraries?", ) ) { await editor.flashNotification("Updating all libraries..."); - const updateStats: UpdateStats = await invokeFunction( + const updateStats: UpdateStats = await system.invokeFunction( "federation.updateLibraries", ); await editor.reloadConfigAndCommands(); diff --git a/plugs/index/anchor.ts b/plugs/index/anchor.ts index b5db64d7..18d8d8a4 100644 --- a/plugs/index/anchor.ts +++ b/plugs/index/anchor.ts @@ -1,12 +1,12 @@ -import { collectNodesOfType } from "$sb/lib/tree.ts"; +import { collectNodesOfType } from "@silverbulletmd/silverbullet/lib/tree"; import type { CompleteEvent, IndexTreeEvent, ObjectValue, QueryExpression, -} from "$sb/types.ts"; +} from "@silverbulletmd/silverbullet/types"; import { indexObjects, queryObjects } from "./api.ts"; -import { parsePageRef } from "$sb/lib/page_ref.ts"; +import { parsePageRef } from "@silverbulletmd/silverbullet/lib/page_ref"; type AnchorObject = ObjectValue<{ name: string; diff --git a/plugs/index/api.ts b/plugs/index/api.ts index 16a9ecc1..d496631f 100644 --- a/plugs/index/api.ts +++ b/plugs/index/api.ts @@ -1,4 +1,4 @@ -import { datastore } from "$sb/syscalls.ts"; +import { datastore } from "@silverbulletmd/silverbullet/syscalls"; import type { KV, KvKey, diff --git a/plugs/index/attachment.ts b/plugs/index/attachment.ts index 2772d280..8e50b030 100644 --- a/plugs/index/attachment.ts +++ b/plugs/index/attachment.ts @@ -1,5 +1,5 @@ -import { space, system } from "$sb/syscalls.ts"; -import type { AttachmentMeta } from "$sb/types.ts"; +import { space, system } from "@silverbulletmd/silverbullet/syscalls"; +import type { AttachmentMeta } from "@silverbulletmd/silverbullet/types"; import { indexObjects } from "./api.ts"; // Note: clearFileIndex is not called but since this is the only attachmet:index listener, this should be fine (famous last words) diff --git a/plugs/index/attributes.ts b/plugs/index/attributes.ts index ebadca3e..5137f449 100644 --- a/plugs/index/attributes.ts +++ b/plugs/index/attributes.ts @@ -3,7 +3,7 @@ import type { ObjectValue, QueryExpression, } from "../../plug-api/types.ts"; -import { events } from "$sb/syscalls.ts"; +import { events } from "@silverbulletmd/silverbullet/syscalls"; import { queryObjects } from "./api.ts"; import { determineTags } from "$lib/cheap_yaml.ts"; diff --git a/plugs/index/builtins.ts b/plugs/index/builtins.ts index aed4c875..d625aa27 100644 --- a/plugs/index/builtins.ts +++ b/plugs/index/builtins.ts @@ -1,7 +1,10 @@ -import { system } from "$sb/syscalls.ts"; +import { system } from "@silverbulletmd/silverbullet/syscalls"; import { indexObjects } from "./api.ts"; -import type { ObjectValue, QueryProviderEvent } from "$sb/types.ts"; -import { applyQuery } from "$sb/lib/query.ts"; +import type { + ObjectValue, + QueryProviderEvent, +} from "@silverbulletmd/silverbullet/types"; +import { applyQuery } from "@silverbulletmd/silverbullet/lib/query"; import { builtinFunctions } from "$lib/builtin_query_functions.ts"; export const builtinPseudoPage = ":builtin:"; diff --git a/plugs/index/command.ts b/plugs/index/command.ts index a5c85d1a..52af35f5 100644 --- a/plugs/index/command.ts +++ b/plugs/index/command.ts @@ -1,8 +1,14 @@ -import { editor, events, markdown, mq, space, system } from "$sb/syscalls.ts"; -import type { IndexEvent, MQMessage } from "$sb/types.ts"; +import { + editor, + events, + markdown, + mq, + space, + system, +} from "@silverbulletmd/silverbullet/syscalls"; +import type { IndexEvent, MQMessage } from "@silverbulletmd/silverbullet/types"; import { isTemplate } from "$lib/cheap_yaml.ts"; import { sleep } from "$lib/async.ts"; -import { plugPrefix } from "$common/spaces/constants.ts"; import { indexAttachment } from "./attachment.ts"; import { clearFileIndex } from "./api.ts"; @@ -47,7 +53,7 @@ export async function reindexSpace(noClear = false) { export async function processIndexQueue(messages: MQMessage[]) { for (const message of messages) { let name: string = message.body; - if (name.startsWith(plugPrefix)) { + if (name.startsWith("_plug/")) { continue; } console.log(`Indexing file ${name}`); diff --git a/plugs/index/config.ts b/plugs/index/config.ts index 3aff9a24..aed4bb6f 100644 --- a/plugs/index/config.ts +++ b/plugs/index/config.ts @@ -1,7 +1,10 @@ import type { IndexTreeEvent, ObjectValue } from "../../plug-api/types.ts"; -import { findNodeOfType, traverseTreeAsync } from "$sb/lib/tree.ts"; +import { + findNodeOfType, + traverseTreeAsync, +} from "@silverbulletmd/silverbullet/lib/tree"; import { indexObjects } from "./api.ts"; -import { YAML } from "$sb/syscalls.ts"; +import { YAML } from "@silverbulletmd/silverbullet/syscalls"; export type ConfigObject = ObjectValue<{ key: string; diff --git a/plugs/index/data.ts b/plugs/index/data.ts index e078f227..cbb2ed74 100644 --- a/plugs/index/data.ts +++ b/plugs/index/data.ts @@ -1,10 +1,13 @@ -import { YAML } from "$sb/syscalls.ts"; -import { collectNodesOfType, findNodeOfType } from "$sb/lib/tree.ts"; +import { YAML } from "@silverbulletmd/silverbullet/syscalls"; +import { + collectNodesOfType, + findNodeOfType, +} from "@silverbulletmd/silverbullet/lib/tree"; import type { IndexTreeEvent, ObjectValue } from "../../plug-api/types.ts"; import { indexObjects } from "./api.ts"; import type { TagObject } from "./tags.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; -import { updateITags } from "$sb/lib/tags.ts"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; +import { updateITags } from "@silverbulletmd/silverbullet/lib/tags"; type DataObject = ObjectValue< { diff --git a/plugs/index/header.ts b/plugs/index/header.ts index 15de1fb2..922289d6 100644 --- a/plugs/index/header.ts +++ b/plugs/index/header.ts @@ -2,15 +2,15 @@ import { collectNodesMatching, collectNodesOfType, renderToText, -} from "$sb/lib/tree.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; import type { CompleteEvent, IndexTreeEvent, ObjectValue, } from "../../plug-api/types.ts"; import { indexObjects, queryObjects } from "./api.ts"; -import { parsePageRef } from "$sb/lib/page_ref.ts"; -import { extractAttributes } from "$sb/lib/attribute.ts"; +import { parsePageRef } from "@silverbulletmd/silverbullet/lib/page_ref"; +import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute"; type HeaderObject = ObjectValue< { diff --git a/plugs/index/item.ts b/plugs/index/item.ts index 93a42db5..3c07c3a6 100644 --- a/plugs/index/item.ts +++ b/plugs/index/item.ts @@ -5,12 +5,12 @@ import { type ParseTree, renderToText, } from "../../plug-api/lib/tree.ts"; -import { extractAttributes } from "$sb/lib/attribute.ts"; -import { rewritePageRefs } from "$sb/lib/resolve.ts"; +import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute"; +import { rewritePageRefs } from "@silverbulletmd/silverbullet/lib/resolve"; import type { ObjectValue } from "../../plug-api/types.ts"; import { indexObjects } from "./api.ts"; -import { updateITags } from "$sb/lib/tags.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; +import { updateITags } from "@silverbulletmd/silverbullet/lib/tags"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; export type ItemObject = ObjectValue< { diff --git a/plugs/index/lint.ts b/plugs/index/lint.ts index c97fd7ea..0a86d56d 100644 --- a/plugs/index/lint.ts +++ b/plugs/index/lint.ts @@ -1,15 +1,15 @@ -import { jsonschema, YAML } from "$sb/syscalls.ts"; +import { jsonschema, YAML } from "@silverbulletmd/silverbullet/syscalls"; import type { LintDiagnostic, QueryExpression } from "../../plug-api/types.ts"; import { findNodeOfType, renderToText, traverseTreeAsync, -} from "$sb/lib/tree.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; import type { LintEvent } from "../../plug-api/types.ts"; import { queryObjects } from "./api.ts"; import type { AttributeObject } from "./attributes.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; -import { ConfigSchema } from "$type/config.ts"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; +import { ConfigSchema } from "@silverbulletmd/silverbullet/type/config"; export async function lintYAML({ tree }: LintEvent): Promise { const diagnostics: LintDiagnostic[] = []; diff --git a/plugs/index/page.ts b/plugs/index/page.ts index bf706322..e8504ba0 100644 --- a/plugs/index/page.ts +++ b/plugs/index/page.ts @@ -1,16 +1,21 @@ import type { IndexTreeEvent } from "../../plug-api/types.ts"; -import { editor, markdown, space, YAML } from "$sb/syscalls.ts"; +import { + editor, + markdown, + space, + YAML, +} from "@silverbulletmd/silverbullet/syscalls"; import type { LintDiagnostic, PageMeta } from "../../plug-api/types.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; -import { extractAttributes } from "$sb/lib/attribute.ts"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; +import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute"; import { indexObjects } from "./api.ts"; import { findNodeOfType, renderToText, traverseTreeAsync, } from "../../plug-api/lib/tree.ts"; -import { updateITags } from "$sb/lib/tags.ts"; +import { updateITags } from "@silverbulletmd/silverbullet/lib/tags"; export async function indexPage({ name, tree }: IndexTreeEvent) { if (name.startsWith("_")) { diff --git a/plugs/index/page_links.ts b/plugs/index/page_links.ts index 63d9cb5f..16151896 100644 --- a/plugs/index/page_links.ts +++ b/plugs/index/page_links.ts @@ -1,10 +1,23 @@ -import { findNodeOfType, renderToText, traverseTree } from "$sb/lib/tree.ts"; -import type { IndexTreeEvent, ObjectValue } from "$sb/types.ts"; -import { isLocalPath, resolvePath } from "$sb/lib/resolve.ts"; +import { + findNodeOfType, + renderToText, + traverseTree, +} from "@silverbulletmd/silverbullet/lib/tree"; +import type { + IndexTreeEvent, + ObjectValue, +} from "@silverbulletmd/silverbullet/types"; +import { + isLocalPath, + resolvePath, +} from "@silverbulletmd/silverbullet/lib/resolve"; import { indexObjects, queryObjects } from "./api.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; -import { updateITags } from "$sb/lib/tags.ts"; -import { looksLikePathWithExtension, parsePageRef } from "$sb/lib/page_ref.ts"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; +import { updateITags } from "@silverbulletmd/silverbullet/lib/tags"; +import { + looksLikePathWithExtension, + parsePageRef, +} from "@silverbulletmd/silverbullet/lib/page_ref"; import { extractSnippetAroundIndex } from "./snippet_extractor.ts"; import { mdLinkRegex, diff --git a/plugs/index/paragraph.ts b/plugs/index/paragraph.ts index fbff4a1b..8de95c78 100644 --- a/plugs/index/paragraph.ts +++ b/plugs/index/paragraph.ts @@ -6,10 +6,10 @@ import { renderToText, traverseTreeAsync, } from "../../plug-api/lib/tree.ts"; -import { extractAttributes } from "$sb/lib/attribute.ts"; +import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute"; import type { ObjectValue } from "../../plug-api/types.ts"; -import { updateITags } from "$sb/lib/tags.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; +import { updateITags } from "@silverbulletmd/silverbullet/lib/tags"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; /** ParagraphObject An index object for the top level text nodes */ export type ParagraphObject = ObjectValue< diff --git a/plugs/index/plug_api.ts b/plugs/index/plug_api.ts index 305875da..12db5e79 100644 --- a/plugs/index/plug_api.ts +++ b/plugs/index/plug_api.ts @@ -5,7 +5,7 @@ import type { ObjectValue, } from "../../plug-api/types.ts"; import { ttlCache } from "$lib/memory_cache.ts"; -import { system } from "$sb/syscalls.ts"; +import { system } from "@silverbulletmd/silverbullet/syscalls"; export function indexObjects( page: string, diff --git a/plugs/index/refactor.ts b/plugs/index/refactor.ts index 5edd4637..91148332 100644 --- a/plugs/index/refactor.ts +++ b/plugs/index/refactor.ts @@ -1,9 +1,12 @@ -import { editor, space } from "$sb/syscalls.ts"; -import { validatePageName } from "$sb/lib/page_ref.ts"; +import { editor, space } from "@silverbulletmd/silverbullet/syscalls"; +import { validatePageName } from "@silverbulletmd/silverbullet/lib/page_ref"; import { getBackLinks, type LinkObject } from "./page_links.ts"; import { queryObjects } from "./api.ts"; -import { absoluteToRelativePath, folderName } from "$sb/lib/resolve.ts"; -import type { ObjectValue } from "$sb/types.ts"; +import { + absoluteToRelativePath, + folderName, +} from "@silverbulletmd/silverbullet/lib/resolve"; +import type { ObjectValue } from "@silverbulletmd/silverbullet/types"; /** * Renames a single page. diff --git a/plugs/index/style.ts b/plugs/index/style.ts index 5677e7a3..aa05daa0 100644 --- a/plugs/index/style.ts +++ b/plugs/index/style.ts @@ -2,8 +2,8 @@ import type { IndexTreeEvent } from "../../plug-api/types.ts"; import { collectNodesOfType, findNodeOfType } from "../../plug-api/lib/tree.ts"; import type { ObjectValue } from "../../plug-api/types.ts"; import { indexObjects } from "./api.ts"; -import { cleanPageRef } from "$sb/lib/resolve.ts"; -import { system } from "$sb/syscalls.ts"; +import { cleanPageRef } from "@silverbulletmd/silverbullet/lib/resolve"; +import { system } from "@silverbulletmd/silverbullet/syscalls"; export type StyleObject = ObjectValue<{ style: string; diff --git a/plugs/index/table.ts b/plugs/index/table.ts index 9a0d9238..e913f30e 100644 --- a/plugs/index/table.ts +++ b/plugs/index/table.ts @@ -3,7 +3,7 @@ import { collectNodesMatching, collectNodesOfType, type ParseTree, -} from "$sb/lib/tree.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; import { indexObjects } from "./api.ts"; type TableRowObject = diff --git a/plugs/index/tag_page.ts b/plugs/index/tag_page.ts index ac0746e8..c459a7ea 100644 --- a/plugs/index/tag_page.ts +++ b/plugs/index/tag_page.ts @@ -1,6 +1,6 @@ import type { FileMeta } from "../../plug-api/types.ts"; -import { markdown, system } from "$sb/syscalls.ts"; -import { renderToText } from "$sb/lib/tree.ts"; +import { markdown, system } from "@silverbulletmd/silverbullet/syscalls"; +import { renderToText } from "@silverbulletmd/silverbullet/lib/tree"; import { tagPrefix } from "./constants.ts"; export async function readFileTag( diff --git a/plugs/index/tags.ts b/plugs/index/tags.ts index 46924e6d..3f4634ef 100644 --- a/plugs/index/tags.ts +++ b/plugs/index/tags.ts @@ -1,11 +1,11 @@ import type { CompleteEvent, IndexTreeEvent } from "../../plug-api/types.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; import { indexObjects, queryObjects } from "./api.ts"; import { addParentPointers, collectNodesOfType, findParentMatching, -} from "$sb/lib/tree.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; import type { ObjectValue } from "../../plug-api/types.ts"; export type TagObject = ObjectValue<{ diff --git a/plugs/index/toc.ts b/plugs/index/toc.ts index 9df7e29b..054f2125 100644 --- a/plugs/index/toc.ts +++ b/plugs/index/toc.ts @@ -1,7 +1,7 @@ -import { editor, markdown, YAML } from "$sb/syscalls.ts"; -import type { CodeWidgetContent } from "$sb/types.ts"; -import { stripMarkdown } from "$sb/lib/markdown.ts"; -import { traverseTree } from "$sb/lib/tree.ts"; +import { editor, markdown, YAML } from "@silverbulletmd/silverbullet/syscalls"; +import type { CodeWidgetContent } from "@silverbulletmd/silverbullet/types"; +import { stripMarkdown } from "@silverbulletmd/silverbullet/lib/markdown"; +import { traverseTree } from "@silverbulletmd/silverbullet/lib/tree"; type Header = { name: string; diff --git a/plugs/index/widget.ts b/plugs/index/widget.ts index ae96fc8e..b92bf7b8 100644 --- a/plugs/index/widget.ts +++ b/plugs/index/widget.ts @@ -1,14 +1,23 @@ -import { codeWidget, editor, language, markdown, space } from "$sb/syscalls.ts"; -import { parseTreeToAST, renderToText } from "$sb/lib/tree.ts"; +import { + codeWidget, + editor, + language, + markdown, + space, +} from "@silverbulletmd/silverbullet/syscalls"; +import { + parseTreeToAST, + renderToText, +} from "@silverbulletmd/silverbullet/lib/tree"; import type { CodeWidgetContent } from "../../plug-api/types.ts"; import { loadPageObject } from "../template/page.ts"; import { queryObjects } from "./api.ts"; import type { TemplateObject } from "../template/types.ts"; -import { expressionToKvQueryExpression } from "$sb/lib/parse-query.ts"; -import { evalQueryExpression } from "$sb/lib/query_expression.ts"; +import { expressionToKvQueryExpression } from "../../plug-api/lib/parse_query.ts"; +import { evalQueryExpression } from "@silverbulletmd/silverbullet/lib/query_expression"; import { renderTemplate } from "../template/plug_api.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; -import { rewritePageRefs } from "$sb/lib/resolve.ts"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; +import { rewritePageRefs } from "@silverbulletmd/silverbullet/lib/resolve"; export async function refreshWidgets() { await codeWidget.refreshAll(); diff --git a/plugs/markdown/api.ts b/plugs/markdown/api.ts index be57d383..7614fc94 100644 --- a/plugs/markdown/api.ts +++ b/plugs/markdown/api.ts @@ -4,14 +4,14 @@ import { renderToText, replaceNodesMatchingAsync, } from "../../plug-api/lib/tree.ts"; -import { codeWidget } from "$sb/syscalls.ts"; +import { codeWidget } from "@silverbulletmd/silverbullet/syscalls"; import { parseMarkdown } from "../../plug-api/syscalls/markdown.ts"; import { type MarkdownRenderOptions, renderMarkdownToHtml, } from "./markdown_render.ts"; -import { validatePageName } from "$sb/lib/page_ref.ts"; -import { parsePageRef } from "$sb/lib/page_ref.ts"; +import { validatePageName } from "@silverbulletmd/silverbullet/lib/page_ref"; +import { parsePageRef } from "@silverbulletmd/silverbullet/lib/page_ref"; /** * Finds code widgets, runs their plug code to render and inlines their content in the parse tree diff --git a/plugs/markdown/markdown.ts b/plugs/markdown/markdown.ts index 495faa81..f4e90f51 100644 --- a/plugs/markdown/markdown.ts +++ b/plugs/markdown/markdown.ts @@ -1,4 +1,4 @@ -import { clientStore, editor } from "$sb/syscalls.ts"; +import { clientStore, editor } from "@silverbulletmd/silverbullet/syscalls"; import { updateMarkdownPreview } from "./preview.ts"; export async function togglePreview() { diff --git a/plugs/markdown/markdown_render.ts b/plugs/markdown/markdown_render.ts index 2f936e38..2dbc42ee 100644 --- a/plugs/markdown/markdown_render.ts +++ b/plugs/markdown/markdown_render.ts @@ -6,11 +6,14 @@ import { removeParentPointers, renderToText, traverseTree, -} from "$sb/lib/tree.ts"; -import { encodePageRef, parsePageRef } from "$sb/lib/page_ref.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; +import { + encodePageRef, + parsePageRef, +} from "@silverbulletmd/silverbullet/lib/page_ref"; import { Fragment, renderHtml, type Tag } from "./html_render.ts"; -import { isLocalPath } from "$sb/lib/resolve.ts"; -import type { PageMeta } from "$sb/types.ts"; +import { isLocalPath } from "@silverbulletmd/silverbullet/lib/resolve"; +import type { PageMeta } from "@silverbulletmd/silverbullet/types"; export type MarkdownRenderOptions = { failOnUnknown?: true; diff --git a/plugs/markdown/preview.ts b/plugs/markdown/preview.ts index c3343b46..c4c6ea30 100644 --- a/plugs/markdown/preview.ts +++ b/plugs/markdown/preview.ts @@ -1,6 +1,15 @@ -import { asset, clientStore, editor, markdown, system } from "$sb/syscalls.ts"; +import { + asset, + clientStore, + editor, + markdown, + system, +} from "@silverbulletmd/silverbullet/syscalls"; import { renderMarkdownToHtml } from "./markdown_render.ts"; -import { isLocalPath, resolvePath } from "$sb/lib/resolve.ts"; +import { + isLocalPath, + resolvePath, +} from "@silverbulletmd/silverbullet/lib/resolve"; import { expandCodeWidgets } from "./api.ts"; export async function updateMarkdownPreview() { diff --git a/plugs/markdown/util.ts b/plugs/markdown/util.ts index d5e6ef67..66496021 100644 --- a/plugs/markdown/util.ts +++ b/plugs/markdown/util.ts @@ -2,9 +2,9 @@ import { findNodeOfType, renderToText, replaceNodesMatching, -} from "$sb/lib/tree.ts"; -import { markdown } from "$sb/syscalls.ts"; -import { isLocalPath } from "$sb/lib/resolve.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; +import { markdown } from "@silverbulletmd/silverbullet/syscalls"; +import { isLocalPath } from "@silverbulletmd/silverbullet/lib/resolve"; export function encodePageUrl(name: string): string { return name; diff --git a/plugs/plug-manager/plugmanager.ts b/plugs/plug-manager/plugmanager.ts index 98de908b..071b1eeb 100644 --- a/plugs/plug-manager/plugmanager.ts +++ b/plugs/plug-manager/plugmanager.ts @@ -1,7 +1,11 @@ -import { editor, events, space, system } from "$sb/syscalls.ts"; -import { readYamlPage } from "$sb/lib/yaml_page.ts"; +import { + editor, + events, + space, + system, +} from "@silverbulletmd/silverbullet/syscalls"; +import { readYamlPage } from "@silverbulletmd/silverbullet/lib/yaml_page"; import { builtinPlugNames } from "../builtin_plugs.ts"; -import { plugPrefix } from "$common/spaces/constants.ts"; const plugsPrelude = "This file lists all plugs that SilverBullet will load. Run the {[Plugs: Update]} command to update and reload this list of plugs.\n\n"; @@ -73,7 +77,7 @@ export async function updatePlugsCommand() { allCustomPlugNames.push(plugName); // console.log("Writing", `_plug/${plugName}.plug.js`, workerCode); await space.writeAttachment( - `${plugPrefix}${plugName}.plug.js`, + `_plug/${plugName}.plug.js`, new TextEncoder().encode(workerCode), ); } @@ -82,7 +86,7 @@ export async function updatePlugsCommand() { // And delete extra ones for (const { name: existingPlug } of await space.listPlugs()) { const plugName = existingPlug.substring( - plugPrefix.length, + "_plug/".length, existingPlug.length - ".plug.js".length, ); if (!allPlugNames.includes(plugName)) { diff --git a/plugs/query/api.ts b/plugs/query/api.ts index 090037d8..6dd160d7 100644 --- a/plugs/query/api.ts +++ b/plugs/query/api.ts @@ -1,8 +1,8 @@ -import { parseQuery } from "$sb/lib/parse-query.ts"; +import { parseQuery } from "../../plug-api/lib/parse_query.ts"; import type { Query } from "../../plug-api/types.ts"; -import { events } from "$sb/syscalls.ts"; +import { events } from "@silverbulletmd/silverbullet/syscalls"; import type { QueryProviderEvent } from "../../plug-api/types.ts"; -import { resolvePath } from "$sb/lib/resolve.ts"; +import { resolvePath } from "@silverbulletmd/silverbullet/lib/resolve"; import { renderQueryTemplate } from "../template/util.ts"; export async function query( diff --git a/plugs/query/complete.ts b/plugs/query/complete.ts index d4e0555b..dd00f220 100644 --- a/plugs/query/complete.ts +++ b/plugs/query/complete.ts @@ -1,5 +1,5 @@ import type { CompleteEvent } from "../../plug-api/types.ts"; -import { events, language } from "$sb/syscalls.ts"; +import { events, language } from "@silverbulletmd/silverbullet/syscalls"; import type { AttributeCompleteEvent, AttributeCompletion, diff --git a/plugs/query/lint.ts b/plugs/query/lint.ts index 40241511..21c2ea63 100644 --- a/plugs/query/lint.ts +++ b/plugs/query/lint.ts @@ -1,8 +1,14 @@ import type { LintEvent } from "../../plug-api/types.ts"; -import { parseQuery } from "$sb/lib/parse-query.ts"; -import { cleanPageRef, resolvePath } from "$sb/lib/resolve.ts"; -import { findNodeOfType, traverseTreeAsync } from "$sb/lib/tree.ts"; -import { events, space, system } from "$sb/syscalls.ts"; +import { parseQuery } from "../../plug-api/lib/parse_query.ts"; +import { + cleanPageRef, + resolvePath, +} from "@silverbulletmd/silverbullet/lib/resolve"; +import { + findNodeOfType, + traverseTreeAsync, +} from "@silverbulletmd/silverbullet/lib/tree"; +import { events, space, system } from "@silverbulletmd/silverbullet/syscalls"; import type { LintDiagnostic } from "../../plug-api/types.ts"; import { loadPageObject, replaceTemplateVars } from "../template/page.ts"; diff --git a/plugs/query/widget.ts b/plugs/query/widget.ts index 8a392cf3..21c485c1 100644 --- a/plugs/query/widget.ts +++ b/plugs/query/widget.ts @@ -1,4 +1,9 @@ -import { codeWidget, editor, markdown, system } from "$sb/syscalls.ts"; +import { + codeWidget, + editor, + markdown, + system, +} from "@silverbulletmd/silverbullet/syscalls"; import { addParentPointers, collectNodesOfType, @@ -8,8 +13,8 @@ import { type ParseTree, removeParentPointers, renderToText, -} from "$sb/lib/tree.ts"; -import { parseQuery } from "$sb/lib/parse-query.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; +import { parseQuery } from "../../plug-api/lib/parse_query.ts"; import { loadPageObject, replaceTemplateVars } from "../template/page.ts"; import type { CodeWidgetContent } from "../../plug-api/types.ts"; import { jsonToMDTable } from "../template/util.ts"; diff --git a/plugs/search/search.ts b/plugs/search/search.ts index 7c0a3c68..c7b95073 100644 --- a/plugs/search/search.ts +++ b/plugs/search/search.ts @@ -2,12 +2,15 @@ import type { IndexTreeEvent, QueryProviderEvent, } from "../../plug-api/types.ts"; -import { renderToText } from "$sb/lib/tree.ts"; -import { applyQuery, liftAttributeFilter } from "$sb/lib/query.ts"; -import { editor } from "$sb/syscalls.ts"; +import { renderToText } from "@silverbulletmd/silverbullet/lib/tree"; +import { + applyQuery, + liftAttributeFilter, +} from "@silverbulletmd/silverbullet/lib/query"; +import { editor } from "@silverbulletmd/silverbullet/syscalls"; import type { FileMeta } from "../../plug-api/types.ts"; import { ftsIndexPage, ftsSearch } from "./engine.ts"; -import { evalQueryExpression } from "$sb/lib/query_expression.ts"; +import { evalQueryExpression } from "@silverbulletmd/silverbullet/lib/query_expression"; import { PromiseQueue } from "$lib/async.ts"; const searchPrefix = "🔍 "; diff --git a/plugs/share/publish.ts b/plugs/share/publish.ts index 476f7983..bced8bcc 100644 --- a/plugs/share/publish.ts +++ b/plugs/share/publish.ts @@ -1,5 +1,9 @@ -import { editor, events, markdown } from "$sb/syscalls.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; +import { + editor, + events, + markdown, +} from "@silverbulletmd/silverbullet/syscalls"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; import type { PublishEvent } from "../../plug-api/types.ts"; export async function publishShareOptions() { diff --git a/plugs/share/share.ts b/plugs/share/share.ts index 4b0d315f..3f957e43 100644 --- a/plugs/share/share.ts +++ b/plugs/share/share.ts @@ -1,8 +1,13 @@ -import { editor, events, markdown, system } from "$sb/syscalls.ts"; +import { + editor, + events, + markdown, + system, +} from "@silverbulletmd/silverbullet/syscalls"; import { findNodeOfType, renderToText } from "../../plug-api/lib/tree.ts"; import { replaceNodesMatching } from "../../plug-api/lib/tree.ts"; import type { ParseTree } from "../../plug-api/lib/tree.ts"; -import { parsePageRef } from "$sb/lib/page_ref.ts"; +import { parsePageRef } from "@silverbulletmd/silverbullet/lib/page_ref"; type ShareOption = { id: string; diff --git a/plugs/sync/sync.ts b/plugs/sync/sync.ts index f03819a7..547fa6f8 100644 --- a/plugs/sync/sync.ts +++ b/plugs/sync/sync.ts @@ -1,4 +1,4 @@ -import { editor, sync } from "$sb/syscalls.ts"; +import { editor, sync } from "@silverbulletmd/silverbullet/syscalls"; export async function syncSpaceCommand() { await editor.flashNotification("Syncing space..."); diff --git a/plugs/tasks/task.ts b/plugs/tasks/task.ts index 803a046a..3421a359 100644 --- a/plugs/tasks/task.ts +++ b/plugs/tasks/task.ts @@ -1,6 +1,12 @@ import type { ClickEvent, IndexTreeEvent } from "../../plug-api/types.ts"; -import { editor, events, markdown, space, sync } from "$sb/syscalls.ts"; +import { + editor, + events, + markdown, + space, + sync, +} from "@silverbulletmd/silverbullet/syscalls"; import { addParentPointers, @@ -15,13 +21,16 @@ import { traverseTreeAsync, } from "../../plug-api/lib/tree.ts"; import { niceDate } from "$lib/dates.ts"; -import { extractAttributes } from "$sb/lib/attribute.ts"; -import { rewritePageRefs } from "$sb/lib/resolve.ts"; +import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute"; +import { rewritePageRefs } from "@silverbulletmd/silverbullet/lib/resolve"; import type { ObjectValue } from "../../plug-api/types.ts"; import { indexObjects, queryObjects } from "../index/plug_api.ts"; -import { updateITags } from "$sb/lib/tags.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; -import { parsePageRef, positionOfLine } from "$sb/lib/page_ref.ts"; +import { updateITags } from "@silverbulletmd/silverbullet/lib/tags"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; +import { + parsePageRef, + positionOfLine, +} from "@silverbulletmd/silverbullet/lib/page_ref"; export type TaskObject = ObjectValue< { diff --git a/plugs/template/api.ts b/plugs/template/api.ts index d9fc51ec..0e09b9ae 100644 --- a/plugs/template/api.ts +++ b/plugs/template/api.ts @@ -1,7 +1,11 @@ -import { markdown, template, YAML } from "$sb/syscalls.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; +import { + markdown, + template, + YAML, +} from "@silverbulletmd/silverbullet/syscalls"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; import type { TemplateObject } from "./types.ts"; -import { renderToText } from "$sb/lib/tree.ts"; +import { renderToText } from "@silverbulletmd/silverbullet/lib/tree"; /** * Strips the template from its frontmatter and renders it. diff --git a/plugs/template/index.ts b/plugs/template/index.ts index 93ada430..99b16bd7 100644 --- a/plugs/template/index.ts +++ b/plugs/template/index.ts @@ -1,5 +1,5 @@ import type { IndexTreeEvent } from "../../plug-api/types.ts"; -import { system } from "$sb/syscalls.ts"; +import { system } from "@silverbulletmd/silverbullet/syscalls"; export async function indexTemplate({ name, tree }: IndexTreeEvent) { // Just delegate to the index plug diff --git a/plugs/template/lint.ts b/plugs/template/lint.ts index fc6f85a1..f3eebde8 100644 --- a/plugs/template/lint.ts +++ b/plugs/template/lint.ts @@ -3,9 +3,13 @@ import { findNodeOfType, renderToText, traverseTreeAsync, -} from "$sb/lib/tree.ts"; -import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; -import { jsonschema, template, YAML } from "$sb/syscalls.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; +import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter"; +import { + jsonschema, + template, + YAML, +} from "@silverbulletmd/silverbullet/syscalls"; import { TemplateObjectSchema } from "./types.ts"; export async function lintTemplateFrontmatter( diff --git a/plugs/template/page.ts b/plugs/template/page.ts index 86bbf5d1..077fe856 100644 --- a/plugs/template/page.ts +++ b/plugs/template/page.ts @@ -1,4 +1,9 @@ -import { editor, space, system, template } from "$sb/syscalls.ts"; +import { + editor, + space, + system, + template, +} from "@silverbulletmd/silverbullet/syscalls"; import type { PageMeta } from "../../plug-api/types.ts"; import { getObjectByRef, queryObjects } from "../index/plug_api.ts"; import type { FrontmatterConfig, TemplateObject } from "./types.ts"; diff --git a/plugs/template/snippet.ts b/plugs/template/snippet.ts index eefe96d9..dda1178f 100644 --- a/plugs/template/snippet.ts +++ b/plugs/template/snippet.ts @@ -3,7 +3,13 @@ import type { SlashCompletionOption, SlashCompletions, } from "../../plug-api/types.ts"; -import { editor, markdown, space, system, YAML } from "$sb/syscalls.ts"; +import { + editor, + markdown, + space, + system, + YAML, +} from "@silverbulletmd/silverbullet/syscalls"; import type { AttributeCompletion } from "../index/attributes.ts"; import { queryObjects } from "../index/plug_api.ts"; import type { TemplateObject } from "./types.ts"; @@ -12,9 +18,9 @@ import { renderTemplate } from "./api.ts"; import { extractFrontmatter, prepareFrontmatterDispatch, -} from "$sb/lib/frontmatter.ts"; +} from "@silverbulletmd/silverbullet/lib/frontmatter"; import type { SnippetConfig } from "./types.ts"; -import { deepObjectMerge } from "$sb/lib/json.ts"; +import { deepObjectMerge } from "@silverbulletmd/silverbullet/lib/json"; export async function snippetSlashComplete( completeEvent: CompleteEvent, diff --git a/plugs/template/types.ts b/plugs/template/types.ts index 209efe4f..ff02b04a 100644 --- a/plugs/template/types.ts +++ b/plugs/template/types.ts @@ -1,4 +1,4 @@ -import type { ObjectValue } from "$sb/types.ts"; +import type { ObjectValue } from "@silverbulletmd/silverbullet/types"; export type CommandConfig = { command?: string; diff --git a/plugs/template/util.ts b/plugs/template/util.ts index 1d550aa7..0953c7c2 100644 --- a/plugs/template/util.ts +++ b/plugs/template/util.ts @@ -1,5 +1,5 @@ import type { PageMeta } from "../../plug-api/types.ts"; -import { space, system, template } from "$sb/syscalls.ts"; +import { space, system, template } from "@silverbulletmd/silverbullet/syscalls"; import { cleanTemplate } from "./plug_api.ts"; export function defaultJsonTransformer(v: any): string { diff --git a/plugs/template/var.ts b/plugs/template/var.ts index 09942399..4f7f02c7 100644 --- a/plugs/template/var.ts +++ b/plugs/template/var.ts @@ -1,5 +1,5 @@ import type { CompleteEvent } from "../../plug-api/types.ts"; -import { datastore, events } from "$sb/syscalls.ts"; +import { datastore, events } from "@silverbulletmd/silverbullet/syscalls"; import type { AttributeCompleteEvent, diff --git a/plugs/template/widget.ts b/plugs/template/widget.ts index 2894f4e1..d8d020b3 100644 --- a/plugs/template/widget.ts +++ b/plugs/template/widget.ts @@ -1,11 +1,19 @@ -import { markdown, space, system, YAML } from "$sb/syscalls.ts"; +import { + markdown, + space, + system, + YAML, +} from "@silverbulletmd/silverbullet/syscalls"; import { loadPageObject, replaceTemplateVars } from "./page.ts"; import type { CodeWidgetContent, PageMeta } from "../../plug-api/types.ts"; import { renderTemplate } from "./plug_api.ts"; -import { renderToText } from "$sb/lib/tree.ts"; -import { rewritePageRefs, rewritePageRefsInString } from "$sb/lib/resolve.ts"; +import { renderToText } from "@silverbulletmd/silverbullet/lib/tree"; +import { + rewritePageRefs, + rewritePageRefsInString, +} from "@silverbulletmd/silverbullet/lib/resolve"; import { queryParsed } from "../query/api.ts"; -import { parseQuery } from "$sb/lib/parse-query.ts"; +import { parseQuery } from "../../plug-api/lib/parse_query.ts"; type TemplateWidgetConfig = { // Pull the template from a page diff --git a/scripts/release.sh b/scripts/release.sh index 551d7e12..0daf374d 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,7 +1,10 @@ #!/bin/bash -e VERSION=$1 + +# Patch version is version.ts and deno.json echo "export const version = \"$VERSION\";" > version.ts +sed -i '' "s/\(\"version\": \"\)[^\"]*\(\"\)/\1$VERSION\2/" deno.json git commit -am $VERSION git tag $VERSION git push && git push --tags diff --git a/server/http_server.ts b/server/http_server.ts index 3eedc281..fdf5db07 100644 --- a/server/http_server.ts +++ b/server/http_server.ts @@ -2,8 +2,12 @@ import { deleteCookie, getCookie, setCookie } from "hono/helper.ts"; import { cors } from "hono/middleware.ts"; import { type Context, Hono, type HonoRequest, validator } from "hono/mod.ts"; import type { AssetBundle } from "$lib/asset_bundle/bundle.ts"; -import type { EndpointRequest, EndpointResponse, FileMeta } from "$sb/types.ts"; -import type { ShellRequest } from "$type/rpc.ts"; +import type { + EndpointRequest, + EndpointResponse, + FileMeta, +} from "@silverbulletmd/silverbullet/types"; +import type { ShellRequest } from "@silverbulletmd/silverbullet/type/rpc"; import { SpaceServer } from "./instance.ts"; import type { SpaceServerConfig } from "./instance.ts"; import type { KvPrimitives } from "$lib/data/kv_primitives.ts"; @@ -11,7 +15,10 @@ import { PrefixedKvPrimitives } from "$lib/data/prefixed_kv_primitives.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts"; import { renderMarkdownToHtml } from "../plugs/markdown/markdown_render.ts"; -import { looksLikePathWithExtension, parsePageRef } from "$sb/lib/page_ref.ts"; +import { + looksLikePathWithExtension, + parsePageRef, +} from "@silverbulletmd/silverbullet/lib/page_ref"; import { base64Encode } from "$lib/crypto.ts"; import { basename, dirname, join } from "@std/path"; diff --git a/lib/web.ts b/type/client.ts similarity index 100% rename from lib/web.ts rename to type/client.ts diff --git a/type/config.ts b/type/config.ts index dfb025f7..a4041b46 100644 --- a/type/config.ts +++ b/type/config.ts @@ -1,4 +1,4 @@ -import type { ActionButton, EmojiConfig, Shortcut } from "$lib/web.ts"; +import type { ActionButton, EmojiConfig, Shortcut } from "./client.ts"; export type ObjectDecorator = { // The expression to match against the object diff --git a/web/client.ts b/web/client.ts index 783128a5..8bd93890 100644 --- a/web/client.ts +++ b/web/client.ts @@ -8,7 +8,7 @@ import { syntaxTree } from "@codemirror/language"; import { compile as gitIgnoreCompiler } from "gitignore-parser"; import type { SyntaxNode } from "@lezer/common"; import { Space } from "../common/space.ts"; -import type { FilterOption } from "$lib/web.ts"; +import type { FilterOption } from "@silverbulletmd/silverbullet/type/client"; import { EventHook } from "../common/hooks/event.ts"; import type { AppCommand } from "$lib/command.ts"; import { @@ -17,7 +17,7 @@ import { PathPageNavigator, } from "./navigator.ts"; -import type { AppViewState } from "../type/web.ts"; +import type { AppViewState } from "./type.ts"; import type { AppEvent, @@ -39,11 +39,14 @@ import type { SyncStatus } from "$common/spaces/sync.ts"; import { HttpSpacePrimitives } from "$common/spaces/http_space_primitives.ts"; import { FallbackSpacePrimitives } from "$common/spaces/fallback_space_primitives.ts"; import { FilteredSpacePrimitives } from "$common/spaces/filtered_space_primitives.ts"; -import { encodePageRef, validatePageName } from "$sb/lib/page_ref.ts"; +import { + encodePageRef, + validatePageName, +} from "@silverbulletmd/silverbullet/lib/page_ref"; import { ClientSystem } from "./client_system.ts"; import { createEditorState } from "./editor_state.ts"; import { MainUI } from "./editor_ui.tsx"; -import { cleanPageRef } from "$sb/lib/resolve.ts"; +import { cleanPageRef } from "@silverbulletmd/silverbullet/lib/resolve"; import type { SpacePrimitives } from "$common/spaces/space_primitives.ts"; import type { CodeWidgetButton, @@ -69,7 +72,7 @@ import { import { LimitedMap } from "$lib/limited_map.ts"; import { plugPrefix } from "$common/spaces/constants.ts"; import { lezerToParseTree } from "$common/markdown_parser/parse_tree.ts"; -import { findNodeMatching } from "$sb/lib/tree.ts"; +import { findNodeMatching } from "@silverbulletmd/silverbullet/lib/tree"; import type { LinkObject } from "../plugs/index/page_links.ts"; import type { Config } from "../type/config.ts"; diff --git a/web/cm_plugins/editor_paste.ts b/web/cm_plugins/editor_paste.ts index 8b10c8a1..f32dbde1 100644 --- a/web/cm_plugins/editor_paste.ts +++ b/web/cm_plugins/editor_paste.ts @@ -1,7 +1,7 @@ import { syntaxTree } from "@codemirror/language"; import { EditorView, ViewPlugin, type ViewUpdate } from "@codemirror/view"; import type { Client } from "../client.ts"; -import type { UploadFile } from "$sb/types.ts"; +import type { UploadFile } from "@silverbulletmd/silverbullet/types"; // We use turndown to convert HTML to Markdown import TurndownService from "turndown"; @@ -13,10 +13,10 @@ import { addParentPointers, findParentMatching, nodeAtPos, -} from "$sb/lib/tree.ts"; +} from "@silverbulletmd/silverbullet/lib/tree"; import { defaultLinkStyle, maximumAttachmentSize } from "../constants.ts"; import { safeRun } from "$lib/async.ts"; -import { resolvePath } from "$sb/lib/resolve.ts"; +import { resolvePath } from "@silverbulletmd/silverbullet/lib/resolve"; const turndownService = new TurndownService({ hr: "---", diff --git a/web/cm_plugins/inline_content.ts b/web/cm_plugins/inline_content.ts index e987f6d6..765ee067 100644 --- a/web/cm_plugins/inline_content.ts +++ b/web/cm_plugins/inline_content.ts @@ -4,8 +4,12 @@ import { Decoration, WidgetType } from "@codemirror/view"; import { MarkdownWidget } from "./markdown_widget.ts"; import { decoratorStateField } from "./util.ts"; import type { Client } from "../client.ts"; -import { isFederationPath, isLocalPath, resolvePath } from "$sb/lib/resolve.ts"; -import { parsePageRef } from "$sb/lib/page_ref.ts"; +import { + isFederationPath, + isLocalPath, + resolvePath, +} from "@silverbulletmd/silverbullet/lib/resolve"; +import { parsePageRef } from "@silverbulletmd/silverbullet/lib/page_ref"; import { mime } from "mimetypes"; type ContentDimensions = { diff --git a/web/cm_plugins/link.ts b/web/cm_plugins/link.ts index 20c73259..5b278b6c 100644 --- a/web/cm_plugins/link.ts +++ b/web/cm_plugins/link.ts @@ -1,4 +1,7 @@ -import { isLocalPath, resolvePath } from "$sb/lib/resolve.ts"; +import { + isLocalPath, + resolvePath, +} from "@silverbulletmd/silverbullet/lib/resolve"; import type { Client } from "../client.ts"; import { syntaxTree } from "@codemirror/language"; import { Decoration } from "@codemirror/view"; diff --git a/web/cm_plugins/markdown_widget.ts b/web/cm_plugins/markdown_widget.ts index 13e6a6d6..ce9cdfdb 100644 --- a/web/cm_plugins/markdown_widget.ts +++ b/web/cm_plugins/markdown_widget.ts @@ -5,12 +5,15 @@ import type { CodeWidgetCallback, } from "../../plug-api/types.ts"; import { renderMarkdownToHtml } from "../../plugs/markdown/markdown_render.ts"; -import { isLocalPath, resolvePath } from "$sb/lib/resolve.ts"; +import { + isLocalPath, + resolvePath, +} from "@silverbulletmd/silverbullet/lib/resolve"; import { parse } from "$common/markdown_parser/parse_tree.ts"; import { parsePageRef } from "../../plug-api/lib/page_ref.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; import { tagPrefix } from "../../plugs/index/constants.ts"; -import { renderToText } from "$sb/lib/tree.ts"; +import { renderToText } from "@silverbulletmd/silverbullet/lib/tree"; const activeWidgets = new Set(); diff --git a/web/cm_plugins/table.ts b/web/cm_plugins/table.ts index a46152bd..e5bbd857 100644 --- a/web/cm_plugins/table.ts +++ b/web/cm_plugins/table.ts @@ -11,7 +11,10 @@ import { renderMarkdownToHtml } from "../../plugs/markdown/markdown_render.ts"; import { type ParseTree, renderToText } from "../../plug-api/lib/tree.ts"; import { lezerToParseTree } from "$common/markdown_parser/parse_tree.ts"; import type { Client } from "../client.ts"; -import { isLocalPath, resolvePath } from "$sb/lib/resolve.ts"; +import { + isLocalPath, + resolvePath, +} from "@silverbulletmd/silverbullet/lib/resolve"; class TableViewWidget extends WidgetType { tableBodyText: string; diff --git a/web/cm_plugins/wiki_link.ts b/web/cm_plugins/wiki_link.ts index dbe65e75..f58b2e26 100644 --- a/web/cm_plugins/wiki_link.ts +++ b/web/cm_plugins/wiki_link.ts @@ -1,10 +1,13 @@ -import type { ClickEvent } from "$sb/types.ts"; +import type { ClickEvent } from "@silverbulletmd/silverbullet/types"; import { syntaxTree } from "@codemirror/language"; import { Decoration } from "@codemirror/view"; import type { Client } from "../client.ts"; import { decoratorStateField, isCursorInRange, LinkWidget } from "./util.ts"; -import { resolvePath } from "$sb/lib/resolve.ts"; -import { encodePageRef, parsePageRef } from "$sb/lib/page_ref.ts"; +import { resolvePath } from "@silverbulletmd/silverbullet/lib/resolve"; +import { + encodePageRef, + parsePageRef, +} from "@silverbulletmd/silverbullet/lib/page_ref"; /** * Plugin to hide path prefix when the cursor is not inside. diff --git a/web/components/command_palette.tsx b/web/components/command_palette.tsx index 2233a58f..7a17e48c 100644 --- a/web/components/command_palette.tsx +++ b/web/components/command_palette.tsx @@ -5,7 +5,7 @@ import type { } from "@codemirror/autocomplete"; import { Terminal } from "preact-feather"; import type { AppCommand } from "../../lib/command.ts"; -import type { FilterOption } from "$lib/web.ts"; +import type { FilterOption } from "@silverbulletmd/silverbullet/type/client"; import { parseCommand } from "$common/command.ts"; import type { Config } from "../../type/config.ts"; diff --git a/web/components/filter.tsx b/web/components/filter.tsx index 95e0a8da..c1e47a70 100644 --- a/web/components/filter.tsx +++ b/web/components/filter.tsx @@ -5,7 +5,7 @@ import type { } from "@codemirror/autocomplete"; import type { FunctionalComponent } from "preact"; import { useEffect, useRef, useState } from "preact/hooks"; -import type { FilterOption } from "$lib/web.ts"; +import type { FilterOption } from "@silverbulletmd/silverbullet/type/client"; import { MiniEditor } from "./mini_editor.tsx"; import { fuzzySearchAndSort } from "../fuse_search.ts"; import { deepEqual } from "../../plug-api/lib/json.ts"; diff --git a/web/components/page_navigator.tsx b/web/components/page_navigator.tsx index fd4e6eae..045683fd 100644 --- a/web/components/page_navigator.tsx +++ b/web/components/page_navigator.tsx @@ -1,5 +1,5 @@ import { FilterList } from "./filter.tsx"; -import type { FilterOption } from "$lib/web.ts"; +import type { FilterOption } from "@silverbulletmd/silverbullet/type/client"; import type { CompletionContext, CompletionResult, diff --git a/web/components/panel.tsx b/web/components/panel.tsx index dc503e5d..1a9fe19a 100644 --- a/web/components/panel.tsx +++ b/web/components/panel.tsx @@ -1,6 +1,6 @@ import { useEffect, useRef } from "preact/hooks"; import type { Client } from "../client.ts"; -import type { PanelConfig } from "../../type/web.ts"; +import type { PanelConfig } from "../type.ts"; import { panelHtml } from "./panel_html.ts"; export function Panel({ diff --git a/web/components/top_bar.tsx b/web/components/top_bar.tsx index 521ca491..a255d6c9 100644 --- a/web/components/top_bar.tsx +++ b/web/components/top_bar.tsx @@ -3,7 +3,7 @@ import type { CompletionResult, } from "@codemirror/autocomplete"; import type { ComponentChildren, FunctionalComponent } from "preact"; -import type { Notification } from "$lib/web.ts"; +import type { Notification } from "@silverbulletmd/silverbullet/type/client"; import type { FeatherProps } from "preact-feather/types"; import type { IconBaseProps } from "react-icons/types"; import { MiniEditor } from "./mini_editor.tsx"; diff --git a/web/editor_ui.tsx b/web/editor_ui.tsx index e19dc2fb..7fa35bc8 100644 --- a/web/editor_ui.tsx +++ b/web/editor_ui.tsx @@ -4,11 +4,7 @@ import { FilterList } from "./components/filter.tsx"; import { PageNavigator } from "./components/page_navigator.tsx"; import { TopBar } from "./components/top_bar.tsx"; import reducer from "./reducer.ts"; -import { - type Action, - type AppViewState, - initialViewState, -} from "../type/web.ts"; +import { type Action, type AppViewState, initialViewState } from "./type.ts"; import * as featherIcons from "preact-feather"; import * as mdi from "./filtered_material_icons.ts"; import { h, render as preactRender } from "preact"; diff --git a/web/fuse_search.test.ts b/web/fuse_search.test.ts index 905d079f..55e66251 100644 --- a/web/fuse_search.test.ts +++ b/web/fuse_search.test.ts @@ -1,4 +1,4 @@ -import type { FilterOption } from "$lib/web.ts"; +import type { FilterOption } from "@silverbulletmd/silverbullet/type/client"; import { assertEquals } from "@std/assert"; import { fuzzySearchAndSort } from "./fuse_search.ts"; diff --git a/web/fuse_search.ts b/web/fuse_search.ts index d864c653..c0964683 100644 --- a/web/fuse_search.ts +++ b/web/fuse_search.ts @@ -1,6 +1,6 @@ // @deno-types="https://deno.land/x/fuse@v6.4.1/dist/fuse.d.ts" import Fuse from "fuse"; -import type { FilterOption } from "$lib/web.ts"; +import type { FilterOption } from "@silverbulletmd/silverbullet/type/client"; type FuseOption = FilterOption & { baseName: string; diff --git a/web/navigator.ts b/web/navigator.ts index b5853dca..9b6888b4 100644 --- a/web/navigator.ts +++ b/web/navigator.ts @@ -1,6 +1,6 @@ import { type PageRef, parsePageRef } from "../plug-api/lib/page_ref.ts"; import type { Client } from "./client.ts"; -import { cleanPageRef } from "$sb/lib/resolve.ts"; +import { cleanPageRef } from "@silverbulletmd/silverbullet/lib/resolve"; import { renderTheTemplate } from "$common/syscalls/template.ts"; import { safeRun } from "../lib/async.ts"; diff --git a/web/reducer.ts b/web/reducer.ts index 9bec53fb..9060b458 100644 --- a/web/reducer.ts +++ b/web/reducer.ts @@ -1,5 +1,5 @@ import type { PageMeta } from "../plug-api/types.ts"; -import type { Action, AppViewState } from "../type/web.ts"; +import type { Action, AppViewState } from "./type.ts"; export default function reducer( state: AppViewState, diff --git a/web/service_worker.ts b/web/service_worker.ts index fa3452d2..a1c4ae11 100644 --- a/web/service_worker.ts +++ b/web/service_worker.ts @@ -2,7 +2,7 @@ import type { FileContent } from "$common/spaces/datastore_space_primitives.ts"; import { simpleHash } from "$lib/crypto.ts"; import { DataStore } from "$lib/data/datastore.ts"; import { IndexedDBKvPrimitives } from "$lib/data/indexeddb_kv_primitives.ts"; -import { looksLikePathWithExtension } from "$sb/lib/page_ref.ts"; +import { looksLikePathWithExtension } from "@silverbulletmd/silverbullet/lib/page_ref"; const CACHE_NAME = "{{CACHE_NAME}}_{{CONFIG_HASH}}"; diff --git a/web/syscalls/editor.ts b/web/syscalls/editor.ts index 908eaa24..be5af5a9 100644 --- a/web/syscalls/editor.ts +++ b/web/syscalls/editor.ts @@ -11,9 +11,9 @@ import type { Transaction } from "@codemirror/state"; import { EditorView } from "@codemirror/view"; import { getCM as vimGetCm, Vim } from "@replit/codemirror-vim"; import type { SysCallMapping } from "$lib/plugos/system.ts"; -import type { FilterOption } from "$lib/web.ts"; +import type { FilterOption } from "@silverbulletmd/silverbullet/type/client"; import type { UploadFile } from "../../plug-api/types.ts"; -import type { PageRef } from "$sb/lib/page_ref.ts"; +import type { PageRef } from "@silverbulletmd/silverbullet/lib/page_ref"; import { openSearchPanel } from "@codemirror/search"; import { diffAndPrepareChanges } from "../cm_util.ts"; @@ -60,6 +60,7 @@ export function editorSyscalls(client: Client): SysCallMapping { }, "editor.reloadConfigAndCommands": async () => { await client.loadConfig(); + await client.clientSystem.system.localSyscall( "system.loadSpaceScripts", [], diff --git a/type/web.ts b/web/type.ts similarity index 94% rename from type/web.ts rename to web/type.ts index f7e32580..69e96193 100644 --- a/type/web.ts +++ b/web/type.ts @@ -1,8 +1,8 @@ import type { AppCommand } from "../lib/command.ts"; import { defaultConfig } from "../common/config.ts"; -import type { FilterOption, Notification, PanelMode } from "$lib/web.ts"; -import type { Config } from "./config.ts"; -import type { PageMeta } from "$sb/types.ts"; +import type { FilterOption, Notification, PanelMode } from "../type/client.ts"; +import type { Config } from "../type/config.ts"; +import type { PageMeta } from "@silverbulletmd/silverbullet/types"; export type PanelConfig = { mode?: PanelMode;