Cleaning some dependencies
parent
7b955ef26a
commit
5c8332a109
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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 })
|
||||
) {
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
|
@ -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";
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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"](
|
||||
|
|
|
@ -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<FileMeta> => {
|
||||
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 {
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue