Folder refactor
parent
887ab18c79
commit
e36e0d00db
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DenoSettings">
|
||||
<option name="useDeno" value="true" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/silverbullet.iml" filepath="$PROJECT_DIR$/.idea/silverbullet.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/pages" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
5
Makefile
5
Makefile
|
@ -1,6 +1,7 @@
|
|||
.PHONY: plugs
|
||||
plugs:
|
||||
deno run -A --unstable packages/plugos/bin/plugos-bundle.ts --dist dist packages/plugs/global.plug.yaml
|
||||
deno run -A --unstable packages/plugos/bin/plugos-bundle.ts --dist packages/plugs/dist --exclude=https://esm.sh/handlebars,https://deno.land/std/encoding/yaml.ts,https://esm.sh/@lezer/lr packages/plugs/*/*.plug.yaml
|
||||
deno run -A --unstable plugos/bin/plugos-bundle.ts --dist dist plugs/global.plug.yaml
|
||||
deno run -A --unstable plugos/bin/plugos-bundle.ts --dist plugs/dist --exclude=https://esm.sh/handlebars,https://deno.land/std/encoding/yaml.ts,https://esm.sh/@lezer/lr plugs/*/*.plug.yaml
|
||||
|
||||
test:
|
||||
deno test -A --unstable
|
||||
|
|
18
build.ts
18
build.ts
|
@ -2,12 +2,12 @@
|
|||
// @deno-types="https://deno.land/x/esbuild@v0.14.54/mod.d.ts"
|
||||
import * as esbuildWasm from "https://deno.land/x/esbuild@v0.14.54/wasm.js";
|
||||
import * as esbuildNative from "https://deno.land/x/esbuild@v0.14.54/mod.js";
|
||||
import { denoPlugin } from "./packages/esbuild_deno_loader/mod.ts";
|
||||
import { denoPlugin } from "./esbuild_deno_loader/mod.ts";
|
||||
import { copy } from "https://deno.land/std@0.158.0/fs/copy.ts";
|
||||
|
||||
import sass from "https://deno.land/x/denosass@1.0.4/mod.ts";
|
||||
import { bundleFolder } from "./json_bundle.ts";
|
||||
import { patchDenoLibJS } from "./packages/common/hack.ts";
|
||||
import { patchDenoLibJS } from "./common/hack.ts";
|
||||
|
||||
// @ts-ignore trust me
|
||||
const esbuild: typeof esbuildWasm = Deno.run === undefined
|
||||
|
@ -15,14 +15,14 @@ const esbuild: typeof esbuildWasm = Deno.run === undefined
|
|||
: esbuildNative;
|
||||
|
||||
async function prepareAssets(dest: string) {
|
||||
await copy("packages/web/fonts", dest, { overwrite: true });
|
||||
await copy("packages/web/index.html", `${dest}/index.html`, {
|
||||
await copy("web/fonts", dest, { overwrite: true });
|
||||
await copy("web/index.html", `${dest}/index.html`, {
|
||||
overwrite: true,
|
||||
});
|
||||
const compiler = sass(
|
||||
Deno.readTextFileSync("packages/web/styles/main.scss"),
|
||||
Deno.readTextFileSync("web/styles/main.scss"),
|
||||
{
|
||||
load_paths: ["packages/web/styles"],
|
||||
load_paths: ["web/styles"],
|
||||
},
|
||||
);
|
||||
await Deno.writeTextFile(
|
||||
|
@ -47,8 +47,8 @@ async function bundle(): Promise<void> {
|
|||
await Promise.all([
|
||||
esbuild.build({
|
||||
entryPoints: {
|
||||
"client": "packages/web/boot.ts",
|
||||
"worker": "packages/plugos/environments/sandbox_worker.ts",
|
||||
"client": "web/boot.ts",
|
||||
"worker": "plugos/environments/sandbox_worker.ts",
|
||||
},
|
||||
outdir: "./dist",
|
||||
absWorkingDir: Deno.cwd(),
|
||||
|
@ -56,7 +56,7 @@ async function bundle(): Promise<void> {
|
|||
treeShaking: true,
|
||||
sourcemap: "linked",
|
||||
watch: {
|
||||
onRebuild(error, result) {
|
||||
onRebuild(error) {
|
||||
if (error) {
|
||||
console.error("watch build failed:", error);
|
||||
} else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { assertEquals } from "../../test_dep.ts";
|
||||
import { assertEquals } from "../test_dep.ts";
|
||||
import { base64Decode } from "./base64.ts";
|
||||
import { base64Encode } from "./base64.ts";
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { Tag } from "../../dep_common.ts";
|
||||
import { Tag } from "../dep_common.ts";
|
||||
|
||||
export const WikiLinkTag = Tag.define();
|
||||
export const WikiLinkPageTag = Tag.define();
|
|
@ -1,5 +1,5 @@
|
|||
import { Tag } from "../../dep_common.ts";
|
||||
import type { MarkdownConfig } from "../../dep_common.ts";
|
||||
import { Tag } from "../dep_common.ts";
|
||||
import type { MarkdownConfig } from "../dep_common.ts";
|
||||
import { System } from "../plugos/system.ts";
|
||||
import { Manifest } from "./manifest.ts";
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { ParseTree } from "./tree.ts";
|
||||
|
||||
import type { SyntaxNode } from "../../dep_common.ts";
|
||||
import type { Language } from "../../dep_common.ts";
|
||||
import type { SyntaxNode } from "../dep_common.ts";
|
||||
import type { Language } from "../dep_common.ts";
|
||||
export function lezerToParseTree(
|
||||
text: string,
|
||||
n: SyntaxNode,
|
|
@ -12,7 +12,7 @@ import {
|
|||
Table,
|
||||
tags as t,
|
||||
TaskList,
|
||||
} from "../../dep_common.ts";
|
||||
} from "../dep_common.ts";
|
||||
import * as ct from "./customtags.ts";
|
||||
import {
|
||||
MDExt,
|
|
@ -1,6 +1,6 @@
|
|||
// import { mkdir, readdir, readFile, stat, unlink, writeFile } from "fs/promises";
|
||||
import { path } from "../../../dep_common.ts";
|
||||
import { readAll } from "../../../dep_common.ts";
|
||||
import { path } from "../../dep_common.ts";
|
||||
import { readAll } from "../../dep_common.ts";
|
||||
import { FileMeta } from "../types.ts";
|
||||
import { FileData, FileEncoding, SpacePrimitives } from "./space_primitives.ts";
|
||||
import { Plug } from "../../plugos/plug.ts";
|
|
@ -1,6 +1,6 @@
|
|||
import { SysCallMapping } from "../../plugos/system.ts";
|
||||
import { parse } from "../parse_tree.ts";
|
||||
import { Language } from "../../../dep_common.ts";
|
||||
import { Language } from "../../dep_common.ts";
|
||||
import type { ParseTree } from "../tree.ts";
|
||||
|
||||
export function markdownSyscalls(lang: Language): SysCallMapping {
|
|
@ -9,7 +9,7 @@ import {
|
|||
replaceNodesMatching,
|
||||
} from "./tree.ts";
|
||||
import wikiMarkdownLang from "./parser.ts";
|
||||
import { assertEquals, assertNotEquals } from "../../test_dep.ts";
|
||||
import { assertEquals, assertNotEquals } from "../test_dep.ts";
|
||||
|
||||
const mdTest1 = `
|
||||
# Heading
|
|
@ -1,4 +1,4 @@
|
|||
import { YAML } from "../../dep_common.ts";
|
||||
import { YAML } from "../dep_common.ts";
|
||||
|
||||
export function safeRun(fn: () => Promise<void>) {
|
||||
fn().catch((e) => {
|
|
@ -6,7 +6,9 @@
|
|||
"tasks": {
|
||||
"test": "deno test -A --unstable",
|
||||
"watch": "deno run -A build.ts",
|
||||
"plugs": "deno run -A --unstable packages/plugos/bin/plugos-bundle.ts --dist packages/plugs/dist --exclude=https://esm.sh/handlebars,https://deno.land/std@0.158.0/encoding/yaml.ts packages/plugs/*/*.plug.yaml"
|
||||
"server": "deno run -A --unstable --watch server/server.ts",
|
||||
"plugs": "deno run -A --unstable plugos/bin/plugos-bundle.ts --dist plugs/dist --exclude=https://esm.sh/handlebars,https://deno.land/std@0.158.0/encoding/yaml.ts plugs/*/*.plug.yaml",
|
||||
"compile": "deno compile --output silverbullet --importmap import_map.json -A --unstable server/server.ts"
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
export * from "esbuild_deno_loader/testdata/mod.ts";
|
|
@ -10,7 +10,7 @@
|
|||
"@lezer/highlight": "https://esm.sh/@lezer/highlight@1.1.1?external=@lezer/common",
|
||||
"@codemirror/autocomplete": "https://esm.sh/@codemirror/autocomplete@6.3.0?external=@codemirror/state,@lezer/common",
|
||||
"@codemirror/lint": "https://esm.sh/@codemirror/lint@6.0.0?external=@codemirror/state,@lezer/common",
|
||||
"$sb/": "./packages/",
|
||||
"$sb/": "./syscall/",
|
||||
"handlebars": "https://esm.sh/handlebars",
|
||||
"@lezer/lr": "https://esm.sh/@lezer/lr",
|
||||
"yaml": "https://deno.land/std/encoding/yaml.ts"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { walk } from "https://deno.land/std@0.159.0/fs/mod.ts";
|
||||
import { base64Encode } from "./packages/common/base64.ts";
|
||||
import { base64Encode } from "./common/base64.ts";
|
||||
|
||||
export async function bundleFolder(path: string, bundlePath: string) {
|
||||
const bundle: Record<string, string> = {};
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"name": "@silverbulletmd/common",
|
||||
"author": {
|
||||
"name": "Zef Hemel",
|
||||
"email": "zef@zef.me"
|
||||
},
|
||||
"version": "0.0.35",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.1.1",
|
||||
"@codemirror/commands": "^6.1.0",
|
||||
"@codemirror/lang-javascript": "^6.0.2",
|
||||
"@codemirror/lang-markdown": "^6.0.1",
|
||||
"@codemirror/language": "^6.2.1",
|
||||
"@codemirror/legacy-modes": "^6.1.0",
|
||||
"@codemirror/search": "^6.2.0",
|
||||
"@codemirror/state": "^6.1.1",
|
||||
"@codemirror/view": "^6.2.3",
|
||||
"@lezer/common": "^1.0.1",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/markdown": "^1.0.1",
|
||||
"mime-types": "^2.1.35",
|
||||
"yaml": "^1.10.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mime-types": "^2.1.1"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export * from "mod";
|
|
@ -1,84 +0,0 @@
|
|||
{
|
||||
"name": "@silverbulletmd/server",
|
||||
"author": {
|
||||
"name": "Zef Hemel",
|
||||
"email": "zef@zef.me"
|
||||
},
|
||||
"version": "0.0.35",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"silverbullet": "./dist/server/server.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest dist/test"
|
||||
},
|
||||
"targets": {
|
||||
"server": {
|
||||
"source": [
|
||||
"server.ts"
|
||||
],
|
||||
"outputFormat": "commonjs",
|
||||
"isLibrary": true,
|
||||
"context": "node",
|
||||
"includeNodeModules": [
|
||||
"@plugos/plugos",
|
||||
"@silverbulletmd/common",
|
||||
"@silverbulletmd/web"
|
||||
]
|
||||
},
|
||||
"test": {
|
||||
"source": [],
|
||||
"outputFormat": "commonjs",
|
||||
"isLibrary": true,
|
||||
"context": "node"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@codemirror/lang-javascript": "6.0.2",
|
||||
"@codemirror/language": "6.2.1",
|
||||
"@codemirror/legacy-modes": "6.1.0",
|
||||
"@jest/globals": "^27.5.1",
|
||||
"@lezer/markdown": "1.0.1",
|
||||
"@silverbulletmd/common": "^0.0.35",
|
||||
"@silverbulletmd/plugs": "^0.0.35",
|
||||
"@silverbulletmd/web": "^0.0.35",
|
||||
"better-sqlite3": "^7.6.2",
|
||||
"body-parser": "^1.20.0",
|
||||
"buffer": "^6.0.3",
|
||||
"cors": "^2.8.5",
|
||||
"dexie": "^3.2.2",
|
||||
"esbuild": "^0.15.7",
|
||||
"events": "^3.3.0",
|
||||
"express": "^4.18.1",
|
||||
"fake-indexeddb": "^3.1.7",
|
||||
"form-data": "^4.0.0",
|
||||
"jest": "^27.5.1",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"knex": "^1.0.4",
|
||||
"node-cron": "^3.0.2",
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-watch": "^0.7.3",
|
||||
"uuid": "^9.0.0",
|
||||
"vm2": "^3.9.11",
|
||||
"ws": "^8.8.1",
|
||||
"yaml": "^1.10.2",
|
||||
"yargs": "^17.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/packager-raw-url": "2.5.0",
|
||||
"@parcel/service-worker": "2.5.0",
|
||||
"@parcel/transformer-inline-string": "2.5.0",
|
||||
"@parcel/transformer-sass": "2.5.0",
|
||||
"@parcel/transformer-webmanifest": "2.5.0",
|
||||
"@parcel/validator-typescript": "2.5.0",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/events": "^3.0.0",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^17.0.21",
|
||||
"assert": "^2.0.0",
|
||||
"nodemon": "^2.0.19",
|
||||
"parcel": "2.5.0",
|
||||
"typescript": "^4.8.3"
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
{
|
||||
"name": "@silverbulletmd/web",
|
||||
"author": {
|
||||
"name": "Zef Hemel",
|
||||
"email": "zef@zef.me"
|
||||
},
|
||||
"version": "0.0.35",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"watch": "rm -rf .parcel-cache && parcel watch",
|
||||
"build": "parcel build",
|
||||
"clean": "rm -rf dist",
|
||||
"plugs": "cd plugs && ../plugos/dist/plugos/plugos-bundle.js -w --dist dist */*.plug.yaml",
|
||||
"server": "nodemon -w dist/server dist/server/server.js pages",
|
||||
"test": "jest dist/test plugos/dist/test"
|
||||
},
|
||||
"targets": {
|
||||
"webapp": {
|
||||
"source": [
|
||||
"index.html"
|
||||
],
|
||||
"context": "browser"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.1.1",
|
||||
"@codemirror/commands": "^6.1.0",
|
||||
"@codemirror/lang-javascript": "^6.0.2",
|
||||
"@codemirror/lang-markdown": "^6.0.1",
|
||||
"@codemirror/language": "^6.2.1",
|
||||
"@codemirror/legacy-modes": "^6.1.0",
|
||||
"@codemirror/search": "^6.2.0",
|
||||
"@codemirror/state": "^6.1.1",
|
||||
"@codemirror/view": "^6.2.3",
|
||||
"@fortawesome/fontawesome-svg-core": "1.3.0",
|
||||
"@fortawesome/free-solid-svg-icons": "6.0.0",
|
||||
"@fortawesome/react-fontawesome": "0.1.17",
|
||||
"@jest/globals": "^27.5.1",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/markdown": "^1.0.1",
|
||||
"fake-indexeddb": "^3.1.7",
|
||||
"fuzzysort": "^2.0.1",
|
||||
"jest": "^27.5.1",
|
||||
"knex": "^1.0.4",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/packager-raw-url": "2.5.0",
|
||||
"@parcel/service-worker": "2.5.0",
|
||||
"@parcel/transformer-inline-string": "2.5.0",
|
||||
"@parcel/transformer-sass": "2.5.0",
|
||||
"@parcel/transformer-webmanifest": "2.5.0",
|
||||
"@parcel/validator-typescript": "2.5.0",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/events": "^3.0.0",
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/react": "^17.0.39",
|
||||
"@types/react-dom": "^17.0.11",
|
||||
"assert": "^2.0.0",
|
||||
"nodemon": "^2.0.19",
|
||||
"parcel": "2.5.0",
|
||||
"prettier": "^2.7.1",
|
||||
"typescript": "^4.8.3"
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env deno
|
||||
|
||||
import { Manifest } from "../types.ts";
|
||||
import { YAML } from "../../../dep_common.ts";
|
||||
import { YAML } from "../../dep_common.ts";
|
||||
import { compile, esbuild, sandboxCompileModule } from "../compile.ts";
|
||||
import { path } from "../../../dep_server.ts";
|
||||
import { path } from "../../dep_server.ts";
|
||||
|
||||
import * as flags from "https://deno.land/std@0.158.0/flags/mod.ts";
|
||||
|
|
@ -4,15 +4,15 @@ import express from "express";
|
|||
import yargs from "yargs";
|
||||
import { hideBin } from "yargs/helpers";
|
||||
import { DiskPlugLoader } from "../plug_loader";
|
||||
import { CronHookT, NodeCronHook } from "../hooks/node_cron";
|
||||
import shellSyscalls from "../syscalls/shell.node";
|
||||
import { System } from "../system";
|
||||
import { EndpointHook, EndpointHookT } from "../hooks/endpoint";
|
||||
import { safeRun } from "../util";
|
||||
import { CronHookT, NodeCronHook } from "../hooks/node_cron.ts";
|
||||
import shellSyscalls from "../syscalls/shell.node.ts";
|
||||
import { System } from "../system.ts";
|
||||
import { EndpointHook, EndpointHookT } from "../hooks/endpoint.ts";
|
||||
import { safeRun } from "../util.ts";
|
||||
import knex from "knex";
|
||||
import { ensureTable, storeSyscalls } from "../syscalls/store.knex_node";
|
||||
import { EventHook, EventHookT } from "../hooks/event";
|
||||
import { eventSyscalls } from "../syscalls/event";
|
||||
import { EventHook, EventHookT } from "../hooks/event.ts";
|
||||
import { eventSyscalls } from "../syscalls/event.ts";
|
||||
|
||||
let args = yargs(hideBin(process.argv))
|
||||
.option("port", {
|
|
@ -6,7 +6,7 @@ export const esbuild: typeof esbuildWasm = Deno.run === undefined
|
|||
? esbuildWasm
|
||||
: esbuildNative;
|
||||
|
||||
import { path } from "../../dep_server.ts";
|
||||
import { path } from "../dep_server.ts";
|
||||
import { denoPlugin } from "../esbuild_deno_loader/mod.ts";
|
||||
import { patchDenoLibJS } from "../common/hack.ts";
|
||||
|
||||
|
@ -51,7 +51,7 @@ export async function compile(
|
|||
treeShaking: true,
|
||||
plugins: [
|
||||
denoPlugin({
|
||||
importMapURL: new URL("./../../import_map.json", import.meta.url),
|
||||
importMapURL: new URL("./../import_map.json", import.meta.url),
|
||||
}),
|
||||
],
|
||||
loader: {
|
|
@ -3,8 +3,8 @@ import { Manifest } from "../types.ts";
|
|||
import { EndpointHook, EndpointHookT } from "./endpoint.ts";
|
||||
import { System } from "../system.ts";
|
||||
|
||||
import { Application } from "../../../dep_server.ts";
|
||||
import { assertEquals } from "../../../test_dep.ts";
|
||||
import { Application } from "../../dep_server.ts";
|
||||
import { assertEquals } from "../../test_dep.ts";
|
||||
|
||||
Deno.test("Run a plugos endpoint server", async () => {
|
||||
let system = new System<EndpointHookT>("server");
|
|
@ -1,6 +1,6 @@
|
|||
import { Hook, Manifest } from "../types.ts";
|
||||
import { System } from "../system.ts";
|
||||
import { Application } from "../../../dep_server.ts";
|
||||
import { Application } from "../../dep_server.ts";
|
||||
|
||||
export type EndpointRequest = {
|
||||
method: string;
|
|
@ -1,5 +1,6 @@
|
|||
import type { SysCallMapping } from "../system.ts";
|
||||
|
||||
import { path } from "../../dep_server.ts";
|
||||
import { base64Decode, base64Encode } from "../../common/base64.ts";
|
||||
export type FileMeta = {
|
||||
name: string;
|
||||
lastModified: number;
|
||||
|
@ -18,76 +19,76 @@ export default function fileSystemSyscalls(root = "/"): SysCallMapping {
|
|||
"fs.readFile": async (
|
||||
ctx,
|
||||
filePath: string,
|
||||
encoding: "utf8" | "dataurl" = "utf8"
|
||||
encoding: "utf8" | "dataurl" = "utf8",
|
||||
): Promise<{ text: string; meta: FileMeta }> => {
|
||||
let p = resolvedPath(filePath);
|
||||
let text = "";
|
||||
if (encoding === "utf8") {
|
||||
text = await readFile(p, "utf8");
|
||||
text = await Deno.readTextFile(p);
|
||||
} else {
|
||||
text = `data:application/octet-stream,${await readFile(p, "base64")}`;
|
||||
text = `data:application/octet-stream,${
|
||||
base64Encode(await Deno.readFile(p))
|
||||
}`;
|
||||
}
|
||||
let s = await stat(p);
|
||||
let s = await Deno.stat(p);
|
||||
return {
|
||||
text,
|
||||
meta: {
|
||||
name: filePath,
|
||||
lastModified: s.mtime.getTime(),
|
||||
lastModified: s.mtime!.getTime(),
|
||||
},
|
||||
};
|
||||
},
|
||||
"fs.getFileMeta": async (ctx, filePath: string): Promise<FileMeta> => {
|
||||
let p = resolvedPath(filePath);
|
||||
let s = await stat(p);
|
||||
let s = await Deno.stat(p);
|
||||
return {
|
||||
name: filePath,
|
||||
lastModified: s.mtime.getTime(),
|
||||
lastModified: s.mtime!.getTime(),
|
||||
};
|
||||
},
|
||||
"fs.writeFile": async (
|
||||
ctx,
|
||||
filePath: string,
|
||||
text: string,
|
||||
encoding: "utf8" | "dataurl" = "utf8"
|
||||
encoding: "utf8" | "dataurl" = "utf8",
|
||||
): Promise<FileMeta> => {
|
||||
let p = resolvedPath(filePath);
|
||||
await mkdir(path.dirname(p), { recursive: true });
|
||||
await Deno.mkdir(path.dirname(p), { recursive: true });
|
||||
if (encoding === "utf8") {
|
||||
await writeFile(p, text);
|
||||
await Deno.writeTextFile(p, text);
|
||||
} else {
|
||||
await writeFile(p, text.split(",")[1], {
|
||||
encoding: "base64",
|
||||
});
|
||||
await Deno.writeFile(p, base64Decode(text.split(",")[1]));
|
||||
}
|
||||
let s = await stat(p);
|
||||
let s = await Deno.stat(p);
|
||||
return {
|
||||
name: filePath,
|
||||
lastModified: s.mtime.getTime(),
|
||||
lastModified: s.mtime!.getTime(),
|
||||
};
|
||||
},
|
||||
"fs.deleteFile": async (ctx, filePath: string): Promise<void> => {
|
||||
let p = resolvedPath(filePath);
|
||||
await unlink(p);
|
||||
await Deno.remove(p);
|
||||
},
|
||||
"fs.listFiles": async (
|
||||
ctx,
|
||||
dirPath: string,
|
||||
recursive: boolean
|
||||
recursive: boolean,
|
||||
): Promise<FileMeta[]> => {
|
||||
dirPath = resolvedPath(dirPath);
|
||||
let allFiles: FileMeta[] = [];
|
||||
|
||||
async function walkPath(dir: string) {
|
||||
let files = await readdir(dir);
|
||||
for (let file of files) {
|
||||
const fullPath = path.join(dir, file);
|
||||
let s = await stat(fullPath);
|
||||
if (s.isDirectory() && recursive) {
|
||||
let files = await Deno.readDir(dir);
|
||||
for await (const file of files) {
|
||||
const fullPath = path.join(dir, file.name);
|
||||
let s = await Deno.stat(fullPath);
|
||||
if (s.isDirectory && recursive) {
|
||||
await walkPath(fullPath);
|
||||
} else {
|
||||
allFiles.push({
|
||||
name: fullPath.substring(dirPath.length + 1),
|
||||
lastModified: s.mtime.getTime(),
|
||||
lastModified: s.mtime!.getTime(),
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import { SQLite } from "../../../dep_server.ts";
|
||||
import { SQLite } from "../../dep_server.ts";
|
||||
import { SysCallMapping } from "../system.ts";
|
||||
import { asyncExecute, asyncQuery } from "./store.deno.ts";
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import jwt, { Algorithm } from "jsonwebtoken";
|
||||
import { SysCallMapping } from "../system";
|
||||
import { SysCallMapping } from "../system.ts";
|
||||
|
||||
export function jwtSyscalls(): SysCallMapping {
|
||||
return {
|
|
@ -1,5 +1,5 @@
|
|||
import { assertEquals } from "../../../test_dep.ts";
|
||||
import { SQLite } from "../../../dep_server.ts";
|
||||
import { assertEquals } from "../../test_dep.ts";
|
||||
import { SQLite } from "../../dep_server.ts";
|
||||
import { createSandbox } from "../environments/deno_sandbox.ts";
|
||||
import { System } from "../system.ts";
|
||||
import { ensureTable, storeSyscalls } from "./store.deno.ts";
|
|
@ -1,4 +1,4 @@
|
|||
import { SQLite } from "../../../dep_server.ts";
|
||||
import { SQLite } from "../../dep_server.ts";
|
||||
import { SysCallMapping } from "../system.ts";
|
||||
|
||||
export type Item = {
|
|
@ -2,11 +2,11 @@ import { collectNodesOfType } from "../../common/tree.ts";
|
|||
import {
|
||||
batchSet,
|
||||
queryPrefix,
|
||||
} from "../../plugos-silverbullet-syscall/index.ts";
|
||||
} from "../../syscall/silverbullet-syscall/index.ts";
|
||||
import {
|
||||
getCurrentPage,
|
||||
matchBefore,
|
||||
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||
} from "../../syscall/silverbullet-syscall/editor.ts";
|
||||
import type { IndexTreeEvent } from "../../web/app_event.ts";
|
||||
import { removeQueries } from "../query/util.ts";
|
||||
|
|
@ -4,7 +4,7 @@ import type {
|
|||
} from "../../common/spaces/space_primitives.ts";
|
||||
import { renderToText, replaceNodesMatching } from "../../common/tree.ts";
|
||||
import type { FileMeta } from "../../common/types.ts";
|
||||
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||
import { parseMarkdown } from "../../syscall/silverbullet-syscall/markdown.ts";
|
||||
|
||||
const pagePrefix = "💭 ";
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { matchBefore } from "../../plugos-silverbullet-syscall/editor.ts";
|
||||
import { listCommands } from "../../plugos-silverbullet-syscall/system.ts";
|
||||
import { matchBefore } from "../../syscall/silverbullet-syscall/editor.ts";
|
||||
import { listCommands } from "../../syscall/silverbullet-syscall/system.ts";
|
||||
|
||||
export async function commandComplete() {
|
||||
let prefix = await matchBefore("\\{\\[[^\\]]*");
|
|
@ -1,11 +1,11 @@
|
|||
import { getLogs } from "../../plugos-syscall/sandbox.ts";
|
||||
import { getLogs } from "../../syscall/plugos-syscall/sandbox.ts";
|
||||
import {
|
||||
getText,
|
||||
hidePanel,
|
||||
showPanel,
|
||||
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||
import { getServerLogs } from "../../plugos-silverbullet-syscall/sandbox.ts";
|
||||
} from "../../syscall/silverbullet-syscall/editor.ts";
|
||||
import { parseMarkdown } from "../../syscall/silverbullet-syscall/markdown.ts";
|
||||
import { getServerLogs } from "../../syscall/silverbullet-syscall/sandbox.ts";
|
||||
|
||||
export async function parsePageCommand() {
|
||||
console.log(
|
|
@ -1,5 +1,5 @@
|
|||
import * as clientStore from "../../plugos-silverbullet-syscall/clientStore.ts";
|
||||
import { enableReadOnlyMode } from "../../plugos-silverbullet-syscall/editor.ts";
|
||||
import * as clientStore from "../../syscall/silverbullet-syscall/clientStore.ts";
|
||||
import { enableReadOnlyMode } from "../../syscall/silverbullet-syscall/editor.ts";
|
||||
|
||||
export async function editorLoad() {
|
||||
let readOnlyMode = await clientStore.get("readOnlyMode");
|
|
@ -3,7 +3,7 @@ import type { IndexTreeEvent } from "../../web/app_event.ts";
|
|||
import {
|
||||
batchSet,
|
||||
queryPrefix,
|
||||
} from "../../plugos-silverbullet-syscall/index.ts";
|
||||
} from "../../syscall/silverbullet-syscall/index.ts";
|
||||
import {
|
||||
collectNodesOfType,
|
||||
ParseTree,
|
|
@ -5,10 +5,10 @@ import {
|
|||
getCursor,
|
||||
getText,
|
||||
replaceRange,
|
||||
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||
import { dispatch as dispatchEvent } from "../../plugos-syscall/event.ts";
|
||||
import { invokeFunction } from "../../plugos-silverbullet-syscall/system.ts";
|
||||
} from "../../syscall/silverbullet-syscall/editor.ts";
|
||||
import { parseMarkdown } from "../../syscall/silverbullet-syscall/markdown.ts";
|
||||
import { dispatch as dispatchEvent } from "../../syscall/plugos-syscall/event.ts";
|
||||
import { invokeFunction } from "../../syscall/silverbullet-syscall/system.ts";
|
||||
|
||||
type UnfurlOption = {
|
||||
id: string;
|
|
@ -6,10 +6,10 @@ import {
|
|||
getText,
|
||||
navigate as navigateTo,
|
||||
openUrl,
|
||||
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||
} from "../../syscall/silverbullet-syscall/editor.ts";
|
||||
import { parseMarkdown } from "../../syscall/silverbullet-syscall/markdown.ts";
|
||||
import { nodeAtPos, ParseTree } from "../../common/tree.ts";
|
||||
import { invokeCommand } from "../../plugos-silverbullet-syscall/system.ts";
|
||||
import { invokeCommand } from "../../syscall/silverbullet-syscall/system.ts";
|
||||
|
||||
// Checks if the URL contains a protocol, if so keeps it, otherwise assumes an attachment
|
||||
function patchUrl(url: string): string {
|
|
@ -5,7 +5,7 @@ import {
|
|||
clearPageIndexForPage,
|
||||
queryPrefix,
|
||||
set,
|
||||
} from "../../plugos-silverbullet-syscall/index.ts";
|
||||
} from "../../syscall/silverbullet-syscall/index.ts";
|
||||
|
||||
import {
|
||||
flashNotification,
|
||||
|
@ -15,17 +15,17 @@ import {
|
|||
matchBefore,
|
||||
navigate,
|
||||
prompt,
|
||||
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||
} from "../../syscall/silverbullet-syscall/editor.ts";
|
||||
|
||||
import { dispatch } from "../../plugos-syscall/event.ts";
|
||||
import { dispatch } from "../../syscall/plugos-syscall/event.ts";
|
||||
import {
|
||||
deletePage as deletePageSyscall,
|
||||
listPages,
|
||||
readPage,
|
||||
writePage,
|
||||
} from "../../plugos-silverbullet-syscall/space.ts";
|
||||
import { invokeFunction } from "../../plugos-silverbullet-syscall/system.ts";
|
||||
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||
} from "../../syscall/silverbullet-syscall/space.ts";
|
||||
import { invokeFunction } from "../../syscall/silverbullet-syscall/system.ts";
|
||||
import { parseMarkdown } from "../../syscall/silverbullet-syscall/markdown.ts";
|
||||
import {
|
||||
addParentPointers,
|
||||
collectNodesMatching,
|
|
@ -1,18 +1,18 @@
|
|||
import { dispatch } from "../../plugos-syscall/event.ts";
|
||||
import { dispatch } from "../../syscall/plugos-syscall/event.ts";
|
||||
import { Manifest } from "../../common/manifest.ts";
|
||||
import {
|
||||
flashNotification,
|
||||
save,
|
||||
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||
} from "../../syscall/silverbullet-syscall/editor.ts";
|
||||
import {
|
||||
deleteAttachment,
|
||||
listPlugs,
|
||||
writeAttachment,
|
||||
} from "../../plugos-silverbullet-syscall/space.ts";
|
||||
} from "../../syscall/silverbullet-syscall/space.ts";
|
||||
import {
|
||||
invokeFunction,
|
||||
reloadPlugs,
|
||||
} from "../../plugos-silverbullet-syscall/system.ts";
|
||||
} from "../../syscall/silverbullet-syscall/system.ts";
|
||||
|
||||
import { readYamlPage } from "../lib/yaml_page.ts";
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue