More JSR dependency moves
parent
64e116f75e
commit
9f353f7de1
|
@ -2,10 +2,10 @@ import { path } from "./lib/deps_server.ts";
|
|||
import * as esbuild from "esbuild";
|
||||
import { compileManifests } from "./cmd/compile.ts";
|
||||
import { builtinPlugNames } from "./plugs/builtin_plugs.ts";
|
||||
import { parse } from "$std/flags/mod.ts";
|
||||
import { parseArgs } from "@std/cli/parse-args";
|
||||
|
||||
if (import.meta.main) {
|
||||
const args = parse(Deno.args, {
|
||||
const args = parseArgs(Deno.args, {
|
||||
boolean: ["debug", "watch", "reload", "info"],
|
||||
alias: { w: "watch" },
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { copy } from "$std/fs/copy.ts";
|
||||
import { copy } from "@std/fs";
|
||||
|
||||
import sass from "denosass";
|
||||
import { bundleFolder } from "./lib/asset_bundle/builder.ts";
|
||||
|
||||
import { parse } from "$std/flags/mod.ts";
|
||||
import { parseArgs } from "@std/cli/parse-args";
|
||||
import { patchDenoLibJS } from "./cmd/compile.ts";
|
||||
import { denoPlugins } from "@luca/esbuild-deno-loader";
|
||||
import * as esbuild from "esbuild";
|
||||
|
@ -126,7 +126,7 @@ async function buildCopyBundleAssets() {
|
|||
}
|
||||
|
||||
if (import.meta.main) {
|
||||
const args = parse(Deno.args, {
|
||||
const args = parseArgs(Deno.args, {
|
||||
boolean: ["watch"],
|
||||
alias: { w: "watch" },
|
||||
default: {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { path, YAML } from "../lib/deps_server.ts";
|
|||
import { denoPlugins } from "@luca/esbuild-deno-loader";
|
||||
import * as esbuild from "esbuild";
|
||||
import { bundleAssets } from "../lib/asset_bundle/builder.ts";
|
||||
import { Manifest } from "../lib/plugos/types.ts";
|
||||
import type { Manifest } from "../lib/plugos/types.ts";
|
||||
import { version } from "../version.ts";
|
||||
|
||||
// const workerRuntimeUrl = new URL("./worker_runtime.ts", import.meta.url);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { resolve } from "$std/path/mod.ts";
|
||||
import { resolve } from "@std/path";
|
||||
import assets from "../dist/plug_asset_bundle.json" with { type: "json" };
|
||||
import { determineDatabaseBackend } from "../server/db_backend.ts";
|
||||
import { KvPrimitives } from "$lib/data/kv_primitives.ts";
|
||||
|
|
|
@ -2,8 +2,8 @@ import { AssetBundle } from "$lib/asset_bundle/bundle.ts";
|
|||
import { compileManifest } from "../compile.ts";
|
||||
import * as esbuild from "esbuild";
|
||||
import assets from "../../dist/plug_asset_bundle.json" with { type: "json" };
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { dirname, join } from "$std/path/mod.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { dirname, join } from "@std/path";
|
||||
import { MemoryKvPrimitives } from "$lib/data/memory_kv_primitives.ts";
|
||||
import { runPlug } from "../plug_run.ts";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { createSandbox } from "../../lib/plugos/sandboxes/deno_worker_sandbox.ts";
|
||||
import { System } from "../../lib/plugos/system.ts";
|
||||
import { assert, assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assert, assertEquals } from "@std/assert";
|
||||
import { compileManifest } from "../compile.ts";
|
||||
import * as esbuild from "esbuild";
|
||||
import {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import * as YAML from "js-yaml";
|
||||
|
||||
export async function hello() {
|
||||
// @ts-ignore: syscall is a global function
|
||||
const numbers = await syscall("addNumbers", 1, 2);
|
||||
return {
|
||||
yamlMessage: YAML.dump({ hello: "world" }),
|
||||
|
|
|
@ -37,7 +37,7 @@ export async function upgradeCommand() {
|
|||
}
|
||||
|
||||
// WIP: This is not yet working, but it's a start
|
||||
import { dirname } from "$std/path/mod.ts";
|
||||
import { dirname } from "@std/path";
|
||||
|
||||
const silverBulletReleases =
|
||||
"https://github.com/silverbulletmd/silverbullet/releases";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { parseCommand } from "./command.ts";
|
||||
|
||||
Deno.test("Command parser", () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { parseExpression } from "$common/expression_parser.ts";
|
||||
|
||||
Deno.test("Test expression parser", () => {
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
findNodeOfType,
|
||||
renderToText,
|
||||
} from "$sb/lib/tree.ts";
|
||||
import { assertEquals, assertNotEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals, assertNotEquals } from "@std/assert";
|
||||
import { extendedMarkdownLanguage } from "./parser.ts";
|
||||
|
||||
const sample1 = `---
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
import { beforeEach, describe, it } from "$std/testing/bdd.ts";
|
||||
import { beforeEach, describe, it } from "@std/testing/bdd";
|
||||
import { buildQueryFunctions } from "$common/query_functions.ts";
|
||||
import type { System } from "$lib/plugos/system.ts";
|
||||
import {
|
||||
assertEquals,
|
||||
assertRejects,
|
||||
assertThrows,
|
||||
} from "$std/testing/asserts.ts";
|
||||
import { assertEquals, assertRejects, assertThrows } from "@std/assert";
|
||||
|
||||
let functions: ReturnType<typeof buildQueryFunctions>;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { parseYamlSettings } from "./settings.ts";
|
||||
|
||||
Deno.test("Settings regex", () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { MemoryKvPrimitives } from "$lib/data/memory_kv_primitives.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { ChunkedKvStoreSpacePrimitives } from "./chunked_datastore_space_primitives.ts";
|
||||
import { testSpacePrimitives } from "./space_primitives.test.ts";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as path from "$std/path/mod.ts";
|
||||
import { readAll } from "$std/streams/read_all.ts";
|
||||
import * as path from "@std/path";
|
||||
import { readAll } from "@std/io/read-all";
|
||||
import { SpacePrimitives } from "./space_primitives.ts";
|
||||
import { mime } from "mimetypes";
|
||||
import { FileMeta } from "../../plug-api/types.ts";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assert, assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assert, assertEquals } from "@std/assert";
|
||||
import { SpacePrimitives } from "./space_primitives.ts";
|
||||
|
||||
export async function testSpacePrimitives(spacePrimitives: SpacePrimitives) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { SpaceSync, SyncStatusItem } from "./sync.ts";
|
||||
import { DiskSpacePrimitives } from "./disk_space_primitives.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
|
||||
Deno.test("Test store", async () => {
|
||||
const primaryPath = await Deno.makeTempDir();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { builtinFunctions } from "../../lib/builtin_query_functions.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { renderTemplate } from "./render.ts";
|
||||
import { parseTemplate } from "./template_parser.ts";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { parseTemplate } from "./template_parser.ts";
|
||||
|
||||
Deno.test("Test template", () => {
|
||||
|
|
19
deno.json
19
deno.json
|
@ -1,4 +1,15 @@
|
|||
{
|
||||
"name": "@silverbulletmd/silverbullet",
|
||||
"version": "0.0.1",
|
||||
"exports": {
|
||||
"./syscalls": "./plug-api/syscalls.ts"
|
||||
},
|
||||
"publish": {
|
||||
"exclude": [
|
||||
"website",
|
||||
"CHANGELOG.md"
|
||||
]
|
||||
},
|
||||
"tasks": {
|
||||
"clean": "rm -rf dist dist_client_bundle dist_plug_bundle website_build",
|
||||
"deep-clean-mac": "rm -f deno.lock && rm -rf $HOME/Library/Caches/deno && deno task clean",
|
||||
|
@ -59,7 +70,6 @@
|
|||
"$common/": "./common/",
|
||||
"$lib/": "./lib/",
|
||||
"$sb/": "./plug-api/",
|
||||
"$std/": "https://deno.land/std@0.189.0/",
|
||||
"$type/": "./type/",
|
||||
"@codemirror/autocomplete": "https://esm.sh/@codemirror/autocomplete@6.17.0?external=@codemirror/state,@codemirror/commands,@lezer/common,@codemirror/view,@codemirror/language&target=es2022",
|
||||
"@codemirror/commands": "https://esm.sh/@codemirror/commands@6.6.0?external=@codemirror/state,@codemirror/view,@codemirror/language,@lezer/common&target=es2022",
|
||||
|
@ -83,6 +93,13 @@
|
|||
"@lezer/markdown": "https://esm.sh/@lezer/markdown@1.3.0?external=@lezer/common,@codemirror/language,@lezer/highlight,@lezer/lr&target=es2022",
|
||||
"@luca/esbuild-deno-loader": "jsr:@luca/esbuild-deno-loader@^0.10.3",
|
||||
"@replit/codemirror-vim": "https://esm.sh/@replit/codemirror-vim@6.2.1?external=@codemirror/state,@codemirror/language,@codemirror/view,@codemirror/search,@codemirror/commands",
|
||||
"@std/assert": "jsr:@std/assert@^1.0.1",
|
||||
"@std/cli": "jsr:@std/cli@^1.0.1",
|
||||
"@std/fs": "jsr:@std/fs@^1.0.0",
|
||||
"@std/io": "jsr:@std/io@^0.224.3",
|
||||
"@std/io/read-all": "jsr:@std/io@^0.224.3/read-all",
|
||||
"@std/path": "jsr:@std/path@^1.0.2",
|
||||
"@std/testing": "jsr:@std/testing@^0.225.3",
|
||||
"cliffy/": "https://deno.land/x/cliffy@v1.0.0-rc.4/",
|
||||
"crelt": "https://esm.sh/crelt@1.0.6",
|
||||
"denosass": "https://deno.land/x/denosass@1.0.6/mod.ts",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { AssetBundle } from "./bundle.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
|
||||
Deno.test("Asset bundle", () => {
|
||||
const assetBundle = new AssetBundle();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assert, assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assert, assertEquals } from "@std/assert";
|
||||
import { batchRequests, PromiseQueue, sleep } from "./async.ts";
|
||||
|
||||
Deno.test("PromiseQueue test", async () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, it } from "$std/testing/bdd.ts";
|
||||
import { describe, it } from "@std/testing/bdd";
|
||||
import { builtinFunctions } from "./builtin_query_functions.ts";
|
||||
import { assertEquals, assertThrows } from "$std/testing/asserts.ts";
|
||||
import { assertEquals, assertThrows } from "@std/assert";
|
||||
|
||||
describe("replace()", () => {
|
||||
const { replace } = builtinFunctions;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { determineTags, isTemplate } from "./cheap_yaml.ts";
|
||||
|
||||
Deno.test("cheap yaml", () => {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { IndexedDBKvPrimitives } from "../data/indexeddb_kv_primitives.ts";
|
|||
import { cleanupEmptyObjects, DataStore } from "../data/datastore.ts";
|
||||
import { DenoKvPrimitives } from "../data/deno_kv_primitives.ts";
|
||||
import { KvPrimitives } from "../data/kv_primitives.ts";
|
||||
import { assertEquals, assertThrows } from "$std/testing/asserts.ts";
|
||||
import { assertEquals, assertThrows } from "@std/assert";
|
||||
import { PrefixedKvPrimitives } from "../data/prefixed_kv_primitives.ts";
|
||||
import { Query } from "../../plug-api/types.ts";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { KvPrimitives } from "./kv_primitives.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { KV } from "../../plug-api/types.ts";
|
||||
|
||||
export async function allTests(db: KvPrimitives) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { DataStoreMQ } from "./mq.datastore.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
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 { FakeTime } from "@std/testing/time";
|
||||
import type { MQMessage } from "../../plug-api/types.ts";
|
||||
|
||||
Deno.test("DataStore MQ", async () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { sleep } from "$lib/async.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { LimitedMap } from "./limited_map.ts";
|
||||
|
||||
Deno.test("limited map", async () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ttlCache } from "$lib/memory_cache.ts";
|
||||
import { sleep } from "$lib/async.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
|
||||
Deno.test("Memory cache", async () => {
|
||||
let calls = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { FileMeta } from "../../../plug-api/types.ts";
|
||||
import { assert } from "$std/testing/asserts.ts";
|
||||
import { assert } from "@std/assert";
|
||||
import { path } from "../../deps_server.ts";
|
||||
import fileSystemSyscalls from "./fs.deno.ts";
|
||||
|
||||
|
|
|
@ -1,7 +1,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 "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { renderToText } from "./tree.ts";
|
||||
import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import "$sb/lib/syscall_mock.ts";
|
||||
import { parse } from "$common/markdown_parser/parse_tree.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { extractFeedItems } from "$sb/lib/feed.ts";
|
||||
import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { cleanupJSON, deepEqual, deepObjectMerge } from "./json.ts";
|
||||
|
||||
Deno.test("utils", () => {
|
||||
|
@ -18,6 +18,9 @@ Deno.test("utils", () => {
|
|||
assertEquals(cleanupJSON({ a: [{ "a.b": 1 }] }), {
|
||||
a: [{ a: { b: 1 } }],
|
||||
});
|
||||
assertEquals(cleanupJSON(new Date("2023-05-13T12:30:00Z")), "2023-05-13T12:30:00.000Z");
|
||||
assertEquals(
|
||||
cleanupJSON(new Date("2023-05-13T12:30:00Z")),
|
||||
"2023-05-13T12:30:00.000Z",
|
||||
);
|
||||
assertEquals(cleanupJSON(new Date("2023-05-03T00:00:00Z")), "2023-05-03");
|
||||
});
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
import { encodePageRef, parsePageRef, validatePageName } from "./page_ref.ts";
|
||||
import {
|
||||
assertEquals,
|
||||
AssertionError,
|
||||
assertThrows,
|
||||
} from "$std/testing/asserts.ts";
|
||||
import { assertEquals, AssertionError, assertThrows } from "@std/assert";
|
||||
|
||||
Deno.test("Page utility functions", () => {
|
||||
// Base cases
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { parse } from "$common/markdown_parser/parse_tree.ts";
|
||||
import { AST, collectNodesOfType, parseTreeToAST } from "./tree.ts";
|
||||
import { assert, assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assert, assertEquals } from "@std/assert";
|
||||
import { astToKvQuery } from "$sb/lib/parse-query.ts";
|
||||
import { languageFor } from "$common/languages.ts";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { evalQueryExpression } from "$sb/lib/query_expression.ts";
|
||||
import { assert, assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assert, assertEquals } from "@std/assert";
|
||||
|
||||
Deno.test("Test query expression evaluation", async () => {
|
||||
assertEquals(
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
resolvePath,
|
||||
rewritePageRefs,
|
||||
} from "$sb/lib/resolve.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { ParseTree, renderToText } from "./tree.ts";
|
||||
import { parse } from "$common/markdown_parser/parse_tree.ts";
|
||||
import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { YAML } from "../../lib/deps_server.ts";
|
||||
|
||||
// @ts-ignore: syscall is a global function
|
||||
globalThis.syscall = (name: string, ...args: readonly any[]) => {
|
||||
switch (name) {
|
||||
case "yaml.parse":
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
renderToText,
|
||||
replaceNodesMatching,
|
||||
} from "./tree.ts";
|
||||
import { assertEquals, assertNotEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals, assertNotEquals } from "@std/assert";
|
||||
import { parse } from "$common/markdown_parser/parse_tree.ts";
|
||||
import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
|
||||
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
declare global {
|
||||
function syscall(name: string, ...args: any[]): Promise<any>;
|
||||
}
|
||||
// declare global {
|
||||
// function syscall(name: string, ...args: any[]): Promise<any>;
|
||||
// }
|
||||
|
||||
// This is the case when running tests only, so giving it a dummy syscall function
|
||||
if (typeof self === "undefined") {
|
||||
// @ts-ignore: test
|
||||
// deno-lint-ignore no-global-assign
|
||||
self = {
|
||||
(self as any) = {
|
||||
syscall: () => {
|
||||
throw new Error("Not implemented here");
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export const syscall = globalThis.syscall;
|
||||
export const syscall = (globalThis as any).syscall;
|
||||
|
|
|
@ -10,6 +10,6 @@ export function render(
|
|||
}
|
||||
|
||||
// Refresh all code widgets on the page that support it
|
||||
export function refreshAll() {
|
||||
export function refreshAll(): Promise<void> {
|
||||
return syscall("codeWidget.refreshAll");
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { syscall } from "../syscall.ts";
|
||||
|
||||
export function resetClient() {
|
||||
export function resetClient(): Promise<void> {
|
||||
return syscall("debug.resetClient");
|
||||
}
|
||||
|
||||
/**
|
||||
* Wipes the entire state KV store and the entire space KV store.
|
||||
*/
|
||||
export function cleanup() {
|
||||
export function cleanup(): Promise<void> {
|
||||
return syscall("debug.cleanup");
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ export function getText(): Promise<string> {
|
|||
* This updates the editor text, but in a minimal-diff way:
|
||||
* it compares the current editor text with the new text, and only sends the changes to the editor, thereby preserving cursor location
|
||||
*/
|
||||
export function setText(newText: string) {
|
||||
export function setText(newText: string): Promise<void> {
|
||||
return syscall("editor.setText", newText);
|
||||
}
|
||||
|
||||
|
@ -183,36 +183,36 @@ export function vimEx(exCommand: string): Promise<any> {
|
|||
}
|
||||
|
||||
// Folding
|
||||
export function fold() {
|
||||
export function fold(): Promise<void> {
|
||||
return syscall("editor.fold");
|
||||
}
|
||||
|
||||
export function unfold() {
|
||||
export function unfold(): Promise<void> {
|
||||
return syscall("editor.unfold");
|
||||
}
|
||||
|
||||
export function toggleFold() {
|
||||
export function toggleFold(): Promise<void> {
|
||||
return syscall("editor.toggleFold");
|
||||
}
|
||||
|
||||
export function foldAll() {
|
||||
export function foldAll(): Promise<void> {
|
||||
return syscall("editor.foldAll");
|
||||
}
|
||||
|
||||
export function unfoldAll() {
|
||||
export function unfoldAll(): Promise<void> {
|
||||
return syscall("editor.unfoldAll");
|
||||
}
|
||||
|
||||
// Undo/redo
|
||||
export function undo() {
|
||||
export function undo(): Promise<void> {
|
||||
return syscall("editor.undo");
|
||||
}
|
||||
|
||||
export function redo() {
|
||||
export function redo(): Promise<void> {
|
||||
return syscall("editor.redo");
|
||||
}
|
||||
|
||||
export function openSearchPanel() {
|
||||
export function openSearchPanel(): Promise<void> {
|
||||
return syscall("editor.openSearchPanel");
|
||||
}
|
||||
|
||||
|
@ -220,6 +220,6 @@ export function copyToClipboard(data: string | Blob): Promise<void> {
|
|||
return syscall("editor.copyToClipboard", data);
|
||||
}
|
||||
|
||||
export function deleteLine() {
|
||||
export function deleteLine(): Promise<void> {
|
||||
return syscall("editor.deleteLine");
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ export function dispatchEvent(
|
|||
}, timeout);
|
||||
}
|
||||
syscall("event.dispatch", eventName, data)
|
||||
.then((r) => {
|
||||
.then((r: any) => {
|
||||
if (timeouter !== -1) {
|
||||
clearTimeout(timeouter);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import { syscall } from "../syscall.ts";
|
||||
import type { MQStats } from "../types.ts";
|
||||
|
||||
export function send(queue: string, body: any) {
|
||||
export function send(queue: string, body: any): Promise<void> {
|
||||
return syscall("mq.send", queue, body);
|
||||
}
|
||||
|
||||
export function batchSend(queue: string, bodies: any[]) {
|
||||
export function batchSend(queue: string, bodies: any[]): Promise<void> {
|
||||
return syscall("mq.batchSend", queue, bodies);
|
||||
}
|
||||
|
||||
export function ack(queue: string, id: string) {
|
||||
export function ack(queue: string, id: string): Promise<void> {
|
||||
return syscall("mq.ack", queue, id);
|
||||
}
|
||||
|
||||
export function batchAck(queue: string, ids: string[]) {
|
||||
export function batchAck(queue: string, ids: string[]): Promise<void> {
|
||||
return syscall("mq.batchAck", queue, ids);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ export function applyAttributeExtractors(
|
|||
return syscall("system.applyAttributeExtractors", tags, text, tree);
|
||||
}
|
||||
|
||||
export function reloadPlugs() {
|
||||
export function reloadPlugs(): Promise<void> {
|
||||
return syscall("system.reloadPlugs");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assert, assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assert, assertEquals } from "@std/assert";
|
||||
import { federatedPathToLocalPath, wildcardPathToRegex } from "./util.ts";
|
||||
|
||||
Deno.test("Test wildcardPathToRegex", () => {
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
import { KV, KvQuery, ObjectQuery, ObjectValue } from "../../plug-api/types.ts";
|
||||
import type {
|
||||
KV,
|
||||
KvQuery,
|
||||
ObjectQuery,
|
||||
ObjectValue,
|
||||
} from "../../plug-api/types.ts";
|
||||
import { ttlCache } from "$lib/memory_cache.ts";
|
||||
import { system } from "$sb/syscalls.ts";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { extractSnippetAroundIndex } from "./snippet_extractor.ts";
|
||||
|
||||
Deno.test("SnippetExtractor", () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { renderHtml } from "./html_render.ts";
|
||||
|
||||
Deno.test("HTML Render", () => {
|
||||
|
|
|
@ -4,7 +4,7 @@ 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 { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
|
||||
Deno.test("Markdown render", async () => {
|
||||
const system = new System<any>("server");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { walk } from "$std/fs/walk.ts";
|
||||
import { resolve } from "$std/path/mod.ts";
|
||||
import { walk } from "@std/fs/walk";
|
||||
import { resolve } from "@std/path";
|
||||
import { mime } from "mimetypes";
|
||||
import { FileMeta } from "../plug-api/types.ts";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { sleep } from "$lib/async.ts";
|
||||
import { MemoryKvPrimitives } from "$lib/data/memory_kv_primitives.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { JWTIssuer } from "./crypto.ts";
|
||||
|
||||
Deno.test("Test JWT crypto", async () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { DenoKvPrimitives } from "$lib/data/deno_kv_primitives.ts";
|
||||
import { KvPrimitives } from "$lib/data/kv_primitives.ts";
|
||||
import { MemoryKvPrimitives } from "$lib/data/memory_kv_primitives.ts";
|
||||
import { resolve } from "$std/path/mod.ts";
|
||||
import { resolve } from "@std/path";
|
||||
|
||||
/**
|
||||
* Environment variables:
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
import { deleteCookie, getCookie, setCookie } from "hono/helper.ts";
|
||||
import { cors } from "hono/middleware.ts";
|
||||
import { type Context, Hono, type HonoRequest, validator } from "hono/mod.ts";
|
||||
import { AssetBundle } from "$lib/asset_bundle/bundle.ts";
|
||||
import { EndpointRequest, EndpointResponse, FileMeta } from "$sb/types.ts";
|
||||
import { ShellRequest } from "$type/rpc.ts";
|
||||
import { SpaceServer, SpaceServerConfig } from "./instance.ts";
|
||||
import { KvPrimitives } from "$lib/data/kv_primitives.ts";
|
||||
import type { AssetBundle } from "$lib/asset_bundle/bundle.ts";
|
||||
import type { EndpointRequest, EndpointResponse, FileMeta } from "$sb/types.ts";
|
||||
import type { ShellRequest } from "$type/rpc.ts";
|
||||
import { SpaceServer } from "./instance.ts";
|
||||
import type { SpaceServerConfig } from "./instance.ts";
|
||||
import type { KvPrimitives } from "$lib/data/kv_primitives.ts";
|
||||
import { PrefixedKvPrimitives } from "$lib/data/prefixed_kv_primitives.ts";
|
||||
import { extendedMarkdownLanguage } from "$common/markdown_parser/parser.ts";
|
||||
import { parse } from "$common/markdown_parser/parse_tree.ts";
|
||||
import { renderMarkdownToHtml } from "../plugs/markdown/markdown_render.ts";
|
||||
import { looksLikePathWithExtension, parsePageRef } from "$sb/lib/page_ref.ts";
|
||||
import { base64Encode } from "$lib/crypto.ts";
|
||||
import * as path from "$std/path/mod.ts";
|
||||
import { basename, dirname, join } from "@std/path";
|
||||
|
||||
const authenticationExpirySeconds = 60 * 60 * 24 * 7; // 1 week
|
||||
|
||||
|
@ -600,10 +601,10 @@ export class HttpServer {
|
|||
}
|
||||
}
|
||||
|
||||
const filename = path.posix.basename(name, mdExt);
|
||||
const filename = basename(name, mdExt);
|
||||
if (filename.trim() !== filename) {
|
||||
const newName = path.posix.join(
|
||||
path.posix.dirname(name),
|
||||
const newName = join(
|
||||
dirname(name),
|
||||
filename.trim(),
|
||||
);
|
||||
return c.redirect(`/${newName}`);
|
||||
|
@ -647,7 +648,7 @@ export class HttpServer {
|
|||
return c.text("Forbidden", 403);
|
||||
}
|
||||
|
||||
const filename = path.posix.basename(name, mdExt);
|
||||
const filename = basename(name, mdExt);
|
||||
if (filename.trim() !== filename) {
|
||||
return c.text("Malformed filename", 400);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { DiskSpacePrimitives } from "$common/spaces/disk_space_primitives.ts";
|
||||
import { SpacePrimitives } from "$common/spaces/space_primitives.ts";
|
||||
import { resolve } from "$std/path/mod.ts";
|
||||
import { resolve } from "@std/path";
|
||||
import { S3SpacePrimitives } from "$common/spaces/s3_space_primitives.ts";
|
||||
import { KvPrimitives } from "$lib/data/kv_primitives.ts";
|
||||
import { ChunkedKvStoreSpacePrimitives } from "$common/spaces/chunked_datastore_space_primitives.ts";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { rangeLength, rangesOverlap } from "./change.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
|
||||
Deno.test("rangeLength", () => {
|
||||
assertEquals(rangeLength({ from: 4, to: 11 }), 7);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { FilterOption } from "$lib/web.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { fuzzySearchAndSort } from "./fuse_search.ts";
|
||||
|
||||
Deno.test("testFuzzyFilter", () => {
|
||||
|
|
Loading…
Reference in New Issue