From bf2e0cdb87f72ca25825df9e73b8bcbc5af9e686 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Wed, 4 Jun 2025 14:01:59 +0200 Subject: [PATCH] Refactor: Merging common/ into web/ --- build_web.ts | 1 - cmd/sync.ts | 2 +- deno.json | 1 - lib/data/datastore.test.ts | 4 +- lib/data/datastore.ts | 4 +- lib/data/mq.datastore.ts | 4 +- plug-api/lib/attribute.test.ts | 4 +- plug-api/lib/resolve.test.ts | 4 +- plug-api/lib/tags.ts | 2 +- plug-api/lib/tree.test.ts | 4 +- plug-api/syscalls/datastore.ts | 2 +- plug-api/syscalls/index.ts | 2 +- plug-api/syscalls/lua.ts | 2 +- plug-api/syscalls/shell.ts | 2 +- plugs/index/api.ts | 2 +- plugs/index/item.test.ts | 2 +- plugs/index/page_links.ts | 2 +- plugs/markdown/markdown_render.test.ts | 4 +- plugs/tasks/task.test.ts | 2 +- prompts/sync-api-docs.md | 13 ------- prompts/upgrade-dependencies.md | 11 ------ server/http_server.ts | 4 +- server/shell.test.ts | 4 +- server/space_server.ts | 10 ++--- server/storage_backend.ts | 6 +-- {common => web}/PAGE_TEMPLATES.ts | 0 {common => web}/README.md | 0 web/client.ts | 29 +++++++------- web/client_system.ts | 38 +++++++++---------- web/cm_plugins/editor_paste.ts | 2 +- web/cm_plugins/lint.ts | 4 +- web/cm_plugins/lua_directive.ts | 15 +++----- web/cm_plugins/lua_widget.ts | 10 ++--- web/cm_plugins/table.ts | 2 +- web/components/command_palette.tsx | 2 +- web/components/page_navigator.tsx | 2 +- {common => web}/config.test.ts | 0 {common => web}/config.ts | 0 web/editor_state.ts | 6 +-- {common => web}/hooks/command.ts | 0 {common => web}/hooks/event.ts | 2 +- {common => web}/hooks/plug_namespace.ts | 0 {common => web}/languages.ts | 2 +- {common => web}/markdown.ts | 12 +++--- {common => web}/markdown_parser/constants.ts | 0 {common => web}/markdown_parser/customtags.ts | 0 .../markdown_parser/extended_task.ts | 0 {common => web}/markdown_parser/parse_tree.ts | 0 .../markdown_parser/parser.test.ts | 0 {common => web}/markdown_parser/parser.ts | 6 +-- .../markdown_parser/table_parser.ts | 0 {common => web}/markdown_util.ts | 2 +- web/service_worker.ts | 2 +- {common => web}/shell_stream_client.ts | 0 {common => web}/space.ts | 6 +-- {common => web}/space_lua.ts | 19 +++------- {common => web}/space_lua/ast.ts | 0 {common => web}/space_lua/eval.test.ts | 2 +- {common => web}/space_lua/eval.ts | 12 +++--- .../space_lua/language_core_test.lua | 0 {common => web}/space_lua/lua.grammar | 0 {common => web}/space_lua/lua.test.ts | 8 ++-- {common => web}/space_lua/parse-lua.js | 0 {common => web}/space_lua/parse-lua.terms.js | 0 {common => web}/space_lua/parse.test.ts | 4 +- {common => web}/space_lua/parse.ts | 2 +- .../space_lua/query_collection.test.ts | 4 +- {common => web}/space_lua/query_collection.ts | 8 ++-- {common => web}/space_lua/query_test.lua | 0 {common => web}/space_lua/runtime.test.ts | 2 +- {common => web}/space_lua/runtime.ts | 0 {common => web}/space_lua/stdlib.ts | 18 ++++----- .../space_lua/stdlib/global_test.lua | 0 {common => web}/space_lua/stdlib/js.ts | 2 +- {common => web}/space_lua/stdlib/js_test.lua | 0 {common => web}/space_lua/stdlib/math.ts | 6 +-- .../space_lua/stdlib/math_test.lua | 0 {common => web}/space_lua/stdlib/os.ts | 6 +-- {common => web}/space_lua/stdlib/os_test.lua | 0 {common => web}/space_lua/stdlib/printf.ts | 0 {common => web}/space_lua/stdlib/space_lua.ts | 8 ++-- .../space_lua/stdlib/space_lua_test.lua | 0 {common => web}/space_lua/stdlib/string.ts | 2 +- .../space_lua/stdlib/string_test.lua | 0 .../space_lua/stdlib/string_test2.lua | 0 {common => web}/space_lua/stdlib/table.ts | 4 +- .../space_lua/stdlib/table_test.lua | 0 {common => web}/space_lua/util.test.ts | 2 +- {common => web}/space_lua/util.ts | 0 {common => web}/space_lua_api.ts | 4 +- {common => web}/space_script.ts | 2 +- .../spaces/asset_bundle_space_primitives.ts | 0 {common => web}/spaces/constants.ts | 0 .../spaces/datastore_space_primitives.test.ts | 0 .../spaces/datastore_space_primitives.ts | 0 .../spaces/disk_space_primitives.ts | 0 .../spaces/evented_space_primitives.ts | 4 +- .../spaces/fallback_space_primitives.ts | 0 .../spaces/filtered_space_primitives.ts | 0 .../spaces/http_space_primitives.ts | 0 .../spaces/kv_meta_space_primitives.ts | 0 .../spaces/plug_space_primitives.ts | 4 +- {common => web}/spaces/ro_space_primitives.ts | 0 .../spaces/space_primitives.test.ts | 0 {common => web}/spaces/space_primitives.ts | 0 {common => web}/spaces/sync.test.ts | 0 {common => web}/spaces/sync.ts | 0 web/style.ts | 2 +- {common => web}/sw_util.ts | 0 web/sync_service.ts | 8 ++-- {common => web}/syscalls/command.ts | 6 +-- {common => web}/syscalls/config.ts | 2 +- {lib/plugos => web}/syscalls/datastore.ts | 12 +++--- {common => web}/syscalls/event.ts | 8 ++-- {common => web}/syscalls/index.ts | 8 ++-- {common => web}/syscalls/jsonschema.ts | 0 {common => web}/syscalls/language.ts | 0 {common => web}/syscalls/lua.ts | 10 ++--- {common => web}/syscalls/markdown.ts | 6 +-- web/syscalls/shell.ts | 2 +- {common => web}/syscalls/system.ts | 2 +- {common => web}/syscalls/yaml.ts | 0 122 files changed, 194 insertions(+), 235 deletions(-) delete mode 100644 prompts/sync-api-docs.md delete mode 100644 prompts/upgrade-dependencies.md rename {common => web}/PAGE_TEMPLATES.ts (100%) rename {common => web}/README.md (100%) rename {common => web}/config.test.ts (100%) rename {common => web}/config.ts (100%) rename {common => web}/hooks/command.ts (100%) rename {common => web}/hooks/event.ts (98%) rename {common => web}/hooks/plug_namespace.ts (100%) rename {common => web}/languages.ts (99%) rename {common => web}/markdown.ts (85%) rename {common => web}/markdown_parser/constants.ts (100%) rename {common => web}/markdown_parser/customtags.ts (100%) rename {common => web}/markdown_parser/extended_task.ts (100%) rename {common => web}/markdown_parser/parse_tree.ts (100%) rename {common => web}/markdown_parser/parser.test.ts (100%) rename {common => web}/markdown_parser/parser.ts (98%) rename {common => web}/markdown_parser/table_parser.ts (100%) rename {common => web}/markdown_util.ts (98%) rename {common => web}/shell_stream_client.ts (100%) rename {common => web}/space.ts (96%) rename {common => web}/space_lua.ts (83%) rename {common => web}/space_lua/ast.ts (100%) rename {common => web}/space_lua/eval.test.ts (99%) rename {common => web}/space_lua/eval.ts (98%) rename {common => web}/space_lua/language_core_test.lua (100%) rename {common => web}/space_lua/lua.grammar (100%) rename {common => web}/space_lua/lua.test.ts (87%) rename {common => web}/space_lua/parse-lua.js (100%) rename {common => web}/space_lua/parse-lua.terms.js (100%) rename {common => web}/space_lua/parse.test.ts (97%) rename {common => web}/space_lua/parse.ts (99%) rename {common => web}/space_lua/query_collection.test.ts (98%) rename {common => web}/space_lua/query_collection.ts (96%) rename {common => web}/space_lua/query_test.lua (100%) rename {common => web}/space_lua/runtime.test.ts (98%) rename {common => web}/space_lua/runtime.ts (100%) rename {common => web}/space_lua/stdlib.ts (93%) rename {common => web}/space_lua/stdlib/global_test.lua (100%) rename {common => web}/space_lua/stdlib/js.ts (98%) rename {common => web}/space_lua/stdlib/js_test.lua (100%) rename {common => web}/space_lua/stdlib/math.ts (97%) rename {common => web}/space_lua/stdlib/math_test.lua (100%) rename {common => web}/space_lua/stdlib/os.ts (97%) rename {common => web}/space_lua/stdlib/os_test.lua (100%) rename {common => web}/space_lua/stdlib/printf.ts (100%) rename {common => web}/space_lua/stdlib/space_lua.ts (94%) rename {common => web}/space_lua/stdlib/space_lua_test.lua (100%) rename {common => web}/space_lua/stdlib/string.ts (99%) rename {common => web}/space_lua/stdlib/string_test.lua (100%) rename {common => web}/space_lua/stdlib/string_test2.lua (100%) rename {common => web}/space_lua/stdlib/table.ts (98%) rename {common => web}/space_lua/stdlib/table_test.lua (100%) rename {common => web}/space_lua/util.test.ts (89%) rename {common => web}/space_lua/util.ts (100%) rename {common => web}/space_lua_api.ts (95%) rename {common => web}/space_script.ts (97%) rename {common => web}/spaces/asset_bundle_space_primitives.ts (100%) rename {common => web}/spaces/constants.ts (100%) rename {common => web}/spaces/datastore_space_primitives.test.ts (100%) rename {common => web}/spaces/datastore_space_primitives.ts (100%) rename {common => web}/spaces/disk_space_primitives.ts (100%) rename {common => web}/spaces/evented_space_primitives.ts (98%) rename {common => web}/spaces/fallback_space_primitives.ts (100%) rename {common => web}/spaces/filtered_space_primitives.ts (100%) rename {common => web}/spaces/http_space_primitives.ts (100%) rename {common => web}/spaces/kv_meta_space_primitives.ts (100%) rename {common => web}/spaces/plug_space_primitives.ts (95%) rename {common => web}/spaces/ro_space_primitives.ts (100%) rename {common => web}/spaces/space_primitives.test.ts (100%) rename {common => web}/spaces/space_primitives.ts (100%) rename {common => web}/spaces/sync.test.ts (100%) rename {common => web}/spaces/sync.ts (100%) rename {common => web}/sw_util.ts (100%) rename {common => web}/syscalls/command.ts (91%) rename {common => web}/syscalls/config.ts (94%) rename {lib/plugos => web}/syscalls/datastore.ts (86%) rename {common => web}/syscalls/event.ts (82%) rename {common => web}/syscalls/index.ts (85%) rename {common => web}/syscalls/jsonschema.ts (100%) rename {common => web}/syscalls/language.ts (100%) rename {common => web}/syscalls/lua.ts (85%) rename {common => web}/syscalls/markdown.ts (83%) rename {common => web}/syscalls/system.ts (99%) rename {common => web}/syscalls/yaml.ts (100%) diff --git a/build_web.ts b/build_web.ts index 7c43280f..e8038ebc 100644 --- a/build_web.ts +++ b/build_web.ts @@ -21,7 +21,6 @@ export async function bundleAll( if (watch) { const watcher = Deno.watchFs([ "web", - "common", "dist_plug_bundle/_plug", "Library", ]); diff --git a/cmd/sync.ts b/cmd/sync.ts index d54b7af1..9d7c87c9 100644 --- a/cmd/sync.ts +++ b/cmd/sync.ts @@ -1,4 +1,4 @@ -import { SpaceSync, type SyncStatusItem } from "$common/spaces/sync.ts"; +import { SpaceSync, type SyncStatusItem } from "../web/spaces/sync.ts"; import { determineStorageBackend } from "../server/storage_backend.ts"; export async function syncCommand( diff --git a/deno.json b/deno.json index 56c8833d..0bba554c 100644 --- a/deno.json +++ b/deno.json @@ -110,7 +110,6 @@ "@silverbulletmd/silverbullet/type/config": "./type/config.ts", "@silverbulletmd/silverbullet/type/rpc": "./type/rpc.ts", "@silverbulletmd/silverbullet/type/client": "./type/client.ts", - "$common/": "./common/", "$lib/": "./lib/", "@codemirror/autocomplete": "https://esm.sh/@codemirror/autocomplete@6.18.1?external=@codemirror/state,@codemirror/commands,@lezer/common,@codemirror/view,@codemirror/language&target=es2022", "@codemirror/commands": "https://esm.sh/@codemirror/commands@6.7.0?external=@codemirror/state,@codemirror/view,@codemirror/language,@lezer/common&target=es2022", diff --git a/lib/data/datastore.test.ts b/lib/data/datastore.test.ts index f9432707..25ee36fd 100644 --- a/lib/data/datastore.test.ts +++ b/lib/data/datastore.test.ts @@ -5,8 +5,8 @@ import type { KvPrimitives } from "../data/kv_primitives.ts"; import { assertEquals } from "@std/assert"; import { PrefixedKvPrimitives } from "../data/prefixed_kv_primitives.ts"; import { DataStore } from "$lib/data/datastore.ts"; -import { LuaEnv, LuaStackFrame } from "$common/space_lua/runtime.ts"; -import { parseExpressionString } from "$common/space_lua/parse.ts"; +import { LuaEnv, LuaStackFrame } from "../../web/space_lua/runtime.ts"; +import { parseExpressionString } from "../../web/space_lua/parse.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 fe1fed74..f9b89e81 100644 --- a/lib/data/datastore.ts +++ b/lib/data/datastore.ts @@ -1,8 +1,8 @@ import { type LuaCollectionQuery, queryLua, -} from "$common/space_lua/query_collection.ts"; -import { LuaEnv, LuaStackFrame } from "$common/space_lua/runtime.ts"; +} from "../../web/space_lua/query_collection.ts"; +import { LuaEnv, LuaStackFrame } from "../../web/space_lua/runtime.ts"; import type { KV, KvKey } from "../../plug-api/types.ts"; import type { KvPrimitives, KvQueryOptions } from "./kv_primitives.ts"; diff --git a/lib/data/mq.datastore.ts b/lib/data/mq.datastore.ts index e753d451..dddb0bf9 100644 --- a/lib/data/mq.datastore.ts +++ b/lib/data/mq.datastore.ts @@ -6,8 +6,8 @@ import type { MQSubscribeOptions, } from "../../plug-api/types.ts"; import type { DataStore } from "./datastore.ts"; -import { parseExpressionString } from "$common/space_lua/parse.ts"; -import { LuaEnv } from "$common/space_lua/runtime.ts"; +import { parseExpressionString } from "../../web/space_lua/parse.ts"; +import { LuaEnv } from "../../web/space_lua/runtime.ts"; export type ProcessingMessage = MQMessage & { ts: number; diff --git a/plug-api/lib/attribute.test.ts b/plug-api/lib/attribute.test.ts index 10a376f4..58ec116c 100644 --- a/plug-api/lib/attribute.test.ts +++ b/plug-api/lib/attribute.test.ts @@ -1,12 +1,12 @@ import "./syscall_mock.ts"; -import { parse } from "$common/markdown_parser/parse_tree.ts"; +import { parse } from "../../web/markdown_parser/parse_tree.ts"; import { cleanAttributes, extractAttributes, } from "@silverbulletmd/silverbullet/lib/attribute"; import { assertEquals } from "@std/assert"; import { renderToText } from "./tree.ts"; -import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; +import { extendedMarkdownLanguage } from "../../web/markdown_parser/parser.ts"; const inlineAttributeSample = ` # My document diff --git a/plug-api/lib/resolve.test.ts b/plug-api/lib/resolve.test.ts index dbf8aa3f..af6cad58 100644 --- a/plug-api/lib/resolve.test.ts +++ b/plug-api/lib/resolve.test.ts @@ -5,8 +5,8 @@ import { } from "@silverbulletmd/silverbullet/lib/resolve"; import { assertEquals } from "@std/assert"; import { type ParseTree, renderToText } from "./tree.ts"; -import { parse } from "$common/markdown_parser/parse_tree.ts"; -import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; +import { parse } from "../../web/markdown_parser/parse_tree.ts"; +import { extendedMarkdownLanguage } from "../../web/markdown_parser/parser.ts"; Deno.test("Test URL resolver", () => { // Absolute paths diff --git a/plug-api/lib/tags.ts b/plug-api/lib/tags.ts index 133710e3..87ab3a01 100644 --- a/plug-api/lib/tags.ts +++ b/plug-api/lib/tags.ts @@ -4,7 +4,7 @@ import { type ParseTree, traverseTree, } from "@silverbulletmd/silverbullet/lib/tree"; -import { tagRegex } from "../../common/markdown_parser/constants.ts"; +import { tagRegex } from "../../web/markdown_parser/constants.ts"; export function updateITags(obj: ObjectValue, frontmatter: FrontMatter) { const itags = [obj.tag, ...frontmatter.tags || []]; diff --git a/plug-api/lib/tree.test.ts b/plug-api/lib/tree.test.ts index 32949c92..e6f93633 100644 --- a/plug-api/lib/tree.test.ts +++ b/plug-api/lib/tree.test.ts @@ -9,8 +9,8 @@ import { replaceNodesMatching, } from "./tree.ts"; import { assertEquals, assertNotEquals } from "@std/assert"; -import { parse } from "$common/markdown_parser/parse_tree.ts"; -import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; +import { parse } from "../../web/markdown_parser/parse_tree.ts"; +import { extendedMarkdownLanguage } from "../../web/markdown_parser/parser.ts"; const mdTest1 = ` # Heading diff --git a/plug-api/syscalls/datastore.ts b/plug-api/syscalls/datastore.ts index 765dee43..488361dd 100644 --- a/plug-api/syscalls/datastore.ts +++ b/plug-api/syscalls/datastore.ts @@ -1,4 +1,4 @@ -import type { LuaCollectionQuery } from "$common/space_lua/query_collection.ts"; +import type { LuaCollectionQuery } from "../../web/space_lua/query_collection.ts"; import { syscall } from "../syscall.ts"; import type { KV, KvKey, KvQuery } from "../types.ts"; diff --git a/plug-api/syscalls/index.ts b/plug-api/syscalls/index.ts index 50320557..f70e4d3a 100644 --- a/plug-api/syscalls/index.ts +++ b/plug-api/syscalls/index.ts @@ -1,5 +1,5 @@ import type { ObjectValue } from "@silverbulletmd/silverbullet/types"; -import type { LuaCollectionQuery } from "$common/space_lua/query_collection.ts"; +import type { LuaCollectionQuery } from "../../web/space_lua/query_collection.ts"; import { syscall } from "@silverbulletmd/silverbullet/syscall"; /** diff --git a/plug-api/syscalls/lua.ts b/plug-api/syscalls/lua.ts index 25d789af..e9f23043 100644 --- a/plug-api/syscalls/lua.ts +++ b/plug-api/syscalls/lua.ts @@ -1,5 +1,5 @@ import { syscall } from "../syscall.ts"; -import type { LuaBlock, LuaExpression } from "$common/space_lua/ast.ts"; +import type { LuaBlock, LuaExpression } from "../../web/space_lua/ast.ts"; export function parse( code: string, diff --git a/plug-api/syscalls/shell.ts b/plug-api/syscalls/shell.ts index 12586c77..c32d07de 100644 --- a/plug-api/syscalls/shell.ts +++ b/plug-api/syscalls/shell.ts @@ -1,4 +1,4 @@ -import type { ShellStreamClient } from "$common/shell_stream_client.ts"; +import type { ShellStreamClient } from "../../web/shell_stream_client.ts"; import { syscall } from "../syscall.ts"; /** diff --git a/plugs/index/api.ts b/plugs/index/api.ts index 6c6cf4ed..66469d65 100644 --- a/plugs/index/api.ts +++ b/plugs/index/api.ts @@ -1,7 +1,7 @@ import { datastore, markdown } from "@silverbulletmd/silverbullet/syscalls"; import type { KV, KvKey, KvQuery, ObjectValue } from "../../plug-api/types.ts"; import { ttlCache } from "$lib/memory_cache.ts"; -import type { LuaCollectionQuery } from "$common/space_lua/query_collection.ts"; +import type { LuaCollectionQuery } from "../../web/space_lua/query_collection.ts"; import { extractFrontmatter as extractFrontmatterFromTree, type FrontMatter, diff --git a/plugs/index/item.test.ts b/plugs/index/item.test.ts index d01d57bf..2dfe4459 100644 --- a/plugs/index/item.test.ts +++ b/plugs/index/item.test.ts @@ -1,5 +1,5 @@ import "../../plug-api/lib/syscall_mock.ts"; -import { parseMarkdown } from "$common/markdown_parser/parser.ts"; +import { parseMarkdown } from "../../web/markdown_parser/parser.ts"; import { extractItems } from "./item.ts"; import { assertEquals } from "@std/assert"; diff --git a/plugs/index/page_links.ts b/plugs/index/page_links.ts index 7234052d..6b020bd5 100644 --- a/plugs/index/page_links.ts +++ b/plugs/index/page_links.ts @@ -23,7 +23,7 @@ import { extractSnippetAroundIndex } from "./snippet_extractor.ts"; import { mdLinkRegex, wikiLinkRegex, -} from "$common/markdown_parser/constants.ts"; +} from "../../web/markdown_parser/constants.ts"; import { lua, space } from "@silverbulletmd/silverbullet/syscalls"; export type LinkObject = ObjectValue< diff --git a/plugs/markdown/markdown_render.test.ts b/plugs/markdown/markdown_render.test.ts index a56b6554..a8b4dd62 100644 --- a/plugs/markdown/markdown_render.test.ts +++ b/plugs/markdown/markdown_render.test.ts @@ -1,9 +1,9 @@ -import { parse } from "$common/markdown_parser/parse_tree.ts"; +import { parse } from "../../web/markdown_parser/parse_tree.ts"; import { System } from "../../lib/plugos/system.ts"; import { createSandbox } from "../../lib/plugos/sandboxes/deno_worker_sandbox.ts"; import { renderMarkdownToHtml } from "./markdown_render.ts"; -import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; +import { extendedMarkdownLanguage } from "../../web/markdown_parser/parser.ts"; import { assertEquals } from "@std/assert"; import { fileURLToPath } from "node:url"; diff --git a/plugs/tasks/task.test.ts b/plugs/tasks/task.test.ts index 442ed7f8..3bcfddcf 100644 --- a/plugs/tasks/task.test.ts +++ b/plugs/tasks/task.test.ts @@ -1,5 +1,5 @@ import "../../plug-api/lib/syscall_mock.ts"; -import { parseMarkdown } from "$common/markdown_parser/parser.ts"; +import { parseMarkdown } from "../../web/markdown_parser/parser.ts"; import { extractTasks } from "./task.ts"; import { assertEquals } from "@std/assert"; diff --git a/prompts/sync-api-docs.md b/prompts/sync-api-docs.md deleted file mode 100644 index 31d47080..00000000 --- a/prompts/sync-api-docs.md +++ /dev/null @@ -1,13 +0,0 @@ -# Step 1: Lua APIs -The `common/space_lua/stdlib` folder contains implementations of the standard Lua library functions in TypeScript. These APIs should all be documented in a markdown format under `website/API` folder. The markdown files should be named after the Lua module they represent. For example, the `string` module should be documented in `website/API/string.md`. - -Ignore the `printf` module, as it is not part of the standard Lua library. - -Please compare the APIs implemented in TypeScript and make sure they appear in the API documentation. Add documentation for any missing APIs, follow the same format as the existing documentation. - -# Step 2: Syscall documentation -Also in the `website/API` are markdown files for syscalls exposed in SilverBullet. Interfaces for all of theses are implemented under the `plug-api/syscalls/` folder. Each .ts file there should have a matching .md file under `website/API` documenting the APIs using the format similar to `website/API/editor.md`. - -Check if all the syscalls defined in the .ts files are present under the API docs, and if not, add them. - -For exising API documentation, verify if it is complete and no syscalls are missing. If it is missing, add it. \ No newline at end of file diff --git a/prompts/upgrade-dependencies.md b/prompts/upgrade-dependencies.md deleted file mode 100644 index 8b3ed53c..00000000 --- a/prompts/upgrade-dependencies.md +++ /dev/null @@ -1,11 +0,0 @@ -# Steps -1. Look at deno.json to find all dependencies under `imports` -3. Find out online (use web search) if there is a NEWER version available for each dependency, exclude the current version number from your search for better results. Note that the esm.sh ones are really npm dependencies, so you may want to search on npmjs.com for the latest version -4. Only when you discover a newer version (higher version number), bump the version number, otherwise leave it as is - -After each dependency bump run: -* `deno task check` to ensure type checks -* `deno task test` to ensure all tests still pass -* `deno task lint` to ensure all linting rules are adhered to - -Fix any issues as you go along. \ No newline at end of file diff --git a/server/http_server.ts b/server/http_server.ts index 38e6153f..f7ce4e36 100644 --- a/server/http_server.ts +++ b/server/http_server.ts @@ -9,8 +9,8 @@ import { } from "./shell_endpoints.ts"; import { SpaceServer } from "./space_server.ts"; import type { KvPrimitives } from "$lib/data/kv_primitives.ts"; -import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; -import { parse } from "$common/markdown_parser/parse_tree.ts"; +import { extendedMarkdownLanguage } from "../web/markdown_parser/parser.ts"; +import { parse } from "../web/markdown_parser/parse_tree.ts"; import { renderMarkdownToHtml } from "../plugs/markdown/markdown_render.ts"; import { decodePageURI, diff --git a/server/shell.test.ts b/server/shell.test.ts index 9cf73f6f..f690e1be 100644 --- a/server/shell.test.ts +++ b/server/shell.test.ts @@ -6,8 +6,8 @@ import { sleep } from "../lib/async.ts"; import { ShellStreamClient, type ShellStreamEvent, -} from "../common/shell_stream_client.ts"; -import { HttpSpacePrimitives } from "../common/spaces/http_space_primitives.ts"; +} from "../web/shell_stream_client.ts"; +import { HttpSpacePrimitives } from "../web/spaces/http_space_primitives.ts"; // Create a test script async function createTestScript(dir: string): Promise { diff --git a/server/space_server.ts b/server/space_server.ts index 897f6b72..bc83db86 100644 --- a/server/space_server.ts +++ b/server/space_server.ts @@ -1,7 +1,7 @@ -import { AssetBundlePlugSpacePrimitives } from "$common/spaces/asset_bundle_space_primitives.ts"; -import { FilteredSpacePrimitives } from "$common/spaces/filtered_space_primitives.ts"; -import { ReadOnlySpacePrimitives } from "$common/spaces/ro_space_primitives.ts"; -import type { SpacePrimitives } from "$common/spaces/space_primitives.ts"; +import { AssetBundlePlugSpacePrimitives } from "../web/spaces/asset_bundle_space_primitives.ts"; +import { FilteredSpacePrimitives } from "../web/spaces/filtered_space_primitives.ts"; +import { ReadOnlySpacePrimitives } from "../web/spaces/ro_space_primitives.ts"; +import type { SpacePrimitives } from "../web/spaces/space_primitives.ts"; import type { AssetBundle } from "../lib/asset_bundle/bundle.ts"; import type { KvPrimitives } from "$lib/data/kv_primitives.ts"; import { JWTIssuer } from "./crypto.ts"; @@ -11,7 +11,7 @@ import type { ShellBackend } from "./shell_backend.ts"; import { determineStorageBackend } from "./storage_backend.ts"; import type { ServerOptions } from "./http_server.ts"; import type { AuthOptions } from "../cmd/server.ts"; -import { CONFIG_TEMPLATE, INDEX_TEMPLATE } from "$common/PAGE_TEMPLATES.ts"; +import { CONFIG_TEMPLATE, INDEX_TEMPLATE } from "../web/PAGE_TEMPLATES.ts"; // Equivalent of Client on the server export class SpaceServer { diff --git a/server/storage_backend.ts b/server/storage_backend.ts index 5ace9a39..941dee69 100644 --- a/server/storage_backend.ts +++ b/server/storage_backend.ts @@ -1,7 +1,7 @@ -import { DiskSpacePrimitives } from "$common/spaces/disk_space_primitives.ts"; -import type { SpacePrimitives } from "$common/spaces/space_primitives.ts"; +import { DiskSpacePrimitives } from "../web/spaces/disk_space_primitives.ts"; +import type { SpacePrimitives } from "../web/spaces/space_primitives.ts"; import { resolve } from "@std/path"; -import { HttpSpacePrimitives } from "$common/spaces/http_space_primitives.ts"; +import { HttpSpacePrimitives } from "../web/spaces/http_space_primitives.ts"; export function determineStorageBackend( folder: string, diff --git a/common/PAGE_TEMPLATES.ts b/web/PAGE_TEMPLATES.ts similarity index 100% rename from common/PAGE_TEMPLATES.ts rename to web/PAGE_TEMPLATES.ts diff --git a/common/README.md b/web/README.md similarity index 100% rename from common/README.md rename to web/README.md diff --git a/web/client.ts b/web/client.ts index 5914df01..7f940ef7 100644 --- a/web/client.ts +++ b/web/client.ts @@ -7,9 +7,9 @@ import { EditorView } from "@codemirror/view"; import { syntaxTree } from "@codemirror/language"; import { history, isolateHistory } from "@codemirror/commands"; import type { SyntaxNode } from "@lezer/common"; -import { Space } from "../common/space.ts"; +import { Space } from "./space.ts"; import type { FilterOption } from "@silverbulletmd/silverbullet/type/client"; -import { EventHook } from "../common/hooks/event.ts"; +import { EventHook } from "./hooks/event.ts"; import { type AppCommand, isValidEditor } from "$lib/command.ts"; import { type LocationState, @@ -31,13 +31,13 @@ import type { } from "../plug-api/types.ts"; import type { StyleObject } from "../plugs/index/style.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"; +import { PlugSpacePrimitives } from "./spaces/plug_space_primitives.ts"; +import { EventedSpacePrimitives } from "./spaces/evented_space_primitives.ts"; import { pageSyncInterval, SyncService } from "./sync_service.ts"; import { simpleHash } from "$lib/crypto.ts"; -import type { SyncStatus } from "$common/spaces/sync.ts"; -import { HttpSpacePrimitives } from "$common/spaces/http_space_primitives.ts"; -import { FallbackSpacePrimitives } from "$common/spaces/fallback_space_primitives.ts"; +import type { SyncStatus } from "./spaces/sync.ts"; +import { HttpSpacePrimitives } from "./spaces/http_space_primitives.ts"; +import { FallbackSpacePrimitives } from "./spaces/fallback_space_primitives.ts"; import { encodePageURI, encodeRef, @@ -49,7 +49,7 @@ import { ClientSystem } from "./client_system.ts"; import { createEditorState } from "./editor_state.ts"; import { MainUI } from "./editor_ui.tsx"; import { cleanPageRef } from "@silverbulletmd/silverbullet/lib/resolve"; -import type { SpacePrimitives } from "$common/spaces/space_primitives.ts"; +import type { SpacePrimitives } from "./spaces/space_primitives.ts"; import type { CodeWidgetButton, FileMeta, @@ -58,15 +58,15 @@ import type { import { DataStore } from "$lib/data/datastore.ts"; import { IndexedDBKvPrimitives } from "$lib/data/indexeddb_kv_primitives.ts"; import { DataStoreMQ } from "$lib/data/mq.datastore.ts"; -import { DataStoreSpacePrimitives } from "$common/spaces/datastore_space_primitives.ts"; +import { DataStoreSpacePrimitives } from "./spaces/datastore_space_primitives.ts"; -import { ReadOnlySpacePrimitives } from "$common/spaces/ro_space_primitives.ts"; +import { ReadOnlySpacePrimitives } from "./spaces/ro_space_primitives.ts"; import { LimitedMap } from "$lib/limited_map.ts"; -import { plugPrefix } from "$common/spaces/constants.ts"; +import { plugPrefix } from "./spaces/constants.ts"; import { diffAndPrepareChanges } from "./cm_util.ts"; import { DocumentEditor } from "./document_editor.ts"; -import { parseExpressionString } from "$common/space_lua/parse.ts"; -import { Config } from "$common/config.ts"; +import { parseExpressionString } from "./space_lua/parse.ts"; +import { Config } from "./config.ts"; const frontMatterRegex = /^---\n(([^\n]|\n)*?)---\n/; @@ -1479,8 +1479,7 @@ export class Client { return; } - const customStylesContent = spaceStyles.map(s => s.style).join("\n\n"); - console.info("Accumulated styles", customStylesContent) + const customStylesContent = spaceStyles.map((s) => s.style).join("\n\n"); this.ui.viewDispatch({ type: "set-ui-option", key: "customStyles", diff --git a/web/client_system.ts b/web/client_system.ts index 17f08f4d..d8c2e7b7 100644 --- a/web/client_system.ts +++ b/web/client_system.ts @@ -1,6 +1,6 @@ -import { PlugNamespaceHook } from "$common/hooks/plug_namespace.ts"; +import { PlugNamespaceHook } from "./hooks/plug_namespace.ts"; import type { SilverBulletHooks } from "../lib/manifest.ts"; -import type { EventHook } from "../common/hooks/event.ts"; +import type { EventHook } from "./hooks/event.ts"; import { createSandbox } from "../lib/plugos/sandboxes/web_worker_sandbox.ts"; import assetSyscalls from "../lib/plugos/syscalls/asset.ts"; @@ -8,44 +8,44 @@ import { eventSyscalls } from "../lib/plugos/syscalls/event.ts"; import { System } from "../lib/plugos/system.ts"; import type { Client } from "./client.ts"; import { CodeWidgetHook } from "./hooks/code_widget.ts"; -import { CommandHook } from "$common/hooks/command.ts"; +import { CommandHook } from "./hooks/command.ts"; import { SlashCommandHook } from "./hooks/slash_command.ts"; import { SyscallHook } from "./hooks/syscall.ts"; import { clientStoreSyscalls } from "./syscalls/clientStore.ts"; import { editorSyscalls } from "./syscalls/editor.ts"; import { sandboxFetchSyscalls } from "./syscalls/fetch.ts"; -import { markdownSyscalls } from "$common/syscalls/markdown.ts"; +import { markdownSyscalls } from "./syscalls/markdown.ts"; import { shellSyscalls } from "./syscalls/shell.ts"; import { spaceReadSyscalls, spaceWriteSyscalls } from "./syscalls/space.ts"; import { syncSyscalls } from "./syscalls/sync.ts"; -import { systemSyscalls } from "$common/syscalls/system.ts"; -import { yamlSyscalls } from "$common/syscalls/yaml.ts"; -import type { Space } from "../common/space.ts"; +import { systemSyscalls } from "./syscalls/system.ts"; +import { yamlSyscalls } from "./syscalls/yaml.ts"; +import type { Space } from "./space.ts"; import { MQHook } from "../lib/plugos/hooks/mq.ts"; import { mqSyscalls } from "../lib/plugos/syscalls/mq.ts"; import { dataStoreReadSyscalls, dataStoreWriteSyscalls, -} from "../lib/plugos/syscalls/datastore.ts"; +} from "./syscalls/datastore.ts"; import type { DataStore } from "$lib/data/datastore.ts"; -import { languageSyscalls } from "$common/syscalls/language.ts"; +import { languageSyscalls } from "./syscalls/language.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 { createKeyBindings } from "./editor_state.ts"; import type { DataStoreMQ } from "$lib/data/mq.datastore.ts"; -import { plugPrefix } from "$common/spaces/constants.ts"; -import { jsonschemaSyscalls } from "$common/syscalls/jsonschema.ts"; -import { luaSyscalls } from "$common/syscalls/lua.ts"; -import { indexSyscalls } from "$common/syscalls/index.ts"; -import { commandSyscalls } from "$common/syscalls/command.ts"; -import { configSyscalls } from "$common/syscalls/config.ts"; -import { eventListenerSyscalls } from "$common/syscalls/event.ts"; +import { plugPrefix } from "./spaces/constants.ts"; +import { jsonschemaSyscalls } from "./syscalls/jsonschema.ts"; +import { luaSyscalls } from "./syscalls/lua.ts"; +import { indexSyscalls } from "./syscalls/index.ts"; +import { commandSyscalls } from "./syscalls/command.ts"; +import { configSyscalls } from "./syscalls/config.ts"; +import { eventListenerSyscalls } from "./syscalls/event.ts"; import { DocumentEditorHook } from "./hooks/document_editor.ts"; -import type { LuaCollectionQuery } from "$common/space_lua/query_collection.ts"; +import type { LuaCollectionQuery } from "./space_lua/query_collection.ts"; import type { AppCommand } from "$lib/command.ts"; -import { ScriptEnvironment } from "$common/space_script.ts"; -import { SpaceLuaEnvironment } from "$common/space_lua.ts"; +import { ScriptEnvironment } from "./space_script.ts"; +import { SpaceLuaEnvironment } from "./space_lua.ts"; import type { ParseTree } from "@silverbulletmd/silverbullet/lib/tree"; const plugNameExtractRegex = /\/(.+)\.plug\.js$/; diff --git a/web/cm_plugins/editor_paste.ts b/web/cm_plugins/editor_paste.ts index 895fc58a..d94e0a08 100644 --- a/web/cm_plugins/editor_paste.ts +++ b/web/cm_plugins/editor_paste.ts @@ -8,7 +8,7 @@ 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 { lezerToParseTree } from "../markdown_parser/parse_tree.ts"; import { addParentPointers, findParentMatching, diff --git a/web/cm_plugins/lint.ts b/web/cm_plugins/lint.ts index b0e12626..1df4da8a 100644 --- a/web/cm_plugins/lint.ts +++ b/web/cm_plugins/lint.ts @@ -1,8 +1,8 @@ import { type Diagnostic, linter } from "@codemirror/lint"; import type { Client } from "../client.ts"; -import { parse } from "$common/markdown_parser/parse_tree.ts"; +import { parse } from "../markdown_parser/parse_tree.ts"; import type { LintEvent } from "../../plug-api/types.ts"; -import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; +import { extendedMarkdownLanguage } from "../markdown_parser/parser.ts"; export function plugLinter(client: Client) { return linter(async (view): Promise => { diff --git a/web/cm_plugins/lua_directive.ts b/web/cm_plugins/lua_directive.ts index 87cc24f3..be281856 100644 --- a/web/cm_plugins/lua_directive.ts +++ b/web/cm_plugins/lua_directive.ts @@ -7,21 +7,18 @@ import { isCursorInRange, } from "./util.ts"; import type { Client } from "../client.ts"; -import { parse as parseLua } from "$common/space_lua/parse.ts"; -import type { - LuaBlock, - LuaFunctionCallStatement, -} from "$common/space_lua/ast.ts"; -import { evalExpression } from "$common/space_lua/eval.ts"; +import { parse as parseLua } from "../space_lua/parse.ts"; +import type { LuaBlock, LuaFunctionCallStatement } from "../space_lua/ast.ts"; +import { evalExpression } from "../space_lua/eval.ts"; import { LuaEnv, LuaStackFrame, luaValueToJS, singleResult, -} from "$common/space_lua/runtime.ts"; -import { LuaRuntimeError } from "$common/space_lua/runtime.ts"; +} from "../space_lua/runtime.ts"; +import { LuaRuntimeError } from "../space_lua/runtime.ts"; import { encodeRef } from "@silverbulletmd/silverbullet/lib/page_ref"; -import { resolveASTReference } from "$common/space_lua.ts"; +import { resolveASTReference } from "../space_lua.ts"; import { LuaWidget } from "./lua_widget.ts"; import type { PageMeta } from "@silverbulletmd/silverbullet/types"; import YAML from "js-yaml"; diff --git a/web/cm_plugins/lua_widget.ts b/web/cm_plugins/lua_widget.ts index 41f17ad6..559ced85 100644 --- a/web/cm_plugins/lua_widget.ts +++ b/web/cm_plugins/lua_widget.ts @@ -5,16 +5,16 @@ import { isLocalPath, resolvePath, } from "@silverbulletmd/silverbullet/lib/resolve"; -import { parse } from "$common/markdown_parser/parse_tree.ts"; -import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; +import { parse } from "../markdown_parser/parse_tree.ts"; +import { extendedMarkdownLanguage } from "../markdown_parser/parser.ts"; import { renderToText } from "@silverbulletmd/silverbullet/lib/tree"; import { attachWidgetEventHandlers, moveCursorIntoText, } from "./widget_util.ts"; -import { expandMarkdown } from "$common/markdown.ts"; -import { LuaStackFrame, LuaTable } from "$common/space_lua/runtime.ts"; -import { jsonToMDTable } from "$common/markdown_util.ts"; +import { expandMarkdown } from "../markdown.ts"; +import { LuaStackFrame, LuaTable } from "../space_lua/runtime.ts"; +import { jsonToMDTable } from "../markdown_util.ts"; import { activeWidgets } from "./code_widget.ts"; export type LuaWidgetCallback = ( diff --git a/web/cm_plugins/table.ts b/web/cm_plugins/table.ts index d25acc95..bea29684 100644 --- a/web/cm_plugins/table.ts +++ b/web/cm_plugins/table.ts @@ -9,7 +9,7 @@ import { import { renderMarkdownToHtml } from "../../plugs/markdown/markdown_render.ts"; import { type ParseTree, renderToText } from "../../plug-api/lib/tree.ts"; -import { lezerToParseTree } from "$common/markdown_parser/parse_tree.ts"; +import { lezerToParseTree } from "../markdown_parser/parse_tree.ts"; import type { Client } from "../client.ts"; import { isLocalPath, diff --git a/web/components/command_palette.tsx b/web/components/command_palette.tsx index 8ba1a537..0d9e2500 100644 --- a/web/components/command_palette.tsx +++ b/web/components/command_palette.tsx @@ -9,7 +9,7 @@ import type { FilterOption, Shortcut, } from "@silverbulletmd/silverbullet/type/client"; -import type { Config } from "$common/config.ts"; +import type { Config } from "../config.ts"; export function CommandPalette({ commands, diff --git a/web/components/page_navigator.tsx b/web/components/page_navigator.tsx index a3b30200..50feffb6 100644 --- a/web/components/page_navigator.tsx +++ b/web/components/page_navigator.tsx @@ -8,7 +8,7 @@ import type { DocumentMeta, PageMeta, } from "@silverbulletmd/silverbullet/types"; -import { tagRegex as mdTagRegex } from "$common/markdown_parser/constants.ts"; +import { tagRegex as mdTagRegex } from "../markdown_parser/constants.ts"; import { extractHashtag } from "@silverbulletmd/silverbullet/lib/tags"; const tagRegex = new RegExp(mdTagRegex.source, "g"); diff --git a/common/config.test.ts b/web/config.test.ts similarity index 100% rename from common/config.test.ts rename to web/config.test.ts diff --git a/common/config.ts b/web/config.ts similarity index 100% rename from common/config.ts rename to web/config.ts diff --git a/web/editor_state.ts b/web/editor_state.ts index 1fc634a1..f72bbdca 100644 --- a/web/editor_state.ts +++ b/web/editor_state.ts @@ -46,10 +46,10 @@ import { } from "./cm_plugins/editor_paste.ts"; import type { TextChange } from "./change.ts"; import { postScriptPrefacePlugin } from "./cm_plugins/top_bottom_panels.ts"; -import { languageFor } from "$common/languages.ts"; +import { languageFor } from "./languages.ts"; import { plugLinter } from "./cm_plugins/lint.ts"; import { Compartment, type Extension } from "@codemirror/state"; -import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts"; +import { extendedMarkdownLanguage } from "./markdown_parser/parser.ts"; import { safeRun } from "$lib/async.ts"; import { codeCopyPlugin } from "./cm_plugins/code_copy.ts"; import { disableSpellcheck } from "./cm_plugins/spell_checking.ts"; @@ -311,7 +311,7 @@ export function createCommandKeyBindings(client: Client): KeyBinding[] { // Keyboard shortcuts from SETTINGS take precedense if (client.config.has("shortcuts")) { for (const shortcut of client.config.get("shortcuts", [])) { - overriddenCommands.add(shortcut.command) + overriddenCommands.add(shortcut.command); commandKeyBindings.push({ key: shortcut.key, mac: shortcut.mac, diff --git a/common/hooks/command.ts b/web/hooks/command.ts similarity index 100% rename from common/hooks/command.ts rename to web/hooks/command.ts diff --git a/common/hooks/event.ts b/web/hooks/event.ts similarity index 98% rename from common/hooks/event.ts rename to web/hooks/event.ts index 4a4bb3d3..6fba046a 100644 --- a/common/hooks/event.ts +++ b/web/hooks/event.ts @@ -1,6 +1,6 @@ import type { Manifest } from "$lib/plugos/types.ts"; import type { System } from "$lib/plugos/system.ts"; -import type { ScriptEnvironment } from "$common/space_script.ts"; +import type { ScriptEnvironment } from "../space_script.ts"; import type { EventHookI } from "$lib/plugos/eventhook.ts"; import type { EventHookT } from "$lib/manifest.ts"; diff --git a/common/hooks/plug_namespace.ts b/web/hooks/plug_namespace.ts similarity index 100% rename from common/hooks/plug_namespace.ts rename to web/hooks/plug_namespace.ts diff --git a/common/languages.ts b/web/languages.ts similarity index 99% rename from common/languages.ts rename to web/languages.ts index 7953bf47..7f574164 100644 --- a/common/languages.ts +++ b/web/languages.ts @@ -41,7 +41,7 @@ import { } from "@codemirror/lang-javascript"; import { cssLanguage } from "@codemirror/lang-css"; import { nixLanguage } from "@replit/codemirror-lang-nix"; -import { luaLanguage } from "$common/space_lua/parse.ts"; +import { luaLanguage } from "./space_lua/parse.ts"; const yamlStreamLanguage = StreamLanguage.define(yamlLanguage); diff --git a/common/markdown.ts b/web/markdown.ts similarity index 85% rename from common/markdown.ts rename to web/markdown.ts index d091bdbc..6c9f00ff 100644 --- a/common/markdown.ts +++ b/web/markdown.ts @@ -9,12 +9,12 @@ import { type Ref, validatePageName, } from "@silverbulletmd/silverbullet/lib/page_ref"; -import { parseMarkdown } from "$common/markdown_parser/parser.ts"; -import type { LuaExpression } from "$common/space_lua/ast.ts"; -import { evalExpression } from "$common/space_lua/eval.ts"; -import type { LuaEnv, LuaStackFrame } from "$common/space_lua/runtime.ts"; -import { parseExpressionString } from "$common/space_lua/parse.ts"; -import { renderExpressionResult } from "$common/markdown_util.ts"; +import { parseMarkdown } from "./markdown_parser/parser.ts"; +import type { LuaExpression } from "./space_lua/ast.ts"; +import { evalExpression } from "./space_lua/eval.ts"; +import type { LuaEnv, LuaStackFrame } from "./space_lua/runtime.ts"; +import { parseExpressionString } from "./space_lua/parse.ts"; +import { renderExpressionResult } from "./markdown_util.ts"; import type { Client } from "../web/client.ts"; /** diff --git a/common/markdown_parser/constants.ts b/web/markdown_parser/constants.ts similarity index 100% rename from common/markdown_parser/constants.ts rename to web/markdown_parser/constants.ts diff --git a/common/markdown_parser/customtags.ts b/web/markdown_parser/customtags.ts similarity index 100% rename from common/markdown_parser/customtags.ts rename to web/markdown_parser/customtags.ts diff --git a/common/markdown_parser/extended_task.ts b/web/markdown_parser/extended_task.ts similarity index 100% rename from common/markdown_parser/extended_task.ts rename to web/markdown_parser/extended_task.ts diff --git a/common/markdown_parser/parse_tree.ts b/web/markdown_parser/parse_tree.ts similarity index 100% rename from common/markdown_parser/parse_tree.ts rename to web/markdown_parser/parse_tree.ts diff --git a/common/markdown_parser/parser.test.ts b/web/markdown_parser/parser.test.ts similarity index 100% rename from common/markdown_parser/parser.test.ts rename to web/markdown_parser/parser.test.ts diff --git a/common/markdown_parser/parser.ts b/web/markdown_parser/parser.ts similarity index 98% rename from common/markdown_parser/parser.ts rename to web/markdown_parser/parser.ts index 5fd1c9a0..3a1e3ce9 100644 --- a/common/markdown_parser/parser.ts +++ b/web/markdown_parser/parser.ts @@ -309,10 +309,10 @@ const TaskDeadline = regexParser({ import { Table } from "./table_parser.ts"; import { foldNodeProp } from "@codemirror/language"; -import { pWikiLinkRegex, tagRegex } from "$common/markdown_parser/constants.ts"; -import { parse } from "$common/markdown_parser/parse_tree.ts"; +import { pWikiLinkRegex, tagRegex } from "../markdown_parser/constants.ts"; +import { parse } from "../markdown_parser/parse_tree.ts"; import type { ParseTree } from "@silverbulletmd/silverbullet/lib/tree"; -import { luaLanguage } from "$common/space_lua/parse.ts"; +import { luaLanguage } from "../space_lua/parse.ts"; // FrontMatter parser diff --git a/common/markdown_parser/table_parser.ts b/web/markdown_parser/table_parser.ts similarity index 100% rename from common/markdown_parser/table_parser.ts rename to web/markdown_parser/table_parser.ts diff --git a/common/markdown_util.ts b/web/markdown_util.ts similarity index 98% rename from common/markdown_util.ts rename to web/markdown_util.ts index 9f5bb11d..73e374c9 100644 --- a/common/markdown_util.ts +++ b/web/markdown_util.ts @@ -1,4 +1,4 @@ -import { LuaTable, luaToString } from "$common/space_lua/runtime.ts"; +import { LuaTable, luaToString } from "./space_lua/runtime.ts"; export function defaultTransformer(v: any): Promise { if (v === undefined) { diff --git a/web/service_worker.ts b/web/service_worker.ts index 26c998f5..fbe7b98e 100644 --- a/web/service_worker.ts +++ b/web/service_worker.ts @@ -1,4 +1,4 @@ -import type { FileContent } from "$common/spaces/datastore_space_primitives.ts"; +import type { FileContent } from "./spaces/datastore_space_primitives.ts"; import { simpleHash } from "$lib/crypto.ts"; import { DataStore } from "$lib/data/datastore.ts"; import { IndexedDBKvPrimitives } from "$lib/data/indexeddb_kv_primitives.ts"; diff --git a/common/shell_stream_client.ts b/web/shell_stream_client.ts similarity index 100% rename from common/shell_stream_client.ts rename to web/shell_stream_client.ts diff --git a/common/space.ts b/web/space.ts similarity index 96% rename from common/space.ts rename to web/space.ts index 3b6c1b25..615e4e83 100644 --- a/common/space.ts +++ b/web/space.ts @@ -1,10 +1,10 @@ -import { plugPrefix } from "$common/spaces/constants.ts"; +import { plugPrefix } from "./spaces/constants.ts"; import type { DocumentMeta, FileMeta, PageMeta } from "../plug-api/types.ts"; -import type { EventHook } from "./hooks/event.ts"; +import type { EventHook } from "../web/hooks/event.ts"; import { safeRun } from "../lib/async.ts"; import { localDateString } from "$lib/dates.ts"; -import type { EventedSpacePrimitives } from "$common/spaces/evented_space_primitives.ts"; +import type { EventedSpacePrimitives } from "./spaces/evented_space_primitives.ts"; const pageWatchInterval = 5000; diff --git a/common/space_lua.ts b/web/space_lua.ts similarity index 83% rename from common/space_lua.ts rename to web/space_lua.ts index b246f9c0..8b59bb5c 100644 --- a/common/space_lua.ts +++ b/web/space_lua.ts @@ -1,19 +1,12 @@ import type { System } from "../lib/plugos/system.ts"; import type { ScriptObject } from "../plugs/index/script.ts"; -import { - LuaEnv, - LuaRuntimeError, - LuaStackFrame, -} from "$common/space_lua/runtime.ts"; -import { - parse as parseLua, - parseExpressionString, -} from "$common/space_lua/parse.ts"; -import { evalStatement } from "$common/space_lua/eval.ts"; +import { LuaEnv, LuaRuntimeError, LuaStackFrame } from "./space_lua/runtime.ts"; +import { parse as parseLua, parseExpressionString } from "./space_lua/parse.ts"; +import { evalStatement } from "./space_lua/eval.ts"; import { parseRef, type Ref } from "@silverbulletmd/silverbullet/lib/page_ref"; -import type { ASTCtx } from "$common/space_lua/ast.ts"; -import { buildLuaEnv } from "$common/space_lua_api.ts"; -import type { LuaCollectionQuery } from "$common/space_lua/query_collection.ts"; +import type { ASTCtx } from "./space_lua/ast.ts"; +import { buildLuaEnv } from "./space_lua_api.ts"; +import type { LuaCollectionQuery } from "./space_lua/query_collection.ts"; export class SpaceLuaEnvironment { env: LuaEnv = new LuaEnv(); diff --git a/common/space_lua/ast.ts b/web/space_lua/ast.ts similarity index 100% rename from common/space_lua/ast.ts rename to web/space_lua/ast.ts diff --git a/common/space_lua/eval.test.ts b/web/space_lua/eval.test.ts similarity index 99% rename from common/space_lua/eval.test.ts rename to web/space_lua/eval.test.ts index 20fb9a89..087c6df2 100644 --- a/common/space_lua/eval.test.ts +++ b/web/space_lua/eval.test.ts @@ -10,7 +10,7 @@ import { import { parse } from "./parse.ts"; import type { LuaBlock, LuaFunctionCallStatement } from "./ast.ts"; import { evalExpression, evalStatement } from "./eval.ts"; -import { luaBuildStandardEnv } from "$common/space_lua/stdlib.ts"; +import { luaBuildStandardEnv } from "../space_lua/stdlib.ts"; const sf = LuaStackFrame.lostFrame; diff --git a/common/space_lua/eval.ts b/web/space_lua/eval.ts similarity index 98% rename from common/space_lua/eval.ts rename to web/space_lua/eval.ts index 333d4586..8f65e4cc 100644 --- a/common/space_lua/eval.ts +++ b/web/space_lua/eval.ts @@ -3,15 +3,15 @@ import type { LuaExpression, LuaLValue, LuaStatement, -} from "$common/space_lua/ast.ts"; -import { evalPromiseValues } from "$common/space_lua/util.ts"; +} from "../space_lua/ast.ts"; +import { evalPromiseValues } from "../space_lua/util.ts"; import { luaCall, luaEquals, luaIndexValue, luaSet, type LuaStackFrame, -} from "$common/space_lua/runtime.ts"; +} from "../space_lua/runtime.ts"; import { type ILuaFunction, type ILuaGettable, @@ -34,9 +34,9 @@ import { import { ArrayQueryCollection, type LuaCollectionQuery, -} from "$common/space_lua/query_collection.ts"; -import { luaValueToJS } from "$common/space_lua/runtime.ts"; -import { jsToLuaValue } from "$common/space_lua/runtime.ts"; +} from "../space_lua/query_collection.ts"; +import { luaValueToJS } from "../space_lua/runtime.ts"; +import { jsToLuaValue } from "../space_lua/runtime.ts"; function handleVarargSync(env: LuaEnv): LuaValue[] | Promise { const varargs = env.get("..."); diff --git a/common/space_lua/language_core_test.lua b/web/space_lua/language_core_test.lua similarity index 100% rename from common/space_lua/language_core_test.lua rename to web/space_lua/language_core_test.lua diff --git a/common/space_lua/lua.grammar b/web/space_lua/lua.grammar similarity index 100% rename from common/space_lua/lua.grammar rename to web/space_lua/lua.grammar diff --git a/common/space_lua/lua.test.ts b/web/space_lua/lua.test.ts similarity index 87% rename from common/space_lua/lua.test.ts rename to web/space_lua/lua.test.ts index 2c51a85d..57e82cef 100644 --- a/common/space_lua/lua.test.ts +++ b/web/space_lua/lua.test.ts @@ -1,11 +1,11 @@ -import { parse } from "$common/space_lua/parse.ts"; -import { luaBuildStandardEnv } from "$common/space_lua/stdlib.ts"; +import { parse } from "../space_lua/parse.ts"; +import { luaBuildStandardEnv } from "../space_lua/stdlib.ts"; import { LuaEnv, LuaRuntimeError, LuaStackFrame, -} from "$common/space_lua/runtime.ts"; -import { evalStatement } from "$common/space_lua/eval.ts"; +} from "../space_lua/runtime.ts"; +import { evalStatement } from "../space_lua/eval.ts"; import { assert } from "@std/assert/assert"; import { fileURLToPath } from "node:url"; diff --git a/common/space_lua/parse-lua.js b/web/space_lua/parse-lua.js similarity index 100% rename from common/space_lua/parse-lua.js rename to web/space_lua/parse-lua.js diff --git a/common/space_lua/parse-lua.terms.js b/web/space_lua/parse-lua.terms.js similarity index 100% rename from common/space_lua/parse-lua.terms.js rename to web/space_lua/parse-lua.terms.js diff --git a/common/space_lua/parse.test.ts b/web/space_lua/parse.test.ts similarity index 97% rename from common/space_lua/parse.test.ts rename to web/space_lua/parse.test.ts index 27f8fd26..feb820e5 100644 --- a/common/space_lua/parse.test.ts +++ b/web/space_lua/parse.test.ts @@ -2,8 +2,8 @@ import { parse, parseExpressionString, stripLuaComments, -} from "$common/space_lua/parse.ts"; -import type { LuaNumberLiteral } from "$common/space_lua/ast.ts"; +} from "../space_lua/parse.ts"; +import type { LuaNumberLiteral } from "../space_lua/ast.ts"; import { assertEquals } from "@std/assert/equals"; Deno.test("Test Lua parser", () => { diff --git a/common/space_lua/parse.ts b/web/space_lua/parse.ts similarity index 99% rename from common/space_lua/parse.ts rename to web/space_lua/parse.ts index 69082009..1860e08c 100644 --- a/common/space_lua/parse.ts +++ b/web/space_lua/parse.ts @@ -1,4 +1,4 @@ -import { lezerToParseTree } from "$common/markdown_parser/parse_tree.ts"; +import { lezerToParseTree } from "../markdown_parser/parse_tree.ts"; import { cleanTree, type ParseTree, diff --git a/common/space_lua/query_collection.test.ts b/web/space_lua/query_collection.test.ts similarity index 98% rename from common/space_lua/query_collection.test.ts rename to web/space_lua/query_collection.test.ts index 649970a1..28a7e69c 100644 --- a/common/space_lua/query_collection.test.ts +++ b/web/space_lua/query_collection.test.ts @@ -1,10 +1,10 @@ -import { parseExpressionString } from "$common/space_lua/parse.ts"; +import { parseExpressionString } from "../space_lua/parse.ts"; import { ArrayQueryCollection } from "./query_collection.ts"; import { LuaEnv, LuaNativeJSFunction, LuaStackFrame, -} from "$common/space_lua/runtime.ts"; +} from "../space_lua/runtime.ts"; import { assert, assertEquals } from "@std/assert"; Deno.test("ArrayQueryCollection", async () => { diff --git a/common/space_lua/query_collection.ts b/web/space_lua/query_collection.ts similarity index 96% rename from common/space_lua/query_collection.ts rename to web/space_lua/query_collection.ts index f3801efa..a4b091dc 100644 --- a/common/space_lua/query_collection.ts +++ b/web/space_lua/query_collection.ts @@ -1,12 +1,12 @@ -import type { LuaExpression } from "$common/space_lua/ast.ts"; +import type { LuaExpression } from "../space_lua/ast.ts"; import { LuaEnv, luaGet, luaKeys, LuaStackFrame, -} from "$common/space_lua/runtime.ts"; -import { evalExpression } from "$common/space_lua/eval.ts"; -import { asyncQuickSort } from "$common/space_lua/util.ts"; +} from "../space_lua/runtime.ts"; +import { evalExpression } from "../space_lua/eval.ts"; +import { asyncQuickSort } from "../space_lua/util.ts"; import type { DataStore } from "$lib/data/datastore.ts"; import type { KvKey } from "@silverbulletmd/silverbullet/types"; import type { KvPrimitives } from "$lib/data/kv_primitives.ts"; diff --git a/common/space_lua/query_test.lua b/web/space_lua/query_test.lua similarity index 100% rename from common/space_lua/query_test.lua rename to web/space_lua/query_test.lua diff --git a/common/space_lua/runtime.test.ts b/web/space_lua/runtime.test.ts similarity index 98% rename from common/space_lua/runtime.test.ts rename to web/space_lua/runtime.test.ts index 6ac42028..cf58c3f2 100644 --- a/common/space_lua/runtime.test.ts +++ b/web/space_lua/runtime.test.ts @@ -5,7 +5,7 @@ import { LuaMultiRes, LuaStackFrame, luaToString, -} from "$common/space_lua/runtime.ts"; +} from "../space_lua/runtime.ts"; Deno.test("Test Lua Rutime", async () => { // Test LuaMultires diff --git a/common/space_lua/runtime.ts b/web/space_lua/runtime.ts similarity index 100% rename from common/space_lua/runtime.ts rename to web/space_lua/runtime.ts diff --git a/common/space_lua/stdlib.ts b/web/space_lua/stdlib.ts similarity index 93% rename from common/space_lua/stdlib.ts rename to web/space_lua/stdlib.ts index de17bfb9..780a3330 100644 --- a/common/space_lua/stdlib.ts +++ b/web/space_lua/stdlib.ts @@ -11,15 +11,15 @@ import { luaToString, luaTypeOf, type LuaValue, -} from "$common/space_lua/runtime.ts"; -import { stringApi } from "$common/space_lua/stdlib/string.ts"; -import { tableApi } from "$common/space_lua/stdlib/table.ts"; -import { osApi } from "$common/space_lua/stdlib/os.ts"; -import { jsApi } from "$common/space_lua/stdlib/js.ts"; -import { spaceluaApi } from "$common/space_lua/stdlib/space_lua.ts"; -import { mathApi } from "$common/space_lua/stdlib/math.ts"; -import { parse } from "$common/space_lua/parse.ts"; -import { evalStatement } from "$common/space_lua/eval.ts"; +} from "../space_lua/runtime.ts"; +import { stringApi } from "../space_lua/stdlib/string.ts"; +import { tableApi } from "../space_lua/stdlib/table.ts"; +import { osApi } from "../space_lua/stdlib/os.ts"; +import { jsApi } from "../space_lua/stdlib/js.ts"; +import { spaceluaApi } from "../space_lua/stdlib/space_lua.ts"; +import { mathApi } from "../space_lua/stdlib/math.ts"; +import { parse } from "../space_lua/parse.ts"; +import { evalStatement } from "../space_lua/eval.ts"; const printFunction = new LuaBuiltinFunction(async (_sf, ...args) => { console.log( diff --git a/common/space_lua/stdlib/global_test.lua b/web/space_lua/stdlib/global_test.lua similarity index 100% rename from common/space_lua/stdlib/global_test.lua rename to web/space_lua/stdlib/global_test.lua diff --git a/common/space_lua/stdlib/js.ts b/web/space_lua/stdlib/js.ts similarity index 98% rename from common/space_lua/stdlib/js.ts rename to web/space_lua/stdlib/js.ts index 86014c49..32116051 100644 --- a/common/space_lua/stdlib/js.ts +++ b/web/space_lua/stdlib/js.ts @@ -3,7 +3,7 @@ import { LuaBuiltinFunction, LuaTable, luaValueToJS, -} from "$common/space_lua/runtime.ts"; +} from "../runtime.ts"; export const jsApi = new LuaTable({ /** diff --git a/common/space_lua/stdlib/js_test.lua b/web/space_lua/stdlib/js_test.lua similarity index 100% rename from common/space_lua/stdlib/js_test.lua rename to web/space_lua/stdlib/js_test.lua diff --git a/common/space_lua/stdlib/math.ts b/web/space_lua/stdlib/math.ts similarity index 97% rename from common/space_lua/stdlib/math.ts rename to web/space_lua/stdlib/math.ts index 5447ea63..a90097a8 100644 --- a/common/space_lua/stdlib/math.ts +++ b/web/space_lua/stdlib/math.ts @@ -1,8 +1,4 @@ -import { - LuaBuiltinFunction, - LuaRuntimeError, - LuaTable, -} from "$common/space_lua/runtime.ts"; +import { LuaBuiltinFunction, LuaRuntimeError, LuaTable } from "../runtime.ts"; export const mathApi = new LuaTable({ /** diff --git a/common/space_lua/stdlib/math_test.lua b/web/space_lua/stdlib/math_test.lua similarity index 100% rename from common/space_lua/stdlib/math_test.lua rename to web/space_lua/stdlib/math_test.lua diff --git a/common/space_lua/stdlib/os.ts b/web/space_lua/stdlib/os.ts similarity index 97% rename from common/space_lua/stdlib/os.ts rename to web/space_lua/stdlib/os.ts index 398df383..999bd6e4 100644 --- a/common/space_lua/stdlib/os.ts +++ b/web/space_lua/stdlib/os.ts @@ -1,4 +1,4 @@ -import { LuaBuiltinFunction, LuaTable } from "$common/space_lua/runtime.ts"; +import { LuaBuiltinFunction, LuaTable } from "../runtime.ts"; const ONE_DAY = 1000 * 60 * 60 * 24; const ONE_WEEK = ONE_DAY * 7; @@ -24,7 +24,7 @@ function weekNumber(inDate: Date, weekStartDay: number, iso: boolean): number { ); // Monday of that week const diff = target.getTime() - weekStart.getTime(); - return 1 + Math.floor(diff / (ONE_WEEK)); + return 1 + Math.floor(diff / ONE_WEEK); } else { // Non-ISO week: Week 1 starts on the first weekStartDay of the year const yearStart = new Date(Date.UTC(date.getUTCFullYear(), 0, 1)); @@ -38,7 +38,7 @@ function weekNumber(inDate: Date, weekStartDay: number, iso: boolean): number { } const diff = date.getTime() - firstWeekStart.getTime(); - return 1 + Math.floor(diff / (ONE_WEEK)); + return 1 + Math.floor(diff / ONE_WEEK); } } diff --git a/common/space_lua/stdlib/os_test.lua b/web/space_lua/stdlib/os_test.lua similarity index 100% rename from common/space_lua/stdlib/os_test.lua rename to web/space_lua/stdlib/os_test.lua diff --git a/common/space_lua/stdlib/printf.ts b/web/space_lua/stdlib/printf.ts similarity index 100% rename from common/space_lua/stdlib/printf.ts rename to web/space_lua/stdlib/printf.ts diff --git a/common/space_lua/stdlib/space_lua.ts b/web/space_lua/stdlib/space_lua.ts similarity index 94% rename from common/space_lua/stdlib/space_lua.ts rename to web/space_lua/stdlib/space_lua.ts index cd7ff55b..09baee65 100644 --- a/common/space_lua/stdlib/space_lua.ts +++ b/web/space_lua/stdlib/space_lua.ts @@ -1,6 +1,6 @@ -import { parseExpressionString } from "$common/space_lua/parse.ts"; -import type { LuaExpression } from "$common/space_lua/ast.ts"; -import { evalExpression } from "$common/space_lua/eval.ts"; +import { parseExpressionString } from "../parse.ts"; +import type { LuaExpression } from "../ast.ts"; +import { evalExpression } from "../eval.ts"; import { LuaBuiltinFunction, LuaEnv, @@ -10,7 +10,7 @@ import { luaToString, luaValueToJS, singleResult, -} from "$common/space_lua/runtime.ts"; +} from "../runtime.ts"; /** * These are Space Lua specific functions that are available to all scripts, but are not part of the standard Lua language. diff --git a/common/space_lua/stdlib/space_lua_test.lua b/web/space_lua/stdlib/space_lua_test.lua similarity index 100% rename from common/space_lua/stdlib/space_lua_test.lua rename to web/space_lua/stdlib/space_lua_test.lua diff --git a/common/space_lua/stdlib/string.ts b/web/space_lua/stdlib/string.ts similarity index 99% rename from common/space_lua/stdlib/string.ts rename to web/space_lua/stdlib/string.ts index e3ec83f9..d9109dd2 100644 --- a/common/space_lua/stdlib/string.ts +++ b/web/space_lua/stdlib/string.ts @@ -4,7 +4,7 @@ import { LuaMultiRes, LuaTable, luaToString, -} from "$common/space_lua/runtime.ts"; +} from "../runtime.ts"; import printf from "./printf.ts"; // Bits and pieces borrowed from https://github.com/paulcuth/starlight/blob/master/src/runtime/lib/string.js diff --git a/common/space_lua/stdlib/string_test.lua b/web/space_lua/stdlib/string_test.lua similarity index 100% rename from common/space_lua/stdlib/string_test.lua rename to web/space_lua/stdlib/string_test.lua diff --git a/common/space_lua/stdlib/string_test2.lua b/web/space_lua/stdlib/string_test2.lua similarity index 100% rename from common/space_lua/stdlib/string_test2.lua rename to web/space_lua/stdlib/string_test2.lua diff --git a/common/space_lua/stdlib/table.ts b/web/space_lua/stdlib/table.ts similarity index 98% rename from common/space_lua/stdlib/table.ts rename to web/space_lua/stdlib/table.ts index 663bde92..df5930ae 100644 --- a/common/space_lua/stdlib/table.ts +++ b/web/space_lua/stdlib/table.ts @@ -8,8 +8,8 @@ import { LuaRuntimeError, LuaTable, type LuaValue, -} from "$common/space_lua/runtime.ts"; -import { asyncQuickSort } from "$common/space_lua/util.ts"; +} from "../runtime.ts"; +import { asyncQuickSort } from "../util.ts"; export const tableApi = new LuaTable({ /** diff --git a/common/space_lua/stdlib/table_test.lua b/web/space_lua/stdlib/table_test.lua similarity index 100% rename from common/space_lua/stdlib/table_test.lua rename to web/space_lua/stdlib/table_test.lua diff --git a/common/space_lua/util.test.ts b/web/space_lua/util.test.ts similarity index 89% rename from common/space_lua/util.test.ts rename to web/space_lua/util.test.ts index 1281c6c4..d03d8651 100644 --- a/common/space_lua/util.test.ts +++ b/web/space_lua/util.test.ts @@ -1,4 +1,4 @@ -import { evalPromiseValues } from "$common/space_lua/util.ts"; +import { evalPromiseValues } from "../space_lua/util.ts"; import { assertEquals } from "@std/assert/equals"; import { assert } from "@std/assert"; diff --git a/common/space_lua/util.ts b/web/space_lua/util.ts similarity index 100% rename from common/space_lua/util.ts rename to web/space_lua/util.ts diff --git a/common/space_lua_api.ts b/web/space_lua_api.ts similarity index 95% rename from common/space_lua_api.ts rename to web/space_lua_api.ts index cb445f41..ba0a9f1a 100644 --- a/common/space_lua_api.ts +++ b/web/space_lua_api.ts @@ -1,4 +1,4 @@ -import { luaBuildStandardEnv } from "$common/space_lua/stdlib.ts"; +import { luaBuildStandardEnv } from "./space_lua/stdlib.ts"; import { parseRef } from "@silverbulletmd/silverbullet/lib/page_ref"; import { LuaEnv, @@ -6,7 +6,7 @@ import { type LuaRuntimeError, LuaStackFrame, LuaTable, -} from "$common/space_lua/runtime.ts"; +} from "./space_lua/runtime.ts"; import type { System } from "$lib/plugos/system.ts"; export function buildLuaEnv(system: System) { diff --git a/common/space_script.ts b/web/space_script.ts similarity index 97% rename from common/space_script.ts rename to web/space_script.ts index 93a83b70..b19abeac 100644 --- a/common/space_script.ts +++ b/web/space_script.ts @@ -2,7 +2,7 @@ import type { ParseTree } from "../plug-api/lib/tree.ts"; import type { AppCommand, CommandDef, SlashCommand } from "$lib/command.ts"; import type { SlashCommandDef } from "$lib/manifest.ts"; import type { JSONSchemaType } from "ajv"; -import { jsToLuaValue, type LuaTable } from "$common/space_lua/runtime.ts"; +import { jsToLuaValue, type LuaTable } from "./space_lua/runtime.ts"; type FunctionDef = { name: string; diff --git a/common/spaces/asset_bundle_space_primitives.ts b/web/spaces/asset_bundle_space_primitives.ts similarity index 100% rename from common/spaces/asset_bundle_space_primitives.ts rename to web/spaces/asset_bundle_space_primitives.ts diff --git a/common/spaces/constants.ts b/web/spaces/constants.ts similarity index 100% rename from common/spaces/constants.ts rename to web/spaces/constants.ts diff --git a/common/spaces/datastore_space_primitives.test.ts b/web/spaces/datastore_space_primitives.test.ts similarity index 100% rename from common/spaces/datastore_space_primitives.test.ts rename to web/spaces/datastore_space_primitives.test.ts diff --git a/common/spaces/datastore_space_primitives.ts b/web/spaces/datastore_space_primitives.ts similarity index 100% rename from common/spaces/datastore_space_primitives.ts rename to web/spaces/datastore_space_primitives.ts diff --git a/common/spaces/disk_space_primitives.ts b/web/spaces/disk_space_primitives.ts similarity index 100% rename from common/spaces/disk_space_primitives.ts rename to web/spaces/disk_space_primitives.ts diff --git a/common/spaces/evented_space_primitives.ts b/web/spaces/evented_space_primitives.ts similarity index 98% rename from common/spaces/evented_space_primitives.ts rename to web/spaces/evented_space_primitives.ts index ee54e031..7da2a4f0 100644 --- a/common/spaces/evented_space_primitives.ts +++ b/web/spaces/evented_space_primitives.ts @@ -1,6 +1,6 @@ import type { FileMeta } from "@silverbulletmd/silverbullet/types"; -import type { EventHook } from "$common/hooks/event.ts"; -import { plugPrefix } from "$common/spaces/constants.ts"; +import type { EventHook } from "../../web/hooks/event.ts"; +import { plugPrefix } from "../spaces/constants.ts"; import type { SpacePrimitives } from "./space_primitives.ts"; diff --git a/common/spaces/fallback_space_primitives.ts b/web/spaces/fallback_space_primitives.ts similarity index 100% rename from common/spaces/fallback_space_primitives.ts rename to web/spaces/fallback_space_primitives.ts diff --git a/common/spaces/filtered_space_primitives.ts b/web/spaces/filtered_space_primitives.ts similarity index 100% rename from common/spaces/filtered_space_primitives.ts rename to web/spaces/filtered_space_primitives.ts diff --git a/common/spaces/http_space_primitives.ts b/web/spaces/http_space_primitives.ts similarity index 100% rename from common/spaces/http_space_primitives.ts rename to web/spaces/http_space_primitives.ts diff --git a/common/spaces/kv_meta_space_primitives.ts b/web/spaces/kv_meta_space_primitives.ts similarity index 100% rename from common/spaces/kv_meta_space_primitives.ts rename to web/spaces/kv_meta_space_primitives.ts diff --git a/common/spaces/plug_space_primitives.ts b/web/spaces/plug_space_primitives.ts similarity index 95% rename from common/spaces/plug_space_primitives.ts rename to web/spaces/plug_space_primitives.ts index 5bc34d1d..1487de7c 100644 --- a/common/spaces/plug_space_primitives.ts +++ b/web/spaces/plug_space_primitives.ts @@ -1,7 +1,7 @@ -import type { SpacePrimitives } from "$common/spaces/space_primitives.ts"; +import type { SpacePrimitives } from "../spaces/space_primitives.ts"; import type { NamespaceOperation } from "$lib/plugos/namespace.ts"; import type { FileMeta } from "../../plug-api/types.ts"; -import type { PlugNamespaceHook } from "../hooks/plug_namespace.ts"; +import type { PlugNamespaceHook } from "../../web/hooks/plug_namespace.ts"; export class PlugSpacePrimitives implements SpacePrimitives { constructor( diff --git a/common/spaces/ro_space_primitives.ts b/web/spaces/ro_space_primitives.ts similarity index 100% rename from common/spaces/ro_space_primitives.ts rename to web/spaces/ro_space_primitives.ts diff --git a/common/spaces/space_primitives.test.ts b/web/spaces/space_primitives.test.ts similarity index 100% rename from common/spaces/space_primitives.test.ts rename to web/spaces/space_primitives.test.ts diff --git a/common/spaces/space_primitives.ts b/web/spaces/space_primitives.ts similarity index 100% rename from common/spaces/space_primitives.ts rename to web/spaces/space_primitives.ts diff --git a/common/spaces/sync.test.ts b/web/spaces/sync.test.ts similarity index 100% rename from common/spaces/sync.test.ts rename to web/spaces/sync.test.ts diff --git a/common/spaces/sync.ts b/web/spaces/sync.ts similarity index 100% rename from common/spaces/sync.ts rename to web/spaces/sync.ts diff --git a/web/style.ts b/web/style.ts index 4da82e7a..07e7f50c 100644 --- a/web/style.ts +++ b/web/style.ts @@ -1,6 +1,6 @@ import { HighlightStyle } from "@codemirror/language"; import { tagHighlighter, tags as t } from "@lezer/highlight"; -import * as ct from "$common/markdown_parser/customtags.ts"; +import * as ct from "./markdown_parser/customtags.ts"; export default function highlightStyles() { tagHighlighter; diff --git a/common/sw_util.ts b/web/sw_util.ts similarity index 100% rename from common/sw_util.ts rename to web/sw_util.ts diff --git a/web/sync_service.ts b/web/sync_service.ts index 0014753f..16330d35 100644 --- a/web/sync_service.ts +++ b/web/sync_service.ts @@ -1,12 +1,12 @@ -import { plugPrefix, stdLibPrefix } from "$common/spaces/constants.ts"; -import type { SpacePrimitives } from "$common/spaces/space_primitives.ts"; +import { plugPrefix, stdLibPrefix } from "./spaces/constants.ts"; +import type { SpacePrimitives } from "./spaces/space_primitives.ts"; import { SpaceSync, type SyncStatus, type SyncStatusItem, -} from "$common/spaces/sync.ts"; +} from "./spaces/sync.ts"; import { sleep } from "$lib/async.ts"; -import type { EventHook } from "../common/hooks/event.ts"; +import type { EventHook } from "./hooks/event.ts"; import type { DataStore } from "$lib/data/datastore.ts"; // Keeps the current sync snapshot diff --git a/common/syscalls/command.ts b/web/syscalls/command.ts similarity index 91% rename from common/syscalls/command.ts rename to web/syscalls/command.ts index 408bc556..837f54de 100644 --- a/common/syscalls/command.ts +++ b/web/syscalls/command.ts @@ -1,14 +1,14 @@ import type { SysCallMapping } from "$lib/plugos/system.ts"; import type { CommandDef } from "$lib/command.ts"; -import { buildThreadLocalEnv, handleLuaError } from "$common/space_lua_api.ts"; +import { buildThreadLocalEnv, handleLuaError } from "../space_lua_api.ts"; import { type ILuaFunction, jsToLuaValue, luaCall, LuaStackFrame, luaValueToJS, -} from "$common/space_lua/runtime.ts"; -import type { ClientSystem } from "../../web/client_system.ts"; +} from "../space_lua/runtime.ts"; +import type { ClientSystem } from "../client_system.ts"; export type CallbackCommandDef = CommandDef & { run: ILuaFunction; diff --git a/common/syscalls/config.ts b/web/syscalls/config.ts similarity index 94% rename from common/syscalls/config.ts rename to web/syscalls/config.ts index 144663da..5c1a7d96 100644 --- a/common/syscalls/config.ts +++ b/web/syscalls/config.ts @@ -1,5 +1,5 @@ import type { SysCallMapping } from "$lib/plugos/system.ts"; -import type { Client } from "../../web/client.ts"; +import type { Client } from "../client.ts"; export function configSyscalls(client: Client): SysCallMapping { return { diff --git a/lib/plugos/syscalls/datastore.ts b/web/syscalls/datastore.ts similarity index 86% rename from lib/plugos/syscalls/datastore.ts rename to web/syscalls/datastore.ts index c1aef0fc..d8e210bf 100644 --- a/lib/plugos/syscalls/datastore.ts +++ b/web/syscalls/datastore.ts @@ -1,18 +1,18 @@ import { type LuaCollectionQuery, queryLua, -} from "$common/space_lua/query_collection.ts"; -import type { KV, KvKey } from "../../../plug-api/types.ts"; -import type { DataStore } from "../../data/datastore.ts"; -import type { SysCallMapping } from "../system.ts"; +} from "../space_lua/query_collection.ts"; +import type { KV, KvKey } from "../../plug-api/types.ts"; +import type { DataStore } from "../../lib/data/datastore.ts"; +import type { SysCallMapping } from "../../lib/plugos/system.ts"; import { jsToLuaValue, LuaEnv, LuaStackFrame, luaValueToJS, -} from "$common/space_lua/runtime.ts"; +} from "../space_lua/runtime.ts"; import type { KvQueryOptions } from "$lib/data/kv_primitives.ts"; -import type { ClientSystem } from "../../../web/client_system.ts"; +import type { ClientSystem } from "../client_system.ts"; /** * Exposes the datastore API to plugs, but scoping everything to a prefix based on the plug's name diff --git a/common/syscalls/event.ts b/web/syscalls/event.ts similarity index 82% rename from common/syscalls/event.ts rename to web/syscalls/event.ts index c07ebc20..5bd1ce6d 100644 --- a/common/syscalls/event.ts +++ b/web/syscalls/event.ts @@ -1,14 +1,14 @@ import type { SysCallMapping } from "$lib/plugos/system.ts"; -import type { EventListenerDef } from "$common/space_script.ts"; -import { buildThreadLocalEnv, handleLuaError } from "$common/space_lua_api.ts"; +import type { EventListenerDef } from "../space_script.ts"; +import { buildThreadLocalEnv, handleLuaError } from "../space_lua_api.ts"; import { type ILuaFunction, jsToLuaValue, luaCall, LuaStackFrame, luaValueToJS, -} from "$common/space_lua/runtime.ts"; -import type { ClientSystem } from "../../web/client_system.ts"; +} from "../space_lua/runtime.ts"; +import type { ClientSystem } from "../client_system.ts"; export type CallbackEventListener = EventListenerDef & { run: ILuaFunction; diff --git a/common/syscalls/index.ts b/web/syscalls/index.ts similarity index 85% rename from common/syscalls/index.ts rename to web/syscalls/index.ts index f7dfd9fd..5e1c1320 100644 --- a/common/syscalls/index.ts +++ b/web/syscalls/index.ts @@ -2,15 +2,15 @@ import type { SysCallMapping } from "$lib/plugos/system.ts"; import type { LuaCollectionQuery, LuaQueryCollection, -} from "$common/space_lua/query_collection.ts"; +} from "../space_lua/query_collection.ts"; import { jsToLuaValue, type LuaEnv, type LuaStackFrame, -} from "$common/space_lua/runtime.ts"; +} from "../space_lua/runtime.ts"; -import type { Client } from "../../web/client.ts"; -import type { TagDef } from "$common/space_script.ts"; +import type { Client } from "../client.ts"; +import type { TagDef } from "../space_script.ts"; export function indexSyscalls(client: Client): SysCallMapping { return { diff --git a/common/syscalls/jsonschema.ts b/web/syscalls/jsonschema.ts similarity index 100% rename from common/syscalls/jsonschema.ts rename to web/syscalls/jsonschema.ts diff --git a/common/syscalls/language.ts b/web/syscalls/language.ts similarity index 100% rename from common/syscalls/language.ts rename to web/syscalls/language.ts diff --git a/common/syscalls/lua.ts b/web/syscalls/lua.ts similarity index 85% rename from common/syscalls/lua.ts rename to web/syscalls/lua.ts index b390281f..6ac52ee1 100644 --- a/common/syscalls/lua.ts +++ b/web/syscalls/lua.ts @@ -1,15 +1,15 @@ import type { SysCallMapping } from "$lib/plugos/system.ts"; -import { evalExpression } from "$common/space_lua/eval.ts"; +import { evalExpression } from "../space_lua/eval.ts"; import { parse, parseExpressionString } from "../space_lua/parse.ts"; import { LuaStackFrame, luaToString, luaValueToJS, -} from "$common/space_lua/runtime.ts"; -import { buildThreadLocalEnv } from "$common/space_lua_api.ts"; +} from "../space_lua/runtime.ts"; +import { buildThreadLocalEnv } from "../space_lua_api.ts"; import { isSendable } from "$lib/plugos/util.ts"; -import type { LuaBlock, LuaExpression } from "$common/space_lua/ast.ts"; -import type { ClientSystem } from "../../web/client_system.ts"; +import type { LuaBlock, LuaExpression } from "../space_lua/ast.ts"; +import type { ClientSystem } from "../client_system.ts"; export function luaSyscalls(clientSystem: ClientSystem): SysCallMapping { return { diff --git a/common/syscalls/markdown.ts b/web/syscalls/markdown.ts similarity index 83% rename from common/syscalls/markdown.ts rename to web/syscalls/markdown.ts index fd25dd08..ecfd3817 100644 --- a/common/syscalls/markdown.ts +++ b/web/syscalls/markdown.ts @@ -2,9 +2,9 @@ import type { SysCallMapping } from "../../lib/plugos/system.ts"; import { parse } from "../markdown_parser/parse_tree.ts"; import { type ParseTree, renderToText } from "../../plug-api/lib/tree.ts"; import { extendedMarkdownLanguage } from "../markdown_parser/parser.ts"; -import { expandMarkdown } from "$common/markdown.ts"; -import type { Client } from "../../web/client.ts"; -import { LuaStackFrame } from "$common/space_lua/runtime.ts"; +import { expandMarkdown } from "../markdown.ts"; +import type { Client } from "../client.ts"; +import { LuaStackFrame } from "../space_lua/runtime.ts"; export function markdownSyscalls(client: Client): SysCallMapping { return { diff --git a/web/syscalls/shell.ts b/web/syscalls/shell.ts index 6b0af1d3..edefb333 100644 --- a/web/syscalls/shell.ts +++ b/web/syscalls/shell.ts @@ -1,6 +1,6 @@ import type { SysCallMapping } from "../../lib/plugos/system.ts"; import type { Client } from "../client.ts"; -import { ShellStreamClient } from "../../common/shell_stream_client.ts"; +import { ShellStreamClient } from "../shell_stream_client.ts"; /** * Interface for the shell stream client diff --git a/common/syscalls/system.ts b/web/syscalls/system.ts similarity index 99% rename from common/syscalls/system.ts rename to web/syscalls/system.ts index 2aeffb2b..09abe15b 100644 --- a/common/syscalls/system.ts +++ b/web/syscalls/system.ts @@ -1,6 +1,6 @@ import type { SyscallMeta } from "../../plug-api/types.ts"; import type { SysCallMapping } from "../../lib/plugos/system.ts"; -import type { Client } from "../../web/client.ts"; +import type { Client } from "../client.ts"; import type { CommandDef } from "$lib/command.ts"; import { version } from "../../version.ts"; import { deleteDB } from "idb"; diff --git a/common/syscalls/yaml.ts b/web/syscalls/yaml.ts similarity index 100% rename from common/syscalls/yaml.ts rename to web/syscalls/yaml.ts