diff --git a/build_plugs.ts b/build_plugs.ts index 356c715d..5bfb651a 100644 --- a/build_plugs.ts +++ b/build_plugs.ts @@ -1,4 +1,4 @@ -import { path } from "./lib/deps_server.ts"; +import * as path from "@std/path"; import * as esbuild from "esbuild"; import { compileManifests } from "./cmd/compile.ts"; import { builtinPlugNames } from "./plugs/builtin_plugs.ts"; diff --git a/cmd/compile.ts b/cmd/compile.ts index 94dcad3d..c6528be8 100644 --- a/cmd/compile.ts +++ b/cmd/compile.ts @@ -1,4 +1,5 @@ -import { path, YAML } from "../lib/deps_server.ts"; +import * as path from "@std/path"; +import * as YAML from "@std/yaml"; import { denoPlugins } from "@luca/esbuild-deno-loader"; import * as esbuild from "esbuild"; import { bundleAssets } from "../lib/asset_bundle/builder.ts"; diff --git a/common/space_lua.ts b/common/space_lua.ts index 6f140fd8..bcd6a4c7 100644 --- a/common/space_lua.ts +++ b/common/space_lua.ts @@ -3,14 +3,11 @@ import type { ScriptObject } from "../plugs/index/script.ts"; import { LuaEnv, LuaFunction, - LuaNativeJSFunction, LuaRuntimeError, } from "$common/space_lua/runtime.ts"; import { parse as parseLua } from "$common/space_lua/parse.ts"; import { evalStatement } from "$common/space_lua/eval.ts"; import { jsToLuaValue } from "$common/space_lua/runtime.ts"; -import { LuaBuiltinFunction } from "$common/space_lua/runtime.ts"; -import { LuaTable } from "$common/space_lua/runtime.ts"; import { type PageRef, parsePageRef, @@ -18,7 +15,6 @@ import { import type { ScriptEnvironment } from "$common/space_script.ts"; import { luaValueToJS } from "$common/space_lua/runtime.ts"; import type { ASTCtx } from "$common/space_lua/ast.ts"; -import { lua } from "@silverbulletmd/silverbullet/syscalls"; import type { ObjectQuery } from "@silverbulletmd/silverbullet/types"; import { buildLuaEnv } from "$common/space_lua_api.ts"; diff --git a/lib/asset_bundle/builder.ts b/lib/asset_bundle/builder.ts index 4113a543..456e9e30 100644 --- a/lib/asset_bundle/builder.ts +++ b/lib/asset_bundle/builder.ts @@ -1,5 +1,8 @@ -import { globToRegExp, mime, path, walk } from "../deps_server.ts"; +// import { globToRegExp, mime, path, walk } from "../deps_server.ts"; +import { dirname, globToRegExp } from "@std/path"; import { AssetBundle } from "./bundle.ts"; +import { walk } from "@std/fs"; +import { mime } from "mimetypes"; export async function bundleAssets( rootPath: string, @@ -39,7 +42,7 @@ export async function bundleFolder( ) { const bundle = new AssetBundle(); - await Deno.mkdir(path.dirname(bundlePath), { recursive: true }); + await Deno.mkdir(dirname(bundlePath), { recursive: true }); for await ( const { path: filePath } of walk(rootPath, { includeDirs: false }) ) { diff --git a/lib/data/indexeddb_kv_primitives.ts b/lib/data/indexeddb_kv_primitives.ts index a8c471a0..d0708314 100644 --- a/lib/data/indexeddb_kv_primitives.ts +++ b/lib/data/indexeddb_kv_primitives.ts @@ -1,6 +1,9 @@ import type { KV, KvKey } from "../../plug-api/types.ts"; import type { KvPrimitives, KvQueryOptions } from "./kv_primitives.ts"; -import { type IDBPDatabase, openDB } from "../deps_client.ts"; +import { + type IDBPDatabase, + openDB, +} from "https://esm.sh/idb@7.1.1/with-async-ittr"; const sep = "\0"; const objectStoreName = "data"; diff --git a/lib/deps_client.ts b/lib/deps_client.ts deleted file mode 100644 index 27054bc3..00000000 --- a/lib/deps_client.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Remember to keep in sync with deno.json ! -// We have to use different deps for client and server as esbuild doesn't -// support wildcard exporting. See https://github.com/evanw/esbuild/issues/1420 -export { - type IDBPDatabase, - openDB, -} from "https://esm.sh/idb@7.1.1/with-async-ittr"; diff --git a/lib/deps_server.ts b/lib/deps_server.ts deleted file mode 100644 index 4b1490ce..00000000 --- a/lib/deps_server.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Remember to keep in sync with deno.json ! -// We have to use different deps for client and server as esbuild doesn't -// support wildcard exporting. See https://github.com/evanw/esbuild/issues/1420 -export { globToRegExp } from "@std/path"; -export { walk } from "@std/fs"; -export * as path from "@std/path"; -export { mime } from "mimetypes"; -export * as YAML from "@std/yaml"; -export { Cron } from "https://deno.land/x/croner@4.4.1/src/croner.js"; diff --git a/lib/plugos/hooks/cron.ts b/lib/plugos/hooks/cron.ts index a215f917..56200272 100644 --- a/lib/plugos/hooks/cron.ts +++ b/lib/plugos/hooks/cron.ts @@ -1,5 +1,5 @@ import type { Hook, Manifest } from "../types.ts"; -import { Cron } from "../../deps_server.ts"; +import { Cron } from "https://deno.land/x/croner@4.4.1/src/croner.js"; import type { System } from "../system.ts"; import type { CronHookT } from "$lib/manifest.ts"; diff --git a/lib/plugos/syscalls/fs.deno.test.ts b/lib/plugos/syscalls/fs.deno.test.ts index 6a06d00f..e54764ba 100644 --- a/lib/plugos/syscalls/fs.deno.test.ts +++ b/lib/plugos/syscalls/fs.deno.test.ts @@ -1,11 +1,11 @@ import type { FileMeta } from "../../../plug-api/types.ts"; import { assert } from "@std/assert"; -import { path } from "../../deps_server.ts"; import fileSystemSyscalls from "./fs.deno.ts"; +import { dirname, resolve } from "@std/path"; Deno.test("Test FS operations", async () => { - const thisFolder = path.resolve( - path.dirname(new URL(import.meta.url).pathname), + const thisFolder = resolve( + dirname(new URL(import.meta.url).pathname), ); const syscalls = fileSystemSyscalls(thisFolder); const allFiles: FileMeta[] = await syscalls["fs.listFiles"]( diff --git a/lib/plugos/syscalls/fs.deno.ts b/lib/plugos/syscalls/fs.deno.ts index d2f63448..891877d2 100644 --- a/lib/plugos/syscalls/fs.deno.ts +++ b/lib/plugos/syscalls/fs.deno.ts @@ -1,11 +1,13 @@ import type { SysCallMapping } from "../system.ts"; -import { mime, path, walk } from "../../deps_server.ts"; import type { FileMeta } from "../../../plug-api/types.ts"; import { base64DecodeDataUrl, base64Encode } from "../../crypto.ts"; +import { dirname, resolve } from "@std/path"; +import { mime } from "mimetypes"; +import { walk } from "@std/fs"; export default function fileSystemSyscalls(root = "/"): SysCallMapping { function resolvedPath(p: string): string { - p = path.resolve(root, p); + p = resolve(root, p); if (!p.startsWith(root)) { throw Error("Path outside root, not allowed"); } @@ -48,7 +50,7 @@ export default function fileSystemSyscalls(root = "/"): SysCallMapping { encoding: "utf8" | "dataurl" = "utf8", ): Promise => { const p = resolvedPath(filePath); - await Deno.mkdir(path.dirname(p), { recursive: true }); + await Deno.mkdir(dirname(p), { recursive: true }); if (encoding === "utf8") { await Deno.writeTextFile(p, text); } else { diff --git a/plug-api/lib/syscall_mock.ts b/plug-api/lib/syscall_mock.ts index ed015399..2ae5d196 100644 --- a/plug-api/lib/syscall_mock.ts +++ b/plug-api/lib/syscall_mock.ts @@ -1,10 +1,10 @@ -import { YAML } from "../../lib/deps_server.ts"; +import { parse as parseYaml } from "@std/yaml"; // @ts-ignore: syscall is a global function globalThis.syscall = (name: string, ...args: readonly any[]) => { switch (name) { case "yaml.parse": - return Promise.resolve(YAML.parse(args[0])); + return Promise.resolve(parseYaml(args[0])); case "system.applyAttributeExtractors": return Promise.resolve({}); default: