* 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:
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:

View File

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

View File

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

View File

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

View File

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

View File

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

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

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 { 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 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<any>,
@ -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 () => {

View File

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

View File

@ -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",

View File

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

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 { 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";

View File

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

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 { 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 = `---

View File

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

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(
tree: ParseTree,

View File

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

View File

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

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";
Deno.test("Test query expression evaluation", async () => {

View File

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

View File

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

View File

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

View File

@ -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<string> {
return syscall("editor.getCurrentPage");

View File

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

View File

@ -1,4 +1,5 @@
import { syscall } from "../syscall.ts";
import type { AttachmentMeta, FileMeta, PageMeta } from "../types.ts";
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 { 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,

View File

@ -1,4 +1,4 @@
import { debug, editor } from "$sb/syscalls.ts";
import { debug, editor } from "@silverbulletmd/silverbullet/syscalls";
export async function cleanCommand() {
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";
export async function commandComplete(completeEvent: CompleteEvent) {

View File

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

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() {
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"
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";
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";
export async function versionCommand() {

View File

@ -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 = {

View File

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

View File

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

View File

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

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 {
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() {
let text = await editor.getText();

View File

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

View File

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

View File

@ -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: [] };

View File

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

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 { 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();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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}`);

View File

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

View File

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

View File

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

View File

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

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 {
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<LintDiagnostic[]> {
const diagnostics: LintDiagnostic[] = [];

View File

@ -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("_")) {

View File

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

View File

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

View File

@ -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<T>(
page: string,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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";
export async function togglePreview() {

View File

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

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 { isLocalPath, resolvePath } from "$sb/lib/resolve.ts";
import {
isLocalPath,
resolvePath,
} from "@silverbulletmd/silverbullet/lib/resolve";
import { expandCodeWidgets } from "./api.ts";
export async function updateMarkdownPreview() {

View File

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

View File

@ -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)) {

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 { 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(

View File

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

View File

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

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 {
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";

View File

@ -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 = "🔍 ";

View File

@ -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() {

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

View File

@ -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...");

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

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 = {
// 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 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";

View File

@ -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: "---",

View File

@ -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 = {

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

View File

@ -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<MarkdownWidget>();

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