diff --git a/common/common_system.ts b/common/common_system.ts index ea3ca8a2d..52030937b 100644 --- a/common/common_system.ts +++ b/common/common_system.ts @@ -10,7 +10,7 @@ import { CodeWidgetHook } from "../web/hooks/code_widget.ts"; import { PanelWidgetHook } from "../web/hooks/panel_widget.ts"; import { SlashCommandHook } from "../web/hooks/slash_command.ts"; import { DataStoreMQ } from "$lib/data/mq.datastore.ts"; -import { ParseTree } from "$lib/tree.ts"; +import { ParseTree } from "../plug-api/lib/tree.ts"; export abstract class CommonSystem { system!: System; diff --git a/common/hooks/command.ts b/common/hooks/command.ts index 143891710..9071db44a 100644 --- a/common/hooks/command.ts +++ b/common/hooks/command.ts @@ -1,7 +1,7 @@ import { Hook, Manifest } from "../../lib/plugos/types.ts"; import { System } from "../../lib/plugos/system.ts"; import { EventEmitter } from "../../lib/plugos/event.ts"; -import { ObjectValue } from "../../type/types.ts"; +import { ObjectValue } from "../../plug-api/types.ts"; import { FrontmatterConfig, SnippetConfig, diff --git a/common/markdown_parser/parse_tree.ts b/common/markdown_parser/parse_tree.ts index a0689556a..003928d4a 100644 --- a/common/markdown_parser/parse_tree.ts +++ b/common/markdown_parser/parse_tree.ts @@ -1,4 +1,4 @@ -import type { ParseTree } from "$lib/tree.ts"; +import type { ParseTree } from "../../plug-api/lib/tree.ts"; import type { Language, SyntaxNode } from "../deps.ts"; export function lezerToParseTree( diff --git a/common/markdown_parser/parser.test.ts b/common/markdown_parser/parser.test.ts index b5a89c2a5..6d0ef9c39 100644 --- a/common/markdown_parser/parser.test.ts +++ b/common/markdown_parser/parser.test.ts @@ -1,5 +1,9 @@ import { parse } from "./parse_tree.ts"; -import { collectNodesOfType, findNodeOfType, renderToText } from "$lib/tree.ts"; +import { + collectNodesOfType, + findNodeOfType, + renderToText, +} from "$sb/lib/tree.ts"; import { assertEquals, assertNotEquals } from "$lib/test_deps.ts"; import { extendedMarkdownLanguage } from "./parser.ts"; diff --git a/common/query_functions.ts b/common/query_functions.ts index b5a7a4bee..0b7e26365 100644 --- a/common/query_functions.ts +++ b/common/query_functions.ts @@ -1,7 +1,7 @@ -import { FunctionMap } from "../type/types.ts"; +import { FunctionMap } from "../plug-api/types.ts"; import { builtinFunctions } from "../lib/builtin_query_functions.ts"; import { System } from "../lib/plugos/system.ts"; -import { Query } from "../type/types.ts"; +import { Query } from "../plug-api/types.ts"; import { LimitedMap } from "$lib/limited_map.ts"; const pageCacheTtl = 10 * 1000; // 10s diff --git a/common/settings.ts b/common/settings.ts index 145019c8a..6ad68e0a3 100644 --- a/common/settings.ts +++ b/common/settings.ts @@ -1,7 +1,7 @@ import { YAML } from "./deps.ts"; import { INDEX_TEMPLATE, SETTINGS_TEMPLATE } from "./PAGE_TEMPLATES.ts"; import { SpacePrimitives } from "./spaces/space_primitives.ts"; -import { expandPropertyNames } from "../lib/json.ts"; +import { expandPropertyNames } from "../plug-api/lib/json.ts"; import type { BuiltinSettings } from "../type/web.ts"; const yamlSettingsRegex = /^(```+|~~~+)ya?ml\r?\n([\S\s]+)\1/m; diff --git a/common/space.ts b/common/space.ts index 107f2657b..6a8c1ef21 100644 --- a/common/space.ts +++ b/common/space.ts @@ -1,7 +1,7 @@ import { SpacePrimitives } from "$common/spaces/space_primitives.ts"; import { plugPrefix } from "$common/spaces/constants.ts"; -import { AttachmentMeta, FileMeta, PageMeta } from "../type/types.ts"; +import { AttachmentMeta, FileMeta, PageMeta } from "../plug-api/types.ts"; import { EventHook } from "./hooks/event.ts"; import { safeRun } from "../lib/async.ts"; diff --git a/common/space_script.ts b/common/space_script.ts index 63422c514..4fc2e947e 100644 --- a/common/space_script.ts +++ b/common/space_script.ts @@ -1,5 +1,5 @@ import { System } from "../lib/plugos/system.ts"; -import { ParseTree } from "$lib/tree.ts"; +import { ParseTree } from "../plug-api/lib/tree.ts"; import { ScriptObject } from "../plugs/index/script.ts"; import { AppCommand, CommandDef } from "./hooks/command.ts"; diff --git a/common/spaces/asset_bundle_space_primitives.ts b/common/spaces/asset_bundle_space_primitives.ts index 0e576f097..cae9ac6f3 100644 --- a/common/spaces/asset_bundle_space_primitives.ts +++ b/common/spaces/asset_bundle_space_primitives.ts @@ -1,6 +1,6 @@ import { SpacePrimitives } from "./space_primitives.ts"; import { AssetBundle } from "../../lib/asset_bundle/bundle.ts"; -import { FileMeta } from "../../type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; export class AssetBundlePlugSpacePrimitives implements SpacePrimitives { constructor( diff --git a/common/spaces/chunked_datastore_space_primitives.ts b/common/spaces/chunked_datastore_space_primitives.ts index 3078ad793..33c2d37dc 100644 --- a/common/spaces/chunked_datastore_space_primitives.ts +++ b/common/spaces/chunked_datastore_space_primitives.ts @@ -1,5 +1,5 @@ import type { SpacePrimitives } from "./space_primitives.ts"; -import { KvKey } from "$type/types.ts"; +import { KvKey } from "../../plug-api/types.ts"; import { KvPrimitives } from "$lib/data/kv_primitives.ts"; import { KvMetaSpacePrimitives } from "./kv_meta_space_primitives.ts"; import { PrefixedKvPrimitives } from "$lib/data/prefixed_kv_primitives.ts"; diff --git a/common/spaces/datastore_space_primitives.ts b/common/spaces/datastore_space_primitives.ts index a860fff4f..67ba4611d 100644 --- a/common/spaces/datastore_space_primitives.ts +++ b/common/spaces/datastore_space_primitives.ts @@ -1,6 +1,6 @@ import type { SpacePrimitives } from "./space_primitives.ts"; import { mime } from "mimetypes"; -import { FileMeta } from "$type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { DataStore } from "$lib/data/datastore.ts"; export type FileContent = { diff --git a/common/spaces/disk_space_primitives.ts b/common/spaces/disk_space_primitives.ts index 52fbd0ab3..a44178cb3 100644 --- a/common/spaces/disk_space_primitives.ts +++ b/common/spaces/disk_space_primitives.ts @@ -2,7 +2,7 @@ import * as path from "https://deno.land/std@0.189.0/path/mod.ts"; import { readAll } from "https://deno.land/std@0.165.0/streams/conversion.ts"; import { SpacePrimitives } from "./space_primitives.ts"; import { mime } from "https://deno.land/x/mimetypes@v1.0.0/mod.ts"; -import { FileMeta } from "$type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; function lookupContentType(path: string): string { return mime.getType(path) || "application/octet-stream"; diff --git a/common/spaces/encrypted_space_primitives.ts b/common/spaces/encrypted_space_primitives.ts index c64d491b0..cbfd6d351 100644 --- a/common/spaces/encrypted_space_primitives.ts +++ b/common/spaces/encrypted_space_primitives.ts @@ -1,4 +1,4 @@ -import { FileMeta } from "../../type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { base32Decode, base32Encode, diff --git a/common/spaces/evented_space_primitives.ts b/common/spaces/evented_space_primitives.ts index bbe13986d..339a3c7b5 100644 --- a/common/spaces/evented_space_primitives.ts +++ b/common/spaces/evented_space_primitives.ts @@ -1,4 +1,4 @@ -import { FileMeta } from "../../type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { EventHook } from "../hooks/event.ts"; import type { SpacePrimitives } from "./space_primitives.ts"; diff --git a/common/spaces/fallback_space_primitives.ts b/common/spaces/fallback_space_primitives.ts index 8a18e2bbe..96027d297 100644 --- a/common/spaces/fallback_space_primitives.ts +++ b/common/spaces/fallback_space_primitives.ts @@ -1,4 +1,4 @@ -import { FileMeta } from "../../type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import type { SpacePrimitives } from "./space_primitives.ts"; /** diff --git a/common/spaces/filtered_space_primitives.ts b/common/spaces/filtered_space_primitives.ts index a227e0ef1..80757eac3 100644 --- a/common/spaces/filtered_space_primitives.ts +++ b/common/spaces/filtered_space_primitives.ts @@ -1,4 +1,4 @@ -import { FileMeta } from "../../type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { SpacePrimitives } from "./space_primitives.ts"; export class FilteredSpacePrimitives implements SpacePrimitives { diff --git a/common/spaces/http_space_primitives.ts b/common/spaces/http_space_primitives.ts index 9bc956cec..9e45c93a8 100644 --- a/common/spaces/http_space_primitives.ts +++ b/common/spaces/http_space_primitives.ts @@ -1,5 +1,5 @@ import { SpacePrimitives } from "./space_primitives.ts"; -import { FileMeta } from "../../type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { flushCachesAndUnregisterServiceWorker } from "../sw_util.ts"; export class HttpSpacePrimitives implements SpacePrimitives { diff --git a/common/spaces/kv_meta_space_primitives.ts b/common/spaces/kv_meta_space_primitives.ts index e75fe5287..f951de488 100644 --- a/common/spaces/kv_meta_space_primitives.ts +++ b/common/spaces/kv_meta_space_primitives.ts @@ -1,4 +1,4 @@ -import { FileMeta } from "$type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { mime } from "mimetypes"; import { KvPrimitives } from "$lib/data/kv_primitives.ts"; import { SpacePrimitives } from "./space_primitives.ts"; diff --git a/common/spaces/plug_space_primitives.ts b/common/spaces/plug_space_primitives.ts index 4f0e3b5c2..ab185aba4 100644 --- a/common/spaces/plug_space_primitives.ts +++ b/common/spaces/plug_space_primitives.ts @@ -1,5 +1,5 @@ import { SpacePrimitives } from "$common/spaces/space_primitives.ts"; -import { FileMeta } from "../../type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { NamespaceOperation, PlugNamespaceHook, diff --git a/common/spaces/ro_space_primitives.ts b/common/spaces/ro_space_primitives.ts index 6a42c002e..152c37494 100644 --- a/common/spaces/ro_space_primitives.ts +++ b/common/spaces/ro_space_primitives.ts @@ -1,4 +1,4 @@ -import { FileMeta } from "../../type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { SpacePrimitives } from "./space_primitives.ts"; export class ReadOnlySpacePrimitives implements SpacePrimitives { diff --git a/common/spaces/s3_space_primitives.ts b/common/spaces/s3_space_primitives.ts index 398659d07..2e0136811 100644 --- a/common/spaces/s3_space_primitives.ts +++ b/common/spaces/s3_space_primitives.ts @@ -4,7 +4,7 @@ import type { ClientOptions } from "https://deno.land/x/s3_lite_client@0.4.0/cli import { KvMetaSpacePrimitives } from "./kv_meta_space_primitives.ts"; import { KvPrimitives } from "$lib/data/kv_primitives.ts"; import { mime } from "../deps.ts"; -import { KV, KvKey } from "$type/types.ts"; +import { KV, KvKey } from "../../plug-api/types.ts"; import { PrefixedKvPrimitives } from "$lib/data/prefixed_kv_primitives.ts"; export type S3SpacePrimitivesOptions = ClientOptions; diff --git a/common/spaces/space_primitives.ts b/common/spaces/space_primitives.ts index d7df70d77..2310e02ee 100644 --- a/common/spaces/space_primitives.ts +++ b/common/spaces/space_primitives.ts @@ -1,4 +1,4 @@ -import type { FileMeta } from "../../type/types.ts"; +import type { FileMeta } from "../../plug-api/types.ts"; /** * A generic interface used by `Space` to interact with the underlying storage, designed to be easy to implement for different storage backends diff --git a/common/spaces/sync.ts b/common/spaces/sync.ts index ba6e949d7..ef888ff1d 100644 --- a/common/spaces/sync.ts +++ b/common/spaces/sync.ts @@ -1,6 +1,6 @@ import { SpacePrimitives } from "./space_primitives.ts"; import { EventEmitter } from "../../lib/plugos/event.ts"; -import { FileMeta } from "../../type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { plugPrefix } from "./constants.ts"; type SyncHash = number; diff --git a/common/syscalls/language.ts b/common/syscalls/language.ts index 2ed49e2de..2a3a4fa9c 100644 --- a/common/syscalls/language.ts +++ b/common/syscalls/language.ts @@ -1,6 +1,6 @@ import { SysCallMapping } from "../../lib/plugos/system.ts"; import { parse } from "../markdown_parser/parse_tree.ts"; -import type { ParseTree } from "$lib/tree.ts"; +import type { ParseTree } from "../../plug-api/lib/tree.ts"; import { builtinLanguages, languageFor } from "../languages.ts"; export function languageSyscalls(): SysCallMapping { diff --git a/common/syscalls/markdown.ts b/common/syscalls/markdown.ts index 6506380f7..4d30d73e4 100644 --- a/common/syscalls/markdown.ts +++ b/common/syscalls/markdown.ts @@ -1,6 +1,6 @@ import { SysCallMapping } from "../../lib/plugos/system.ts"; import { parse } from "../markdown_parser/parse_tree.ts"; -import type { ParseTree } from "$lib/tree.ts"; +import type { ParseTree } from "../../plug-api/lib/tree.ts"; import { extendedMarkdownLanguage } from "../markdown_parser/parser.ts"; export function markdownSyscalls(): SysCallMapping { diff --git a/common/syscalls/system.ts b/common/syscalls/system.ts index a59f0c5b4..55b30f930 100644 --- a/common/syscalls/system.ts +++ b/common/syscalls/system.ts @@ -1,11 +1,11 @@ -import { SyscallMeta } from "../../type/types.ts"; +import { SyscallMeta } from "../../plug-api/types.ts"; import { SysCallMapping, System } from "../../lib/plugos/system.ts"; import type { Client } from "../../web/client.ts"; import { CommandDef } from "../hooks/command.ts"; import { proxySyscall } from "../../web/syscalls/util.ts"; import type { CommonSystem } from "../common_system.ts"; import { version } from "../../version.ts"; -import { ParseTree } from "$lib/tree.ts"; +import { ParseTree } from "../../plug-api/lib/tree.ts"; export function systemSyscalls( system: System, diff --git a/common/syscalls/template.ts b/common/syscalls/template.ts index a341ed0d9..1e35b7521 100644 --- a/common/syscalls/template.ts +++ b/common/syscalls/template.ts @@ -1,5 +1,5 @@ -import { FunctionMap } from "$type/types.ts"; -import { AST } from "$lib/tree.ts"; +import { FunctionMap } from "../../plug-api/types.ts"; +import { AST } from "../../plug-api/lib/tree.ts"; import { SysCallMapping } from "$lib/plugos/system.ts"; import { renderTemplate } from "$common/template/render.ts"; import { parseTemplate } from "$common/template/template_parser.ts"; diff --git a/common/template/render.ts b/common/template/render.ts index 299677904..fba52b70e 100644 --- a/common/template/render.ts +++ b/common/template/render.ts @@ -1,7 +1,7 @@ -import { AST } from "$lib/tree.ts"; +import { AST } from "../../plug-api/lib/tree.ts"; import { evalQueryExpression } from "$sb/lib/query_expression.ts"; import { expressionToKvQueryExpression } from "$sb/lib/parse-query.ts"; -import { FunctionMap } from "../../type/types.ts"; +import { FunctionMap } from "../../plug-api/types.ts"; import { jsonToMDTable } from "../../plugs/template/util.ts"; export async function renderTemplate( diff --git a/common/template/template_parser.ts b/common/template/template_parser.ts index 778104c6f..36e4a9d99 100644 --- a/common/template/template_parser.ts +++ b/common/template/template_parser.ts @@ -4,8 +4,8 @@ import { parse } from "../markdown_parser/parse_tree.ts"; import { parser as templateParser } from "./parse-template.js"; import { parser as expressionParser } from "../markdown_parser/parse-expression.js"; import { parser as queryParser } from "../markdown_parser/parse-query.js"; -import { AST, parseTreeToAST } from "$lib/tree.ts"; -import { deepEqual } from "../../lib/json.ts"; +import { AST, parseTreeToAST } from "../../plug-api/lib/tree.ts"; +import { deepEqual } from "../../plug-api/lib/json.ts"; export const templateLanguage = LRLanguage.define({ name: "template", diff --git a/lib/builtin_query_functions.ts b/lib/builtin_query_functions.ts index 2d9ecda07..fa4621420 100644 --- a/lib/builtin_query_functions.ts +++ b/lib/builtin_query_functions.ts @@ -1,4 +1,4 @@ -import type { FunctionMap } from "../type/types.ts"; +import type { FunctionMap } from "../plug-api/types.ts"; import { niceDate, niceTime } from "./dates.ts"; export const builtinFunctions: FunctionMap = { diff --git a/lib/data/datastore.test.ts b/lib/data/datastore.test.ts index a9c42dc9b..a7c57792a 100644 --- a/lib/data/datastore.test.ts +++ b/lib/data/datastore.test.ts @@ -5,7 +5,7 @@ import { DenoKvPrimitives } from "../data/deno_kv_primitives.ts"; import { KvPrimitives } from "../data/kv_primitives.ts"; import { assertEquals } from "https://deno.land/std@0.165.0/testing/asserts.ts"; import { PrefixedKvPrimitives } from "../data/prefixed_kv_primitives.ts"; -import { Query } from "$type/types.ts"; +import { Query } from "../../plug-api/types.ts"; async function test(db: KvPrimitives) { const datastore = new DataStore(new PrefixedKvPrimitives(db, ["ds"]), { diff --git a/lib/data/datastore.ts b/lib/data/datastore.ts index ec25ccd80..bc822b299 100644 --- a/lib/data/datastore.ts +++ b/lib/data/datastore.ts @@ -1,5 +1,5 @@ import { applyQueryNoFilterKV } from "$sb/lib/query.ts"; -import { FunctionMap, KV, KvKey, KvQuery } from "$type/types.ts"; +import { FunctionMap, KV, KvKey, KvQuery } from "../../plug-api/types.ts"; import { builtinFunctions } from "$lib/builtin_query_functions.ts"; import { KvPrimitives } from "./kv_primitives.ts"; import { evalQueryExpression } from "$sb/lib/query_expression.ts"; diff --git a/lib/data/deno_kv_primitives.ts b/lib/data/deno_kv_primitives.ts index a3c3e18ab..f1c3d5572 100644 --- a/lib/data/deno_kv_primitives.ts +++ b/lib/data/deno_kv_primitives.ts @@ -1,6 +1,6 @@ /// -import { KV, KvKey } from "$type/types.ts"; +import { KV, KvKey } from "../../plug-api/types.ts"; import { KvPrimitives, KvQueryOptions } from "./kv_primitives.ts"; const kvBatchSize = 100; diff --git a/lib/data/dynamodb_kv_primitives.ts b/lib/data/dynamodb_kv_primitives.ts index 6ea5ac815..b8c2b8267 100644 --- a/lib/data/dynamodb_kv_primitives.ts +++ b/lib/data/dynamodb_kv_primitives.ts @@ -1,4 +1,4 @@ -import { KV, KvKey } from "$type/types.ts"; +import { KV, KvKey } from "../../plug-api/types.ts"; import { KvPrimitives, KvQueryOptions } from "./kv_primitives.ts"; import { createClient, diff --git a/lib/data/indexeddb_kv_primitives.ts b/lib/data/indexeddb_kv_primitives.ts index 5169764de..e22cd6528 100644 --- a/lib/data/indexeddb_kv_primitives.ts +++ b/lib/data/indexeddb_kv_primitives.ts @@ -1,4 +1,4 @@ -import { KV, KvKey } from "$type/types.ts"; +import { KV, KvKey } from "../../plug-api/types.ts"; import { KvPrimitives, KvQueryOptions } from "./kv_primitives.ts"; import { IDBPDatabase, openDB } from "https://esm.sh/idb@7.1.1/with-async-ittr"; diff --git a/lib/data/kv_primitives.test.ts b/lib/data/kv_primitives.test.ts index 8fa338979..d150af051 100644 --- a/lib/data/kv_primitives.test.ts +++ b/lib/data/kv_primitives.test.ts @@ -1,6 +1,6 @@ import { KvPrimitives } from "./kv_primitives.ts"; import { assertEquals } from "$lib/test_deps.ts"; -import { KV } from "$type/types.ts"; +import { KV } from "../../plug-api/types.ts"; export async function allTests(db: KvPrimitives) { await db.batchSet([ diff --git a/lib/data/kv_primitives.ts b/lib/data/kv_primitives.ts index 70f1b1df4..375759a5e 100644 --- a/lib/data/kv_primitives.ts +++ b/lib/data/kv_primitives.ts @@ -1,4 +1,4 @@ -import { KV, KvKey } from "$type/types.ts"; +import { KV, KvKey } from "../../plug-api/types.ts"; export type KvQueryOptions = { prefix?: KvKey; diff --git a/lib/data/memory_kv_primitives.ts b/lib/data/memory_kv_primitives.ts index ff0d97714..7e2f389cf 100644 --- a/lib/data/memory_kv_primitives.ts +++ b/lib/data/memory_kv_primitives.ts @@ -1,4 +1,4 @@ -import { KV, KvKey } from "$type/types.ts"; +import { KV, KvKey } from "../../plug-api/types.ts"; import { KvPrimitives, KvQueryOptions } from "./kv_primitives.ts"; const memoryKeySeparator = "\0"; diff --git a/lib/data/mq.datastore.test.ts b/lib/data/mq.datastore.test.ts index 96098325c..8e7f2daf1 100644 --- a/lib/data/mq.datastore.test.ts +++ b/lib/data/mq.datastore.test.ts @@ -4,7 +4,7 @@ import { DenoKvPrimitives } from "./deno_kv_primitives.ts"; import { DataStore } from "./datastore.ts"; import { PrefixedKvPrimitives } from "./prefixed_kv_primitives.ts"; import { FakeTime } from "$std/testing/time.ts"; -import type { MQMessage } from "$type/types.ts"; +import type { MQMessage } from "../../plug-api/types.ts"; Deno.test("DataStore MQ", async () => { const time = new FakeTime(); diff --git a/lib/data/mq.datastore.ts b/lib/data/mq.datastore.ts index d2d7ab564..3607103f9 100644 --- a/lib/data/mq.datastore.ts +++ b/lib/data/mq.datastore.ts @@ -1,4 +1,9 @@ -import { KV, MQMessage, MQStats, MQSubscribeOptions } from "$type/types.ts"; +import { + KV, + MQMessage, + MQStats, + MQSubscribeOptions, +} from "../../plug-api/types.ts"; import { MessageQueue } from "./mq.ts"; import { DataStore } from "./datastore.ts"; diff --git a/lib/data/mq.ts b/lib/data/mq.ts index fbd849b6e..fd54be213 100644 --- a/lib/data/mq.ts +++ b/lib/data/mq.ts @@ -1,4 +1,8 @@ -import { MQMessage, MQStats, MQSubscribeOptions } from "$type/types.ts"; +import { + MQMessage, + MQStats, + MQSubscribeOptions, +} from "../../plug-api/types.ts"; export interface MessageQueue { batchSend(queue: string, bodies: any[]): Promise; diff --git a/lib/data/prefixed_kv_primitives.ts b/lib/data/prefixed_kv_primitives.ts index d09b1e86e..d22e49f1e 100644 --- a/lib/data/prefixed_kv_primitives.ts +++ b/lib/data/prefixed_kv_primitives.ts @@ -1,4 +1,4 @@ -import { KV, KvKey } from "$type/types.ts"; +import { KV, KvKey } from "../../plug-api/types.ts"; import { KvPrimitives, KvQueryOptions } from "./kv_primitives.ts"; /** diff --git a/lib/json.test.ts b/lib/json.test.ts deleted file mode 100644 index 9d365558c..000000000 --- a/lib/json.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { assertEquals } from "$lib/test_deps.ts"; -import { deepEqual, deepObjectMerge, expandPropertyNames } from "./json.ts"; - -Deno.test("utils", () => { - assertEquals(deepEqual({ a: 1 }, { a: 1 }), true); - assertEquals(deepObjectMerge({ a: 1 }, { a: 2 }), { a: 2 }); - assertEquals( - deepObjectMerge({ list: [1, 2, 3] }, { list: [4, 5, 6] }), - { list: [1, 2, 3, 4, 5, 6] }, - ); - assertEquals(deepObjectMerge({ a: { b: 1 } }, { a: { c: 2 } }), { - a: { b: 1, c: 2 }, - }); - assertEquals(expandPropertyNames({ "a.b": 1 }), { a: { b: 1 } }); - assertEquals(expandPropertyNames({ a: { "a.b": 1 } }), { - a: { a: { b: 1 } }, - }); - assertEquals(expandPropertyNames({ a: [{ "a.b": 1 }] }), { - a: [{ a: { b: 1 } }], - }); -}); diff --git a/lib/json.ts b/lib/json.ts deleted file mode 100644 index 7bb56758e..000000000 --- a/lib/json.ts +++ /dev/null @@ -1,86 +0,0 @@ -// Compares two objects deeply -export function deepEqual(a: any, b: any): boolean { - if (a === b) { - return true; - } - if (typeof a !== typeof b) { - return false; - } - if (typeof a === "object") { - if (Array.isArray(a) && Array.isArray(b)) { - if (a.length !== b.length) { - return false; - } - for (let i = 0; i < a.length; i++) { - if (!deepEqual(a[i], b[i])) { - return false; - } - } - return true; - } else { - const aKeys = Object.keys(a); - const bKeys = Object.keys(b); - if (aKeys.length !== bKeys.length) { - return false; - } - for (const key of aKeys) { - if (!deepEqual(a[key], b[key])) { - return false; - } - } - return true; - } - } - return false; -} - -// Expands property names in an object containing a .-separated path -export function expandPropertyNames(a: any): any { - if (!a) { - return a; - } - if (typeof a !== "object") { - return a; - } - if (Array.isArray(a)) { - return a.map(expandPropertyNames); - } - const expanded: any = {}; - for (const key of Object.keys(a)) { - const parts = key.split("."); - let target = expanded; - for (let i = 0; i < parts.length - 1; i++) { - const part = parts[i]; - if (!target[part]) { - target[part] = {}; - } - target = target[part]; - } - target[parts[parts.length - 1]] = expandPropertyNames(a[key]); - } - return expanded; -} - -export function deepObjectMerge(a: any, b: any): any { - if (typeof a !== typeof b) { - return b; - } - if (typeof a === "object") { - if (Array.isArray(a) && Array.isArray(b)) { - return [...a, ...b]; - } else { - const aKeys = Object.keys(a); - const bKeys = Object.keys(b); - const merged = { ...a }; - for (const key of bKeys) { - if (aKeys.includes(key)) { - merged[key] = deepObjectMerge(a[key], b[key]); - } else { - merged[key] = b[key]; - } - } - return merged; - } - } - return b; -} diff --git a/lib/plugos/hooks/mq.ts b/lib/plugos/hooks/mq.ts index d7c47f7e0..82df924d5 100644 --- a/lib/plugos/hooks/mq.ts +++ b/lib/plugos/hooks/mq.ts @@ -1,6 +1,6 @@ import { Hook, Manifest } from "../types.ts"; import { System } from "../system.ts"; -import { MQMessage } from "$type/types.ts"; +import { MQMessage } from "../../../plug-api/types.ts"; import { MessageQueue } from "$lib/data/mq.ts"; import { throttle } from "$lib/async.ts"; diff --git a/lib/plugos/syscalls/datastore.ts b/lib/plugos/syscalls/datastore.ts index 7aadb23b9..4bdb88bf4 100644 --- a/lib/plugos/syscalls/datastore.ts +++ b/lib/plugos/syscalls/datastore.ts @@ -1,4 +1,4 @@ -import { KV, KvKey, KvQuery } from "$type/types.ts"; +import { KV, KvKey, KvQuery } from "../../../plug-api/types.ts"; import type { DataStore } from "$lib/data/datastore.ts"; import type { SysCallMapping } from "../system.ts"; diff --git a/lib/plugos/syscalls/fs.deno.test.ts b/lib/plugos/syscalls/fs.deno.test.ts index aa3e4c0f0..91e5bbf92 100644 --- a/lib/plugos/syscalls/fs.deno.test.ts +++ b/lib/plugos/syscalls/fs.deno.test.ts @@ -1,4 +1,4 @@ -import { FileMeta } from "../../../type/types.ts"; +import { FileMeta } from "../../../plug-api/types.ts"; import { assert } from "$lib/test_deps.ts"; import { path } from "../deps.ts"; import fileSystemSyscalls from "./fs.deno.ts"; diff --git a/lib/plugos/syscalls/fs.deno.ts b/lib/plugos/syscalls/fs.deno.ts index da68ab64e..246b76ed5 100644 --- a/lib/plugos/syscalls/fs.deno.ts +++ b/lib/plugos/syscalls/fs.deno.ts @@ -1,6 +1,6 @@ import type { SysCallMapping } from "../system.ts"; import { mime, path, walk } from "../deps.ts"; -import { FileMeta } from "../../../type/types.ts"; +import { FileMeta } from "../../../plug-api/types.ts"; import { base64DecodeDataUrl, base64Encode } from "../../crypto.ts"; export default function fileSystemSyscalls(root = "/"): SysCallMapping { diff --git a/lib/tree.test.ts b/lib/tree.test.ts deleted file mode 100644 index 981344d34..000000000 --- a/lib/tree.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -// import { parse } from "./parse_tree.ts"; -import { - addParentPointers, - collectNodesMatching, - findParentMatching, - nodeAtPos, - parseTreeToAST, - removeParentPointers, - renderToText, - replaceNodesMatching, -} from "./tree.ts"; -import { assertEquals, assertNotEquals } from "$lib/test_deps.ts"; -import { parse } from "$common/markdown_parser/parse_tree.ts"; -import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; - -const mdTest1 = ` -# Heading -## Sub _heading_ cool - -Hello, this is some **bold** text and *italic*. And [a link](http://zef.me). - -%% My comment here -%% And second line - -And an @mention - -http://zef.plus - -- This is a list [[PageLink]] -- With another item -- TODOs: - - [ ] A task that's not yet done - - [x] Hello -- And a _third_ one [[Wiki Page]] yo -`; - -const mdTest2 = ` -Hello - -* Item 1 -* - -Sup`; - -const mdTest3 = ` -\`\`\`yaml -name: something -\`\`\` -`; - -Deno.test("Test parsing", () => { - const mdTree = parse(extendedMarkdownLanguage, mdTest1); - addParentPointers(mdTree); - // console.log(JSON.stringify(mdTree, null, 2)); - const wikiLink = nodeAtPos(mdTree, mdTest1.indexOf("Wiki Page"))!; - assertEquals(wikiLink.type, "WikiLinkPage"); - assertNotEquals( - findParentMatching(wikiLink, (n) => n.type === "BulletList"), - null, - ); - - const allTodos = collectNodesMatching(mdTree, (n) => n.type === "Task"); - assertEquals(allTodos.length, 2); - - // Render back into markdown should be equivalent - assertEquals(renderToText(mdTree), mdTest1); - - removeParentPointers(mdTree); - replaceNodesMatching(mdTree, (n) => { - if (n.type === "Task") { - return { - type: "Tosk", - }; - } - }); - // console.log(JSON.stringify(mdTree, null, 2)); - let mdTree3 = parse(extendedMarkdownLanguage, mdTest3); - // console.log(JSON.stringify(mdTree3, null, 2)); -}); - -Deno.test("AST functions", () => { - const mdTree = parse(extendedMarkdownLanguage, mdTest1); - console.log(JSON.stringify(parseTreeToAST(mdTree), null, 2)); -}); diff --git a/lib/tree.ts b/lib/tree.ts deleted file mode 100644 index 5228d1773..000000000 --- a/lib/tree.ts +++ /dev/null @@ -1,237 +0,0 @@ -export type ParseTree = { - type?: string; // undefined === text node - from?: number; - to?: number; - text?: string; - children?: ParseTree[]; - // Only present after running addParentPointers - parent?: ParseTree; -}; - -export type AST = [string, ...AST[]] | string; - -export function addParentPointers(tree: ParseTree) { - if (!tree.children) { - return; - } - for (const child of tree.children) { - if (child.parent) { - // Already added parent pointers before - return; - } - child.parent = tree; - addParentPointers(child); - } -} - -export function removeParentPointers(tree: ParseTree) { - delete tree.parent; - if (!tree.children) { - return; - } - for (const child of tree.children) { - removeParentPointers(child); - } -} - -export function findParentMatching( - tree: ParseTree, - matchFn: (tree: ParseTree) => boolean, -): ParseTree | null { - let node = tree.parent; - while (node) { - if (matchFn(node)) { - return node; - } - node = node.parent; - } - return null; -} - -export function collectNodesOfType( - tree: ParseTree, - nodeType: string, -): ParseTree[] { - return collectNodesMatching(tree, (n) => n.type === nodeType); -} - -export function collectNodesMatching( - tree: ParseTree, - matchFn: (tree: ParseTree) => boolean, -): ParseTree[] { - if (matchFn(tree)) { - return [tree]; - } - let results: ParseTree[] = []; - if (tree.children) { - for (const child of tree.children) { - results = [...results, ...collectNodesMatching(child, matchFn)]; - } - } - return results; -} - -export async function collectNodesMatchingAsync( - tree: ParseTree, - matchFn: (tree: ParseTree) => Promise, -): Promise { - if (await matchFn(tree)) { - return [tree]; - } - let results: ParseTree[] = []; - if (tree.children) { - for (const child of tree.children) { - results = [ - ...results, - ...await collectNodesMatchingAsync(child, matchFn), - ]; - } - } - return results; -} - -// return value: returning undefined = not matched, continue, null = delete, new node = replace -export function replaceNodesMatching( - tree: ParseTree, - substituteFn: (tree: ParseTree) => ParseTree | null | undefined, -) { - if (tree.children) { - const children = tree.children.slice(); - for (const child of children) { - const subst = substituteFn(child); - if (subst !== undefined) { - const pos = tree.children.indexOf(child); - if (subst) { - tree.children.splice(pos, 1, subst); - } else { - // null = delete - tree.children.splice(pos, 1); - } - } else { - replaceNodesMatching(child, substituteFn); - } - } - } -} - -export async function replaceNodesMatchingAsync( - tree: ParseTree, - substituteFn: (tree: ParseTree) => Promise, -) { - if (tree.children) { - const children = tree.children.slice(); - for (const child of children) { - const subst = await substituteFn(child); - if (subst !== undefined) { - const pos = tree.children.indexOf(child); - if (subst) { - tree.children.splice(pos, 1, subst); - } else { - // null = delete - tree.children.splice(pos, 1); - } - } else { - await replaceNodesMatchingAsync(child, substituteFn); - } - } - } -} - -export function findNodeMatching( - tree: ParseTree, - matchFn: (tree: ParseTree) => boolean, -): ParseTree | null { - return collectNodesMatching(tree, matchFn)[0]; -} - -export function findNodeOfType( - tree: ParseTree, - nodeType: string, -): ParseTree | null { - return collectNodesMatching(tree, (n) => n.type === nodeType)[0]; -} - -export function traverseTree( - tree: ParseTree, - // Return value = should stop traversal? - matchFn: (tree: ParseTree) => boolean, -): void { - // Do a collect, but ignore the result - collectNodesMatching(tree, matchFn); -} - -export async function traverseTreeAsync( - tree: ParseTree, - // Return value = should stop traversal? - matchFn: (tree: ParseTree) => Promise, -): Promise { - // Do a collect, but ignore the result - await collectNodesMatchingAsync(tree, matchFn); -} - -// Finds non-text node at position -export function nodeAtPos(tree: ParseTree, pos: number): ParseTree | null { - if (pos < tree.from! || pos >= tree.to!) { - return null; - } - if (!tree.children) { - return tree; - } - for (const child of tree.children) { - const n = nodeAtPos(child, pos); - if (n && n.text !== undefined) { - // Got a text node, let's return its parent - return tree; - } else if (n) { - // Got it - return n; - } - } - return null; -} - -// Turn ParseTree back into text -export function renderToText(tree?: ParseTree): string { - if (!tree) { - return ""; - } - const pieces: string[] = []; - if (tree.text !== undefined) { - return tree.text; - } - for (const child of tree.children!) { - pieces.push(renderToText(child)); - } - return pieces.join(""); -} - -export function cloneTree(tree: ParseTree): ParseTree { - const newTree = { ...tree }; - if (tree.children) { - newTree.children = tree.children.map(cloneTree); - } - delete newTree.parent; - return newTree; -} - -export function parseTreeToAST(tree: ParseTree, omitTrimmable = true): AST { - const parseErrorNodes = collectNodesOfType(tree, "⚠"); - if (parseErrorNodes.length > 0) { - throw new Error( - `Parse error in: ${renderToText(tree)}`, - ); - } - if (tree.text !== undefined) { - return tree.text; - } - const ast: AST = [tree.type!]; - for (const node of tree.children!) { - if (node.type && !node.type.endsWith("Mark")) { - ast.push(parseTreeToAST(node, omitTrimmable)); - } - if (node.text && (omitTrimmable && node.text.trim() || !omitTrimmable)) { - ast.push(node.text); - } - } - return ast; -} diff --git a/plug-api/lib/attribute.test.ts b/plug-api/lib/attribute.test.ts index c8f01ed13..908e5d0a5 100644 --- a/plug-api/lib/attribute.test.ts +++ b/plug-api/lib/attribute.test.ts @@ -2,7 +2,7 @@ import "$sb/lib/syscall_mock.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts"; import { extractAttributes } from "$sb/lib/attribute.ts"; import { assertEquals } from "$lib/test_deps.ts"; -import { renderToText } from "$lib/tree.ts"; +import { renderToText } from "./tree.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; const inlineAttributeSample = ` diff --git a/plug-api/lib/attribute.ts b/plug-api/lib/attribute.ts index 2db47b854..5827adfcd 100644 --- a/plug-api/lib/attribute.ts +++ b/plug-api/lib/attribute.ts @@ -3,7 +3,7 @@ import { ParseTree, renderToText, replaceNodesMatchingAsync, -} from "$lib/tree.ts"; +} from "./tree.ts"; import { system, YAML } from "$sb/syscalls.ts"; diff --git a/plug-api/lib/feed.ts b/plug-api/lib/feed.ts index 83ba08ac0..464e6a689 100644 --- a/plug-api/lib/feed.ts +++ b/plug-api/lib/feed.ts @@ -3,7 +3,7 @@ import { findNodeOfType, ParseTree, renderToText, -} from "$lib/tree.ts"; +} from "./tree.ts"; /** * Feed parsing functionality (WIP) diff --git a/plug-api/lib/frontmatter.ts b/plug-api/lib/frontmatter.ts index 49f3d86f4..ed111cd62 100644 --- a/plug-api/lib/frontmatter.ts +++ b/plug-api/lib/frontmatter.ts @@ -4,8 +4,8 @@ import { renderToText, replaceNodesMatchingAsync, traverseTreeAsync, -} from "$lib/tree.ts"; -import { expandPropertyNames } from "$lib/json.ts"; +} from "./tree.ts"; +import { expandPropertyNames } from "./json.ts"; import { YAML } from "$sb/syscalls.ts"; export type FrontMatter = { tags?: string[] } & Record; diff --git a/plug-api/lib/parse-query.ts b/plug-api/lib/parse-query.ts index 3aa594d2d..227f2a255 100644 --- a/plug-api/lib/parse-query.ts +++ b/plug-api/lib/parse-query.ts @@ -1,5 +1,5 @@ -import { type AST, parseTreeToAST } from "$lib/tree.ts"; -import type { Query, QueryExpression } from "../../type/types.ts"; +import { type AST, parseTreeToAST } from "./tree.ts"; +import type { Query, QueryExpression } from "../types.ts"; import { language } from "$sb/syscalls.ts"; export function astToKvQuery( diff --git a/plug-api/lib/parser-query.test.ts b/plug-api/lib/parser-query.test.ts index 0db3fd9d3..4a5d9c64c 100644 --- a/plug-api/lib/parser-query.test.ts +++ b/plug-api/lib/parser-query.test.ts @@ -1,5 +1,5 @@ import { parse } from "$common/markdown_parser/parse_tree.ts"; -import { AST, collectNodesOfType, parseTreeToAST } from "$lib/tree.ts"; +import { AST, collectNodesOfType, parseTreeToAST } from "$sb/lib/tree.ts"; import { assert, assertEquals } from "$lib/test_deps.ts"; import { astToKvQuery } from "$sb/lib/parse-query.ts"; import { languageFor } from "$common/languages.ts"; diff --git a/plug-api/lib/query.ts b/plug-api/lib/query.ts index 387f7ff7d..660fe1964 100644 --- a/plug-api/lib/query.ts +++ b/plug-api/lib/query.ts @@ -1,4 +1,4 @@ -import { FunctionMap, KV, Query, QueryExpression } from "../../type/types.ts"; +import { FunctionMap, KV, Query, QueryExpression } from "../types.ts"; import { evalQueryExpression } from "$sb/lib/query_expression.ts"; /** diff --git a/plug-api/lib/query_expression.ts b/plug-api/lib/query_expression.ts index 0f6b3415c..8a54c7e49 100644 --- a/plug-api/lib/query_expression.ts +++ b/plug-api/lib/query_expression.ts @@ -1,4 +1,4 @@ -import { FunctionMap, QueryExpression } from "../../type/types.ts"; +import { FunctionMap, QueryExpression } from "../types.ts"; export function evalQueryExpression( val: QueryExpression, diff --git a/plug-api/lib/resolve.test.ts b/plug-api/lib/resolve.test.ts index e0600c6d0..c5701e2a8 100644 --- a/plug-api/lib/resolve.test.ts +++ b/plug-api/lib/resolve.test.ts @@ -6,7 +6,7 @@ import { rewritePageRefs, } from "$sb/lib/resolve.ts"; import { assertEquals } from "$lib/test_deps.ts"; -import { ParseTree, renderToText } from "$lib/tree.ts"; +import { ParseTree, renderToText } from "$sb/lib/tree.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; diff --git a/plug-api/lib/resolve.ts b/plug-api/lib/resolve.ts index 02cbd0952..d842c3a34 100644 --- a/plug-api/lib/resolve.ts +++ b/plug-api/lib/resolve.ts @@ -1,4 +1,4 @@ -import { findNodeOfType, ParseTree, traverseTree } from "$lib/tree.ts"; +import { findNodeOfType, ParseTree, traverseTree } from "./tree.ts"; export function resolvePath( currentPage: string, diff --git a/plug-api/lib/tags.ts b/plug-api/lib/tags.ts index 5d7ac9a05..82260c8e9 100644 --- a/plug-api/lib/tags.ts +++ b/plug-api/lib/tags.ts @@ -1,5 +1,5 @@ import { FrontMatter } from "$sb/lib/frontmatter.ts"; -import { ObjectValue } from "../../type/types.ts"; +import { ObjectValue } from "../types.ts"; export function updateITags(obj: ObjectValue, frontmatter: FrontMatter) { const itags = [obj.tag, ...frontmatter.tags || []]; diff --git a/plug-api/lib/yaml_page.ts b/plug-api/lib/yaml_page.ts index a7e98089c..49f61ff3a 100644 --- a/plug-api/lib/yaml_page.ts +++ b/plug-api/lib/yaml_page.ts @@ -1,4 +1,4 @@ -import { findNodeOfType, traverseTree } from "$lib/tree.ts"; +import { findNodeOfType, traverseTree } from "$sb/lib/tree.ts"; import { markdown, space, YAML } from "$sb/syscalls.ts"; export async function readCodeBlockPage( diff --git a/plug-api/syscalls/asset.ts b/plug-api/syscalls/asset.ts index e084b4fea..8d8a8db1b 100644 --- a/plug-api/syscalls/asset.ts +++ b/plug-api/syscalls/asset.ts @@ -1,4 +1,4 @@ -import { base64DecodeDataUrl } from "$lib/crypto.ts"; +import { base64DecodeDataUrl } from "../../lib/crypto.ts"; import { syscall } from "../syscall.ts"; export async function readAsset( diff --git a/plug-api/syscalls/code_widget.ts b/plug-api/syscalls/code_widget.ts index 48d041a97..bfe472321 100644 --- a/plug-api/syscalls/code_widget.ts +++ b/plug-api/syscalls/code_widget.ts @@ -1,4 +1,4 @@ -import type { CodeWidgetContent } from "$type/types.ts"; +import type { CodeWidgetContent } from "../types.ts"; import { syscall } from "../syscall.ts"; export function render( diff --git a/plug-api/syscalls/datastore.ts b/plug-api/syscalls/datastore.ts index 79e769264..bfdf4d914 100644 --- a/plug-api/syscalls/datastore.ts +++ b/plug-api/syscalls/datastore.ts @@ -1,5 +1,5 @@ import { syscall } from "$sb/syscall.ts"; -import { KV, KvKey, KvQuery } from "$type/types.ts"; +import { KV, KvKey, KvQuery } from "../types.ts"; export function set(key: KvKey, value: any): Promise { return syscall("datastore.set", key, value); diff --git a/plug-api/syscalls/editor.ts b/plug-api/syscalls/editor.ts index b786ad0ee..53b18b437 100644 --- a/plug-api/syscalls/editor.ts +++ b/plug-api/syscalls/editor.ts @@ -1,5 +1,5 @@ import type { FilterOption } from "../../type/web.ts"; -import { UploadFile } from "$type/types.ts"; +import { UploadFile } from "../types.ts"; import { syscall } from "../syscall.ts"; import type { PageRef } from "$sb/lib/page_ref.ts"; diff --git a/plug-api/syscalls/language.ts b/plug-api/syscalls/language.ts index 37bf649ef..cf4091ef5 100644 --- a/plug-api/syscalls/language.ts +++ b/plug-api/syscalls/language.ts @@ -1,6 +1,6 @@ import { syscall } from "../syscall.ts"; -import type { ParseTree } from "$lib/tree.ts"; +import type { ParseTree } from "../lib/tree.ts"; /** * Parses a piece of code using any of the supported SB languages, see `common/languages.ts` for a list diff --git a/plug-api/syscalls/markdown.ts b/plug-api/syscalls/markdown.ts index 54ffd9d9b..068e51f6d 100644 --- a/plug-api/syscalls/markdown.ts +++ b/plug-api/syscalls/markdown.ts @@ -1,6 +1,6 @@ import { syscall } from "../syscall.ts"; -import type { ParseTree } from "$lib/tree.ts"; +import type { ParseTree } from "../lib/tree.ts"; export function parseMarkdown(text: string): Promise { return syscall("markdown.parseMarkdown", text); diff --git a/plug-api/syscalls/mq.ts b/plug-api/syscalls/mq.ts index aeda54af3..f848903f4 100644 --- a/plug-api/syscalls/mq.ts +++ b/plug-api/syscalls/mq.ts @@ -1,5 +1,5 @@ import { syscall } from "$sb/syscall.ts"; -import type { MQStats } from "$type/types.ts"; +import type { MQStats } from "../types.ts"; export function send(queue: string, body: any) { return syscall("mq.send", queue, body); diff --git a/plug-api/syscalls/space.ts b/plug-api/syscalls/space.ts index 025c05a16..b44a0bb40 100644 --- a/plug-api/syscalls/space.ts +++ b/plug-api/syscalls/space.ts @@ -1,5 +1,5 @@ import { syscall } from "../syscall.ts"; -import { AttachmentMeta, FileMeta, PageMeta } from "$type/types.ts"; +import { AttachmentMeta, FileMeta, PageMeta } from "../types.ts"; export function listPages(unfiltered = false): Promise { return syscall("space.listPages", unfiltered); diff --git a/plug-api/syscalls/system.ts b/plug-api/syscalls/system.ts index 362f8c972..e2889693d 100644 --- a/plug-api/syscalls/system.ts +++ b/plug-api/syscalls/system.ts @@ -1,6 +1,6 @@ import type { CommandDef } from "$common/hooks/command.ts"; -import type { SyscallMeta } from "$type/types.ts"; -import type { ParseTree } from "$lib/tree.ts"; +import type { SyscallMeta } from "../types.ts"; +import type { ParseTree } from "../lib/tree.ts"; import { syscall } from "../syscall.ts"; export function invokeFunction( diff --git a/plugs/editor/command.ts b/plugs/editor/command.ts index 6b39a64d8..9c67664ef 100644 --- a/plugs/editor/command.ts +++ b/plugs/editor/command.ts @@ -1,5 +1,5 @@ import { system } from "$sb/syscalls.ts"; -import { CompleteEvent } from "$type/types.ts"; +import { CompleteEvent } from "../../plug-api/types.ts"; export async function commandComplete(completeEvent: CompleteEvent) { const match = /\{\[([^\]\[]*)$/.exec(completeEvent.linePrefix); diff --git a/plugs/editor/complete.ts b/plugs/editor/complete.ts index fbbc18814..932823abb 100644 --- a/plugs/editor/complete.ts +++ b/plugs/editor/complete.ts @@ -1,4 +1,4 @@ -import { CompleteEvent, FileMeta, PageMeta } from "$type/types.ts"; +import { CompleteEvent, FileMeta, PageMeta } from "../../plug-api/types.ts"; import { cacheFileListing } from "../federation/federation.ts"; import { queryObjects } from "../index/plug_api.ts"; diff --git a/plugs/editor/embed.ts b/plugs/editor/embed.ts index f7090d8b9..5cc9efb97 100644 --- a/plugs/editor/embed.ts +++ b/plugs/editor/embed.ts @@ -1,5 +1,5 @@ import { YAML } from "$sb/syscalls.ts"; -import type { WidgetContent } from "$type/types.ts"; +import type { WidgetContent } from "../../plug-api/types.ts"; type EmbedConfig = { url: string; diff --git a/plugs/editor/link.ts b/plugs/editor/link.ts index 27129b4e5..ffa9e9aa5 100644 --- a/plugs/editor/link.ts +++ b/plugs/editor/link.ts @@ -1,4 +1,4 @@ -import { nodeAtPos } from "$lib/tree.ts"; +import { nodeAtPos } from "../../plug-api/lib/tree.ts"; import { editor, events, markdown } from "$sb/syscalls.ts"; import { extractYoutubeVideoId } from "./embed.ts"; diff --git a/plugs/editor/navigate.ts b/plugs/editor/navigate.ts index 841ab8c2e..2c19ec551 100644 --- a/plugs/editor/navigate.ts +++ b/plugs/editor/navigate.ts @@ -1,4 +1,4 @@ -import type { ClickEvent } from "$type/types.ts"; +import type { ClickEvent } from "../../plug-api/types.ts"; import { editor, markdown, system } from "$sb/syscalls.ts"; import { addParentPointers, @@ -6,7 +6,7 @@ import { findParentMatching, nodeAtPos, ParseTree, -} from "$lib/tree.ts"; +} from "$sb/lib/tree.ts"; import { resolveAttachmentPath, resolvePath } from "$sb/lib/resolve.ts"; import { parsePageRef } from "$sb/lib/page_ref.ts"; import { tagPrefix } from "../index/constants.ts"; diff --git a/plugs/editor/upload.ts b/plugs/editor/upload.ts index 3525f6d65..e5e20a3fe 100644 --- a/plugs/editor/upload.ts +++ b/plugs/editor/upload.ts @@ -1,5 +1,5 @@ import { editor, space } from "$sb/syscalls.ts"; -import { UploadFile } from "$type/types.ts"; +import { UploadFile } from "../../plug-api/types.ts"; const maximumAttachmentSize = 1024 * 1024 * 10; // 10MB diff --git a/plugs/emoji/emoji.ts b/plugs/emoji/emoji.ts index 52630e7d2..20b00bc57 100644 --- a/plugs/emoji/emoji.ts +++ b/plugs/emoji/emoji.ts @@ -1,5 +1,5 @@ import emojiBlob from "./emoji.json" assert { type: "json" }; -import type { CompleteEvent } from "$type/types.ts"; +import type { CompleteEvent } from "../../plug-api/types.ts"; import { readSetting } from "$sb/lib/settings_page.ts"; import { editor } from "$sb/syscalls.ts"; import type { EmojiConfig } from "../../type/web.ts"; diff --git a/plugs/federation/federation.ts b/plugs/federation/federation.ts index a8a2387ef..80695fb3d 100644 --- a/plugs/federation/federation.ts +++ b/plugs/federation/federation.ts @@ -2,7 +2,7 @@ import "$sb/lib/native_fetch.ts"; import { federatedPathToUrl } from "$sb/lib/resolve.ts"; import { readFederationConfigs } from "./config.ts"; import { datastore } from "$sb/syscalls.ts"; -import type { FileMeta } from "../../type/types.ts"; +import type { FileMeta } from "../../plug-api/types.ts"; async function responseToFileMeta( r: Response, diff --git a/plugs/index/anchor.ts b/plugs/index/anchor.ts index 9d5b1ed89..39d85d409 100644 --- a/plugs/index/anchor.ts +++ b/plugs/index/anchor.ts @@ -1,6 +1,6 @@ -import { collectNodesOfType } from "$lib/tree.ts"; -import type { CompleteEvent, IndexTreeEvent } from "$type/types.ts"; -import { ObjectValue, QueryExpression } from "$type/types.ts"; +import { collectNodesOfType } from "$sb/lib/tree.ts"; +import type { CompleteEvent, IndexTreeEvent } from "../../plug-api/types.ts"; +import { ObjectValue, QueryExpression } from "../../plug-api/types.ts"; import { indexObjects, queryObjects } from "./api.ts"; import { parsePageRef } from "$sb/lib/page_ref.ts"; diff --git a/plugs/index/api.ts b/plugs/index/api.ts index dc0eb805a..715aacb92 100644 --- a/plugs/index/api.ts +++ b/plugs/index/api.ts @@ -5,8 +5,8 @@ import { KvQuery, ObjectQuery, ObjectValue, -} from "../../type/types.ts"; -import { QueryProviderEvent } from "$type/types.ts"; +} from "../../plug-api/types.ts"; +import { QueryProviderEvent } from "../../plug-api/types.ts"; import { builtins } from "./builtins.ts"; import { determineType } from "./attributes.ts"; import { ttlCache } from "$lib/memory_cache.ts"; diff --git a/plugs/index/attributes.ts b/plugs/index/attributes.ts index bcc683a3c..f6db4a25a 100644 --- a/plugs/index/attributes.ts +++ b/plugs/index/attributes.ts @@ -1,7 +1,7 @@ -import type { CompleteEvent } from "$type/types.ts"; +import type { CompleteEvent } from "../../plug-api/types.ts"; import { events } from "$sb/syscalls.ts"; import { queryObjects } from "./api.ts"; -import { ObjectValue, QueryExpression } from "../../type/types.ts"; +import { ObjectValue, QueryExpression } from "../../plug-api/types.ts"; import { determineTags } from "$lib/cheap_yaml.ts"; export type AttributeObject = ObjectValue<{ diff --git a/plugs/index/builtins.ts b/plugs/index/builtins.ts index fef532769..71070726a 100644 --- a/plugs/index/builtins.ts +++ b/plugs/index/builtins.ts @@ -1,7 +1,7 @@ -import { ObjectValue } from "../../type/types.ts"; +import { ObjectValue } from "../../plug-api/types.ts"; import { system } from "$sb/syscalls.ts"; import { indexObjects } from "./api.ts"; -import { QueryProviderEvent } from "$type/types.ts"; +import { QueryProviderEvent } from "../../plug-api/types.ts"; import { applyQuery } from "$sb/lib/query.ts"; import { builtinFunctions } from "$lib/builtin_query_functions.ts"; diff --git a/plugs/index/command.ts b/plugs/index/command.ts index 61568e5e9..c7663769a 100644 --- a/plugs/index/command.ts +++ b/plugs/index/command.ts @@ -1,6 +1,6 @@ import { editor, events, markdown, mq, space, system } from "$sb/syscalls.ts"; -import { IndexEvent } from "$type/types.ts"; -import { MQMessage } from "$type/types.ts"; +import { IndexEvent } from "../../plug-api/types.ts"; +import { MQMessage } from "../../plug-api/types.ts"; import { isTemplate } from "$lib/cheap_yaml.ts"; import { sleep } from "$lib/async.ts"; diff --git a/plugs/index/data.ts b/plugs/index/data.ts index 41d8f1e1c..1f9d331e2 100644 --- a/plugs/index/data.ts +++ b/plugs/index/data.ts @@ -1,7 +1,7 @@ -import type { IndexTreeEvent } from "$type/types.ts"; +import type { IndexTreeEvent } from "../../plug-api/types.ts"; import { YAML } from "$sb/syscalls.ts"; -import { collectNodesOfType, findNodeOfType } from "$lib/tree.ts"; -import { ObjectValue } from "../../type/types.ts"; +import { collectNodesOfType, findNodeOfType } from "$sb/lib/tree.ts"; +import { ObjectValue } from "../../plug-api/types.ts"; import { indexObjects } from "./api.ts"; import { TagObject } from "./tags.ts"; import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; diff --git a/plugs/index/header.ts b/plugs/index/header.ts index 20d830aae..fb080f5c2 100644 --- a/plugs/index/header.ts +++ b/plugs/index/header.ts @@ -1,6 +1,6 @@ -import { collectNodesMatching } from "$lib/tree.ts"; -import type { CompleteEvent, IndexTreeEvent } from "$type/types.ts"; -import { ObjectValue } from "$type/types.ts"; +import { collectNodesMatching } from "$sb/lib/tree.ts"; +import type { CompleteEvent, IndexTreeEvent } from "../../plug-api/types.ts"; +import { ObjectValue } from "../../plug-api/types.ts"; import { indexObjects, queryObjects } from "./api.ts"; import { parsePageRef } from "$sb/lib/page_ref.ts"; diff --git a/plugs/index/item.ts b/plugs/index/item.ts index bbf7798cf..dfe006598 100644 --- a/plugs/index/item.ts +++ b/plugs/index/item.ts @@ -1,9 +1,13 @@ -import type { IndexTreeEvent } from "$type/types.ts"; +import type { IndexTreeEvent } from "../../plug-api/types.ts"; -import { collectNodesOfType, ParseTree, renderToText } from "$lib/tree.ts"; +import { + collectNodesOfType, + ParseTree, + renderToText, +} from "../../plug-api/lib/tree.ts"; import { extractAttributes } from "$sb/lib/attribute.ts"; import { rewritePageRefs } from "$sb/lib/resolve.ts"; -import { ObjectValue } from "$type/types.ts"; +import { 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"; diff --git a/plugs/index/lint.ts b/plugs/index/lint.ts index 7d80210c4..10b2a1f99 100644 --- a/plugs/index/lint.ts +++ b/plugs/index/lint.ts @@ -1,7 +1,11 @@ import { YAML } from "$sb/syscalls.ts"; -import { LintDiagnostic, QueryExpression } from "../../type/types.ts"; -import { findNodeOfType, renderToText, traverseTreeAsync } from "$lib/tree.ts"; -import { LintEvent } from "$type/types.ts"; +import { LintDiagnostic, QueryExpression } from "../../plug-api/types.ts"; +import { + findNodeOfType, + renderToText, + traverseTreeAsync, +} from "$sb/lib/tree.ts"; +import { LintEvent } from "../../plug-api/types.ts"; import { queryObjects } from "./api.ts"; import { AttributeObject } from "./attributes.ts"; import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; diff --git a/plugs/index/page.ts b/plugs/index/page.ts index 14a0bfab0..bf7063225 100644 --- a/plugs/index/page.ts +++ b/plugs/index/page.ts @@ -1,11 +1,15 @@ -import type { IndexTreeEvent } from "$type/types.ts"; +import type { IndexTreeEvent } from "../../plug-api/types.ts"; import { editor, markdown, space, YAML } from "$sb/syscalls.ts"; -import type { LintDiagnostic, PageMeta } from "../../type/types.ts"; +import type { LintDiagnostic, PageMeta } from "../../plug-api/types.ts"; import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { extractAttributes } from "$sb/lib/attribute.ts"; import { indexObjects } from "./api.ts"; -import { findNodeOfType, renderToText, traverseTreeAsync } from "$lib/tree.ts"; +import { + findNodeOfType, + renderToText, + traverseTreeAsync, +} from "../../plug-api/lib/tree.ts"; import { updateITags } from "$sb/lib/tags.ts"; export async function indexPage({ name, tree }: IndexTreeEvent) { diff --git a/plugs/index/page_links.ts b/plugs/index/page_links.ts index b82432313..407e55c93 100644 --- a/plugs/index/page_links.ts +++ b/plugs/index/page_links.ts @@ -1,8 +1,8 @@ -import { findNodeOfType, renderToText, traverseTree } from "$lib/tree.ts"; -import { IndexTreeEvent } from "$type/types.ts"; +import { findNodeOfType, renderToText, traverseTree } from "$sb/lib/tree.ts"; +import { IndexTreeEvent } from "../../plug-api/types.ts"; import { resolvePath } from "$sb/lib/resolve.ts"; import { indexObjects, queryObjects } from "./api.ts"; -import { ObjectValue } from "$type/types.ts"; +import { ObjectValue } from "../../plug-api/types.ts"; import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { updateITags } from "$sb/lib/tags.ts"; import { parsePageRef } from "$sb/lib/page_ref.ts"; diff --git a/plugs/index/paragraph.ts b/plugs/index/paragraph.ts index cb112ceb0..3ede671dd 100644 --- a/plugs/index/paragraph.ts +++ b/plugs/index/paragraph.ts @@ -1,13 +1,13 @@ -import type { IndexTreeEvent } from "$type/types.ts"; +import type { IndexTreeEvent } from "../../plug-api/types.ts"; import { indexObjects } from "./api.ts"; import { collectNodesOfType, findParentMatching, renderToText, traverseTreeAsync, -} from "$lib/tree.ts"; +} from "../../plug-api/lib/tree.ts"; import { extractAttributes } from "$sb/lib/attribute.ts"; -import { ObjectValue } from "$type/types.ts"; +import { ObjectValue } from "../../plug-api/types.ts"; import { updateITags } from "$sb/lib/tags.ts"; import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; diff --git a/plugs/index/plug_api.ts b/plugs/index/plug_api.ts index a8cdc7dd8..8b9599ad2 100644 --- a/plugs/index/plug_api.ts +++ b/plugs/index/plug_api.ts @@ -1,4 +1,4 @@ -import { KV, KvQuery, ObjectQuery, ObjectValue } from "$type/types.ts"; +import { KV, KvQuery, ObjectQuery, ObjectValue } from "../../plug-api/types.ts"; import { ttlCache } from "$lib/memory_cache.ts"; import { system } from "$sb/syscalls.ts"; diff --git a/plugs/index/script.ts b/plugs/index/script.ts index 82f9ee7ae..193b8354e 100644 --- a/plugs/index/script.ts +++ b/plugs/index/script.ts @@ -1,6 +1,6 @@ -import { IndexTreeEvent } from "$type/types.ts"; -import { collectNodesOfType, findNodeOfType } from "$lib/tree.ts"; -import { ObjectValue } from "$type/types.ts"; +import { IndexTreeEvent } from "../../plug-api/types.ts"; +import { collectNodesOfType, findNodeOfType } from "../../plug-api/lib/tree.ts"; +import { ObjectValue } from "../../plug-api/types.ts"; import { indexObjects } from "./api.ts"; export type ScriptObject = ObjectValue<{ diff --git a/plugs/index/table.ts b/plugs/index/table.ts index cff238fcc..2617871f9 100644 --- a/plugs/index/table.ts +++ b/plugs/index/table.ts @@ -1,7 +1,10 @@ -import { IndexTreeEvent, ObjectValue } from "$type/types.ts"; -import { collectNodesMatching, ParseTree } from "$lib/tree.ts"; +import { IndexTreeEvent, ObjectValue } from "../../plug-api/types.ts"; +import { + collectNodesMatching, + collectNodesOfType, + ParseTree, +} from "$sb/lib/tree.ts"; import { indexObjects } from "./api.ts"; -import { collectNodesOfType } from "$lib/tree.ts"; type TableRowObject = & ObjectValue<{ diff --git a/plugs/index/tag_page.ts b/plugs/index/tag_page.ts index 49e08b8aa..a24864f4e 100644 --- a/plugs/index/tag_page.ts +++ b/plugs/index/tag_page.ts @@ -1,6 +1,6 @@ -import { FileMeta } from "$type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { markdown, system } from "$sb/syscalls.ts"; -import { renderToText } from "$lib/tree.ts"; +import { renderToText } from "$sb/lib/tree.ts"; import { tagPrefix } from "./constants.ts"; export async function readFileTag( diff --git a/plugs/index/tags.ts b/plugs/index/tags.ts index 08ae1dd34..f43eaa2d7 100644 --- a/plugs/index/tags.ts +++ b/plugs/index/tags.ts @@ -1,12 +1,12 @@ -import type { CompleteEvent, IndexTreeEvent } from "$type/types.ts"; +import type { CompleteEvent, IndexTreeEvent } from "../../plug-api/types.ts"; import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { indexObjects, queryObjects } from "./api.ts"; import { addParentPointers, collectNodesOfType, findParentMatching, -} from "$lib/tree.ts"; -import type { ObjectValue } from "../../type/types.ts"; +} from "$sb/lib/tree.ts"; +import type { ObjectValue } from "../../plug-api/types.ts"; export type TagObject = ObjectValue<{ name: string; diff --git a/plugs/index/toc.ts b/plugs/index/toc.ts index 3273153c2..d8bdd5ba6 100644 --- a/plugs/index/toc.ts +++ b/plugs/index/toc.ts @@ -1,6 +1,6 @@ import { editor, markdown, YAML } from "$sb/syscalls.ts"; -import { CodeWidgetContent } from "../../type/types.ts"; -import { renderToText, traverseTree } from "$lib/tree.ts"; +import { CodeWidgetContent } from "../../plug-api/types.ts"; +import { renderToText, traverseTree } from "$sb/lib/tree.ts"; type Header = { name: string; diff --git a/plugs/index/widget.ts b/plugs/index/widget.ts index 88e339445..a64d8542e 100644 --- a/plugs/index/widget.ts +++ b/plugs/index/widget.ts @@ -1,6 +1,6 @@ import { codeWidget, editor, language, markdown, space } from "$sb/syscalls.ts"; -import { parseTreeToAST, renderToText } from "$lib/tree.ts"; -import { CodeWidgetContent } from "$type/types.ts"; +import { parseTreeToAST, renderToText } from "$sb/lib/tree.ts"; +import { CodeWidgetContent } from "../../plug-api/types.ts"; import { loadPageObject } from "../template/page.ts"; import { queryObjects } from "./api.ts"; import { TemplateObject, WidgetConfig } from "../template/types.ts"; diff --git a/plugs/markdown/api.ts b/plugs/markdown/api.ts index 97daf25d3..ae243a337 100644 --- a/plugs/markdown/api.ts +++ b/plugs/markdown/api.ts @@ -3,7 +3,7 @@ import { ParseTree, renderToText, replaceNodesMatchingAsync, -} from "$lib/tree.ts"; +} from "../../plug-api/lib/tree.ts"; import { codeWidget } from "$sb/syscalls.ts"; import { parseMarkdown } from "../../plug-api/syscalls/markdown.ts"; import { diff --git a/plugs/markdown/markdown_render.ts b/plugs/markdown/markdown_render.ts index f630941e7..959984d45 100644 --- a/plugs/markdown/markdown_render.ts +++ b/plugs/markdown/markdown_render.ts @@ -6,7 +6,7 @@ import { removeParentPointers, renderToText, traverseTree, -} from "$lib/tree.ts"; +} from "../../plug-api/lib/tree.ts"; import { encodePageRef, parsePageRef } from "$sb/lib/page_ref.ts"; import { Fragment, renderHtml, Tag } from "./html_render.ts"; diff --git a/plugs/markdown/util.ts b/plugs/markdown/util.ts index 88f1cc2dc..38e945005 100644 --- a/plugs/markdown/util.ts +++ b/plugs/markdown/util.ts @@ -2,7 +2,7 @@ import { findNodeOfType, renderToText, replaceNodesMatching, -} from "$lib/tree.ts"; +} from "$sb/lib/tree.ts"; import { markdown } from "$sb/syscalls.ts"; export function encodePageUrl(name: string): string { diff --git a/plugs/query/api.ts b/plugs/query/api.ts index 34e52de55..3f9e4fc77 100644 --- a/plugs/query/api.ts +++ b/plugs/query/api.ts @@ -1,7 +1,7 @@ import { parseQuery } from "$sb/lib/parse-query.ts"; -import { Query } from "../../type/types.ts"; +import { Query } from "../../plug-api/types.ts"; import { events } from "$sb/syscalls.ts"; -import { QueryProviderEvent } from "$type/types.ts"; +import { QueryProviderEvent } from "../../plug-api/types.ts"; import { resolvePath } from "$sb/lib/resolve.ts"; import { renderQueryTemplate } from "../template/util.ts"; diff --git a/plugs/query/complete.ts b/plugs/query/complete.ts index 5cbd7b1e9..2d6fa54f7 100644 --- a/plugs/query/complete.ts +++ b/plugs/query/complete.ts @@ -1,4 +1,4 @@ -import { CompleteEvent } from "$type/types.ts"; +import { CompleteEvent } from "../../plug-api/types.ts"; import { events, language } from "$sb/syscalls.ts"; import { AttributeCompleteEvent, diff --git a/plugs/query/lint.ts b/plugs/query/lint.ts index 11f23cbe4..805b9d7e3 100644 --- a/plugs/query/lint.ts +++ b/plugs/query/lint.ts @@ -1,9 +1,9 @@ -import { LintEvent } from "$type/types.ts"; +import { 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 "$lib/tree.ts"; +import { findNodeOfType, traverseTreeAsync } from "$sb/lib/tree.ts"; import { events, space } from "$sb/syscalls.ts"; -import { LintDiagnostic } from "$type/types.ts"; +import { LintDiagnostic } from "../../plug-api/types.ts"; import { loadPageObject, replaceTemplateVars } from "../template/page.ts"; export async function lintQuery( diff --git a/plugs/query/widget.ts b/plugs/query/widget.ts index e56cf47d6..efc1303b1 100644 --- a/plugs/query/widget.ts +++ b/plugs/query/widget.ts @@ -8,10 +8,10 @@ import { ParseTree, removeParentPointers, renderToText, -} from "$lib/tree.ts"; +} from "$sb/lib/tree.ts"; import { parseQuery } from "$sb/lib/parse-query.ts"; import { loadPageObject, replaceTemplateVars } from "../template/page.ts"; -import { CodeWidgetContent } from "$type/types.ts"; +import { CodeWidgetContent } from "../../plug-api/types.ts"; import { jsonToMDTable } from "../template/util.ts"; import { renderQuery } from "./api.ts"; import { ChangeSpec } from "../../web/deps.ts"; diff --git a/plugs/search/search.ts b/plugs/search/search.ts index a29121627..61e915c16 100644 --- a/plugs/search/search.ts +++ b/plugs/search/search.ts @@ -1,8 +1,8 @@ -import { IndexTreeEvent, QueryProviderEvent } from "$type/types.ts"; -import { renderToText } from "$lib/tree.ts"; +import { 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 { FileMeta } from "$type/types.ts"; +import { FileMeta } from "../../plug-api/types.ts"; import { ftsIndexPage, ftsSearch } from "./engine.ts"; import { evalQueryExpression } from "$sb/lib/query_expression.ts"; import { PromiseQueue } from "$lib/async.ts"; diff --git a/plugs/share/publish.ts b/plugs/share/publish.ts index 0ca5bc944..76129780a 100644 --- a/plugs/share/publish.ts +++ b/plugs/share/publish.ts @@ -1,6 +1,6 @@ import { editor, events, markdown } from "$sb/syscalls.ts"; import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; -import { PublishEvent } from "$type/types.ts"; +import { PublishEvent } from "../../plug-api/types.ts"; export async function publishShareOptions() { const text = await editor.getText(); diff --git a/plugs/share/share.ts b/plugs/share/share.ts index 6e98c281a..bc3538283 100644 --- a/plugs/share/share.ts +++ b/plugs/share/share.ts @@ -1,7 +1,7 @@ import { editor, events, markdown, system } from "$sb/syscalls.ts"; -import { findNodeOfType, renderToText } from "$lib/tree.ts"; -import { replaceNodesMatching } from "$lib/tree.ts"; -import { ParseTree } from "$lib/tree.ts"; +import { findNodeOfType, renderToText } from "../../plug-api/lib/tree.ts"; +import { replaceNodesMatching } from "../../plug-api/lib/tree.ts"; +import { ParseTree } from "../../plug-api/lib/tree.ts"; import { parsePageRef } from "$sb/lib/page_ref.ts"; type ShareOption = { diff --git a/plugs/tasks/complete.ts b/plugs/tasks/complete.ts index f496a4c73..c5154ba02 100644 --- a/plugs/tasks/complete.ts +++ b/plugs/tasks/complete.ts @@ -1,4 +1,4 @@ -import { CompleteEvent } from "$type/types.ts"; +import { CompleteEvent } from "../../plug-api/types.ts"; import { queryObjects } from "../index/plug_api.ts"; import { TaskStateObject } from "./task.ts"; diff --git a/plugs/tasks/task.ts b/plugs/tasks/task.ts index a1d1c6245..35c589937 100644 --- a/plugs/tasks/task.ts +++ b/plugs/tasks/task.ts @@ -1,4 +1,4 @@ -import type { ClickEvent, IndexTreeEvent } from "$type/types.ts"; +import type { ClickEvent, IndexTreeEvent } from "../../plug-api/types.ts"; import { editor, events, markdown, space, sync } from "$sb/syscalls.ts"; @@ -13,11 +13,11 @@ import { renderToText, replaceNodesMatching, traverseTreeAsync, -} from "$lib/tree.ts"; +} 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 { ObjectValue } from "$type/types.ts"; +import { 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"; diff --git a/plugs/template/api.ts b/plugs/template/api.ts index a03f730e3..f82311a8d 100644 --- a/plugs/template/api.ts +++ b/plugs/template/api.ts @@ -1,7 +1,7 @@ import { markdown, template, YAML } from "$sb/syscalls.ts"; import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { TemplateObject } from "./types.ts"; -import { renderToText } from "$lib/tree.ts"; +import { renderToText } from "$sb/lib/tree.ts"; /** * Strips the template from its frontmatter and renders it. diff --git a/plugs/template/index.ts b/plugs/template/index.ts index 8ddf163eb..93ada430a 100644 --- a/plugs/template/index.ts +++ b/plugs/template/index.ts @@ -1,4 +1,4 @@ -import type { IndexTreeEvent } from "$type/types.ts"; +import type { IndexTreeEvent } from "../../plug-api/types.ts"; import { system } from "$sb/syscalls.ts"; export async function indexTemplate({ name, tree }: IndexTreeEvent) { diff --git a/plugs/template/lint.ts b/plugs/template/lint.ts index 796af7435..a07aba51b 100644 --- a/plugs/template/lint.ts +++ b/plugs/template/lint.ts @@ -1,5 +1,9 @@ -import type { LintDiagnostic, LintEvent } from "$type/types.ts"; -import { findNodeOfType, renderToText, traverseTreeAsync } from "$lib/tree.ts"; +import type { LintDiagnostic, LintEvent } from "../../plug-api/types.ts"; +import { + findNodeOfType, + renderToText, + traverseTreeAsync, +} from "$sb/lib/tree.ts"; import { FrontmatterConfig } from "./types.ts"; import { extractFrontmatter } from "$sb/lib/frontmatter.ts"; import { template, YAML } from "$sb/syscalls.ts"; diff --git a/plugs/template/page.ts b/plugs/template/page.ts index 8fa371cac..0d8251c1d 100644 --- a/plugs/template/page.ts +++ b/plugs/template/page.ts @@ -1,5 +1,5 @@ import { editor, space, template } from "$sb/syscalls.ts"; -import { PageMeta } from "../../type/types.ts"; +import { PageMeta } from "../../plug-api/types.ts"; import { getObjectByRef, queryObjects } from "../index/plug_api.ts"; import { FrontmatterConfig, TemplateObject } from "./types.ts"; import { renderTemplate } from "./api.ts"; diff --git a/plugs/template/snippet.ts b/plugs/template/snippet.ts index 497b1ee1a..07b2f4170 100644 --- a/plugs/template/snippet.ts +++ b/plugs/template/snippet.ts @@ -2,7 +2,7 @@ import { CompleteEvent, SlashCompletionOption, SlashCompletions, -} from "$type/types.ts"; +} from "../../plug-api/types.ts"; import { editor, markdown, space } from "$sb/syscalls.ts"; import type { AttributeCompletion } from "../index/attributes.ts"; import { queryObjects } from "../index/plug_api.ts"; diff --git a/plugs/template/types.ts b/plugs/template/types.ts index 94aa6c0ac..4bc76b67d 100644 --- a/plugs/template/types.ts +++ b/plugs/template/types.ts @@ -1,4 +1,4 @@ -import { ObjectValue } from "../../type/types.ts"; +import { ObjectValue } from "../../plug-api/types.ts"; import { z, ZodEffects } from "zod"; export const CommandConfig = z.object({ diff --git a/plugs/template/util.ts b/plugs/template/util.ts index 4d1dee2bc..8365d699e 100644 --- a/plugs/template/util.ts +++ b/plugs/template/util.ts @@ -1,4 +1,4 @@ -import { PageMeta } from "../../type/types.ts"; +import { PageMeta } from "../../plug-api/types.ts"; import { space, template } from "$sb/syscalls.ts"; import { cleanTemplate } from "./plug_api.ts"; diff --git a/plugs/template/var.ts b/plugs/template/var.ts index e0590604d..270781015 100644 --- a/plugs/template/var.ts +++ b/plugs/template/var.ts @@ -1,4 +1,4 @@ -import { CompleteEvent } from "$type/types.ts"; +import { CompleteEvent } from "../../plug-api/types.ts"; import { datastore, events } from "$sb/syscalls.ts"; import { diff --git a/plugs/template/widget.ts b/plugs/template/widget.ts index d3c3b670b..6bdce24b8 100644 --- a/plugs/template/widget.ts +++ b/plugs/template/widget.ts @@ -1,8 +1,8 @@ import { markdown, space, YAML } from "$sb/syscalls.ts"; import { loadPageObject, replaceTemplateVars } from "./page.ts"; -import { CodeWidgetContent, PageMeta } from "$type/types.ts"; +import { CodeWidgetContent, PageMeta } from "../../plug-api/types.ts"; import { renderTemplate } from "./plug_api.ts"; -import { renderToText } from "$lib/tree.ts"; +import { renderToText } from "$sb/lib/tree.ts"; import { rewritePageRefs, rewritePageRefsInString } from "$sb/lib/resolve.ts"; import { queryParsed } from "../query/api.ts"; import { parseQuery } from "$sb/lib/parse-query.ts"; diff --git a/scripts/generate_fs_list.ts b/scripts/generate_fs_list.ts index 690943f79..481b9446f 100644 --- a/scripts/generate_fs_list.ts +++ b/scripts/generate_fs_list.ts @@ -1,7 +1,7 @@ import { walk } from "https://deno.land/std@0.165.0/fs/mod.ts"; import { resolve } from "https://deno.land/std@0.165.0/path/mod.ts"; import { mime } from "https://deno.land/x/mimetypes@v1.0.0/mod.ts"; -import { FileMeta } from "../type/types.ts"; +import { FileMeta } from "../plug-api/types.ts"; const rootDir = resolve("website_build"); diff --git a/server/http_server.ts b/server/http_server.ts index 6a0ec7136..bb08bcd58 100644 --- a/server/http_server.ts +++ b/server/http_server.ts @@ -8,7 +8,7 @@ import { setCookie, } from "./deps.ts"; import { AssetBundle } from "../lib/asset_bundle/bundle.ts"; -import { FileMeta } from "$type/types.ts"; +import { FileMeta } from "../plug-api/types.ts"; import { ShellRequest } from "../type/rpc.ts"; import { SpaceServer, SpaceServerConfig } from "./instance.ts"; import { KvPrimitives } from "$lib/data/kv_primitives.ts"; diff --git a/server/server_system.ts b/server/server_system.ts index 7cdcc12b1..7e19954cd 100644 --- a/server/server_system.ts +++ b/server/server_system.ts @@ -32,7 +32,7 @@ import { KVPrimitivesManifestCache } from "$lib/plugos/manifest_cache.ts"; import { KvPrimitives } from "$lib/data/kv_primitives.ts"; import { ShellBackend } from "./shell_backend.ts"; import { ensureSpaceIndex } from "$common/space_index.ts"; -import { FileMeta } from "$type/types.ts"; +import { FileMeta } from "../plug-api/types.ts"; import { CommandHook } from "$common/hooks/command.ts"; import { CommonSystem } from "$common/common_system.ts"; import { DataStoreMQ } from "$lib/data/mq.datastore.ts"; diff --git a/server/syscalls/space.ts b/server/syscalls/space.ts index a73eb01d1..8623fbbfe 100644 --- a/server/syscalls/space.ts +++ b/server/syscalls/space.ts @@ -1,4 +1,4 @@ -import { AttachmentMeta, FileMeta, PageMeta } from "../../type/types.ts"; +import { AttachmentMeta, FileMeta, PageMeta } from "../../plug-api/types.ts"; import { SysCallMapping } from "../../lib/plugos/system.ts"; import type { Space } from "../../common/space.ts"; diff --git a/type/types.ts b/type/types.ts deleted file mode 100644 index efc794a2b..000000000 --- a/type/types.ts +++ /dev/null @@ -1,262 +0,0 @@ -import type { ParseTree } from "$lib/tree.ts"; -import type { TextChange } from "../web/change.ts"; - -export type FileMeta = { - name: string; - created: number; - lastModified: number; - contentType: string; - size: number; - perm: "ro" | "rw"; - noSync?: boolean; -}; - -export type PageMeta = ObjectValue< - { - name: string; - created: string; // indexing it as a string - lastModified: string; // indexing it as a string - lastOpened?: number; - perm: "ro" | "rw"; - } & Record ->; - -export type AttachmentMeta = { - name: string; - contentType: string; - created: number; - lastModified: number; - size: number; - perm: "ro" | "rw"; -}; - -export type SyscallMeta = { - name: string; - requiredPermissions: string[]; - argCount: number; -}; - -// Message Queue related types -export type MQMessage = { - id: string; - queue: string; - body: any; - retries?: number; -}; - -export type MQStats = { - queued: number; - processing: number; - dlq: number; -}; - -export type MQSubscribeOptions = { - batchSize?: number; - pollInterval?: number; -}; - -// Key-Value Store related types -export type KvKey = string[]; - -export type KV = { - key: KvKey; - value: T; -}; - -export type OrderBy = { - expr: QueryExpression; - desc: boolean; -}; - -export type Select = { - name: string; - expr?: QueryExpression; -}; - -export type Query = { - querySource?: string; - filter?: QueryExpression; - orderBy?: OrderBy[]; - select?: Select[]; - limit?: QueryExpression; - render?: string; - renderAll?: boolean; - distinct?: boolean; -}; - -export type KvQuery = Omit & { - prefix?: KvKey; -}; - -export type QueryExpression = - | ["and", QueryExpression, QueryExpression] - | ["or", QueryExpression, QueryExpression] - | ["=", QueryExpression, QueryExpression] - | ["!=", QueryExpression, QueryExpression] - | ["=~", QueryExpression, QueryExpression] - | ["!=~", QueryExpression, QueryExpression] - | ["<", QueryExpression, QueryExpression] - | ["<=", QueryExpression, QueryExpression] - | [">", QueryExpression, QueryExpression] - | [">=", QueryExpression, QueryExpression] - | ["in", QueryExpression, QueryExpression] - | ["attr"] // . - | ["attr", string] // name - | ["attr", QueryExpression, string] // something.name - | ["global", string] // @name - | ["number", number] - | ["string", string] - | ["boolean", boolean] - | ["null"] - | ["not", QueryExpression] - | ["array", QueryExpression[]] - | ["object", [string, QueryExpression][]] - | ["regexp", string, string] // regex, modifier - | ["pageref", string] - | ["-", QueryExpression] - | ["+", QueryExpression, QueryExpression] - | ["-", QueryExpression, QueryExpression] - | ["*", QueryExpression, QueryExpression] - | ["%", QueryExpression, QueryExpression] - | ["/", QueryExpression, QueryExpression] - | ["?", QueryExpression, QueryExpression, QueryExpression] - | ["query", Query] - | ["call", string, QueryExpression[]]; - -export type FunctionMap = Record< - string, - (...args: any[]) => any ->; - -/** - * An ObjectValue that can be indexed by the `index` plug, needs to have a minimum of - * of two fields: - * - ref: a unique reference (id) for the object, ideally a page reference - * - tags: a list of tags that the object belongs to - */ -export type ObjectValue = { - ref: string; - tag: string; // main tag - tags?: string[]; - itags?: string[]; // implicit or inherited tags (inherited from the page for instance) -} & T; - -export type ObjectQuery = Omit; - -// Code widget stuff -export type CodeWidgetCallback = ( - bodyText: string, - pageName: string, -) => Promise; - -export type CodeWidgetContent = { - html?: string; - markdown?: string; - script?: string; - buttons?: CodeWidgetButton[]; -}; - -export type CodeWidgetButton = { - widgetTarget?: boolean; - description: string; - svg: string; - invokeFunction: string; -}; - -export type LintDiagnostic = { - from: number; - to: number; - severity: "error" | "warning" | "info" | "hint"; - message: string; -}; - -export type UploadFile = { - name: string; - contentType: string; - content: Uint8Array; -}; - -export type AppEvent = - | "page:click" - | "editor:complete" - | "minieditor:complete" - | "slash:complete" - | "editor:lint" - | "page:load" - | "editor:init" - | "editor:pageLoaded" // args: pageName, previousPage, isSynced - | "editor:pageReloaded" - | "editor:pageSaved" - | "editor:modeswitch" - | "plugs:loaded" - | "editor:pageModified"; - -export type QueryProviderEvent = { - query: Query; - variables?: Record; -}; - -export type ClickEvent = { - page: string; - pos: number; - metaKey: boolean; - ctrlKey: boolean; - altKey: boolean; -}; - -export type IndexEvent = { - name: string; - text: string; -}; - -export type IndexTreeEvent = { - name: string; - tree: ParseTree; -}; - -export type PublishEvent = { - uri?: string; - // Page name - name: string; -}; - -export type LintEvent = { - name: string; - tree: ParseTree; -}; - -export type CompleteEvent = { - pageName: string; - linePrefix: string; - pos: number; - parentNodes: string[]; -}; - -export type SlashCompletionOption = { - label: string; - detail?: string; - invoke: string; - order?: number; -} & Record; - -export type SlashCompletions = { - // Ignore this one, only for compatibility with regular completions - from?: number; - // The actual completions - options: SlashCompletionOption[]; -}; - -export type WidgetContent = { - html?: string; - script?: string; - markdown?: string; - url?: string; - height?: number; - width?: number; -}; - -/** PageModifiedEvent payload for "editor:pageModified". Fired when the document text changes - */ -export type PageModifiedEvent = { - changes: TextChange[]; -}; diff --git a/type/web.ts b/type/web.ts index 7423ddcb6..65cb04e6c 100644 --- a/type/web.ts +++ b/type/web.ts @@ -1,5 +1,5 @@ import { Manifest } from "$common/manifest.ts"; -import { PageMeta } from "$type/types.ts"; +import { PageMeta } from "../plug-api/types.ts"; import { AppCommand } from "$common/hooks/command.ts"; import { defaultSettings } from "$common/settings.ts"; diff --git a/version.ts b/version.ts index 814c1fb0b..26ba978d0 100644 --- a/version.ts +++ b/version.ts @@ -1 +1 @@ -export const version = "0.7.3"; +export const version = "0.7.4"; diff --git a/web/client.ts b/web/client.ts index b7dd5f7e5..dcfdb8e46 100644 --- a/web/client.ts +++ b/web/client.ts @@ -20,7 +20,11 @@ import { import { AppViewState, BuiltinSettings } from "../type/web.ts"; -import type { AppEvent, CompleteEvent, SlashCompletions } from "$type/types.ts"; +import type { + AppEvent, + CompleteEvent, + SlashCompletions, +} from "../plug-api/types.ts"; import { throttle } from "$lib/async.ts"; import { PlugSpacePrimitives } from "$common/spaces/plug_space_primitives.ts"; import { EventedSpacePrimitives } from "$common/spaces/evented_space_primitives.ts"; @@ -41,7 +45,7 @@ import { createEditorState } from "./editor_state.ts"; import { MainUI } from "./editor_ui.tsx"; import { cleanPageRef } from "$sb/lib/resolve.ts"; import { SpacePrimitives } from "$common/spaces/space_primitives.ts"; -import { CodeWidgetButton, FileMeta, PageMeta } from "../type/types.ts"; +import { CodeWidgetButton, FileMeta, PageMeta } from "../plug-api/types.ts"; import { DataStore } from "$lib/data/datastore.ts"; import { IndexedDBKvPrimitives } from "$lib/data/indexeddb_kv_primitives.ts"; import { DataStoreMQ } from "$lib/data/mq.datastore.ts"; diff --git a/web/client_system.ts b/web/client_system.ts index d8dfbb967..913583267 100644 --- a/web/client_system.ts +++ b/web/client_system.ts @@ -36,8 +36,8 @@ import { templateSyscalls } from "$common/syscalls/template.ts"; import { codeWidgetSyscalls } from "./syscalls/code_widget.ts"; import { clientCodeWidgetSyscalls } from "./syscalls/client_code_widget.ts"; import { KVPrimitivesManifestCache } from "$lib/plugos/manifest_cache.ts"; -import { deepObjectMerge } from "$lib/json.ts"; -import { Query } from "$type/types.ts"; +import { deepObjectMerge } from "../plug-api/lib/json.ts"; +import { Query } from "../plug-api/types.ts"; import { PanelWidgetHook } from "./hooks/panel_widget.ts"; import { createKeyBindings } from "./editor_state.ts"; import { CommonSystem } from "$common/common_system.ts"; diff --git a/web/cm_plugins/clean.ts b/web/cm_plugins/clean.ts index cdad2599c..8f5d288ed 100644 --- a/web/cm_plugins/clean.ts +++ b/web/cm_plugins/clean.ts @@ -1,4 +1,4 @@ -import type { ClickEvent } from "$type/types.ts"; +import type { ClickEvent } from "../../plug-api/types.ts"; import type { Extension } from "../deps.ts"; import type { Client } from "../client.ts"; import { blockquotePlugin } from "./block_quote.ts"; diff --git a/web/cm_plugins/command_link.ts b/web/cm_plugins/command_link.ts index 2b9974184..f01a59dcf 100644 --- a/web/cm_plugins/command_link.ts +++ b/web/cm_plugins/command_link.ts @@ -1,4 +1,4 @@ -import { ClickEvent } from "$type/types.ts"; +import { ClickEvent } from "../../plug-api/types.ts"; import { Decoration, syntaxTree } from "../deps.ts"; import { Client } from "../client.ts"; import { diff --git a/web/cm_plugins/editor_paste.ts b/web/cm_plugins/editor_paste.ts index 274b7ef17..9c0af9d72 100644 --- a/web/cm_plugins/editor_paste.ts +++ b/web/cm_plugins/editor_paste.ts @@ -7,7 +7,11 @@ import TurndownService from "turndown"; // With tables and task notation as well import { tables, taskListItems } from "turndown-plugin-gfm"; import { lezerToParseTree } from "$common/markdown_parser/parse_tree.ts"; -import { addParentPointers, findParentMatching, nodeAtPos } from "$lib/tree.ts"; +import { + addParentPointers, + findParentMatching, + nodeAtPos, +} from "../../plug-api/lib/tree.ts"; import { folderName, resolve } from "$lib/path.ts"; import { maximumAttachmentSize } from "../constants.ts"; import { safeRun } from "$lib/async.ts"; diff --git a/web/cm_plugins/iframe_widget.ts b/web/cm_plugins/iframe_widget.ts index 7e165ed20..0fa48e772 100644 --- a/web/cm_plugins/iframe_widget.ts +++ b/web/cm_plugins/iframe_widget.ts @@ -1,4 +1,4 @@ -import { CodeWidgetCallback, WidgetContent } from "$type/types.ts"; +import { CodeWidgetCallback, WidgetContent } from "../../plug-api/types.ts"; import { WidgetType } from "../deps.ts"; import type { Client } from "../client.ts"; import { createWidgetSandboxIFrame } from "../components/widget_sandbox_iframe.ts"; diff --git a/web/cm_plugins/lint.ts b/web/cm_plugins/lint.ts index 76e73513c..856203d82 100644 --- a/web/cm_plugins/lint.ts +++ b/web/cm_plugins/lint.ts @@ -1,7 +1,7 @@ import { Diagnostic, linter } from "@codemirror/lint"; import type { Client } from "../client.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts"; -import { LintEvent } from "$type/types.ts"; +import { LintEvent } from "../../plug-api/types.ts"; import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; export function plugLinter(client: Client) { diff --git a/web/cm_plugins/markdown_widget.ts b/web/cm_plugins/markdown_widget.ts index 8a573737f..7ed59e57e 100644 --- a/web/cm_plugins/markdown_widget.ts +++ b/web/cm_plugins/markdown_widget.ts @@ -1,6 +1,9 @@ import { WidgetType } from "../deps.ts"; import type { Client } from "../client.ts"; -import type { CodeWidgetButton, CodeWidgetCallback } from "../../type/types.ts"; +import type { + CodeWidgetButton, + CodeWidgetCallback, +} from "../../plug-api/types.ts"; import { renderMarkdownToHtml } from "../../plugs/markdown/markdown_render.ts"; import { resolveAttachmentPath } from "$sb/lib/resolve.ts"; import { parse } from "$common/markdown_parser/parse_tree.ts"; diff --git a/web/cm_plugins/table.ts b/web/cm_plugins/table.ts index 1a41ea58e..0f27176c8 100644 --- a/web/cm_plugins/table.ts +++ b/web/cm_plugins/table.ts @@ -6,7 +6,7 @@ import { } from "./util.ts"; import { renderMarkdownToHtml } from "../../plugs/markdown/markdown_render.ts"; -import { ParseTree, renderToText } from "$lib/tree.ts"; +import { ParseTree, renderToText } from "../../plug-api/lib/tree.ts"; import { lezerToParseTree } from "$common/markdown_parser/parse_tree.ts"; import type { Client } from "../client.ts"; import { resolveAttachmentPath } from "$sb/lib/resolve.ts"; diff --git a/web/cm_plugins/wiki_link.ts b/web/cm_plugins/wiki_link.ts index 7eb07d0f9..0faf8b9d5 100644 --- a/web/cm_plugins/wiki_link.ts +++ b/web/cm_plugins/wiki_link.ts @@ -1,5 +1,5 @@ import { pageLinkRegex } from "$common/markdown_parser/parser.ts"; -import { ClickEvent } from "$type/types.ts"; +import { ClickEvent } from "../../plug-api/types.ts"; import { Decoration, syntaxTree } from "../deps.ts"; import { Client } from "../client.ts"; import { diff --git a/web/components/filter.tsx b/web/components/filter.tsx index 716a9434f..408b2918b 100644 --- a/web/components/filter.tsx +++ b/web/components/filter.tsx @@ -10,7 +10,7 @@ import { import { FilterOption } from "../../type/web.ts"; import { MiniEditor } from "./mini_editor.tsx"; import { fuzzySearchAndSort } from "../fuse_search.ts"; -import { deepEqual } from "$lib/json.ts"; +import { deepEqual } from "../../plug-api/lib/json.ts"; export function FilterList({ placeholder, diff --git a/web/components/page_navigator.tsx b/web/components/page_navigator.tsx index 00c177e84..0e83c0213 100644 --- a/web/components/page_navigator.tsx +++ b/web/components/page_navigator.tsx @@ -1,11 +1,11 @@ import { FilterList } from "./filter.tsx"; import { FilterOption } from "../../type/web.ts"; import { CompletionContext, CompletionResult } from "../deps.ts"; -import { PageMeta } from "../../type/types.ts"; +import { PageMeta } from "../../plug-api/types.ts"; import { isFederationPath } from "$sb/lib/resolve.ts"; import { tagRegex as mdTagRegex } from "$common/markdown_parser/parser.ts"; -const tagRegex = new RegExp(mdTagRegex.source, "g") +const tagRegex = new RegExp(mdTagRegex.source, "g"); export function PageNavigator({ allPages, diff --git a/web/components/widget_sandbox_iframe.ts b/web/components/widget_sandbox_iframe.ts index be4bb841b..c6e982b6b 100644 --- a/web/components/widget_sandbox_iframe.ts +++ b/web/components/widget_sandbox_iframe.ts @@ -1,4 +1,4 @@ -import { WidgetContent } from "$type/types.ts"; +import { WidgetContent } from "../../plug-api/types.ts"; import { Client } from "../client.ts"; import { panelHtml } from "./panel_html.ts"; diff --git a/web/editor_state.ts b/web/editor_state.ts index 9e925741c..a511c8984 100644 --- a/web/editor_state.ts +++ b/web/editor_state.ts @@ -31,7 +31,7 @@ import { inlineImagesPlugin } from "./cm_plugins/inline_image.ts"; import { cleanModePlugins } from "./cm_plugins/clean.ts"; import { lineWrapper } from "./cm_plugins/line_wrapper.ts"; import { smartQuoteKeymap } from "./cm_plugins/smart_quotes.ts"; -import { ClickEvent } from "$type/types.ts"; +import { ClickEvent } from "../plug-api/types.ts"; import { attachmentExtension, pasteLinkExtension, diff --git a/web/hooks/code_widget.ts b/web/hooks/code_widget.ts index cbedf7c90..97f1bdf06 100644 --- a/web/hooks/code_widget.ts +++ b/web/hooks/code_widget.ts @@ -1,6 +1,6 @@ import { Hook, Manifest } from "../../lib/plugos/types.ts"; import { System } from "../../lib/plugos/system.ts"; -import { CodeWidgetCallback } from "../../type/types.ts"; +import { CodeWidgetCallback } from "../../plug-api/types.ts"; export type CodeWidgetT = { codeWidget?: string; diff --git a/web/hooks/panel_widget.ts b/web/hooks/panel_widget.ts index 2ecf53ac8..7d0f4d157 100644 --- a/web/hooks/panel_widget.ts +++ b/web/hooks/panel_widget.ts @@ -1,6 +1,6 @@ import { Hook, Manifest } from "../../lib/plugos/types.ts"; import { System } from "../../lib/plugos/system.ts"; -import { CodeWidgetCallback } from "../../type/types.ts"; +import { CodeWidgetCallback } from "../../plug-api/types.ts"; export type PanelWidgetT = { panelWidget?: "top" | "bottom"; diff --git a/web/hooks/slash_command.ts b/web/hooks/slash_command.ts index 4f92c849a..d0b1d102b 100644 --- a/web/hooks/slash_command.ts +++ b/web/hooks/slash_command.ts @@ -3,7 +3,10 @@ import { System } from "../../lib/plugos/system.ts"; import { Completion, CompletionContext, CompletionResult } from "../deps.ts"; import { Client } from "../client.ts"; import { syntaxTree } from "../deps.ts"; -import { SlashCompletionOption, SlashCompletions } from "$type/types.ts"; +import { + SlashCompletionOption, + SlashCompletions, +} from "../../plug-api/types.ts"; import { safeRun } from "$lib/async.ts"; export type SlashCommandDef = { diff --git a/web/syscalls/clientStore.ts b/web/syscalls/clientStore.ts index f14c17cc6..52f11a3e4 100644 --- a/web/syscalls/clientStore.ts +++ b/web/syscalls/clientStore.ts @@ -1,6 +1,6 @@ import { SysCallMapping } from "../../lib/plugos/system.ts"; import { DataStore } from "$lib/data/datastore.ts"; -import { KvKey } from "$type/types.ts"; +import { KvKey } from "../../plug-api/types.ts"; export function clientStoreSyscalls( ds: DataStore, diff --git a/web/syscalls/code_widget.ts b/web/syscalls/code_widget.ts index 89453f6fa..d7d3de5d3 100644 --- a/web/syscalls/code_widget.ts +++ b/web/syscalls/code_widget.ts @@ -1,4 +1,4 @@ -import { CodeWidgetContent } from "../../type/types.ts"; +import { CodeWidgetContent } from "../../plug-api/types.ts"; import { SysCallMapping } from "../../lib/plugos/system.ts"; import { CodeWidgetHook } from "../hooks/code_widget.ts"; diff --git a/web/syscalls/debug.ts b/web/syscalls/debug.ts index dfff9bb3e..6e525ae42 100644 --- a/web/syscalls/debug.ts +++ b/web/syscalls/debug.ts @@ -1,4 +1,4 @@ -import { KvKey } from "../../type/types.ts"; +import { KvKey } from "../../plug-api/types.ts"; import type { SysCallMapping } from "../../lib/plugos/system.ts"; import { Client } from "../client.ts"; diff --git a/web/syscalls/editor.ts b/web/syscalls/editor.ts index 2f15cbe38..a46da8717 100644 --- a/web/syscalls/editor.ts +++ b/web/syscalls/editor.ts @@ -12,7 +12,7 @@ import { } from "../deps.ts"; import { SysCallMapping } from "$lib/plugos/system.ts"; import type { FilterOption } from "../../type/web.ts"; -import { UploadFile } from "$type/types.ts"; +import { UploadFile } from "../../plug-api/types.ts"; import { PageRef } from "$sb/lib/page_ref.ts"; import { openSearchPanel } from "../deps.ts"; import { diffAndPrepareChanges } from "../cm_util.ts"; diff --git a/web/syscalls/space.ts b/web/syscalls/space.ts index 1d54372a9..16fa4ad02 100644 --- a/web/syscalls/space.ts +++ b/web/syscalls/space.ts @@ -1,6 +1,6 @@ import { Client } from "../client.ts"; import { SysCallMapping } from "../../lib/plugos/system.ts"; -import { AttachmentMeta, FileMeta, PageMeta } from "../../type/types.ts"; +import { AttachmentMeta, FileMeta, PageMeta } from "../../plug-api/types.ts"; export function spaceReadSyscalls(editor: Client): SysCallMapping { return { diff --git a/website/CHANGELOG.md b/website/CHANGELOG.md index 591ff73a2..f2f672986 100644 --- a/website/CHANGELOG.md +++ b/website/CHANGELOG.md @@ -6,13 +6,16 @@ release. ## Edge _These features are not yet properly released, you need to use [the edge builds](https://community.silverbullet.md/t/living-on-the-edge-builds/27) to try them._ +* Nothing yet since 0.7.4, be patient! + +## 0.7.4 +* [[Plugs/Share]] using the {[Share: Page Or Selection]} command (bound to Ctrl-s/Cmd-s by default): allowing you to quickly share the current page (or selection) to the clipboard as: + * Clean markdown (to paste into other markdown supporting tools) + * Rich text (to paste into unenlightened rich text tools like Google Docs, Confluence, Word etc.) * Various improvements in tests and input checks (by Maks [here](https://github.com/silverbulletmd/silverbullet/pull/754) and [here](https://github.com/silverbulletmd/silverbullet/pull/751)) * Better sizing of the top bar (was buggy before and poorly implemented) (by [onespaceman](https://github.com/silverbulletmd/silverbullet/pull/753)) * Hashtag can now contain more different characters, including emoji (by [Matthew Pietz](https://github.com/silverbulletmd/silverbullet/pull/752)) * New [[Space Script]] APIs: `registerAttributeExtractor` and `registerEventListener` -* [[Plugs/Share]] using the {[Share: Page Or Selection]} command (bound to Ctrl-s/Cmd-s by default): allowing you to quickly share the current page (or selection) to the clipboard as: - * Clean markdown (to paste into other markdown supporting tools) - * Rich text (to paste into unenlightened rich text tools like Google Docs, Confluence, Word etc.) ---