* Move all syscalls to JSR-style package naming
* Eliminating some prefixes in import maps
pull/1013/head
Zef Hemel 2024-08-06 20:11:38 +02:00 committed by GitHub
parent 51f756ec60
commit 6b69449d05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
115 changed files with 468 additions and 264 deletions

View File

@ -7,6 +7,9 @@ on:
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # The OIDC ID token is used for authentication with JSR.
steps: steps:
- name: Setup repo - name: Setup repo
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -18,6 +21,8 @@ jobs:
run: deno task build run: deno task build
- name: Bundle - name: Bundle
run: deno task bundle run: deno task bundle
- name: Publish to JSR
run: deno publish
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
env: env:

View File

@ -1,4 +1,4 @@
import { datastore } from "$sb/syscalls.ts"; import { datastore } from "@silverbulletmd/silverbullet/syscalls";
export async function run() { export async function run() {
console.log("Hello from plug_test.ts"); console.log("Hello from plug_test.ts");

View File

@ -54,9 +54,11 @@ export abstract class CommonSystem {
console.log( console.log(
"Loaded", "Loaded",
Object.keys(this.scriptEnv.functions).length, Object.keys(this.scriptEnv.functions).length,
"functions and", "functions,",
Object.keys(this.scriptEnv.commands).length, 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) { } catch (e: any) {
console.error("Error loading space-script:", e.message); console.error("Error loading space-script:", e.message);

View File

@ -14,8 +14,8 @@ import type {
import { parseExpression } from "$common/expression_parser.ts"; import { parseExpression } from "$common/expression_parser.ts";
import type { System } from "$lib/plugos/system.ts"; import type { System } from "$lib/plugos/system.ts";
import type { ConfigObject } from "../plugs/index/config.ts"; import type { ConfigObject } from "../plugs/index/config.ts";
import { deepObjectMerge } from "$sb/lib/json.ts"; import { deepObjectMerge } from "@silverbulletmd/silverbullet/lib/json";
import type { ActionButton } from "$lib/web.ts"; import type { ActionButton } from "@silverbulletmd/silverbullet/type/client";
const yamlConfigRegex = /^(```+|~~~+)(ya?ml|space-config)\r?\n([\S\s]+?)\1/m; const yamlConfigRegex = /^(```+|~~~+)(ya?ml|space-config)\r?\n([\S\s]+?)\1/m;

View File

@ -1,7 +1,7 @@
import type { QueryExpression } from "$sb/types.ts"; import type { QueryExpression } from "@silverbulletmd/silverbullet/types";
import { parseTreeToAST } from "$sb/lib/tree.ts"; import { parseTreeToAST } from "@silverbulletmd/silverbullet/lib/tree";
import { expressionLanguage } from "$common/template/template_parser.ts"; 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"; import { lezerToParseTree } from "$common/markdown_parser/parse_tree.ts";
export function parseExpression(s: string): QueryExpression { export function parseExpression(s: string): QueryExpression {

View File

@ -3,7 +3,7 @@ import {
collectNodesOfType, collectNodesOfType,
findNodeOfType, findNodeOfType,
renderToText, renderToText,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import { assertEquals, assertNotEquals } from "@std/assert"; import { assertEquals, assertNotEquals } from "@std/assert";
import { extendedMarkdownLanguage } from "./parser.ts"; import { extendedMarkdownLanguage } from "./parser.ts";

View File

@ -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 { builtinFunctions } from "$lib/builtin_query_functions.ts";
import type { System } from "$lib/plugos/system.ts"; import type { System } from "$lib/plugos/system.ts";
import { LimitedMap } from "$lib/limited_map.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 { parse } from "$common/markdown_parser/parse_tree.ts";
import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
import { traverseTree } from "$sb/lib/tree.ts"; import { traverseTree } from "@silverbulletmd/silverbullet/lib/tree";
import { renderToText } from "$sb/lib/tree.ts"; import { renderToText } from "@silverbulletmd/silverbullet/lib/tree";
import { findNodeOfType } from "$sb/lib/tree.ts"; import { findNodeOfType } from "@silverbulletmd/silverbullet/lib/tree";
import { isFederationPath } from "$sb/lib/resolve.ts"; import {
import { rewritePageRefs } from "$sb/lib/resolve.ts"; isFederationPath,
rewritePageRefs,
} from "@silverbulletmd/silverbullet/lib/resolve";
const pageCacheTtl = 10 * 1000; // 10s const pageCacheTtl = 10 * 1000; // 10s

View File

@ -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 type { EventHook } from "$common/hooks/event.ts";
import { plugPrefix } from "$common/spaces/constants.ts"; import { plugPrefix } from "$common/spaces/constants.ts";

View File

@ -7,7 +7,7 @@ import type { CommonSystem } from "../common_system.ts";
import { version } from "../../version.ts"; import { version } from "../../version.ts";
import type { ParseTree } from "../../plug-api/lib/tree.ts"; import type { ParseTree } from "../../plug-api/lib/tree.ts";
import type { ConfigContainer } from "../config.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( export function systemSyscalls(
system: System<any>, system: System<any>,
@ -115,11 +115,7 @@ export function systemSyscalls(
// Reload scripts locally // Reload scripts locally
await commonSystem.loadSpaceScripts(); await commonSystem.loadSpaceScripts();
if (client) { if (client) {
// And we are in a hybrud mode, tell the server to do the same // Reload scripts remotely
if (system.env === "client") {
console.info(
"Sending syscall to server to trigger space script reload",
);
await proxySyscall( await proxySyscall(
{}, {},
client.httpSpacePrimitives, client.httpSpacePrimitives,
@ -127,7 +123,6 @@ export function systemSyscalls(
[], [],
); );
} }
}
}, },
"system.loadSpaceStyles": async () => { "system.loadSpaceStyles": async () => {
if (!client) { if (!client) {

View File

@ -1,6 +1,6 @@
import type { AST } from "../../plug-api/lib/tree.ts"; import type { AST } from "../../plug-api/lib/tree.ts";
import { evalQueryExpression } from "$sb/lib/query_expression.ts"; import { evalQueryExpression } from "@silverbulletmd/silverbullet/lib/query_expression";
import { expressionToKvQueryExpression } from "$sb/lib/parse-query.ts"; import { expressionToKvQueryExpression } from "../../plug-api/lib/parse_query.ts";
import type { FunctionMap } from "../../plug-api/types.ts"; import type { FunctionMap } from "../../plug-api/types.ts";
import { jsonToMDTable } from "../../plugs/template/util.ts"; import { jsonToMDTable } from "../../plugs/template/util.ts";

View File

@ -2,7 +2,24 @@
"name": "@silverbulletmd/silverbullet", "name": "@silverbulletmd/silverbullet",
"version": "0.0.1", "version": "0.0.1",
"exports": { "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": { "publish": {
"exclude": [ "exclude": [
@ -49,7 +66,7 @@
"cmd/test/test_space" "cmd/test/test_space"
], ],
"rules": { "rules": {
"exclude": ["no-explicit-any"] "exclude": ["no-explicit-any", "no-slow-types"]
} }
}, },
"fmt": { "fmt": {
@ -69,10 +86,27 @@
"jsxImportSource": "https://esm.sh/preact@10.23.1" "jsxImportSource": "https://esm.sh/preact@10.23.1"
}, },
"imports": { "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/", "$common/": "./common/",
"$lib/": "./lib/", "$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/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/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", "@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",

View File

@ -9,7 +9,7 @@ import type {
import { builtinFunctions } from "../builtin_query_functions.ts"; import { builtinFunctions } from "../builtin_query_functions.ts";
import type { KvPrimitives } from "./kv_primitives.ts"; import type { KvPrimitives } from "./kv_primitives.ts";
import { evalQueryExpression } from "../../plug-api/lib/query_expression.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 * This is the data store class you'll actually want to use, wrapping the primitives
* in a more user-friendly way * in a more user-friendly way

View File

@ -1,6 +1,6 @@
import "$sb/lib/syscall_mock.ts"; import "./syscall_mock.ts";
import { parse } from "$common/markdown_parser/parse_tree.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 { assertEquals } from "@std/assert";
import { renderToText } from "./tree.ts"; import { renderToText } from "./tree.ts";
import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";

View File

@ -5,7 +5,7 @@ import {
replaceNodesMatchingAsync, replaceNodesMatchingAsync,
} from "./tree.ts"; } from "./tree.ts";
import { cleanupJSON } from "$sb/lib/json.ts"; import { cleanupJSON } from "@silverbulletmd/silverbullet/lib/json";
import { system, YAML } from "../syscalls.ts"; import { system, YAML } from "../syscalls.ts";

View File

@ -1,7 +1,7 @@
import "$sb/lib/syscall_mock.ts"; import "./syscall_mock.ts";
import { parse } from "$common/markdown_parser/parse_tree.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts";
import { assertEquals } from "@std/assert"; 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"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
const feedSample1 = `--- const feedSample1 = `---

View File

@ -9,7 +9,7 @@ import {
* Feed parsing functionality (WIP) * Feed parsing functionality (WIP)
*/ */
import { extractAttributes } from "$sb/lib/attribute.ts"; import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute";
export type FeedItem = { export type FeedItem = {
id: string; id: string;

View File

@ -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( export function stripMarkdown(
tree: ParseTree, tree: ParseTree,

View File

@ -1,6 +1,6 @@
import { type AST, parseTreeToAST } from "./tree.ts"; import { type AST, parseTreeToAST } from "./tree.ts";
import type { Query, QueryExpression } from "../types.ts"; import type { Query, QueryExpression } from "../types.ts";
import { language } from "$sb/syscalls.ts"; import { language } from "@silverbulletmd/silverbullet/syscalls";
export function astToKvQuery( export function astToKvQuery(
node: AST, node: AST,

View File

@ -1,7 +1,7 @@
import { parse } from "$common/markdown_parser/parse_tree.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts";
import { type AST, collectNodesOfType, parseTreeToAST } from "./tree.ts"; import { type AST, collectNodesOfType, parseTreeToAST } from "./tree.ts";
import { assert, assertEquals } from "@std/assert"; 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"; import { languageFor } from "$common/languages.ts";
function wrapQueryParse(query: string): AST | null { function wrapQueryParse(query: string): AST | null {

View File

@ -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"; import { assert, assertEquals } from "@std/assert";
Deno.test("Test query expression evaluation", async () => { Deno.test("Test query expression evaluation", async () => {

View File

@ -3,7 +3,7 @@ import {
federatedPathToUrl, federatedPathToUrl,
resolvePath, resolvePath,
rewritePageRefs, rewritePageRefs,
} from "$sb/lib/resolve.ts"; } from "@silverbulletmd/silverbullet/lib/resolve";
import { assertEquals } from "@std/assert"; import { assertEquals } from "@std/assert";
import { type ParseTree, renderToText } from "./tree.ts"; import { type ParseTree, renderToText } from "./tree.ts";
import { parse } from "$common/markdown_parser/parse_tree.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts";

View File

@ -47,11 +47,11 @@ export function federatedPathToUrl(path: string): string {
return path; return path;
} }
export function isFederationPath(path: string) { export function isFederationPath(path: string): boolean {
return path.startsWith("!"); return path.startsWith("!");
} }
export function isLocalPath(path: string) { export function isLocalPath(path: string): boolean {
return !path.includes("://") && !path.startsWith("mailto:"); return !path.includes("://") && !path.startsWith("mailto:");
} }
@ -90,13 +90,13 @@ export function rewritePageRefs(tree: ParseTree, containerPageName: string) {
export function rewritePageRefsInString( export function rewritePageRefsInString(
bodyText: string, bodyText: string,
containerPageName: string, containerPageName: string,
) { ): string {
return bodyText.replaceAll(/\[\[(.+)\]\]/g, (_match, pageRefName) => { return bodyText.replaceAll(/\[\[(.+)\]\]/g, (_match, pageRefName) => {
return `[[${resolvePath(containerPageName, "/" + pageRefName)}]]`; return `[[${resolvePath(containerPageName, "/" + pageRefName)}]]`;
}); });
} }
export function cleanPageRef(pageRef: string) { export function cleanPageRef(pageRef: string): string {
if (pageRef.startsWith("[[") && pageRef.endsWith("]]")) { if (pageRef.startsWith("[[") && pageRef.endsWith("]]")) {
return pageRef.slice(2, -2); return pageRef.slice(2, -2);
} else { } 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("/"); return path.split("/").slice(0, -1).join("/");
} }
export function absoluteToRelativePath(page: string, linkTo: string) { export function absoluteToRelativePath(page: string, linkTo: string): string {
// Remove leading / // Remove leading /
page = page.startsWith("/") ? page.slice(1) : page; page = page.startsWith("/") ? page.slice(1) : page;
linkTo = linkTo.startsWith("/") ? linkTo.slice(1) : linkTo; linkTo = linkTo.startsWith("/") ? linkTo.slice(1) : linkTo;
@ -127,7 +127,7 @@ export function absoluteToRelativePath(page: string, linkTo: string) {
return [...splitPage, ...splitLink].join("/"); return [...splitPage, ...splitLink].join("/");
} }
export function relativeToAbsolutePath(page: string, linkTo: string) { export function relativeToAbsolutePath(page: string, linkTo: string): string {
// Remove leading / // Remove leading /
page = page.startsWith("/") ? page.slice(1) : page; page = page.startsWith("/") ? page.slice(1) : page;
linkTo = linkTo.startsWith("/") ? linkTo.slice(1) : linkTo; linkTo = linkTo.startsWith("/") ? linkTo.slice(1) : linkTo;

View File

@ -1,5 +1,5 @@
import { system } from "$sb/syscalls.ts"; import { system } from "@silverbulletmd/silverbullet/syscalls";
import { readYamlPage } from "$sb/lib/yaml_page.ts"; import { readYamlPage } from "@silverbulletmd/silverbullet/lib/yaml_page";
/** /**
* Retrieves a setting from the space configuration. * Retrieves a setting from the space configuration.

View File

@ -1,7 +1,7 @@
import type { UploadFile } from "../types.ts"; import type { UploadFile } from "../types.ts";
import { syscall } from "../syscall.ts"; import { syscall } from "../syscall.ts";
import type { PageRef } from "../lib/page_ref.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<string> { export function getCurrentPage(): Promise<string> {
return syscall("editor.getCurrentPage"); return syscall("editor.getCurrentPage");

View File

@ -1,4 +1,4 @@
import { syscall } from "$sb/syscall.ts"; import { syscall } from "../syscall.ts";
export function validateObject( export function validateObject(
schema: any, schema: any,

View File

@ -1,4 +1,5 @@
import { syscall } from "../syscall.ts"; import { syscall } from "../syscall.ts";
import type { AttachmentMeta, FileMeta, PageMeta } from "../types.ts"; import type { AttachmentMeta, FileMeta, PageMeta } from "../types.ts";
export function listPages(unfiltered = false): Promise<PageMeta[]> { export function listPages(unfiltered = false): Promise<PageMeta[]> {

View File

@ -2,7 +2,7 @@ import type { CommandDef } from "../../lib/command.ts";
import type { SyscallMeta } from "../types.ts"; import type { SyscallMeta } from "../types.ts";
import type { ParseTree } from "../lib/tree.ts"; import type { ParseTree } from "../lib/tree.ts";
import { syscall } from "../syscall.ts"; import { syscall } from "../syscall.ts";
import type { Config } from "$type/config.ts"; import type { Config } from "../../type/config.ts";
export function invokeFunction( export function invokeFunction(
name: string, name: string,

View File

@ -1,4 +1,4 @@
import { debug, editor } from "$sb/syscalls.ts"; import { debug, editor } from "@silverbulletmd/silverbullet/syscalls";
export async function cleanCommand() { export async function cleanCommand() {
if ( if (

View File

@ -1,4 +1,4 @@
import { system } from "$sb/syscalls.ts"; import { system } from "@silverbulletmd/silverbullet/syscalls";
import type { CompleteEvent } from "../../plug-api/types.ts"; import type { CompleteEvent } from "../../plug-api/types.ts";
export async function commandComplete(completeEvent: CompleteEvent) { export async function commandComplete(completeEvent: CompleteEvent) {

View File

@ -4,10 +4,10 @@ import type {
FileMeta, FileMeta,
PageMeta, PageMeta,
QueryExpression, QueryExpression,
} from "$sb/types.ts"; } from "@silverbulletmd/silverbullet/types";
import { listFilesCached } from "../federation/federation.ts"; import { listFilesCached } from "../federation/federation.ts";
import { queryObjects } from "../index/plug_api.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"; import type { LinkObject } from "../index/page_links.ts";
// A meta page is a page tagged with either #template or #meta // A meta page is a page tagged with either #template or #meta

View File

@ -1,4 +1,4 @@
import { debug, editor, markdown } from "$sb/syscalls.ts"; import { debug, editor, markdown } from "@silverbulletmd/silverbullet/syscalls";
export async function parsePageCommand() { export async function parsePageCommand() {
console.log( console.log(

View File

@ -1,4 +1,4 @@
import { clientStore, editor } from "$sb/syscalls.ts"; import { clientStore, editor } from "@silverbulletmd/silverbullet/syscalls";
// Run on "editor:init" // Run on "editor:init"
export async function setEditorMode() { export async function setEditorMode() {

View File

@ -1,4 +1,4 @@
import { YAML } from "$sb/syscalls.ts"; import { YAML } from "@silverbulletmd/silverbullet/syscalls";
import type { WidgetContent } from "../../plug-api/types.ts"; import type { WidgetContent } from "../../plug-api/types.ts";
type EmbedConfig = { type EmbedConfig = {

View File

@ -1,4 +1,4 @@
import { editor } from "$sb/syscalls.ts"; import { editor } from "@silverbulletmd/silverbullet/syscalls";
import { version } from "../../version.ts"; import { version } from "../../version.ts";
export async function versionCommand() { export async function versionCommand() {

View File

@ -1,5 +1,9 @@
import { nodeAtPos } from "../../plug-api/lib/tree.ts"; 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"; import { extractYoutubeVideoId } from "./embed.ts";
type UnfurlOption = { type UnfurlOption = {

View File

@ -1,14 +1,24 @@
import type { ClickEvent } from "../../plug-api/types.ts"; 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 { import {
addParentPointers, addParentPointers,
findNodeOfType, findNodeOfType,
findParentMatching, findParentMatching,
nodeAtPos, nodeAtPos,
type ParseTree, type ParseTree,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import { isLocalPath, resolvePath } from "$sb/lib/resolve.ts"; import {
import { looksLikePathWithExtension, parsePageRef } from "$sb/lib/page_ref.ts"; isLocalPath,
resolvePath,
} from "@silverbulletmd/silverbullet/lib/resolve";
import {
looksLikePathWithExtension,
parsePageRef,
} from "@silverbulletmd/silverbullet/lib/page_ref";
import { tagPrefix } from "../index/constants.ts"; import { tagPrefix } from "../index/constants.ts";
async function actionClickOrActionEnter( async function actionClickOrActionEnter(

View File

@ -1,4 +1,4 @@
import { editor } from "$sb/syscalls.ts"; import { editor } from "@silverbulletmd/silverbullet/syscalls";
export async function moveItemUp() { export async function moveItemUp() {
const cursorPos = await editor.getCursor(); const cursorPos = await editor.getCursor();

View File

@ -1,5 +1,5 @@
import { editor, space } from "$sb/syscalls.ts"; import { editor, space } from "@silverbulletmd/silverbullet/syscalls";
import { isFederationPath } from "$sb/lib/resolve.ts"; import { isFederationPath } from "@silverbulletmd/silverbullet/lib/resolve";
export async function deletePage() { export async function deletePage() {
const pageName = await editor.getCurrentPage(); const pageName = await editor.getCurrentPage();

View File

@ -1,4 +1,4 @@
import { editor, space } from "$sb/syscalls.ts"; import { editor, space } from "@silverbulletmd/silverbullet/syscalls";
function countWords(str: string): number { function countWords(str: string): number {
const matches = str.match(/[\w\d\'-]+/gi); const matches = str.match(/[\w\d\'-]+/gi);

View File

@ -1,4 +1,4 @@
import { editor } from "$sb/syscalls.ts"; import { editor } from "@silverbulletmd/silverbullet/syscalls";
export async function quoteSelection() { export async function quoteSelection() {
let text = await editor.getText(); let text = await editor.getText();

View File

@ -1,10 +1,10 @@
import { editor, space, system } from "$sb/syscalls.ts"; import { editor, space, system } from "@silverbulletmd/silverbullet/syscalls";
import type { UploadFile } from "$sb/types.ts"; import type { UploadFile } from "@silverbulletmd/silverbullet/types";
import { import {
defaultLinkStyle, defaultLinkStyle,
maximumAttachmentSize, maximumAttachmentSize,
} from "../../web/constants.ts"; } from "../../web/constants.ts";
import { resolvePath } from "$sb/lib/resolve.ts"; import { resolvePath } from "@silverbulletmd/silverbullet/lib/resolve";
export async function saveFile(file: UploadFile) { export async function saveFile(file: UploadFile) {
const maxSize = await system.getSpaceConfig( const maxSize = await system.getSpaceConfig(

View File

@ -1,5 +1,5 @@
import { readCodeBlockPage } from "$sb/lib/yaml_page.ts"; import { readCodeBlockPage } from "@silverbulletmd/silverbullet/lib/yaml_page";
import { clientStore, editor } from "$sb/syscalls.ts"; import { clientStore, editor } from "@silverbulletmd/silverbullet/syscalls";
export async function toggleVimMode() { export async function toggleVimMode() {
let vimMode = await clientStore.get("vimMode"); let vimMode = await clientStore.get("vimMode");

View File

@ -1,7 +1,7 @@
import emojiBlob from "./emoji.json" with { type: "json" }; import emojiBlob from "./emoji.json" with { type: "json" };
import type { CompleteEvent } from "../../plug-api/types.ts"; import type { CompleteEvent } from "../../plug-api/types.ts";
import { editor, system } from "$sb/syscalls.ts"; import { editor, system } from "@silverbulletmd/silverbullet/syscalls";
import type { EmojiConfig } from "$lib/web.ts"; import type { EmojiConfig } from "@silverbulletmd/silverbullet/type/client";
let emojiConfig: EmojiConfig = { aliases: [] }; let emojiConfig: EmojiConfig = { aliases: [] };

View File

@ -1,6 +1,6 @@
import "$sb/lib/native_fetch.ts"; import "@silverbulletmd/silverbullet/lib/native_fetch";
import { federatedPathToUrl } from "$sb/lib/resolve.ts"; import { federatedPathToUrl } from "@silverbulletmd/silverbullet/lib/resolve";
import { datastore } from "$sb/syscalls.ts"; import { datastore } from "@silverbulletmd/silverbullet/syscalls";
import type { FileMeta } from "../../plug-api/types.ts"; import type { FileMeta } from "../../plug-api/types.ts";
import { wildcardPathToRegex } from "./util.ts"; import { wildcardPathToRegex } from "./util.ts";

View File

@ -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 { listFilesCached, readFile } from "./federation.ts";
import { parsePageRef } from "$sb/lib/page_ref.ts"; import { parsePageRef } from "@silverbulletmd/silverbullet/lib/page_ref";
import { invokeFunction } from "$sb/syscalls/system.ts";
import { federatedPathToLocalPath, wildcardPathToRegex } from "./util.ts"; import { federatedPathToLocalPath, wildcardPathToRegex } from "./util.ts";
import { confirm } from "$sb/syscalls/editor.ts"; import type { LibraryDef } from "@silverbulletmd/silverbullet/type/config";
import type { LibraryDef } from "$type/config.ts";
export async function updateLibrariesCommand() { export async function updateLibrariesCommand() {
if ( if (
await confirm( await editor.confirm(
"Are you sure you want to update all libraries?", "Are you sure you want to update all libraries?",
) )
) { ) {
await editor.flashNotification("Updating all libraries..."); await editor.flashNotification("Updating all libraries...");
const updateStats: UpdateStats = await invokeFunction( const updateStats: UpdateStats = await system.invokeFunction(
"federation.updateLibraries", "federation.updateLibraries",
); );
await editor.reloadConfigAndCommands(); await editor.reloadConfigAndCommands();

View File

@ -1,12 +1,12 @@
import { collectNodesOfType } from "$sb/lib/tree.ts"; import { collectNodesOfType } from "@silverbulletmd/silverbullet/lib/tree";
import type { import type {
CompleteEvent, CompleteEvent,
IndexTreeEvent, IndexTreeEvent,
ObjectValue, ObjectValue,
QueryExpression, QueryExpression,
} from "$sb/types.ts"; } from "@silverbulletmd/silverbullet/types";
import { indexObjects, queryObjects } from "./api.ts"; 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<{ type AnchorObject = ObjectValue<{
name: string; name: string;

View File

@ -1,4 +1,4 @@
import { datastore } from "$sb/syscalls.ts"; import { datastore } from "@silverbulletmd/silverbullet/syscalls";
import type { import type {
KV, KV,
KvKey, KvKey,

View File

@ -1,5 +1,5 @@
import { space, system } from "$sb/syscalls.ts"; import { space, system } from "@silverbulletmd/silverbullet/syscalls";
import type { AttachmentMeta } from "$sb/types.ts"; import type { AttachmentMeta } from "@silverbulletmd/silverbullet/types";
import { indexObjects } from "./api.ts"; 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) // Note: clearFileIndex is not called but since this is the only attachmet:index listener, this should be fine (famous last words)

View File

@ -3,7 +3,7 @@ import type {
ObjectValue, ObjectValue,
QueryExpression, QueryExpression,
} from "../../plug-api/types.ts"; } from "../../plug-api/types.ts";
import { events } from "$sb/syscalls.ts"; import { events } from "@silverbulletmd/silverbullet/syscalls";
import { queryObjects } from "./api.ts"; import { queryObjects } from "./api.ts";
import { determineTags } from "$lib/cheap_yaml.ts"; import { determineTags } from "$lib/cheap_yaml.ts";

View File

@ -1,7 +1,10 @@
import { system } from "$sb/syscalls.ts"; import { system } from "@silverbulletmd/silverbullet/syscalls";
import { indexObjects } from "./api.ts"; import { indexObjects } from "./api.ts";
import type { ObjectValue, QueryProviderEvent } from "$sb/types.ts"; import type {
import { applyQuery } from "$sb/lib/query.ts"; ObjectValue,
QueryProviderEvent,
} from "@silverbulletmd/silverbullet/types";
import { applyQuery } from "@silverbulletmd/silverbullet/lib/query";
import { builtinFunctions } from "$lib/builtin_query_functions.ts"; import { builtinFunctions } from "$lib/builtin_query_functions.ts";
export const builtinPseudoPage = ":builtin:"; export const builtinPseudoPage = ":builtin:";

View File

@ -1,8 +1,14 @@
import { editor, events, markdown, mq, space, system } from "$sb/syscalls.ts"; import {
import type { IndexEvent, MQMessage } from "$sb/types.ts"; 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 { isTemplate } from "$lib/cheap_yaml.ts";
import { sleep } from "$lib/async.ts"; import { sleep } from "$lib/async.ts";
import { plugPrefix } from "$common/spaces/constants.ts";
import { indexAttachment } from "./attachment.ts"; import { indexAttachment } from "./attachment.ts";
import { clearFileIndex } from "./api.ts"; import { clearFileIndex } from "./api.ts";
@ -47,7 +53,7 @@ export async function reindexSpace(noClear = false) {
export async function processIndexQueue(messages: MQMessage[]) { export async function processIndexQueue(messages: MQMessage[]) {
for (const message of messages) { for (const message of messages) {
let name: string = message.body; let name: string = message.body;
if (name.startsWith(plugPrefix)) { if (name.startsWith("_plug/")) {
continue; continue;
} }
console.log(`Indexing file ${name}`); console.log(`Indexing file ${name}`);

View File

@ -1,7 +1,10 @@
import type { IndexTreeEvent, ObjectValue } from "../../plug-api/types.ts"; 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 { indexObjects } from "./api.ts";
import { YAML } from "$sb/syscalls.ts"; import { YAML } from "@silverbulletmd/silverbullet/syscalls";
export type ConfigObject = ObjectValue<{ export type ConfigObject = ObjectValue<{
key: string; key: string;

View File

@ -1,10 +1,13 @@
import { YAML } from "$sb/syscalls.ts"; import { YAML } from "@silverbulletmd/silverbullet/syscalls";
import { collectNodesOfType, findNodeOfType } from "$sb/lib/tree.ts"; import {
collectNodesOfType,
findNodeOfType,
} from "@silverbulletmd/silverbullet/lib/tree";
import type { IndexTreeEvent, ObjectValue } from "../../plug-api/types.ts"; import type { IndexTreeEvent, ObjectValue } from "../../plug-api/types.ts";
import { indexObjects } from "./api.ts"; import { indexObjects } from "./api.ts";
import type { TagObject } from "./tags.ts"; import type { TagObject } from "./tags.ts";
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
import { updateITags } from "$sb/lib/tags.ts"; import { updateITags } from "@silverbulletmd/silverbullet/lib/tags";
type DataObject = ObjectValue< type DataObject = ObjectValue<
{ {

View File

@ -2,15 +2,15 @@ import {
collectNodesMatching, collectNodesMatching,
collectNodesOfType, collectNodesOfType,
renderToText, renderToText,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import type { import type {
CompleteEvent, CompleteEvent,
IndexTreeEvent, IndexTreeEvent,
ObjectValue, ObjectValue,
} from "../../plug-api/types.ts"; } from "../../plug-api/types.ts";
import { indexObjects, queryObjects } from "./api.ts"; import { indexObjects, queryObjects } from "./api.ts";
import { parsePageRef } from "$sb/lib/page_ref.ts"; import { parsePageRef } from "@silverbulletmd/silverbullet/lib/page_ref";
import { extractAttributes } from "$sb/lib/attribute.ts"; import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute";
type HeaderObject = ObjectValue< type HeaderObject = ObjectValue<
{ {

View File

@ -5,12 +5,12 @@ import {
type ParseTree, type ParseTree,
renderToText, renderToText,
} from "../../plug-api/lib/tree.ts"; } from "../../plug-api/lib/tree.ts";
import { extractAttributes } from "$sb/lib/attribute.ts"; import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute";
import { rewritePageRefs } from "$sb/lib/resolve.ts"; import { rewritePageRefs } from "@silverbulletmd/silverbullet/lib/resolve";
import type { ObjectValue } from "../../plug-api/types.ts"; import type { ObjectValue } from "../../plug-api/types.ts";
import { indexObjects } from "./api.ts"; import { indexObjects } from "./api.ts";
import { updateITags } from "$sb/lib/tags.ts"; import { updateITags } from "@silverbulletmd/silverbullet/lib/tags";
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
export type ItemObject = ObjectValue< export type ItemObject = ObjectValue<
{ {

View File

@ -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 type { LintDiagnostic, QueryExpression } from "../../plug-api/types.ts";
import { import {
findNodeOfType, findNodeOfType,
renderToText, renderToText,
traverseTreeAsync, traverseTreeAsync,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import type { LintEvent } from "../../plug-api/types.ts"; import type { LintEvent } from "../../plug-api/types.ts";
import { queryObjects } from "./api.ts"; import { queryObjects } from "./api.ts";
import type { AttributeObject } from "./attributes.ts"; import type { AttributeObject } from "./attributes.ts";
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
import { ConfigSchema } from "$type/config.ts"; import { ConfigSchema } from "@silverbulletmd/silverbullet/type/config";
export async function lintYAML({ tree }: LintEvent): Promise<LintDiagnostic[]> { export async function lintYAML({ tree }: LintEvent): Promise<LintDiagnostic[]> {
const diagnostics: LintDiagnostic[] = []; const diagnostics: LintDiagnostic[] = [];

View File

@ -1,16 +1,21 @@
import type { IndexTreeEvent } from "../../plug-api/types.ts"; 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 type { LintDiagnostic, PageMeta } from "../../plug-api/types.ts";
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
import { extractAttributes } from "$sb/lib/attribute.ts"; import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute";
import { indexObjects } from "./api.ts"; import { indexObjects } from "./api.ts";
import { import {
findNodeOfType, findNodeOfType,
renderToText, renderToText,
traverseTreeAsync, traverseTreeAsync,
} from "../../plug-api/lib/tree.ts"; } 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) { export async function indexPage({ name, tree }: IndexTreeEvent) {
if (name.startsWith("_")) { if (name.startsWith("_")) {

View File

@ -1,10 +1,23 @@
import { findNodeOfType, renderToText, traverseTree } from "$sb/lib/tree.ts"; import {
import type { IndexTreeEvent, ObjectValue } from "$sb/types.ts"; findNodeOfType,
import { isLocalPath, resolvePath } from "$sb/lib/resolve.ts"; 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 { indexObjects, queryObjects } from "./api.ts";
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
import { updateITags } from "$sb/lib/tags.ts"; import { updateITags } from "@silverbulletmd/silverbullet/lib/tags";
import { looksLikePathWithExtension, parsePageRef } from "$sb/lib/page_ref.ts"; import {
looksLikePathWithExtension,
parsePageRef,
} from "@silverbulletmd/silverbullet/lib/page_ref";
import { extractSnippetAroundIndex } from "./snippet_extractor.ts"; import { extractSnippetAroundIndex } from "./snippet_extractor.ts";
import { import {
mdLinkRegex, mdLinkRegex,

View File

@ -6,10 +6,10 @@ import {
renderToText, renderToText,
traverseTreeAsync, traverseTreeAsync,
} from "../../plug-api/lib/tree.ts"; } 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 type { ObjectValue } from "../../plug-api/types.ts";
import { updateITags } from "$sb/lib/tags.ts"; import { updateITags } from "@silverbulletmd/silverbullet/lib/tags";
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
/** ParagraphObject An index object for the top level text nodes */ /** ParagraphObject An index object for the top level text nodes */
export type ParagraphObject = ObjectValue< export type ParagraphObject = ObjectValue<

View File

@ -5,7 +5,7 @@ import type {
ObjectValue, ObjectValue,
} from "../../plug-api/types.ts"; } from "../../plug-api/types.ts";
import { ttlCache } from "$lib/memory_cache.ts"; import { ttlCache } from "$lib/memory_cache.ts";
import { system } from "$sb/syscalls.ts"; import { system } from "@silverbulletmd/silverbullet/syscalls";
export function indexObjects<T>( export function indexObjects<T>(
page: string, page: string,

View File

@ -1,9 +1,12 @@
import { editor, space } from "$sb/syscalls.ts"; import { editor, space } from "@silverbulletmd/silverbullet/syscalls";
import { validatePageName } from "$sb/lib/page_ref.ts"; import { validatePageName } from "@silverbulletmd/silverbullet/lib/page_ref";
import { getBackLinks, type LinkObject } from "./page_links.ts"; import { getBackLinks, type LinkObject } from "./page_links.ts";
import { queryObjects } from "./api.ts"; import { queryObjects } from "./api.ts";
import { absoluteToRelativePath, folderName } from "$sb/lib/resolve.ts"; import {
import type { ObjectValue } from "$sb/types.ts"; absoluteToRelativePath,
folderName,
} from "@silverbulletmd/silverbullet/lib/resolve";
import type { ObjectValue } from "@silverbulletmd/silverbullet/types";
/** /**
* Renames a single page. * Renames a single page.

View File

@ -2,8 +2,8 @@ import type { IndexTreeEvent } from "../../plug-api/types.ts";
import { collectNodesOfType, findNodeOfType } from "../../plug-api/lib/tree.ts"; import { collectNodesOfType, findNodeOfType } from "../../plug-api/lib/tree.ts";
import type { ObjectValue } from "../../plug-api/types.ts"; import type { ObjectValue } from "../../plug-api/types.ts";
import { indexObjects } from "./api.ts"; import { indexObjects } from "./api.ts";
import { cleanPageRef } from "$sb/lib/resolve.ts"; import { cleanPageRef } from "@silverbulletmd/silverbullet/lib/resolve";
import { system } from "$sb/syscalls.ts"; import { system } from "@silverbulletmd/silverbullet/syscalls";
export type StyleObject = ObjectValue<{ export type StyleObject = ObjectValue<{
style: string; style: string;

View File

@ -3,7 +3,7 @@ import {
collectNodesMatching, collectNodesMatching,
collectNodesOfType, collectNodesOfType,
type ParseTree, type ParseTree,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import { indexObjects } from "./api.ts"; import { indexObjects } from "./api.ts";
type TableRowObject = type TableRowObject =

View File

@ -1,6 +1,6 @@
import type { FileMeta } from "../../plug-api/types.ts"; import type { FileMeta } from "../../plug-api/types.ts";
import { markdown, system } from "$sb/syscalls.ts"; import { markdown, system } from "@silverbulletmd/silverbullet/syscalls";
import { renderToText } from "$sb/lib/tree.ts"; import { renderToText } from "@silverbulletmd/silverbullet/lib/tree";
import { tagPrefix } from "./constants.ts"; import { tagPrefix } from "./constants.ts";
export async function readFileTag( export async function readFileTag(

View File

@ -1,11 +1,11 @@
import type { CompleteEvent, IndexTreeEvent } from "../../plug-api/types.ts"; 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 { indexObjects, queryObjects } from "./api.ts";
import { import {
addParentPointers, addParentPointers,
collectNodesOfType, collectNodesOfType,
findParentMatching, findParentMatching,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import type { ObjectValue } from "../../plug-api/types.ts"; import type { ObjectValue } from "../../plug-api/types.ts";
export type TagObject = ObjectValue<{ export type TagObject = ObjectValue<{

View File

@ -1,7 +1,7 @@
import { editor, markdown, YAML } from "$sb/syscalls.ts"; import { editor, markdown, YAML } from "@silverbulletmd/silverbullet/syscalls";
import type { CodeWidgetContent } from "$sb/types.ts"; import type { CodeWidgetContent } from "@silverbulletmd/silverbullet/types";
import { stripMarkdown } from "$sb/lib/markdown.ts"; import { stripMarkdown } from "@silverbulletmd/silverbullet/lib/markdown";
import { traverseTree } from "$sb/lib/tree.ts"; import { traverseTree } from "@silverbulletmd/silverbullet/lib/tree";
type Header = { type Header = {
name: string; name: string;

View File

@ -1,14 +1,23 @@
import { codeWidget, editor, language, markdown, space } from "$sb/syscalls.ts"; import {
import { parseTreeToAST, renderToText } from "$sb/lib/tree.ts"; 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 type { CodeWidgetContent } from "../../plug-api/types.ts";
import { loadPageObject } from "../template/page.ts"; import { loadPageObject } from "../template/page.ts";
import { queryObjects } from "./api.ts"; import { queryObjects } from "./api.ts";
import type { TemplateObject } from "../template/types.ts"; import type { TemplateObject } from "../template/types.ts";
import { expressionToKvQueryExpression } from "$sb/lib/parse-query.ts"; import { expressionToKvQueryExpression } from "../../plug-api/lib/parse_query.ts";
import { evalQueryExpression } from "$sb/lib/query_expression.ts"; import { evalQueryExpression } from "@silverbulletmd/silverbullet/lib/query_expression";
import { renderTemplate } from "../template/plug_api.ts"; import { renderTemplate } from "../template/plug_api.ts";
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
import { rewritePageRefs } from "$sb/lib/resolve.ts"; import { rewritePageRefs } from "@silverbulletmd/silverbullet/lib/resolve";
export async function refreshWidgets() { export async function refreshWidgets() {
await codeWidget.refreshAll(); await codeWidget.refreshAll();

View File

@ -4,14 +4,14 @@ import {
renderToText, renderToText,
replaceNodesMatchingAsync, replaceNodesMatchingAsync,
} from "../../plug-api/lib/tree.ts"; } 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 { parseMarkdown } from "../../plug-api/syscalls/markdown.ts";
import { import {
type MarkdownRenderOptions, type MarkdownRenderOptions,
renderMarkdownToHtml, renderMarkdownToHtml,
} from "./markdown_render.ts"; } from "./markdown_render.ts";
import { validatePageName } from "$sb/lib/page_ref.ts"; import { validatePageName } from "@silverbulletmd/silverbullet/lib/page_ref";
import { parsePageRef } from "$sb/lib/page_ref.ts"; 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 * Finds code widgets, runs their plug code to render and inlines their content in the parse tree

View File

@ -1,4 +1,4 @@
import { clientStore, editor } from "$sb/syscalls.ts"; import { clientStore, editor } from "@silverbulletmd/silverbullet/syscalls";
import { updateMarkdownPreview } from "./preview.ts"; import { updateMarkdownPreview } from "./preview.ts";
export async function togglePreview() { export async function togglePreview() {

View File

@ -6,11 +6,14 @@ import {
removeParentPointers, removeParentPointers,
renderToText, renderToText,
traverseTree, traverseTree,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import { encodePageRef, parsePageRef } from "$sb/lib/page_ref.ts"; import {
encodePageRef,
parsePageRef,
} from "@silverbulletmd/silverbullet/lib/page_ref";
import { Fragment, renderHtml, type Tag } from "./html_render.ts"; import { Fragment, renderHtml, type Tag } from "./html_render.ts";
import { isLocalPath } from "$sb/lib/resolve.ts"; import { isLocalPath } from "@silverbulletmd/silverbullet/lib/resolve";
import type { PageMeta } from "$sb/types.ts"; import type { PageMeta } from "@silverbulletmd/silverbullet/types";
export type MarkdownRenderOptions = { export type MarkdownRenderOptions = {
failOnUnknown?: true; failOnUnknown?: true;

View File

@ -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 { 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"; import { expandCodeWidgets } from "./api.ts";
export async function updateMarkdownPreview() { export async function updateMarkdownPreview() {

View File

@ -2,9 +2,9 @@ import {
findNodeOfType, findNodeOfType,
renderToText, renderToText,
replaceNodesMatching, replaceNodesMatching,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import { markdown } from "$sb/syscalls.ts"; import { markdown } from "@silverbulletmd/silverbullet/syscalls";
import { isLocalPath } from "$sb/lib/resolve.ts"; import { isLocalPath } from "@silverbulletmd/silverbullet/lib/resolve";
export function encodePageUrl(name: string): string { export function encodePageUrl(name: string): string {
return name; return name;

View File

@ -1,7 +1,11 @@
import { editor, events, space, system } from "$sb/syscalls.ts"; import {
import { readYamlPage } from "$sb/lib/yaml_page.ts"; editor,
events,
space,
system,
} from "@silverbulletmd/silverbullet/syscalls";
import { readYamlPage } from "@silverbulletmd/silverbullet/lib/yaml_page";
import { builtinPlugNames } from "../builtin_plugs.ts"; import { builtinPlugNames } from "../builtin_plugs.ts";
import { plugPrefix } from "$common/spaces/constants.ts";
const plugsPrelude = 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"; "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); allCustomPlugNames.push(plugName);
// console.log("Writing", `_plug/${plugName}.plug.js`, workerCode); // console.log("Writing", `_plug/${plugName}.plug.js`, workerCode);
await space.writeAttachment( await space.writeAttachment(
`${plugPrefix}${plugName}.plug.js`, `_plug/${plugName}.plug.js`,
new TextEncoder().encode(workerCode), new TextEncoder().encode(workerCode),
); );
} }
@ -82,7 +86,7 @@ export async function updatePlugsCommand() {
// And delete extra ones // And delete extra ones
for (const { name: existingPlug } of await space.listPlugs()) { for (const { name: existingPlug } of await space.listPlugs()) {
const plugName = existingPlug.substring( const plugName = existingPlug.substring(
plugPrefix.length, "_plug/".length,
existingPlug.length - ".plug.js".length, existingPlug.length - ".plug.js".length,
); );
if (!allPlugNames.includes(plugName)) { if (!allPlugNames.includes(plugName)) {

View File

@ -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 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 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"; import { renderQueryTemplate } from "../template/util.ts";
export async function query( export async function query(

View File

@ -1,5 +1,5 @@
import type { CompleteEvent } from "../../plug-api/types.ts"; import type { CompleteEvent } from "../../plug-api/types.ts";
import { events, language } from "$sb/syscalls.ts"; import { events, language } from "@silverbulletmd/silverbullet/syscalls";
import type { import type {
AttributeCompleteEvent, AttributeCompleteEvent,
AttributeCompletion, AttributeCompletion,

View File

@ -1,8 +1,14 @@
import type { LintEvent } from "../../plug-api/types.ts"; import type { LintEvent } from "../../plug-api/types.ts";
import { parseQuery } from "$sb/lib/parse-query.ts"; import { parseQuery } from "../../plug-api/lib/parse_query.ts";
import { cleanPageRef, resolvePath } from "$sb/lib/resolve.ts"; import {
import { findNodeOfType, traverseTreeAsync } from "$sb/lib/tree.ts"; cleanPageRef,
import { events, space, system } from "$sb/syscalls.ts"; 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 type { LintDiagnostic } from "../../plug-api/types.ts";
import { loadPageObject, replaceTemplateVars } from "../template/page.ts"; import { loadPageObject, replaceTemplateVars } from "../template/page.ts";

View File

@ -1,4 +1,9 @@
import { codeWidget, editor, markdown, system } from "$sb/syscalls.ts"; import {
codeWidget,
editor,
markdown,
system,
} from "@silverbulletmd/silverbullet/syscalls";
import { import {
addParentPointers, addParentPointers,
collectNodesOfType, collectNodesOfType,
@ -8,8 +13,8 @@ import {
type ParseTree, type ParseTree,
removeParentPointers, removeParentPointers,
renderToText, renderToText,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import { parseQuery } from "$sb/lib/parse-query.ts"; import { parseQuery } from "../../plug-api/lib/parse_query.ts";
import { loadPageObject, replaceTemplateVars } from "../template/page.ts"; import { loadPageObject, replaceTemplateVars } from "../template/page.ts";
import type { CodeWidgetContent } from "../../plug-api/types.ts"; import type { CodeWidgetContent } from "../../plug-api/types.ts";
import { jsonToMDTable } from "../template/util.ts"; import { jsonToMDTable } from "../template/util.ts";

View File

@ -2,12 +2,15 @@ import type {
IndexTreeEvent, IndexTreeEvent,
QueryProviderEvent, QueryProviderEvent,
} from "../../plug-api/types.ts"; } from "../../plug-api/types.ts";
import { renderToText } from "$sb/lib/tree.ts"; import { renderToText } from "@silverbulletmd/silverbullet/lib/tree";
import { applyQuery, liftAttributeFilter } from "$sb/lib/query.ts"; import {
import { editor } from "$sb/syscalls.ts"; applyQuery,
liftAttributeFilter,
} from "@silverbulletmd/silverbullet/lib/query";
import { editor } from "@silverbulletmd/silverbullet/syscalls";
import type { FileMeta } from "../../plug-api/types.ts"; import type { FileMeta } from "../../plug-api/types.ts";
import { ftsIndexPage, ftsSearch } from "./engine.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"; import { PromiseQueue } from "$lib/async.ts";
const searchPrefix = "🔍 "; const searchPrefix = "🔍 ";

View File

@ -1,5 +1,9 @@
import { editor, events, markdown } from "$sb/syscalls.ts"; import {
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; editor,
events,
markdown,
} from "@silverbulletmd/silverbullet/syscalls";
import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
import type { PublishEvent } from "../../plug-api/types.ts"; import type { PublishEvent } from "../../plug-api/types.ts";
export async function publishShareOptions() { export async function publishShareOptions() {

View File

@ -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 { findNodeOfType, renderToText } from "../../plug-api/lib/tree.ts";
import { replaceNodesMatching } from "../../plug-api/lib/tree.ts"; import { replaceNodesMatching } from "../../plug-api/lib/tree.ts";
import type { ParseTree } 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 = { type ShareOption = {
id: string; id: string;

View File

@ -1,4 +1,4 @@
import { editor, sync } from "$sb/syscalls.ts"; import { editor, sync } from "@silverbulletmd/silverbullet/syscalls";
export async function syncSpaceCommand() { export async function syncSpaceCommand() {
await editor.flashNotification("Syncing space..."); await editor.flashNotification("Syncing space...");

View File

@ -1,6 +1,12 @@
import type { ClickEvent, IndexTreeEvent } from "../../plug-api/types.ts"; 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 { import {
addParentPointers, addParentPointers,
@ -15,13 +21,16 @@ import {
traverseTreeAsync, traverseTreeAsync,
} from "../../plug-api/lib/tree.ts"; } from "../../plug-api/lib/tree.ts";
import { niceDate } from "$lib/dates.ts"; import { niceDate } from "$lib/dates.ts";
import { extractAttributes } from "$sb/lib/attribute.ts"; import { extractAttributes } from "@silverbulletmd/silverbullet/lib/attribute";
import { rewritePageRefs } from "$sb/lib/resolve.ts"; import { rewritePageRefs } from "@silverbulletmd/silverbullet/lib/resolve";
import type { ObjectValue } from "../../plug-api/types.ts"; import type { ObjectValue } from "../../plug-api/types.ts";
import { indexObjects, queryObjects } from "../index/plug_api.ts"; import { indexObjects, queryObjects } from "../index/plug_api.ts";
import { updateITags } from "$sb/lib/tags.ts"; import { updateITags } from "@silverbulletmd/silverbullet/lib/tags";
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
import { parsePageRef, positionOfLine } from "$sb/lib/page_ref.ts"; import {
parsePageRef,
positionOfLine,
} from "@silverbulletmd/silverbullet/lib/page_ref";
export type TaskObject = ObjectValue< export type TaskObject = ObjectValue<
{ {

View File

@ -1,7 +1,11 @@
import { markdown, template, YAML } from "$sb/syscalls.ts"; import {
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; markdown,
template,
YAML,
} from "@silverbulletmd/silverbullet/syscalls";
import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
import type { TemplateObject } from "./types.ts"; 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. * Strips the template from its frontmatter and renders it.

View File

@ -1,5 +1,5 @@
import type { IndexTreeEvent } from "../../plug-api/types.ts"; 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) { export async function indexTemplate({ name, tree }: IndexTreeEvent) {
// Just delegate to the index plug // Just delegate to the index plug

View File

@ -3,9 +3,13 @@ import {
findNodeOfType, findNodeOfType,
renderToText, renderToText,
traverseTreeAsync, traverseTreeAsync,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { extractFrontmatter } from "@silverbulletmd/silverbullet/lib/frontmatter";
import { jsonschema, template, YAML } from "$sb/syscalls.ts"; import {
jsonschema,
template,
YAML,
} from "@silverbulletmd/silverbullet/syscalls";
import { TemplateObjectSchema } from "./types.ts"; import { TemplateObjectSchema } from "./types.ts";
export async function lintTemplateFrontmatter( export async function lintTemplateFrontmatter(

View File

@ -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 type { PageMeta } from "../../plug-api/types.ts";
import { getObjectByRef, queryObjects } from "../index/plug_api.ts"; import { getObjectByRef, queryObjects } from "../index/plug_api.ts";
import type { FrontmatterConfig, TemplateObject } from "./types.ts"; import type { FrontmatterConfig, TemplateObject } from "./types.ts";

View File

@ -3,7 +3,13 @@ import type {
SlashCompletionOption, SlashCompletionOption,
SlashCompletions, SlashCompletions,
} from "../../plug-api/types.ts"; } 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 type { AttributeCompletion } from "../index/attributes.ts";
import { queryObjects } from "../index/plug_api.ts"; import { queryObjects } from "../index/plug_api.ts";
import type { TemplateObject } from "./types.ts"; import type { TemplateObject } from "./types.ts";
@ -12,9 +18,9 @@ import { renderTemplate } from "./api.ts";
import { import {
extractFrontmatter, extractFrontmatter,
prepareFrontmatterDispatch, prepareFrontmatterDispatch,
} from "$sb/lib/frontmatter.ts"; } from "@silverbulletmd/silverbullet/lib/frontmatter";
import type { SnippetConfig } from "./types.ts"; import type { SnippetConfig } from "./types.ts";
import { deepObjectMerge } from "$sb/lib/json.ts"; import { deepObjectMerge } from "@silverbulletmd/silverbullet/lib/json";
export async function snippetSlashComplete( export async function snippetSlashComplete(
completeEvent: CompleteEvent, completeEvent: CompleteEvent,

View File

@ -1,4 +1,4 @@
import type { ObjectValue } from "$sb/types.ts"; import type { ObjectValue } from "@silverbulletmd/silverbullet/types";
export type CommandConfig = { export type CommandConfig = {
command?: string; command?: string;

View File

@ -1,5 +1,5 @@
import type { PageMeta } from "../../plug-api/types.ts"; 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"; import { cleanTemplate } from "./plug_api.ts";
export function defaultJsonTransformer(v: any): string { export function defaultJsonTransformer(v: any): string {

View File

@ -1,5 +1,5 @@
import type { CompleteEvent } from "../../plug-api/types.ts"; import type { CompleteEvent } from "../../plug-api/types.ts";
import { datastore, events } from "$sb/syscalls.ts"; import { datastore, events } from "@silverbulletmd/silverbullet/syscalls";
import type { import type {
AttributeCompleteEvent, AttributeCompleteEvent,

View File

@ -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 { loadPageObject, replaceTemplateVars } from "./page.ts";
import type { CodeWidgetContent, PageMeta } from "../../plug-api/types.ts"; import type { CodeWidgetContent, PageMeta } from "../../plug-api/types.ts";
import { renderTemplate } from "./plug_api.ts"; import { renderTemplate } from "./plug_api.ts";
import { renderToText } from "$sb/lib/tree.ts"; import { renderToText } from "@silverbulletmd/silverbullet/lib/tree";
import { rewritePageRefs, rewritePageRefsInString } from "$sb/lib/resolve.ts"; import {
rewritePageRefs,
rewritePageRefsInString,
} from "@silverbulletmd/silverbullet/lib/resolve";
import { queryParsed } from "../query/api.ts"; 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 = { type TemplateWidgetConfig = {
// Pull the template from a page // Pull the template from a page

View File

@ -1,7 +1,10 @@
#!/bin/bash -e #!/bin/bash -e
VERSION=$1 VERSION=$1
# Patch version is version.ts and deno.json
echo "export const version = \"$VERSION\";" > version.ts echo "export const version = \"$VERSION\";" > version.ts
sed -i '' "s/\(\"version\": \"\)[^\"]*\(\"\)/\1$VERSION\2/" deno.json
git commit -am $VERSION git commit -am $VERSION
git tag $VERSION git tag $VERSION
git push && git push --tags git push && git push --tags

View File

@ -2,8 +2,12 @@ import { deleteCookie, getCookie, setCookie } from "hono/helper.ts";
import { cors } from "hono/middleware.ts"; import { cors } from "hono/middleware.ts";
import { type Context, Hono, type HonoRequest, validator } from "hono/mod.ts"; import { type Context, Hono, type HonoRequest, validator } from "hono/mod.ts";
import type { AssetBundle } from "$lib/asset_bundle/bundle.ts"; import type { AssetBundle } from "$lib/asset_bundle/bundle.ts";
import type { EndpointRequest, EndpointResponse, FileMeta } from "$sb/types.ts"; import type {
import type { ShellRequest } from "$type/rpc.ts"; EndpointRequest,
EndpointResponse,
FileMeta,
} from "@silverbulletmd/silverbullet/types";
import type { ShellRequest } from "@silverbulletmd/silverbullet/type/rpc";
import { SpaceServer } from "./instance.ts"; import { SpaceServer } from "./instance.ts";
import type { SpaceServerConfig } from "./instance.ts"; import type { SpaceServerConfig } from "./instance.ts";
import type { KvPrimitives } from "$lib/data/kv_primitives.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 { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
import { parse } from "$common/markdown_parser/parse_tree.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts";
import { renderMarkdownToHtml } from "../plugs/markdown/markdown_render.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 { base64Encode } from "$lib/crypto.ts";
import { basename, dirname, join } from "@std/path"; import { basename, dirname, join } from "@std/path";

View File

@ -1,4 +1,4 @@
import type { ActionButton, EmojiConfig, Shortcut } from "$lib/web.ts"; import type { ActionButton, EmojiConfig, Shortcut } from "./client.ts";
export type ObjectDecorator = { export type ObjectDecorator = {
// The expression to match against the object // The expression to match against the object

View File

@ -8,7 +8,7 @@ import { syntaxTree } from "@codemirror/language";
import { compile as gitIgnoreCompiler } from "gitignore-parser"; import { compile as gitIgnoreCompiler } from "gitignore-parser";
import type { SyntaxNode } from "@lezer/common"; import type { SyntaxNode } from "@lezer/common";
import { Space } from "../common/space.ts"; 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 { EventHook } from "../common/hooks/event.ts";
import type { AppCommand } from "$lib/command.ts"; import type { AppCommand } from "$lib/command.ts";
import { import {
@ -17,7 +17,7 @@ import {
PathPageNavigator, PathPageNavigator,
} from "./navigator.ts"; } from "./navigator.ts";
import type { AppViewState } from "../type/web.ts"; import type { AppViewState } from "./type.ts";
import type { import type {
AppEvent, AppEvent,
@ -39,11 +39,14 @@ import type { SyncStatus } from "$common/spaces/sync.ts";
import { HttpSpacePrimitives } from "$common/spaces/http_space_primitives.ts"; import { HttpSpacePrimitives } from "$common/spaces/http_space_primitives.ts";
import { FallbackSpacePrimitives } from "$common/spaces/fallback_space_primitives.ts"; import { FallbackSpacePrimitives } from "$common/spaces/fallback_space_primitives.ts";
import { FilteredSpacePrimitives } from "$common/spaces/filtered_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 { ClientSystem } from "./client_system.ts";
import { createEditorState } from "./editor_state.ts"; import { createEditorState } from "./editor_state.ts";
import { MainUI } from "./editor_ui.tsx"; 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 { SpacePrimitives } from "$common/spaces/space_primitives.ts";
import type { import type {
CodeWidgetButton, CodeWidgetButton,
@ -69,7 +72,7 @@ import {
import { LimitedMap } from "$lib/limited_map.ts"; import { LimitedMap } from "$lib/limited_map.ts";
import { plugPrefix } from "$common/spaces/constants.ts"; import { plugPrefix } from "$common/spaces/constants.ts";
import { lezerToParseTree } from "$common/markdown_parser/parse_tree.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 { LinkObject } from "../plugs/index/page_links.ts";
import type { Config } from "../type/config.ts"; import type { Config } from "../type/config.ts";

View File

@ -1,7 +1,7 @@
import { syntaxTree } from "@codemirror/language"; import { syntaxTree } from "@codemirror/language";
import { EditorView, ViewPlugin, type ViewUpdate } from "@codemirror/view"; import { EditorView, ViewPlugin, type ViewUpdate } from "@codemirror/view";
import type { Client } from "../client.ts"; 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 // We use turndown to convert HTML to Markdown
import TurndownService from "turndown"; import TurndownService from "turndown";
@ -13,10 +13,10 @@ import {
addParentPointers, addParentPointers,
findParentMatching, findParentMatching,
nodeAtPos, nodeAtPos,
} from "$sb/lib/tree.ts"; } from "@silverbulletmd/silverbullet/lib/tree";
import { defaultLinkStyle, maximumAttachmentSize } from "../constants.ts"; import { defaultLinkStyle, maximumAttachmentSize } from "../constants.ts";
import { safeRun } from "$lib/async.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({ const turndownService = new TurndownService({
hr: "---", hr: "---",

View File

@ -4,8 +4,12 @@ import { Decoration, WidgetType } from "@codemirror/view";
import { MarkdownWidget } from "./markdown_widget.ts"; import { MarkdownWidget } from "./markdown_widget.ts";
import { decoratorStateField } from "./util.ts"; import { decoratorStateField } from "./util.ts";
import type { Client } from "../client.ts"; import type { Client } from "../client.ts";
import { isFederationPath, isLocalPath, resolvePath } from "$sb/lib/resolve.ts"; import {
import { parsePageRef } from "$sb/lib/page_ref.ts"; isFederationPath,
isLocalPath,
resolvePath,
} from "@silverbulletmd/silverbullet/lib/resolve";
import { parsePageRef } from "@silverbulletmd/silverbullet/lib/page_ref";
import { mime } from "mimetypes"; import { mime } from "mimetypes";
type ContentDimensions = { type ContentDimensions = {

View File

@ -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 type { Client } from "../client.ts";
import { syntaxTree } from "@codemirror/language"; import { syntaxTree } from "@codemirror/language";
import { Decoration } from "@codemirror/view"; import { Decoration } from "@codemirror/view";

View File

@ -5,12 +5,15 @@ import type {
CodeWidgetCallback, CodeWidgetCallback,
} from "../../plug-api/types.ts"; } from "../../plug-api/types.ts";
import { renderMarkdownToHtml } from "../../plugs/markdown/markdown_render.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 { parse } from "$common/markdown_parser/parse_tree.ts";
import { parsePageRef } from "../../plug-api/lib/page_ref.ts"; import { parsePageRef } from "../../plug-api/lib/page_ref.ts";
import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
import { tagPrefix } from "../../plugs/index/constants.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<MarkdownWidget>(); const activeWidgets = new Set<MarkdownWidget>();

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