WIP
parent
8ddd61f029
commit
66104a1ee7
|
@ -1,8 +1,6 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"imports": {
|
"imports": {
|
||||||
"@codemirror/state": "https://esm.sh/@codemirror/state",
|
"@codemirror/state": "https://esm.sh/@codemirror/state",
|
||||||
"@codemirror/language": "https://esm.sh/@codemirror/language"
|
"@codemirror/language": "https://esm.sh/@codemirror/language"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
44
mod.ts
44
mod.ts
|
@ -3,12 +3,29 @@ export {
|
||||||
completionKeymap,
|
completionKeymap,
|
||||||
} from "https://esm.sh/@codemirror/autocomplete@6.3.0?external=@codemirror/state";
|
} from "https://esm.sh/@codemirror/autocomplete@6.3.0?external=@codemirror/state";
|
||||||
|
|
||||||
|
export * as YAML from "https://deno.land/std@0.158.0/encoding/yaml.ts";
|
||||||
|
export * as path from "https://deno.land/std@0.158.0/path/mod.ts";
|
||||||
|
|
||||||
|
export { readAll } from "https://deno.land/std@0.158.0/streams/conversion.ts";
|
||||||
|
|
||||||
|
export {
|
||||||
|
encode as b64encode,
|
||||||
|
decode as b64decode,
|
||||||
|
} from "https://deno.land/std/encoding/base64.ts";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
defaultHighlightStyle,
|
defaultHighlightStyle,
|
||||||
Language,
|
Language,
|
||||||
|
LanguageSupport,
|
||||||
|
LanguageDescription,
|
||||||
syntaxHighlighting,
|
syntaxHighlighting,
|
||||||
syntaxTree,
|
syntaxTree,
|
||||||
} from "https://esm.sh/@codemirror/language@6.2.1?external=@codemirror/state";
|
defineLanguageFacet,
|
||||||
|
languageDataProp,
|
||||||
|
foldNodeProp,
|
||||||
|
indentNodeProp,
|
||||||
|
ParseContext,
|
||||||
|
} from "@codemirror/language";
|
||||||
export { markdown } from "https://esm.sh/@codemirror/lang-markdown@6.0.1?external=@codemirror/state";
|
export { markdown } from "https://esm.sh/@codemirror/lang-markdown@6.0.1?external=@codemirror/state";
|
||||||
export {
|
export {
|
||||||
history,
|
history,
|
||||||
|
@ -30,13 +47,22 @@ export type {
|
||||||
MarkdownConfig,
|
MarkdownConfig,
|
||||||
Table,
|
Table,
|
||||||
TaskList,
|
TaskList,
|
||||||
|
MarkdownExtension,
|
||||||
} from "https://esm.sh/@lezer/markdown";
|
} from "https://esm.sh/@lezer/markdown";
|
||||||
|
|
||||||
export type { SyntaxNode } from "https://esm.sh/@lezer/common";
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
searchKeymap,
|
MarkdownParser,
|
||||||
} from "https://esm.sh/@codemirror/search?external=@codemirror/state";
|
parseCode,
|
||||||
|
parser as baseParser,
|
||||||
|
GFM,
|
||||||
|
Subscript,
|
||||||
|
Superscript,
|
||||||
|
Emoji,
|
||||||
|
} from "https://esm.sh/@lezer/markdown";
|
||||||
|
|
||||||
|
export type { SyntaxNode, Tree } from "https://esm.sh/@lezer/common";
|
||||||
|
|
||||||
|
export { searchKeymap } from "https://esm.sh/@codemirror/search?external=@codemirror/state";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
drawSelection,
|
drawSelection,
|
||||||
|
@ -50,6 +76,10 @@ export {
|
||||||
} from "https://esm.sh/@codemirror/view@6.3.0?external=@codemirror/state";
|
} from "https://esm.sh/@codemirror/view@6.3.0?external=@codemirror/state";
|
||||||
export type { KeyBinding } from "https://esm.sh/@codemirror/view@6.3.0?external=@codemirror/state";
|
export type { KeyBinding } from "https://esm.sh/@codemirror/view@6.3.0?external=@codemirror/state";
|
||||||
|
|
||||||
// export * as react from "https://esm.sh/react@17";
|
export { EditorSelection, EditorState, Text } from "@codemirror/state";
|
||||||
|
export type { StateCommand, ChangeSpec } from "@codemirror/state";
|
||||||
|
|
||||||
export { EditorSelection, EditorState } from "@codemirror/state";
|
export { DB as SQLite3 } from "https://deno.land/x/sqlite/mod.ts";
|
||||||
|
|
||||||
|
// @deno-types="https://deno.land/x/dex@1.0.2/types/index.d.ts"
|
||||||
|
export { default as Dex } from "https://deno.land/x/dex@1.0.2/mod.ts";
|
||||||
|
|
|
@ -0,0 +1,674 @@
|
||||||
|
Args {
|
||||||
|
_: [ "packages/plugs/core/core.plug.yaml" ],
|
||||||
|
exclude: [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ],
|
||||||
|
dist: "/Users/zef/git/silverbullet/dist"
|
||||||
|
}
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for clearPageIndex
|
||||||
|
_out.tmp 1.2kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 8.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 7.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/page.ts 77b 6.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 62b 4.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 3.0%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.5%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for pageQueryProvider
|
||||||
|
_out.tmp 2.3kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 1.0kb 43.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/page.ts 212b 8.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 4.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 53b 2.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 52b 2.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 0.8%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for parseIndexTextRepublish
|
||||||
|
_out.tmp 1.4kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/event.ts 199b 13.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 6.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/page.ts 81b 5.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 3.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.3%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for reindexCommand
|
||||||
|
_out.tmp 1.3kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/page.ts 104b 7.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 7.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/system.ts 70b 5.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 64b 4.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.8%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.4%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for reindexSpace
|
||||||
|
_out.tmp 1.8kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/page.ts 272b 15.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/event.ts 199b 10.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 102b 5.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 5.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 52b 2.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.1%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.0%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for deletePage
|
||||||
|
_out.tmp 1.4kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/page.ts 138b 9.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 102b 7.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 6.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 51b 3.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.3%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for editorLoad
|
||||||
|
_out.tmp 747b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 14.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/editor.ts 56b 7.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 54b 7.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/clientStore.ts 50b 6.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 5.1%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for toggleReadOnlyMode
|
||||||
|
_out.tmp 836b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 12.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/clientStore.ts 104b 12.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/editor.ts 91b 10.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 54b 6.5%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 4.5%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for indexLinks
|
||||||
|
_out.tmp 2.6kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/data.ts 515b 19.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 435b 16.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/page.ts 429b 16.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 105b 4.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 4.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 3.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.4%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 0.7%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for linkQueryProvider
|
||||||
|
_out.tmp 2.2kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 1.0kb 45.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/page.ts 153b 6.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 4.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 52b 2.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 0.8%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for renamePage
|
||||||
|
_out.tmp 3.0kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/page.ts 1001b 33.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 392b 13.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 233b 7.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 154b 5.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 3.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 3.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 1.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 52b 1.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.3%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 0.6%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for pageComplete
|
||||||
|
_out.tmp 1.4kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/page.ts 155b 11.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 7.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 53b 3.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 47b 3.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.4%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for commandComplete
|
||||||
|
_out.tmp 849b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/command.ts 164b 19.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 12.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/system.ts 51b 6.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 47b 5.5%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 4.5%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for indexItems
|
||||||
|
_out.tmp 2.4kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/item.ts 497b 20.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/util.ts 469b 18.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 353b 14.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 4.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 3.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 53b 2.1%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.5%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for queryProvider
|
||||||
|
_out.tmp 2.2kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 1.0kb 45.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/item.ts 149b 6.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 4.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 52b 2.3%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.7%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for linkNavigate
|
||||||
|
_out.tmp 1.8kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/navigate.ts 643b 35.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 291b 16.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 167b 9.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 3.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/system.ts 55b 3.1%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.1%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for clickNavigate
|
||||||
|
_out.tmp 1.7kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/navigate.ts 671b 37.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 249b 13.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 167b 9.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 3.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/system.ts 55b 3.1%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.1%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for navigateCommand
|
||||||
|
_out.tmp 678b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 15.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 55b 8.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 5.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/navigate.ts 36b 5.3%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for indexTags
|
||||||
|
_out.tmp 2.1kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/util.ts 469b 21.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 353b 16.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/tags.ts 155b 7.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 4.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 4.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 53b 2.5%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.8%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for tagComplete
|
||||||
|
_out.tmp 1.3kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/tags.ts 162b 11.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 7.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 52b 3.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 47b 3.4%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.8%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for tagProvider
|
||||||
|
_out.tmp 2.2kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 1.0kb 45.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/tags.ts 176b 7.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 4.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 52b 2.3%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.7%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for indexAnchors
|
||||||
|
_out.tmp 1.6kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/util.ts 469b 28.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 353b 21.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/anchor.ts 206b 12.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 6.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 53b 3.2%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.3%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for anchorComplete
|
||||||
|
_out.tmp 1003b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/anchor.ts 270b 26.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 10.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 94b 9.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 52b 5.2%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 3.8%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for index
|
||||||
|
_out.tmp 2.0kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/util.ts 469b 23.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 311b 15.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 4.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/search.ts 64b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/fulltext.ts 53b 2.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.9%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 0.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for unindex
|
||||||
|
_out.tmp 1.2kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 8.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 8.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/fulltext.ts 50b 4.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/search.ts 31b 2.5%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.6%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for queryProvider
|
||||||
|
_out.tmp 2.5kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 1.0kb 40.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/search.ts 359b 14.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 4.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/fulltext.ts 58b 2.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/index.ts 52b 2.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.5%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 0.7%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for searchCommand
|
||||||
|
_out.tmp 1.3kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 104b 7.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 7.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/search.ts 91b 6.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.9%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.4%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for readPageSearch
|
||||||
|
_out.tmp 1.4kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/search.ts 229b 16.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 6.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/fulltext.ts 58b 4.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.3%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for getPageMetaSearch
|
||||||
|
_out.tmp 1.2kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 8.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 8.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/search.ts 60b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 3.2%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.6%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for insertTemplateText
|
||||||
|
_out.tmp 1.9kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 478b 24.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 185b 9.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for insertTemplateText
|
||||||
|
_out.tmp 1.9kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 478b 24.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 185b 9.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for insertTemplateText
|
||||||
|
_out.tmp 1.9kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 478b 24.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 185b 9.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for insertTemplateText
|
||||||
|
_out.tmp 1.9kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 478b 24.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 185b 9.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for insertTemplateText
|
||||||
|
_out.tmp 1.9kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 478b 24.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 185b 9.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for insertTemplateText
|
||||||
|
_out.tmp 1.9kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 478b 24.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 185b 9.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for insertTemplateText
|
||||||
|
_out.tmp 1.9kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 478b 24.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 185b 9.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for quickNoteCommand
|
||||||
|
_out.tmp 2.3kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 439b 18.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 262b 11.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 179b 7.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 177b 7.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 4.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 4.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 2.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 55b 2.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 49b 2.1%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.6%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for dailyNoteCommand
|
||||||
|
_out.tmp 3.0kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 710b 23.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 439b 14.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 262b 8.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 177b 5.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 155b 5.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 3.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 3.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 1.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 55b 1.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 1.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.3%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for instantiateTemplateCommand
|
||||||
|
_out.tmp 4.1kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 866b 20.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 569b 13.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/data.ts 515b 12.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 439b 10.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 262b 6.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 167b 4.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 156b 3.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 2.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 2.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 1.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 1.2%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 0.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for insertSnippet
|
||||||
|
_out.tmp 3.2kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 774b 24.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 439b 13.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 262b 8.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 248b 7.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 177b 5.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 3.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 102b 3.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 3.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 1.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 1.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.2%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for insertTemplateText
|
||||||
|
_out.tmp 1.9kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 478b 24.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 185b 9.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for insertTemplateText
|
||||||
|
_out.tmp 1.9kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/template.ts 478b 24.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 185b 9.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/query/engine.ts 97b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/settings_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 3.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/dates.ts 51b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for quoteSelection
|
||||||
|
_out.tmp 959b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/text.ts 231b 24.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 141b 14.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 10.9%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 4.0%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for listifySelection
|
||||||
|
_out.tmp 892b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/text.ts 164b 18.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 141b 15.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 11.8%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 4.3%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for numberListifySelection
|
||||||
|
_out.tmp 915b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/text.ts 187b 20.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 141b 15.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 11.5%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 4.2%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for linkSelection
|
||||||
|
_out.tmp 972b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/text.ts 198b 20.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 187b 19.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 10.8%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 3.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for wrapSelection
|
||||||
|
_out.tmp 1.3kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/text.ts 495b 36.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 289b 21.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.8%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for wrapSelection
|
||||||
|
_out.tmp 1.3kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/text.ts 495b 36.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 289b 21.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.8%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for wrapSelection
|
||||||
|
_out.tmp 1.3kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/text.ts 495b 36.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 289b 21.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.8%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for updatePlugsCommand
|
||||||
|
_out.tmp 1.5kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/plugmanager.ts 172b 11.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/system.ts 113b 7.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 101b 6.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 4.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.3%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for updatePlugs
|
||||||
|
_out.tmp 2.8kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/plugmanager.ts 681b 23.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 439b 15.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 217b 7.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/event.ts 199b 7.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 177b 6.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 3.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 2.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/system.ts 43b 1.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.3%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 0.7%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for getPlugHTTPS
|
||||||
|
_out.tmp 1.3kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/plugmanager.ts 208b 15.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 8.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 4.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.9%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.5%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for getPlugGithub
|
||||||
|
_out.tmp 1.4kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/plugmanager.ts 345b 23.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 7.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 4.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.3%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for getPlugGithubRelease
|
||||||
|
_out.tmp 1.6kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/plugmanager.ts 584b 34.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 6.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/lib/yaml_page.ts 61b 3.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.3%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.1%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for parsePageCommand
|
||||||
|
_out.tmp 764b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 13.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/debug.ts 80b 10.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 7.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 40b 5.2%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 5.0%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for showLogsCommand
|
||||||
|
_out.tmp 2.1kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/debug.ts 1.3kb 64.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 5.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 60b 2.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/sandbox.ts 59b 2.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/sandbox.ts 53b 2.5%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 1.8%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for hideBhsCommand
|
||||||
|
_out.tmp 666b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 15.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 45b 6.8%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 5.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/debug.ts 34b 5.1%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for unfurlCommand
|
||||||
|
_out.tmp 1.7kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/link.ts 371b 21.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 265b 15.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/event.ts 199b 11.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 167b 9.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 6.1%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/system.ts 70b 4.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 3.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.2%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 1.1%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for unfurlExec
|
||||||
|
_out.tmp 919b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/event.ts 199b 21.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/link.ts 114b 12.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 11.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 4.1%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 2.1%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for titleUnfurlOptions
|
||||||
|
_out.tmp 675b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 15.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/link.ts 69b 10.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 5.6%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 2.8%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for titleUnfurl
|
||||||
|
_out.tmp 925b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/link.ts 319b 34.5%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 11.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 4.1%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugos-syscall/syscall.ts 19b 2.1%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for statsCommand
|
||||||
|
_out.tmp 983b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/stats.ts 239b 24.3%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 10.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/editor.ts 104b 10.6%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/space.ts 53b 5.4%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 3.9%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for readFileCloud
|
||||||
|
_out.tmp 1.5kb 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/cloud.ts 584b 38.2%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/common/tree.ts 301b 19.7%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 6.9%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/markdown.ts 57b 3.7%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 2.5%
|
||||||
|
|
||||||
|
External modules [ "https://esm.sh/handlebars", "https://deno.land/std@0.158.0/encoding/yaml.ts" ]
|
||||||
|
Bundle info for getFileMetaCloud
|
||||||
|
_out.tmp 682b 100.0%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugos-silverbullet-syscall/syscall.ts 105b 15.4%
|
||||||
|
├ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/cloud.ts 95b 13.9%
|
||||||
|
└ deno:file:///Users/zef/git/silverbullet/packages/plugs/core/_in.ts 38b 5.6%
|
||||||
|
|
||||||
|
Emitting bundle to /Users/zef/git/silverbullet/dist/core.plug.json
|
|
@ -6,10 +6,10 @@ import {
|
||||||
Text,
|
Text,
|
||||||
EditorSelection,
|
EditorSelection,
|
||||||
ChangeSpec,
|
ChangeSpec,
|
||||||
} from "@codemirror/state";
|
} from "../../../mod.ts";
|
||||||
import { syntaxTree } from "@codemirror/language";
|
import { syntaxTree } from "../../../mod.ts";
|
||||||
import { SyntaxNode, Tree } from "@lezer/common";
|
import { SyntaxNode, Tree } from "../../../mod.ts";
|
||||||
import { markdownLanguage } from "./markdown";
|
import { markdownLanguage } from "./markdown.ts";
|
||||||
|
|
||||||
function nodeStart(node: SyntaxNode, doc: Text) {
|
function nodeStart(node: SyntaxNode, doc: Text) {
|
||||||
return doc.sliceString(node.from, node.from + 50);
|
return doc.sliceString(node.from, node.from + 50);
|
||||||
|
|
|
@ -2,21 +2,24 @@
|
||||||
// * Disable HTML tags
|
// * Disable HTML tags
|
||||||
|
|
||||||
import { Prec } from "@codemirror/state";
|
import { Prec } from "@codemirror/state";
|
||||||
import { KeyBinding, keymap } from "@codemirror/view";
|
import { KeyBinding, keymap } from "../../../mod.ts";
|
||||||
import {
|
import {
|
||||||
Language,
|
Language,
|
||||||
LanguageSupport,
|
LanguageSupport,
|
||||||
LanguageDescription,
|
LanguageDescription,
|
||||||
} from "@codemirror/language";
|
} from "../../../mod.ts";
|
||||||
import { MarkdownExtension, MarkdownParser, parseCode } from "@lezer/markdown";
|
import { MarkdownExtension, MarkdownParser, parseCode } from "../../../mod.ts";
|
||||||
// import { html } from "@codemirror/lang-html";
|
// import { html } from "@codemirror/lang-html";
|
||||||
import {
|
import {
|
||||||
commonmarkLanguage,
|
commonmarkLanguage,
|
||||||
markdownLanguage,
|
markdownLanguage,
|
||||||
mkLang,
|
mkLang,
|
||||||
getCodeParser,
|
getCodeParser,
|
||||||
} from "./markdown";
|
} from "./markdown.ts";
|
||||||
import { insertNewlineContinueMarkup, deleteMarkupBackward } from "./commands";
|
import {
|
||||||
|
insertNewlineContinueMarkup,
|
||||||
|
deleteMarkupBackward,
|
||||||
|
} from "./commands.ts";
|
||||||
export {
|
export {
|
||||||
commonmarkLanguage,
|
commonmarkLanguage,
|
||||||
markdownLanguage,
|
markdownLanguage,
|
||||||
|
|
|
@ -6,15 +6,15 @@ import {
|
||||||
indentNodeProp,
|
indentNodeProp,
|
||||||
LanguageDescription,
|
LanguageDescription,
|
||||||
ParseContext,
|
ParseContext,
|
||||||
} from "@codemirror/language";
|
} from "../../../mod.ts";
|
||||||
import {
|
import {
|
||||||
parser as baseParser,
|
baseParser,
|
||||||
MarkdownParser,
|
MarkdownParser,
|
||||||
GFM,
|
GFM,
|
||||||
Subscript,
|
Subscript,
|
||||||
Superscript,
|
Superscript,
|
||||||
Emoji,
|
Emoji,
|
||||||
} from "@lezer/markdown";
|
} from "../../../mod.ts";
|
||||||
|
|
||||||
const data = defineLanguageFacet({ block: { open: "<!--", close: "-->" } });
|
const data = defineLanguageFacet({ block: { open: "<!--", close: "-->" } });
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
import { mkdir, readdir, readFile, stat, unlink, writeFile } from "fs/promises";
|
// import { mkdir, readdir, readFile, stat, unlink, writeFile } from "fs/promises";
|
||||||
import * as path from "path";
|
import { path } from "../../../mod.ts";
|
||||||
import { FileMeta } from "../types";
|
import { b64encode, b64decode } from "../../../mod.ts";
|
||||||
import { FileData, FileEncoding, SpacePrimitives } from "./space_primitives";
|
import { readAll } from "../../../mod.ts";
|
||||||
import { Plug } from "@plugos/plugos/plug";
|
import { FileMeta } from "../types.ts";
|
||||||
import { realpathSync } from "fs";
|
import { FileData, FileEncoding, SpacePrimitives } from "./space_primitives.ts";
|
||||||
import mime from "mime-types";
|
import { Plug } from "../../plugos/plug.ts";
|
||||||
|
import { mime } from "https://deno.land/x/mimetypes@v1.0.0/mod.ts";
|
||||||
|
|
||||||
function lookupContentType(path: string): string {
|
function lookupContentType(path: string): string {
|
||||||
return mime.lookup(path) || "application/octet-stream";
|
return mime.getType(path) || "application/octet-stream";
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DiskSpacePrimitives implements SpacePrimitives {
|
export class DiskSpacePrimitives implements SpacePrimitives {
|
||||||
rootPath: string;
|
rootPath: string;
|
||||||
|
|
||||||
constructor(rootPath: string) {
|
constructor(rootPath: string) {
|
||||||
this.rootPath = realpathSync(rootPath);
|
this.rootPath = Deno.realPathSync(rootPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
safePath(p: string): string {
|
safePath(p: string): string {
|
||||||
let realPath = path.resolve(p);
|
const realPath = path.resolve(p);
|
||||||
if (!realPath.startsWith(this.rootPath)) {
|
if (!realPath.startsWith(this.rootPath)) {
|
||||||
throw Error(`Path ${p} is not in the space`);
|
throw Error(`Path ${p} is not in the space`);
|
||||||
}
|
}
|
||||||
|
@ -39,29 +40,37 @@ export class DiskSpacePrimitives implements SpacePrimitives {
|
||||||
): Promise<{ data: FileData; meta: FileMeta }> {
|
): Promise<{ data: FileData; meta: FileMeta }> {
|
||||||
const localPath = this.filenameToPath(name);
|
const localPath = this.filenameToPath(name);
|
||||||
try {
|
try {
|
||||||
const s = await stat(localPath);
|
const s = await Deno.stat(localPath);
|
||||||
let data: FileData | null = null;
|
let data: FileData | null = null;
|
||||||
let contentType = lookupContentType(name);
|
const contentType = lookupContentType(name);
|
||||||
switch (encoding) {
|
switch (encoding) {
|
||||||
case "string":
|
case "string":
|
||||||
data = await readFile(localPath, "utf8");
|
data = await Deno.readTextFile(localPath);
|
||||||
break;
|
break;
|
||||||
case "dataurl":
|
case "dataurl":
|
||||||
let fileBuffer = await readFile(localPath, {
|
{
|
||||||
encoding: "base64",
|
const f = await Deno.open(localPath, { read: true });
|
||||||
});
|
const buf = b64encode(await readAll(f));
|
||||||
data = `data:${contentType};base64,${fileBuffer}`;
|
Deno.close(f.rid);
|
||||||
|
|
||||||
|
data = `data:${contentType};base64,${buf}`;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "arraybuffer":
|
case "arraybuffer":
|
||||||
let arrayBuffer = await readFile(localPath);
|
{
|
||||||
data = arrayBuffer.buffer;
|
const f = await Deno.open(localPath, { read: true });
|
||||||
|
const buf = await readAll(f);
|
||||||
|
Deno.close(f.rid);
|
||||||
|
|
||||||
|
data = buf.buffer;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
meta: {
|
meta: {
|
||||||
name: name,
|
name: name,
|
||||||
lastModified: s.mtime.getTime(),
|
lastModified: s.mtime!.getTime(),
|
||||||
perm: "rw",
|
perm: "rw",
|
||||||
size: s.size,
|
size: s.size,
|
||||||
contentType: contentType,
|
contentType: contentType,
|
||||||
|
@ -82,30 +91,31 @@ export class DiskSpacePrimitives implements SpacePrimitives {
|
||||||
let localPath = this.filenameToPath(name);
|
let localPath = this.filenameToPath(name);
|
||||||
try {
|
try {
|
||||||
// Ensure parent folder exists
|
// Ensure parent folder exists
|
||||||
await mkdir(path.dirname(localPath), { recursive: true });
|
await Deno.mkdir(path.dirname(localPath), { recursive: true });
|
||||||
|
|
||||||
// Actually write the file
|
// Actually write the file
|
||||||
switch (encoding) {
|
switch (encoding) {
|
||||||
case "string":
|
case "string":
|
||||||
await writeFile(localPath, data as string, "utf8");
|
await Deno.writeTextFile(localPath, data as string);
|
||||||
break;
|
break;
|
||||||
case "dataurl":
|
case "dataurl":
|
||||||
await writeFile(localPath, (data as string).split(",")[1], {
|
await Deno.writeFile(
|
||||||
encoding: "base64",
|
localPath,
|
||||||
});
|
b64decode((data as string).split(",")[1])
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case "arraybuffer":
|
case "arraybuffer":
|
||||||
await writeFile(localPath, Buffer.from(data as ArrayBuffer));
|
await Deno.writeFile(localPath, new Uint8Array(data as ArrayBuffer));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch new metadata
|
// Fetch new metadata
|
||||||
const s = await stat(localPath);
|
const s = await Deno.stat(localPath);
|
||||||
return {
|
return {
|
||||||
name: name,
|
name: name,
|
||||||
size: s.size,
|
size: s.size,
|
||||||
contentType: lookupContentType(name),
|
contentType: lookupContentType(name),
|
||||||
lastModified: s.mtime.getTime(),
|
lastModified: s.mtime!.getTime(),
|
||||||
perm: "rw",
|
perm: "rw",
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -115,14 +125,14 @@ export class DiskSpacePrimitives implements SpacePrimitives {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getFileMeta(name: string): Promise<FileMeta> {
|
async getFileMeta(name: string): Promise<FileMeta> {
|
||||||
let localPath = this.filenameToPath(name);
|
const localPath = this.filenameToPath(name);
|
||||||
try {
|
try {
|
||||||
const s = await stat(localPath);
|
const s = await Deno.stat(localPath);
|
||||||
return {
|
return {
|
||||||
name: name,
|
name: name,
|
||||||
size: s.size,
|
size: s.size,
|
||||||
contentType: lookupContentType(name),
|
contentType: lookupContentType(name),
|
||||||
lastModified: s.mtime.getTime(),
|
lastModified: s.mtime!.getTime(),
|
||||||
perm: "rw",
|
perm: "rw",
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -132,30 +142,29 @@ export class DiskSpacePrimitives implements SpacePrimitives {
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteFile(name: string): Promise<void> {
|
async deleteFile(name: string): Promise<void> {
|
||||||
let localPath = this.filenameToPath(name);
|
const localPath = this.filenameToPath(name);
|
||||||
await unlink(localPath);
|
await Deno.remove(localPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchFileList(): Promise<FileMeta[]> {
|
async fetchFileList(): Promise<FileMeta[]> {
|
||||||
let fileList: FileMeta[] = [];
|
const fileList: FileMeta[] = [];
|
||||||
|
|
||||||
const walkPath = async (dir: string) => {
|
const walkPath = async (dir: string) => {
|
||||||
let files = await readdir(dir);
|
for await (const file of Deno.readDir(dir)) {
|
||||||
for (let file of files) {
|
if (file.name.startsWith(".")) {
|
||||||
if (file.startsWith(".")) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const fullPath = path.join(dir, file);
|
const fullPath = path.join(dir, file.name);
|
||||||
let s = await stat(fullPath);
|
let s = await Deno.stat(fullPath);
|
||||||
if (s.isDirectory()) {
|
if (file.isDirectory) {
|
||||||
await walkPath(fullPath);
|
await walkPath(fullPath);
|
||||||
} else {
|
} else {
|
||||||
if (!file.startsWith(".")) {
|
if (!file.name.startsWith(".")) {
|
||||||
fileList.push({
|
fileList.push({
|
||||||
name: this.pathToFilename(fullPath),
|
name: this.pathToFilename(fullPath),
|
||||||
size: s.size,
|
size: s.size,
|
||||||
contentType: lookupContentType(fullPath),
|
contentType: lookupContentType(fullPath),
|
||||||
lastModified: s.mtime.getTime(),
|
lastModified: s.mtime!.getTime(),
|
||||||
perm: "rw",
|
perm: "rw",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { EventHook } from "@plugos/plugos/hooks/event";
|
import { EventHook } from "../../plugos/hooks/event.ts";
|
||||||
import { Plug } from "@plugos/plugos/plug";
|
import { Plug } from "../../plugos/plug.ts";
|
||||||
|
|
||||||
import { FileMeta } from "../types";
|
import { FileMeta } from "../types.ts";
|
||||||
import { FileData, FileEncoding, SpacePrimitives } from "./space_primitives";
|
import { FileData, FileEncoding, SpacePrimitives } from "./space_primitives.ts";
|
||||||
|
|
||||||
export class EventedSpacePrimitives implements SpacePrimitives {
|
export class EventedSpacePrimitives implements SpacePrimitives {
|
||||||
constructor(private wrapped: SpacePrimitives, private eventHook: EventHook) {}
|
constructor(private wrapped: SpacePrimitives, private eventHook: EventHook) {}
|
||||||
|
@ -52,8 +52,11 @@ export class EventedSpacePrimitives implements SpacePrimitives {
|
||||||
text = data as string;
|
text = data as string;
|
||||||
break;
|
break;
|
||||||
case "arraybuffer":
|
case "arraybuffer":
|
||||||
|
{
|
||||||
const decoder = new TextDecoder("utf-8");
|
const decoder = new TextDecoder("utf-8");
|
||||||
text = decoder.decode(data as ArrayBuffer);
|
text = decoder.decode(data as ArrayBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "dataurl":
|
case "dataurl":
|
||||||
throw Error("Data urls not supported in this context");
|
throw Error("Data urls not supported in this context");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { AttachmentMeta, FileMeta, PageMeta } from "../types";
|
import { AttachmentMeta, FileMeta, PageMeta } from "../types.ts";
|
||||||
import { Plug } from "@plugos/plugos/plug";
|
import { Plug } from "../../plugos/plug.ts";
|
||||||
import { FileData, FileEncoding, SpacePrimitives } from "./space_primitives";
|
import { FileData, FileEncoding, SpacePrimitives } from "./space_primitives.ts";
|
||||||
|
|
||||||
export class HttpSpacePrimitives implements SpacePrimitives {
|
export class HttpSpacePrimitives implements SpacePrimitives {
|
||||||
fsUrl: string;
|
fsUrl: string;
|
||||||
|
@ -51,12 +51,16 @@ export class HttpSpacePrimitives implements SpacePrimitives {
|
||||||
let data: FileData | null = null;
|
let data: FileData | null = null;
|
||||||
switch (encoding) {
|
switch (encoding) {
|
||||||
case "arraybuffer":
|
case "arraybuffer":
|
||||||
|
{
|
||||||
let abBlob = await res.blob();
|
let abBlob = await res.blob();
|
||||||
data = await abBlob.arrayBuffer();
|
data = await abBlob.arrayBuffer();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "dataurl":
|
case "dataurl":
|
||||||
|
{
|
||||||
let dUBlob = await res.blob();
|
let dUBlob = await res.blob();
|
||||||
data = arrayBufferToDataUrl(await dUBlob.arrayBuffer());
|
data = arrayBufferToDataUrl(await dUBlob.arrayBuffer());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "string":
|
case "string":
|
||||||
data = await res.text();
|
data = await res.text();
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { FileData, FileEncoding, SpacePrimitives } from "./space_primitives";
|
import { FileData, FileEncoding, SpacePrimitives } from "./space_primitives.ts";
|
||||||
import { AttachmentMeta, FileMeta, PageMeta } from "../types";
|
import { AttachmentMeta, FileMeta, PageMeta } from "../types.ts";
|
||||||
import { EventEmitter } from "@plugos/plugos/event";
|
import { EventEmitter } from "../../plugos/event.ts";
|
||||||
import { Plug } from "@plugos/plugos/plug";
|
import { Plug } from "../../plugos/plug.ts";
|
||||||
import { plugPrefix } from "./constants";
|
import { plugPrefix } from "./constants.ts";
|
||||||
import { safeRun } from "../util";
|
import { safeRun } from "../util.ts";
|
||||||
|
|
||||||
const pageWatchInterval = 2000;
|
const pageWatchInterval = 2000;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Plug } from "@plugos/plugos/plug";
|
import { Plug } from "../../plugos/plug.ts";
|
||||||
import { FileMeta } from "../types";
|
import { FileMeta } from "../types.ts";
|
||||||
|
|
||||||
export type FileEncoding = "string" | "arraybuffer" | "dataurl";
|
export type FileEncoding = "string" | "arraybuffer" | "dataurl";
|
||||||
export type FileData = ArrayBuffer | string;
|
export type FileData = ArrayBuffer | string;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { SysCallMapping } from "@plugos/plugos/system";
|
import { SysCallMapping } from "../../plugos/system.ts";
|
||||||
import { parse } from "../parse_tree";
|
import { parse } from "../parse_tree.ts";
|
||||||
import { Language } from "@codemirror/language";
|
import { Language } from "../../../mod.ts";
|
||||||
import type { ParseTree } from "../tree";
|
import type { ParseTree } from "../tree.ts";
|
||||||
|
|
||||||
export function markdownSyscalls(lang: Language): SysCallMapping {
|
export function markdownSyscalls(lang: Language): SysCallMapping {
|
||||||
return {
|
return {
|
||||||
"markdown.parseMarkdown": (ctx, text: string): ParseTree => {
|
"markdown.parseMarkdown": (_ctx, text: string): ParseTree => {
|
||||||
return parse(lang, text);
|
return parse(lang, text);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import YAML from "yaml";
|
import { YAML } from "../../mod.ts";
|
||||||
|
|
||||||
export function safeRun(fn: () => Promise<void>) {
|
export function safeRun(fn: () => Promise<void>) {
|
||||||
fn().catch((e) => {
|
fn().catch((e) => {
|
||||||
|
@ -33,5 +33,7 @@ export function parseYamlSettings(settingsMarkdown: string): {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const yaml = match[1];
|
const yaml = match[1];
|
||||||
return YAML.parse(yaml);
|
return YAML.parse(yaml) as {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
|
|
||||||
export async function set(key: string, value: any): Promise<void> {
|
export async function set(key: string, value: any): Promise<void> {
|
||||||
return syscall("clientStore.set", key, value);
|
return syscall("clientStore.set", key, value);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
import { FilterOption } from "../common/types";
|
import { FilterOption } from "../common/types.ts";
|
||||||
|
|
||||||
export function getCurrentPage(): Promise<string> {
|
export function getCurrentPage(): Promise<string> {
|
||||||
return syscall("editor.getCurrentPage");
|
return syscall("editor.getCurrentPage");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Query } from "@plugos/plugos-syscall/store";
|
import type { Query } from "../plugos-syscall/store.ts";
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
|
|
||||||
export type KV = {
|
export type KV = {
|
||||||
key: string;
|
key: string;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
|
|
||||||
import type { ParseTree } from "../common/tree";
|
import type { ParseTree } from "../common/tree.ts";
|
||||||
|
|
||||||
export async function parseMarkdown(text: string): Promise<ParseTree> {
|
export async function parseMarkdown(text: string): Promise<ParseTree> {
|
||||||
return syscall("markdown.parseMarkdown", text);
|
return syscall("markdown.parseMarkdown", text);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
import { AttachmentMeta, PageMeta } from "../common/types";
|
import { AttachmentMeta, PageMeta } from "../common/types.ts";
|
||||||
|
|
||||||
export async function listPages(unfiltered = false): Promise<PageMeta[]> {
|
export async function listPages(unfiltered = false): Promise<PageMeta[]> {
|
||||||
return syscall("space.listPages", unfiltered);
|
return syscall("space.listPages", unfiltered);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { CommandDef } from "@silverbulletmd/web/hooks/command";
|
import type { CommandDef } from "../web/hooks/command.ts";
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
|
|
||||||
export async function invokeFunction(
|
export async function invokeFunction(
|
||||||
env: string,
|
env: string,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
|
|
||||||
export async function dispatch(
|
export async function dispatch(
|
||||||
eventName: string,
|
eventName: string,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
|
|
||||||
export type FileMeta = {
|
export type FileMeta = {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
|
|
||||||
export async function fullTextIndex(key: string, value: string) {
|
export async function fullTextIndex(key: string, value: string) {
|
||||||
return syscall("fulltext.index", key, value);
|
return syscall("fulltext.index", key, value);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { LogEntry } from "@plugos/plugos/sandbox";
|
import type { LogEntry } from "../plugos/sandbox.ts";
|
||||||
|
|
||||||
export async function getLogs(): Promise<LogEntry[]> {
|
export async function getLogs(): Promise<LogEntry[]> {
|
||||||
return syscall("sandbox.getLogs");
|
return syscall("sandbox.getLogs");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
|
|
||||||
export async function run(
|
export async function run(
|
||||||
cmd: string,
|
cmd: string,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { syscall } from "./syscall";
|
import { syscall } from "./syscall.ts";
|
||||||
|
|
||||||
export type KV = {
|
export type KV = {
|
||||||
key: string;
|
key: string;
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env deno
|
||||||
|
|
||||||
import { readFile, watch, writeFile } from "fs/promises";
|
import { Manifest } from "../types.ts";
|
||||||
import path from "path";
|
import { YAML } from "../../../mod.ts";
|
||||||
|
import { compile, esbuild, sandboxCompileModule } from "../compile.ts";
|
||||||
|
import { path } from "../../../mod.ts";
|
||||||
|
|
||||||
import yargs from "yargs";
|
import * as flags from "https://deno.land/std@0.158.0/flags/mod.ts";
|
||||||
import { hideBin } from "yargs/helpers";
|
|
||||||
import { Manifest } from "../types";
|
|
||||||
import YAML from "yaml";
|
|
||||||
import { mkdirSync } from "fs";
|
|
||||||
import { compile, sandboxCompileModule } from "../compile";
|
|
||||||
|
|
||||||
async function bundle(
|
async function bundle(
|
||||||
manifestPath: string,
|
manifestPath: string,
|
||||||
|
@ -17,14 +14,15 @@ async function bundle(
|
||||||
) {
|
) {
|
||||||
const rootPath = path.dirname(manifestPath);
|
const rootPath = path.dirname(manifestPath);
|
||||||
const manifest = YAML.parse(
|
const manifest = YAML.parse(
|
||||||
(await readFile(manifestPath)).toString()
|
await Deno.readTextFile(manifestPath)
|
||||||
) as Manifest<any>;
|
) as Manifest<any>;
|
||||||
|
|
||||||
if (!manifest.name) {
|
if (!manifest.name) {
|
||||||
throw new Error(`Missing 'name' in ${manifestPath}`);
|
throw new Error(`Missing 'name' in ${manifestPath}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let allModulesToExclude = excludeModules.slice();
|
const allModulesToExclude = excludeModules.slice();
|
||||||
|
|
||||||
for (let [name, moduleSpec] of Object.entries(manifest.dependencies || {})) {
|
for (let [name, moduleSpec] of Object.entries(manifest.dependencies || {})) {
|
||||||
manifest.dependencies![name] = await sandboxCompileModule(moduleSpec);
|
manifest.dependencies![name] = await sandboxCompileModule(moduleSpec);
|
||||||
allModulesToExclude.push(name);
|
allModulesToExclude.push(name);
|
||||||
|
@ -42,7 +40,7 @@ async function bundle(
|
||||||
jsFunctionName,
|
jsFunctionName,
|
||||||
debug,
|
debug,
|
||||||
allModulesToExclude,
|
allModulesToExclude,
|
||||||
false
|
true
|
||||||
);
|
);
|
||||||
delete def.path;
|
delete def.path;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +53,7 @@ async function buildManifest(
|
||||||
debug: boolean,
|
debug: boolean,
|
||||||
excludeModules: string[]
|
excludeModules: string[]
|
||||||
) {
|
) {
|
||||||
let generatedManifest = await bundle(manifestPath, debug, excludeModules);
|
const generatedManifest = await bundle(manifestPath, debug, excludeModules);
|
||||||
const outFile =
|
const outFile =
|
||||||
manifestPath.substring(
|
manifestPath.substring(
|
||||||
0,
|
0,
|
||||||
|
@ -63,47 +61,30 @@ async function buildManifest(
|
||||||
) + ".json";
|
) + ".json";
|
||||||
const outPath = path.join(distPath, path.basename(outFile));
|
const outPath = path.join(distPath, path.basename(outFile));
|
||||||
console.log("Emitting bundle to", outPath);
|
console.log("Emitting bundle to", outPath);
|
||||||
await writeFile(outPath, JSON.stringify(generatedManifest, null, 2));
|
await Deno.writeTextFile(outPath, JSON.stringify(generatedManifest, null, 2));
|
||||||
return { generatedManifest, outPath };
|
return { generatedManifest, outPath };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function run() {
|
type BundleArgs = {
|
||||||
let args = yargs(hideBin(process.argv))
|
_: string[];
|
||||||
.option("debug", {
|
dist?: string;
|
||||||
type: "boolean",
|
debug?: boolean;
|
||||||
})
|
exclude?: string[] | string;
|
||||||
.option("watch", {
|
};
|
||||||
type: "boolean",
|
|
||||||
alias: "w",
|
|
||||||
})
|
|
||||||
.option("dist", {
|
|
||||||
type: "string",
|
|
||||||
default: ".",
|
|
||||||
})
|
|
||||||
.option("exclude", {
|
|
||||||
type: "array",
|
|
||||||
default: [],
|
|
||||||
})
|
|
||||||
.parse();
|
|
||||||
if (args._.length === 0) {
|
|
||||||
console.log(
|
|
||||||
"Usage: plugos-bundle [--debug] [--dist <path>] [--exclude package1 package2] -- <manifest.plug.yaml> <manifest2.plug.yaml> ..."
|
|
||||||
);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log("Args", args);
|
export async function run(args: BundleArgs) {
|
||||||
|
console.log("Args", args);
|
||||||
|
|
||||||
async function buildAll() {
|
async function buildAll() {
|
||||||
mkdirSync(args.dist, { recursive: true });
|
Deno.mkdirSync(args.dist!, { recursive: true });
|
||||||
for (const plugManifestPath of args._) {
|
for (const plugManifestPath of args._) {
|
||||||
let manifestPath = plugManifestPath as string;
|
const manifestPath = plugManifestPath as string;
|
||||||
try {
|
try {
|
||||||
await buildManifest(
|
await buildManifest(
|
||||||
manifestPath,
|
manifestPath,
|
||||||
args.dist,
|
args.dist!,
|
||||||
!!args.debug,
|
!!args.debug,
|
||||||
args.exclude
|
args.exclude as string[]
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Error building ${manifestPath}:`, e);
|
console.error(`Error building ${manifestPath}:`, e);
|
||||||
|
@ -112,28 +93,44 @@ async function run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
await buildAll();
|
await buildAll();
|
||||||
if (args.watch) {
|
// if (args.watch) {
|
||||||
console.log("Watching for changes...");
|
// console.log("Watching for changes...");
|
||||||
for await (const { eventType, filename } of watch(".", {
|
// for await (const event of Deno.watchFs(".", {
|
||||||
recursive: true,
|
// recursive: true,
|
||||||
})) {
|
// })) {
|
||||||
if (
|
// if (
|
||||||
filename.endsWith(".plug.yaml") ||
|
// event.filename.endsWith(".plug.yaml") ||
|
||||||
filename.endsWith(".js") ||
|
// filename.endsWith(".js") ||
|
||||||
filename.endsWith(".css") ||
|
// filename.endsWith(".css") ||
|
||||||
filename.endsWith(".png") ||
|
// filename.endsWith(".png") ||
|
||||||
filename.endsWith(".jpg") ||
|
// filename.endsWith(".jpg") ||
|
||||||
filename.endsWith(".gif") ||
|
// filename.endsWith(".gif") ||
|
||||||
(filename.endsWith(".ts") && !filename.endsWith("_in.ts"))
|
// (filename.endsWith(".ts") && !filename.endsWith("_in.ts"))
|
||||||
) {
|
// ) {
|
||||||
console.log("Change detected", eventType, filename);
|
// console.log("Change detected", eventType, filename);
|
||||||
await buildAll();
|
// await buildAll();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
run().catch((e) => {
|
if (import.meta.main) {
|
||||||
console.error(e);
|
let args: BundleArgs = flags.parse(Deno.args);
|
||||||
process.exit(1);
|
|
||||||
});
|
if (args._.length === 0) {
|
||||||
|
console.log(
|
||||||
|
"Usage: plugos-bundle [--debug] [--dist <path>] [--exclude=package1,package2] <manifest.plug.yaml> <manifest2.plug.yaml> ..."
|
||||||
|
);
|
||||||
|
Deno.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!args.dist) {
|
||||||
|
args.dist = path.resolve("dist");
|
||||||
|
}
|
||||||
|
|
||||||
|
args.exclude =
|
||||||
|
typeof args.exclude === "string" ? args.exclude.split(",") : [];
|
||||||
|
|
||||||
|
await run(args);
|
||||||
|
esbuild.stop();
|
||||||
|
}
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
import esbuild from "esbuild";
|
// import { esbuild } from "../../mod.ts";
|
||||||
import { mkdir, readFile, rm, symlink, unlink, writeFile } from "fs/promises";
|
import * as esbuildWasm from "https://deno.land/x/esbuild@v0.14.54/wasm.js";
|
||||||
import path from "path";
|
import * as esbuildNative from "https://deno.land/x/esbuild@v0.14.54/mod.js";
|
||||||
import { tmpdir } from "os";
|
|
||||||
import { nodeModulesDir } from "./environments/node_sandbox";
|
export const esbuild: typeof esbuildWasm =
|
||||||
import { promisify } from "util";
|
Deno.run === undefined ? esbuildWasm : esbuildNative;
|
||||||
import { execFile } from "child_process";
|
|
||||||
const execFilePromise = promisify(execFile);
|
import { path } from "../../mod.ts";
|
||||||
|
import { denoPlugin } from "../esbuild_deno_loader/mod.ts";
|
||||||
|
|
||||||
export async function compile(
|
export async function compile(
|
||||||
filePath: string,
|
filePath: string,
|
||||||
functionName: string | undefined = undefined,
|
functionName: string | undefined = undefined,
|
||||||
debug: boolean = false,
|
debug = false,
|
||||||
excludeModules: string[] = [],
|
excludeModules: string[] = [],
|
||||||
meta = false
|
meta = false
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
|
@ -20,7 +21,7 @@ export async function compile(
|
||||||
if (functionName) {
|
if (functionName) {
|
||||||
// Generate a new file importing just this one function and exporting it
|
// Generate a new file importing just this one function and exporting it
|
||||||
inFile = path.resolve(path.dirname(filePath), "_in.ts");
|
inFile = path.resolve(path.dirname(filePath), "_in.ts");
|
||||||
await writeFile(
|
await Deno.writeTextFile(
|
||||||
inFile,
|
inFile,
|
||||||
`import {${functionName}} from "./${path.basename(
|
`import {${functionName}} from "./${path.basename(
|
||||||
filePath
|
filePath
|
||||||
|
@ -28,6 +29,8 @@ export async function compile(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log("External modules", excludeModules);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// TODO: Figure out how to make source maps work correctly with eval() code
|
// TODO: Figure out how to make source maps work correctly with eval() code
|
||||||
let result = await esbuild.build({
|
let result = await esbuild.build({
|
||||||
|
@ -41,6 +44,12 @@ export async function compile(
|
||||||
outfile: outFile,
|
outfile: outFile,
|
||||||
metafile: true,
|
metafile: true,
|
||||||
external: excludeModules,
|
external: excludeModules,
|
||||||
|
treeShaking: true,
|
||||||
|
plugins: [
|
||||||
|
denoPlugin({
|
||||||
|
importMapURL: new URL("./../../import_map.json", import.meta.url),
|
||||||
|
}),
|
||||||
|
],
|
||||||
loader: {
|
loader: {
|
||||||
".css": "text",
|
".css": "text",
|
||||||
".md": "text",
|
".md": "text",
|
||||||
|
@ -59,12 +68,12 @@ export async function compile(
|
||||||
console.log("Bundle info for", functionName, text);
|
console.log("Bundle info for", functionName, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
let jsCode = (await readFile(outFile)).toString();
|
let jsCode = await Deno.readTextFile(outFile);
|
||||||
await unlink(outFile);
|
await Deno.remove(outFile);
|
||||||
return `(() => { ${jsCode} return mod;})()`;
|
return `(() => { ${jsCode} return mod;})()`;
|
||||||
} finally {
|
} finally {
|
||||||
if (inFile !== filePath) {
|
if (inFile !== filePath) {
|
||||||
await unlink(inFile);
|
await Deno.remove(inFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,74 +83,61 @@ export async function compileModule(
|
||||||
moduleName: string
|
moduleName: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let inFile = path.resolve(cwd, "_in.ts");
|
let inFile = path.resolve(cwd, "_in.ts");
|
||||||
await writeFile(inFile, `export * from "${moduleName}";`);
|
await Deno.writeTextFile(inFile, `export * from "${moduleName}";`);
|
||||||
let code = await compile(inFile);
|
let code = await compile(inFile);
|
||||||
await unlink(inFile);
|
await Deno.remove(inFile);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Reconsider this later
|
// export async function sandboxCompile(
|
||||||
const exposedModules = [
|
// filename: string,
|
||||||
"@silverbulletmd/plugos-silverbullet-syscall",
|
// code: string,
|
||||||
"@plugos/plugos-syscall",
|
// functionName?: string,
|
||||||
];
|
// debug: boolean = false,
|
||||||
|
// installModules: string[] = [],
|
||||||
|
// globalModules: string[] = []
|
||||||
|
// ): Promise<string> {
|
||||||
|
// let tmpDir = `${tmpdir()}/plugos-${Math.random()}`;
|
||||||
|
// await mkdir(tmpDir, { recursive: true });
|
||||||
|
|
||||||
export async function sandboxCompile(
|
// const srcNodeModules = `${nodeModulesDir}/node_modules`;
|
||||||
filename: string,
|
// const targetNodeModules = `${tmpDir}/node_modules`;
|
||||||
code: string,
|
|
||||||
functionName?: string,
|
|
||||||
debug: boolean = false,
|
|
||||||
installModules: string[] = [],
|
|
||||||
globalModules: string[] = []
|
|
||||||
): Promise<string> {
|
|
||||||
let tmpDir = `${tmpdir()}/plugos-${Math.random()}`;
|
|
||||||
await mkdir(tmpDir, { recursive: true });
|
|
||||||
|
|
||||||
const srcNodeModules = `${nodeModulesDir}/node_modules`;
|
// await mkdir(`${targetNodeModules}/@silverbulletmd`, { recursive: true });
|
||||||
const targetNodeModules = `${tmpDir}/node_modules`;
|
// await mkdir(`${targetNodeModules}/@plugos`, { recursive: true });
|
||||||
|
// for (const exposedModule of exposedModules) {
|
||||||
|
// await symlink(
|
||||||
|
// `${srcNodeModules}/${exposedModule}`,
|
||||||
|
// `${targetNodeModules}/${exposedModule}`,
|
||||||
|
// "dir"
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// for (let moduleName of installModules) {
|
||||||
|
// await execFilePromise("npm", ["install", moduleName], {
|
||||||
|
// cwd: tmpDir,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
await mkdir(`${targetNodeModules}/@silverbulletmd`, { recursive: true });
|
// await writeFile(`${tmpDir}/${filename}`, code);
|
||||||
await mkdir(`${targetNodeModules}/@plugos`, { recursive: true });
|
// let jsCode = await compile(
|
||||||
for (const exposedModule of exposedModules) {
|
// `${tmpDir}/${filename}`,
|
||||||
await symlink(
|
// functionName,
|
||||||
`${srcNodeModules}/${exposedModule}`,
|
// debug,
|
||||||
`${targetNodeModules}/${exposedModule}`,
|
// globalModules
|
||||||
"dir"
|
// );
|
||||||
);
|
// await rm(tmpDir, { recursive: true });
|
||||||
}
|
// return jsCode;
|
||||||
for (let moduleName of installModules) {
|
// }
|
||||||
await execFilePromise("npm", ["install", moduleName], {
|
|
||||||
cwd: tmpDir,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
await writeFile(`${tmpDir}/${filename}`, code);
|
|
||||||
let jsCode = await compile(
|
|
||||||
`${tmpDir}/${filename}`,
|
|
||||||
functionName,
|
|
||||||
debug,
|
|
||||||
globalModules
|
|
||||||
);
|
|
||||||
await rm(tmpDir, { recursive: true });
|
|
||||||
return jsCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function sandboxCompileModule(
|
export async function sandboxCompileModule(
|
||||||
moduleName: string,
|
moduleUrl: string,
|
||||||
globalModules: string[] = []
|
globalModules: string[] = []
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
let [modulePart, path] = moduleName.split(":");
|
await Deno.writeTextFile(
|
||||||
let modulePieces = modulePart.split("@");
|
"_mod.ts",
|
||||||
let cleanModulesName = modulePieces
|
`module.exports = require("${moduleUrl}");`
|
||||||
.slice(0, modulePieces.length - 1)
|
|
||||||
.join("@");
|
|
||||||
return sandboxCompile(
|
|
||||||
"module.ts",
|
|
||||||
// `export * from "${cleanModulesName}${path ? path : ""}";`,
|
|
||||||
`module.exports = require("${cleanModulesName}${path ? path : ""}");`,
|
|
||||||
undefined,
|
|
||||||
true,
|
|
||||||
[modulePart],
|
|
||||||
globalModules
|
|
||||||
);
|
);
|
||||||
|
let code = await compile("_mod.ts", undefined, false, globalModules);
|
||||||
|
await Deno.remove("_mod.ts");
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
import { safeRun } from "../util.ts";
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
// import workerCode from "bundle-text:./node_worker.ts";
|
||||||
|
import { Sandbox } from "../sandbox.ts";
|
||||||
|
import { WorkerLike } from "./worker.ts";
|
||||||
|
import { Plug } from "../plug.ts";
|
||||||
|
|
||||||
|
class DenoWorkerWrapper implements WorkerLike {
|
||||||
|
private worker: Worker;
|
||||||
|
onMessage?: (message: any) => Promise<void>;
|
||||||
|
ready: Promise<void>;
|
||||||
|
|
||||||
|
constructor(worker: Worker) {
|
||||||
|
this.worker = worker;
|
||||||
|
this.worker.addEventListener("message", (evt: any) => {
|
||||||
|
let data = evt.data;
|
||||||
|
if (!data) return;
|
||||||
|
safeRun(async () => {
|
||||||
|
await this.onMessage!(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.ready = Promise.resolve();
|
||||||
|
}
|
||||||
|
postMessage(message: any): void {
|
||||||
|
this.worker.postMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
terminate() {
|
||||||
|
return this.worker.terminate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createSandbox(plug: Plug<any>) {
|
||||||
|
let worker = new Worker(
|
||||||
|
new URL("./sandbox_worker.ts", import.meta.url).href,
|
||||||
|
{
|
||||||
|
type: "module",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return new Sandbox(plug, new DenoWorkerWrapper(worker));
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<script type="module">
|
|
||||||
// Sup yo!
|
|
||||||
import "./sandbox_worker";
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,55 +0,0 @@
|
||||||
import { safeRun } from "../util";
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import sandboxHtml from "bundle-text:./iframe_sandbox.html";
|
|
||||||
import { Sandbox } from "../sandbox";
|
|
||||||
import { WorkerLike } from "./worker";
|
|
||||||
import { Plug } from "../plug";
|
|
||||||
|
|
||||||
class IFrameWrapper implements WorkerLike {
|
|
||||||
private iframe: HTMLIFrameElement;
|
|
||||||
onMessage?: (message: any) => Promise<void>;
|
|
||||||
ready: Promise<void>;
|
|
||||||
private messageListener: (evt: any) => void;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
const iframe = document.createElement("iframe", {});
|
|
||||||
this.iframe = iframe;
|
|
||||||
iframe.style.display = "none";
|
|
||||||
// Let's lock this down significantly
|
|
||||||
iframe.setAttribute("sandbox", "allow-scripts");
|
|
||||||
iframe.srcdoc = sandboxHtml;
|
|
||||||
this.messageListener = (evt: any) => {
|
|
||||||
if (evt.source !== iframe.contentWindow) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let data = evt.data;
|
|
||||||
if (!data) return;
|
|
||||||
safeRun(async () => {
|
|
||||||
await this.onMessage!(data);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
window.addEventListener("message", this.messageListener);
|
|
||||||
document.body.appendChild(iframe);
|
|
||||||
this.ready = new Promise((resolve) => {
|
|
||||||
iframe.onload = () => {
|
|
||||||
resolve();
|
|
||||||
iframe.onload = null;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
postMessage(message: any): void {
|
|
||||||
this.iframe.contentWindow!.postMessage(message, "*");
|
|
||||||
}
|
|
||||||
|
|
||||||
terminate() {
|
|
||||||
console.log("Terminating iframe sandbox");
|
|
||||||
window.removeEventListener("message", this.messageListener);
|
|
||||||
return this.iframe.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createSandbox(plug: Plug<any>) {
|
|
||||||
return new Sandbox(plug, new IFrameWrapper());
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
import { Worker } from "worker_threads";
|
|
||||||
import { safeRun } from "../util";
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import workerCode from "bundle-text:./node_worker.ts";
|
|
||||||
import { Sandbox } from "../sandbox";
|
|
||||||
import { WorkerLike } from "./worker";
|
|
||||||
import { Plug } from "../plug";
|
|
||||||
import path from "path";
|
|
||||||
import fs from "fs";
|
|
||||||
|
|
||||||
class NodeWorkerWrapper implements WorkerLike {
|
|
||||||
onMessage?: (message: any) => Promise<void>;
|
|
||||||
ready: Promise<void>;
|
|
||||||
private worker: Worker;
|
|
||||||
|
|
||||||
constructor(worker: Worker) {
|
|
||||||
this.worker = worker;
|
|
||||||
worker.on("message", (message: any) => {
|
|
||||||
safeRun(async () => {
|
|
||||||
await this.onMessage!(message);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
this.ready = new Promise((resolve) => {
|
|
||||||
worker.once("online", resolve);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
postMessage(message: any): void {
|
|
||||||
this.worker.postMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
terminate(): void {
|
|
||||||
this.worker.terminate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look for the node_modules directory, to be passed to the worker to find e.g. the vm2 module
|
|
||||||
export let nodeModulesDir = __dirname;
|
|
||||||
|
|
||||||
while (
|
|
||||||
!fs.existsSync(nodeModulesDir + "/node_modules/vm2") &&
|
|
||||||
nodeModulesDir !== "/"
|
|
||||||
) {
|
|
||||||
nodeModulesDir = path.dirname(nodeModulesDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createSandbox(plug: Plug<any>) {
|
|
||||||
let worker = new Worker(workerCode, {
|
|
||||||
eval: true,
|
|
||||||
workerData: {
|
|
||||||
nodeModulesPath: path.join(nodeModulesDir, "node_modules"),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return new Sandbox(plug, new NodeWorkerWrapper(worker));
|
|
||||||
}
|
|
|
@ -1,158 +0,0 @@
|
||||||
import { ConsoleLogger } from "./custom_logger";
|
|
||||||
|
|
||||||
const {
|
|
||||||
parentPort,
|
|
||||||
workerData: { nodeModulesPath },
|
|
||||||
} = require("worker_threads");
|
|
||||||
|
|
||||||
const { VM, VMScript } = require(`${nodeModulesPath}/vm2`);
|
|
||||||
|
|
||||||
let loadedFunctions = new Map<string, Function>();
|
|
||||||
let pendingRequests = new Map<
|
|
||||||
number,
|
|
||||||
{
|
|
||||||
resolve: (result: unknown) => void;
|
|
||||||
reject: (e: any) => void;
|
|
||||||
}
|
|
||||||
>();
|
|
||||||
|
|
||||||
let syscallReqId = 0;
|
|
||||||
|
|
||||||
let consoleLogger = new ConsoleLogger((level, message) => {
|
|
||||||
parentPort.postMessage({
|
|
||||||
type: "log",
|
|
||||||
level,
|
|
||||||
message,
|
|
||||||
});
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
let loadedModules = new Map<string, any>();
|
|
||||||
|
|
||||||
// HACK to make Mattermost client work...
|
|
||||||
loadedModules.set("form-data", require(`${nodeModulesPath}/form-data`));
|
|
||||||
|
|
||||||
let vm = new VM({
|
|
||||||
sandbox: {
|
|
||||||
// Exposing some "safe" APIs
|
|
||||||
console: consoleLogger,
|
|
||||||
setTimeout,
|
|
||||||
clearTimeout,
|
|
||||||
setInterval,
|
|
||||||
URL,
|
|
||||||
clearInterval,
|
|
||||||
TextEncoder,
|
|
||||||
TextDecoder,
|
|
||||||
fetch: require(`${nodeModulesPath}/node-fetch`),
|
|
||||||
WebSocket: require(`${nodeModulesPath}/ws`),
|
|
||||||
// This is only going to be called for pre-bundled modules, we won't allow
|
|
||||||
// arbitrary requiring of modules
|
|
||||||
require: (moduleName: string): any => {
|
|
||||||
// console.log("Loading module", moduleName);
|
|
||||||
// if (preloadedModules.includes(moduleName)) {
|
|
||||||
// return require(`${nodeModulesPath}/${moduleName}`);
|
|
||||||
// } else
|
|
||||||
if (loadedModules.has(moduleName)) {
|
|
||||||
let mod = loadedModules.get(moduleName);
|
|
||||||
// console.log("And it has the value", mod);
|
|
||||||
return mod;
|
|
||||||
} else {
|
|
||||||
throw Error(`Cannot import arbitrary modules like ${moduleName}`);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
self: {
|
|
||||||
syscall: (name: string, ...args: any[]) => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
syscallReqId++;
|
|
||||||
pendingRequests.set(syscallReqId, { resolve, reject });
|
|
||||||
parentPort.postMessage({
|
|
||||||
type: "syscall",
|
|
||||||
id: syscallReqId,
|
|
||||||
name,
|
|
||||||
// TODO: Figure out why this is necessary (to avoide a CloneError)
|
|
||||||
args: JSON.parse(JSON.stringify(args)),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
function wrapScript(code: string) {
|
|
||||||
return `(${code})["default"]`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function safeRun(fn: any) {
|
|
||||||
fn().catch((e: any) => {
|
|
||||||
console.error(e);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
parentPort.on("message", (data: any) => {
|
|
||||||
safeRun(async () => {
|
|
||||||
switch (data.type) {
|
|
||||||
case "load":
|
|
||||||
loadedFunctions.set(data.name, new VMScript(wrapScript(data.code)));
|
|
||||||
parentPort.postMessage({
|
|
||||||
type: "inited",
|
|
||||||
name: data.name,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "load-dependency":
|
|
||||||
// console.log("Asked to load dep", data.name);
|
|
||||||
try {
|
|
||||||
let r = vm.run(data.code);
|
|
||||||
// console.log("Loaded dependency", r);
|
|
||||||
loadedModules.set(data.name, r);
|
|
||||||
parentPort.postMessage({
|
|
||||||
type: "dependency-inited",
|
|
||||||
name: data.name,
|
|
||||||
});
|
|
||||||
} catch (e: any) {
|
|
||||||
console.error("Could not load dependency", e.message);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "invoke":
|
|
||||||
let fn = loadedFunctions.get(data.name);
|
|
||||||
if (!fn) {
|
|
||||||
throw new Error(`Function not loaded: ${data.name}`);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
let r = vm.run(fn);
|
|
||||||
let result = await Promise.resolve(r(...data.args));
|
|
||||||
parentPort.postMessage({
|
|
||||||
type: "result",
|
|
||||||
id: data.id,
|
|
||||||
// TOOD: Figure out if this is necessary, because it's expensive
|
|
||||||
result: result && JSON.parse(JSON.stringify(result)),
|
|
||||||
});
|
|
||||||
} catch (e: any) {
|
|
||||||
// console.error("Error caught", e, "Stack", e.stack);
|
|
||||||
parentPort.postMessage({
|
|
||||||
type: "result",
|
|
||||||
id: data.id,
|
|
||||||
error: e.message,
|
|
||||||
stack: e.stack,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "syscall-response":
|
|
||||||
let syscallId = data.id;
|
|
||||||
const lookup = pendingRequests.get(syscallId);
|
|
||||||
if (!lookup) {
|
|
||||||
throw Error("Invalid request id");
|
|
||||||
}
|
|
||||||
pendingRequests.delete(syscallId);
|
|
||||||
if (data.error) {
|
|
||||||
// console.log("Got rejection", data.error);
|
|
||||||
lookup.reject(new Error(data.error));
|
|
||||||
} else {
|
|
||||||
lookup.resolve(data.result);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
process.on("uncaughtException", (e) => {
|
|
||||||
console.error("Uncaught error", e);
|
|
||||||
});
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { safeRun } from "../util";
|
import { safeRun } from "../util.ts";
|
||||||
import { ConsoleLogger } from "./custom_logger";
|
import { ConsoleLogger } from "./custom_logger.ts";
|
||||||
import { ControllerMessage, WorkerMessage } from "./worker";
|
import { ControllerMessage, WorkerMessage } from "./worker.ts";
|
||||||
|
|
||||||
let loadedFunctions = new Map<string, Function>();
|
let loadedFunctions = new Map<string, Function>();
|
||||||
let pendingRequests = new Map<
|
let pendingRequests = new Map<
|
||||||
|
@ -43,7 +43,7 @@ let loadedModules = new Map<string, any>();
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
self.require = (moduleName: string): any => {
|
self.require = (moduleName: string): any => {
|
||||||
// console.log("Loading", moduleName, loadedModules.get(moduleName));
|
console.log("Requiring", moduleName, loadedModules.get(moduleName));
|
||||||
return loadedModules.get(moduleName);
|
return loadedModules.get(moduleName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,15 +61,19 @@ self.addEventListener("message", (event: { data: WorkerMessage }) => {
|
||||||
let data = event.data;
|
let data = event.data;
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case "load":
|
case "load":
|
||||||
|
{
|
||||||
let fn2 = new Function(wrapScript(data.code!));
|
let fn2 = new Function(wrapScript(data.code!));
|
||||||
loadedFunctions.set(data.name!, fn2());
|
loadedFunctions.set(data.name!, fn2());
|
||||||
workerPostMessage({
|
workerPostMessage({
|
||||||
type: "inited",
|
type: "inited",
|
||||||
name: data.name,
|
name: data.name,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "load-dependency":
|
case "load-dependency":
|
||||||
// console.log("Received dep", data.name);
|
{
|
||||||
|
console.log("Received dep", data.name);
|
||||||
let fn3 = new Function(`return ${data.code!}`);
|
let fn3 = new Function(`return ${data.code!}`);
|
||||||
let v = fn3();
|
let v = fn3();
|
||||||
loadedModules.set(data.name!, v);
|
loadedModules.set(data.name!, v);
|
||||||
|
@ -78,8 +82,10 @@ self.addEventListener("message", (event: { data: WorkerMessage }) => {
|
||||||
type: "dependency-inited",
|
type: "dependency-inited",
|
||||||
name: data.name,
|
name: data.name,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "invoke":
|
case "invoke":
|
||||||
|
{
|
||||||
let fn = loadedFunctions.get(data.name!);
|
let fn = loadedFunctions.get(data.name!);
|
||||||
if (!fn) {
|
if (!fn) {
|
||||||
throw new Error(`Function not loaded: ${data.name}`);
|
throw new Error(`Function not loaded: ${data.name}`);
|
||||||
|
@ -101,9 +107,11 @@ self.addEventListener("message", (event: { data: WorkerMessage }) => {
|
||||||
// console.error("Error invoking function", data.name, e.message);
|
// console.error("Error invoking function", data.name, e.message);
|
||||||
// throw e;
|
// throw e;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "syscall-response":
|
case "syscall-response":
|
||||||
|
{
|
||||||
let syscallId = data.id!;
|
let syscallId = data.id!;
|
||||||
const lookup = pendingRequests.get(syscallId);
|
const lookup = pendingRequests.get(syscallId);
|
||||||
if (!lookup) {
|
if (!lookup) {
|
||||||
|
@ -121,6 +129,8 @@ self.addEventListener("message", (event: { data: WorkerMessage }) => {
|
||||||
} else {
|
} else {
|
||||||
lookup.resolve(data.result);
|
lookup.resolve(data.result);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { safeRun } from "../util";
|
import { safeRun } from "../util.ts";
|
||||||
import { Sandbox } from "../sandbox";
|
import { Sandbox } from "../sandbox.ts";
|
||||||
import { WorkerLike } from "./worker";
|
import { WorkerLike } from "./worker.ts";
|
||||||
import { Plug } from "../plug";
|
import type { Plug } from "../plug.ts";
|
||||||
|
|
||||||
class WebWorkerWrapper implements WorkerLike {
|
class WebWorkerWrapper implements WorkerLike {
|
||||||
private worker: Worker;
|
private worker: Worker;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { LogLevel } from "./custom_logger";
|
import type { LogLevel } from "./custom_logger.ts";
|
||||||
|
|
||||||
export type ControllerMessageType =
|
export type ControllerMessageType =
|
||||||
| "inited"
|
| "inited"
|
||||||
|
|
|
@ -9,11 +9,11 @@ export abstract class EventEmitter<HandlerT> {
|
||||||
this.handlers = this.handlers.filter((h) => h !== handlers);
|
this.handlers = this.handlers.filter((h) => h !== handlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(eventName: keyof HandlerT, ...args: any[]) {
|
async emit(eventName: keyof HandlerT, ...args: any[]): Promise<void> {
|
||||||
for (let handler of this.handlers) {
|
for (const handler of this.handlers) {
|
||||||
let fn: any = handler[eventName];
|
const fn: any = handler[eventName];
|
||||||
if (fn) {
|
if (fn) {
|
||||||
fn(...args);
|
await Promise.resolve(fn(...args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Hook, Manifest } from "../types";
|
import type { Hook, Manifest } from "../types.ts";
|
||||||
import { System } from "../system";
|
import { System } from "../system.ts";
|
||||||
import { safeRun } from "../util";
|
import { safeRun } from "../util.ts";
|
||||||
import { EventEmitter } from "events";
|
|
||||||
|
|
||||||
// System events:
|
// System events:
|
||||||
// - plug:load (plugName: string)
|
// - plug:load (plugName: string)
|
||||||
|
@ -28,9 +27,7 @@ export class EventHook implements Hook<EventHookT> {
|
||||||
}
|
}
|
||||||
let eventNames = new Set<string>();
|
let eventNames = new Set<string>();
|
||||||
for (const plug of this.system.loadedPlugs.values()) {
|
for (const plug of this.system.loadedPlugs.values()) {
|
||||||
for (const [name, functionDef] of Object.entries(
|
for (const functionDef of Object.values(plug.manifest!.functions)) {
|
||||||
plug.manifest!.functions
|
|
||||||
)) {
|
|
||||||
if (functionDef.events) {
|
if (functionDef.events) {
|
||||||
for (let eventName of functionDef.events) {
|
for (let eventName of functionDef.events) {
|
||||||
eventNames.add(eventName);
|
eventNames.add(eventName);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Hook, Manifest } from "../types";
|
import { Hook, Manifest } from "../types.ts";
|
||||||
import cron, { ScheduledTask } from "node-cron";
|
import { Cron } from "https://cdn.jsdelivr.net/gh/hexagon/croner@4/src/croner.js";
|
||||||
import { safeRun } from "../util";
|
import { safeRun } from "../util.ts";
|
||||||
import { System } from "../system";
|
import { System } from "../system.ts";
|
||||||
|
|
||||||
export type CronHookT = {
|
export type CronHookT = {
|
||||||
cron?: string | string[];
|
cron?: string | string[];
|
||||||
|
@ -9,7 +9,7 @@ export type CronHookT = {
|
||||||
|
|
||||||
export class NodeCronHook implements Hook<CronHookT> {
|
export class NodeCronHook implements Hook<CronHookT> {
|
||||||
apply(system: System<CronHookT>): void {
|
apply(system: System<CronHookT>): void {
|
||||||
let tasks: ScheduledTask[] = [];
|
let tasks: Cron[] = [];
|
||||||
system.on({
|
system.on({
|
||||||
plugLoaded: () => {
|
plugLoaded: () => {
|
||||||
reloadCrons();
|
reloadCrons();
|
||||||
|
@ -37,9 +37,9 @@ export class NodeCronHook implements Hook<CronHookT> {
|
||||||
const crons = Array.isArray(functionDef.cron)
|
const crons = Array.isArray(functionDef.cron)
|
||||||
? functionDef.cron
|
? functionDef.cron
|
||||||
: [functionDef.cron];
|
: [functionDef.cron];
|
||||||
for (let cronDef of crons) {
|
for (const cronDef of crons) {
|
||||||
tasks.push(
|
tasks.push(
|
||||||
cron.schedule(cronDef, () => {
|
new Cron(cronDef, () => {
|
||||||
console.log("Now acting on cron", cronDef);
|
console.log("Now acting on cron", cronDef);
|
||||||
safeRun(async () => {
|
safeRun(async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -57,7 +57,7 @@ export class NodeCronHook implements Hook<CronHookT> {
|
||||||
}
|
}
|
||||||
|
|
||||||
validateManifest(manifest: Manifest<CronHookT>): string[] {
|
validateManifest(manifest: Manifest<CronHookT>): string[] {
|
||||||
let errors = [];
|
let errors: string[] = [];
|
||||||
for (const [name, functionDef] of Object.entries(manifest.functions)) {
|
for (const [name, functionDef] of Object.entries(manifest.functions)) {
|
||||||
if (!functionDef.cron) {
|
if (!functionDef.cron) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -66,9 +66,9 @@ export class NodeCronHook implements Hook<CronHookT> {
|
||||||
? functionDef.cron
|
? functionDef.cron
|
||||||
: [functionDef.cron];
|
: [functionDef.cron];
|
||||||
for (let cronDef of crons) {
|
for (let cronDef of crons) {
|
||||||
if (!cron.validate(cronDef)) {
|
// if (!cron.validate(cronDef)) {
|
||||||
errors.push(`Invalid cron expression ${cronDef}`);
|
// errors.push(`Invalid cron expression ${cronDef}`);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return errors;
|
return errors;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Manifest, RuntimeEnvironment } from "./types";
|
import { Manifest, RuntimeEnvironment } from "./types.ts";
|
||||||
import { Sandbox } from "./sandbox";
|
import { Sandbox } from "./sandbox.ts";
|
||||||
import { System } from "./system";
|
import { System } from "./system.ts";
|
||||||
|
|
||||||
export class Plug<HookT> {
|
export class Plug<HookT> {
|
||||||
system: System<HookT>;
|
system: System<HookT>;
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
import fs from "fs/promises";
|
|
||||||
import watch from "node-watch";
|
|
||||||
import path from "path";
|
|
||||||
import { createSandbox } from "./environments/node_sandbox";
|
|
||||||
import { System } from "./system";
|
|
||||||
import { Manifest } from "./types";
|
|
||||||
|
|
||||||
export class DiskPlugLoader<HookT> {
|
|
||||||
private system: System<HookT>;
|
|
||||||
private plugPath: string;
|
|
||||||
|
|
||||||
constructor(system: System<HookT>, plugPath: string) {
|
|
||||||
this.system = system;
|
|
||||||
this.plugPath = plugPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
watcher() {
|
|
||||||
watch(this.plugPath, (eventType, localPath) => {
|
|
||||||
if (!localPath.endsWith(".plug.json")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Promise.resolve()
|
|
||||||
.then(async () => {
|
|
||||||
try {
|
|
||||||
// let localPath = path.join(this.plugPath, filename);
|
|
||||||
console.log("Change detected for", localPath);
|
|
||||||
try {
|
|
||||||
await fs.stat(localPath);
|
|
||||||
} catch (e) {
|
|
||||||
// Likely removed
|
|
||||||
console.log("Plug removed, TODO: Unload");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const plugDef = await this.loadPlugFromFile(localPath);
|
|
||||||
} catch (e) {
|
|
||||||
console.log("Ignoring something FYI", e);
|
|
||||||
// ignore, error handled by loadPlug
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(console.error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async loadPlugFromFile(localPath: string) {
|
|
||||||
const plug = await fs.readFile(localPath, "utf8");
|
|
||||||
|
|
||||||
try {
|
|
||||||
const plugDef: Manifest<HookT> = JSON.parse(plug);
|
|
||||||
console.log("Now loading plug", plugDef.name);
|
|
||||||
await this.system.load(plugDef, createSandbox);
|
|
||||||
return plugDef;
|
|
||||||
} catch (e) {
|
|
||||||
console.error("Could not parse plugin file", e);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async loadPlugs() {
|
|
||||||
for (let filename of await fs.readdir(this.plugPath)) {
|
|
||||||
if (filename.endsWith(".plug.json")) {
|
|
||||||
let localPath = path.join(this.plugPath, filename);
|
|
||||||
await this.loadPlugFromFile(localPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +1,14 @@
|
||||||
import { createSandbox } from "./environments/node_sandbox";
|
import { createSandbox } from "./environments/deno_sandbox.ts";
|
||||||
import { expect, test } from "@jest/globals";
|
import { System } from "./system.ts";
|
||||||
import { System } from "./system";
|
|
||||||
|
|
||||||
test("Run a Node sandbox", async () => {
|
import {
|
||||||
let system = new System("server");
|
assertEquals,
|
||||||
|
assert,
|
||||||
|
} from "https://deno.land/std@0.158.0/testing/asserts.ts";
|
||||||
|
import { denoPlugin } from "../esbuild_deno_loader/mod.ts";
|
||||||
|
|
||||||
|
Deno.test("Run a deno sandbox", async () => {
|
||||||
|
const system = new System("server");
|
||||||
system.registerSyscalls([], {
|
system.registerSyscalls([], {
|
||||||
addNumbers: (ctx, a, b) => {
|
addNumbers: (ctx, a, b) => {
|
||||||
return a + b;
|
return a + b;
|
||||||
|
@ -85,31 +90,83 @@ test("Run a Node sandbox", async () => {
|
||||||
},
|
},
|
||||||
createSandbox
|
createSandbox
|
||||||
);
|
);
|
||||||
expect(await plug.invoke("addTen", [10])).toBe(20);
|
assertEquals(await plug.invoke("addTen", [10]), 20);
|
||||||
for (let i = 0; i < 100; i++) {
|
for (let i = 0; i < 100; i++) {
|
||||||
expect(await plug.invoke("addNumbersSyscall", [10, i])).toBe(10 + i);
|
assertEquals(await plug.invoke("addNumbersSyscall", [10, i]), 10 + i);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await plug.invoke("errorOut", []);
|
await plug.invoke("errorOut", []);
|
||||||
expect(true).toBe(false);
|
assert(false);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
expect(e.message).toContain("BOOM");
|
assert(e.message.indexOf("BOOM") !== -1);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await plug.invoke("errorOutSys", []);
|
await plug.invoke("errorOutSys", []);
|
||||||
expect(true).toBe(false);
|
assert(false);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
expect(e.message).toContain("#fail");
|
assert(e.message.indexOf("#fail") !== -1);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await plug.invoke("restrictedTest", []);
|
await plug.invoke("restrictedTest", []);
|
||||||
expect(true).toBe(false);
|
assert(false);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
expect(e.message).toContain(
|
assert(
|
||||||
|
e.message.indexOf(
|
||||||
"Missing permission 'restricted' for syscall restrictedSyscall"
|
"Missing permission 'restricted' for syscall restrictedSyscall"
|
||||||
|
) !== -1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
expect(await plug.invoke("dangerousTest", [])).toBe("yay");
|
assertEquals(await plug.invoke("dangerousTest", []), "yay");
|
||||||
|
|
||||||
await system.unloadAll();
|
await system.unloadAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
import { run as bundleRun } from "./bin/plugos-bundle.ts";
|
||||||
|
import { esbuild } from "./compile.ts";
|
||||||
|
import { safeRun } from "./util.ts";
|
||||||
|
const __dirname = new URL(".", import.meta.url).pathname;
|
||||||
|
|
||||||
|
Deno.test("Preload dependencies", async () => {
|
||||||
|
const tmpDist = `${__dirname}tmp_dist`;
|
||||||
|
await bundleRun({
|
||||||
|
_: [`${__dirname}../plugs/global.plug.yaml`],
|
||||||
|
debug: true,
|
||||||
|
dist: tmpDist,
|
||||||
|
exclude: [],
|
||||||
|
});
|
||||||
|
const globalModules = JSON.parse(
|
||||||
|
Deno.readTextFileSync(`${tmpDist}/global.plug.json`)
|
||||||
|
);
|
||||||
|
await bundleRun({
|
||||||
|
_: [`${__dirname}test.plug.yaml`],
|
||||||
|
debug: true,
|
||||||
|
dist: tmpDist,
|
||||||
|
exclude: Object.keys(globalModules.dependencies),
|
||||||
|
});
|
||||||
|
esbuild.stop();
|
||||||
|
|
||||||
|
const system = new System("server");
|
||||||
|
system.on({
|
||||||
|
plugLoaded: async (plug) => {
|
||||||
|
for (let [modName, code] of Object.entries(globalModules.dependencies)) {
|
||||||
|
await plug.sandbox.loadDependency(modName, code as string);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Load test module
|
||||||
|
console.log("Loading test module");
|
||||||
|
const testPlug = await system.load(
|
||||||
|
JSON.parse(Deno.readTextFileSync(`${tmpDist}/test.plug.json`)),
|
||||||
|
createSandbox
|
||||||
|
);
|
||||||
|
console.log("Running");
|
||||||
|
|
||||||
|
const result = await testPlug.invoke("boot", []);
|
||||||
|
|
||||||
|
console.log("Result", result);
|
||||||
|
|
||||||
|
await system.unloadAll();
|
||||||
|
|
||||||
|
Deno.removeSync(tmpDist, { recursive: true });
|
||||||
|
});
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import type { LogLevel } from "./environments/custom_logger";
|
import type { LogLevel } from "./environments/custom_logger.ts";
|
||||||
import {
|
import {
|
||||||
ControllerMessage,
|
ControllerMessage,
|
||||||
WorkerLike,
|
WorkerLike,
|
||||||
WorkerMessage,
|
WorkerMessage,
|
||||||
} from "./environments/worker";
|
} from "./environments/worker.ts";
|
||||||
import { Plug } from "./plug";
|
import { Plug } from "./plug.ts";
|
||||||
|
|
||||||
export type SandboxFactory<HookT> = (plug: Plug<HookT>) => Sandbox;
|
export type SandboxFactory<HookT> = (plug: Plug<HookT>) => Sandbox;
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ export class Sandbox {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadDependency(name: string, code: string): Promise<void> {
|
loadDependency(name: string, code: string): Promise<void> {
|
||||||
// console.log("Loading dependency", name);
|
console.log("Loading dependency", name);
|
||||||
this.worker.postMessage({
|
this.worker.postMessage({
|
||||||
type: "load-dependency",
|
type: "load-dependency",
|
||||||
name: name,
|
name: name,
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { SysCallMapping } from "../system";
|
import { SysCallMapping } from "../system.ts";
|
||||||
import { EventHook } from "../hooks/event";
|
import { EventHook } from "../hooks/event.ts";
|
||||||
|
|
||||||
export function eventSyscalls(eventHook: EventHook): SysCallMapping {
|
export function eventSyscalls(eventHook: EventHook): SysCallMapping {
|
||||||
return {
|
return {
|
||||||
"event.dispatch": async (ctx, eventName: string, data: any) => {
|
"event.dispatch": (ctx, eventName: string, data: any) => {
|
||||||
return eventHook.dispatchEvent(eventName, data);
|
return eventHook.dispatchEvent(eventName, data);
|
||||||
},
|
},
|
||||||
"event.list": async () => {
|
"event.list": () => {
|
||||||
return eventHook.listEvents();
|
return eventHook.listEvents();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import { readdir, readFile, stat, writeFile, unlink, mkdir } from "fs/promises";
|
import type { SysCallMapping } from "../system.ts";
|
||||||
import path from "path";
|
|
||||||
import type { SysCallMapping } from "../system";
|
|
||||||
|
|
||||||
export type FileMeta = {
|
export type FileMeta = {
|
||||||
name: string;
|
name: string;
|
||||||
lastModified: number;
|
lastModified: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function fileSystemSyscalls(root: string = "/"): SysCallMapping {
|
export default function fileSystemSyscalls(root = "/"): SysCallMapping {
|
||||||
function resolvedPath(p: string): string {
|
function resolvedPath(p: string): string {
|
||||||
p = path.resolve(root, p);
|
p = path.resolve(root, p);
|
||||||
if (!p.startsWith(root)) {
|
if (!p.startsWith(root)) {
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { SQLite3 } from "../../../mod.ts";
|
||||||
|
import { storeSyscalls } from "./store.dex_deno.ts";
|
||||||
|
|
||||||
|
Deno.test("store.dex", async () => {
|
||||||
|
const db = new SQLite3(":memory:");
|
||||||
|
const syscalls = storeSyscalls(db, "test");
|
||||||
|
const fakeCtx = {} as any;
|
||||||
|
await syscalls["store.put"](fakeCtx, "key", { value: "value" });
|
||||||
|
});
|
|
@ -0,0 +1,175 @@
|
||||||
|
import type { QueryBuilder } from "https://deno.land/x/dex@1.0.2/types/index.d.ts";
|
||||||
|
import { RowObject } from "https://deno.land/x/sqlite/mod.ts";
|
||||||
|
import type { SQLite3 } from "../../../mod.ts";
|
||||||
|
|
||||||
|
import { Dex } from "../../../mod.ts";
|
||||||
|
import { SysCallMapping } from "../system.ts";
|
||||||
|
|
||||||
|
export type Item = {
|
||||||
|
page: string;
|
||||||
|
key: string;
|
||||||
|
value: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KV = {
|
||||||
|
key: string;
|
||||||
|
value: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
const dex = Dex<Item>({ client: "sqlite3" });
|
||||||
|
|
||||||
|
export function ensureTable(db: SQLite3, tableName: string) {
|
||||||
|
const result = db.query<[string]>(
|
||||||
|
`SELECT name FROM sqlite_master WHERE type='table' AND name=?`,
|
||||||
|
[tableName],
|
||||||
|
);
|
||||||
|
if (result.length === 0) {
|
||||||
|
const createQuery = dex.schema.createTable(tableName, (table) => {
|
||||||
|
table.string("key");
|
||||||
|
table.text("value");
|
||||||
|
table.primary(["key"]);
|
||||||
|
}).toString();
|
||||||
|
|
||||||
|
db.query(createQuery);
|
||||||
|
|
||||||
|
console.log(`Created table ${tableName}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Query = {
|
||||||
|
filter?: Filter[];
|
||||||
|
orderBy?: string;
|
||||||
|
orderDesc?: boolean;
|
||||||
|
limit?: number;
|
||||||
|
select?: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Filter = {
|
||||||
|
op: string;
|
||||||
|
prop: string;
|
||||||
|
value: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function queryToKnex(
|
||||||
|
queryBuilder: QueryBuilder<Item, any>,
|
||||||
|
query: Query,
|
||||||
|
): QueryBuilder<Item, any> {
|
||||||
|
if (query.filter) {
|
||||||
|
for (const filter of query.filter) {
|
||||||
|
queryBuilder = queryBuilder.andWhereRaw(
|
||||||
|
`json_extract(value, '$.${filter.prop}') ${filter.op} ?`,
|
||||||
|
[filter.value],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (query.limit) {
|
||||||
|
queryBuilder = queryBuilder.limit(query.limit);
|
||||||
|
}
|
||||||
|
if (query.orderBy) {
|
||||||
|
queryBuilder = queryBuilder.orderByRaw(
|
||||||
|
`json_extract(value, '$.${query.orderBy}') ${
|
||||||
|
query.orderDesc ? "desc" : "asc"
|
||||||
|
}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return queryBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
function asyncQuery<T extends RowObject>(
|
||||||
|
db: SQLite3,
|
||||||
|
query: QueryBuilder<any, any>,
|
||||||
|
): Promise<T[]> {
|
||||||
|
return Promise.resolve(db.queryEntries<T>(query.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
function asyncExecute(
|
||||||
|
db: SQLite3,
|
||||||
|
query: QueryBuilder<any, any>,
|
||||||
|
): Promise<void> {
|
||||||
|
return Promise.resolve(db.execute(query.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function storeSyscalls(
|
||||||
|
db: SQLite3,
|
||||||
|
tableName: string,
|
||||||
|
): SysCallMapping {
|
||||||
|
const apiObj: SysCallMapping = {
|
||||||
|
"store.delete": async (_ctx, key: string) => {
|
||||||
|
await asyncExecute(db, dex(tableName).where({ key }).del());
|
||||||
|
},
|
||||||
|
"store.deletePrefix": async (_ctx, prefix: string) => {
|
||||||
|
await asyncExecute(
|
||||||
|
db,
|
||||||
|
dex(tableName).whereRaw(`"key" LIKE "${prefix}%"`).del(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
"store.deleteQuery": async (_ctx, query: Query) => {
|
||||||
|
await asyncExecute(db, queryToKnex(dex(tableName), query).del());
|
||||||
|
},
|
||||||
|
"store.deleteAll": async () => {
|
||||||
|
await asyncExecute(db, dex(tableName).del());
|
||||||
|
},
|
||||||
|
"store.set": async (_ctx, key: string, value: any) => {
|
||||||
|
await asyncExecute(
|
||||||
|
db,
|
||||||
|
dex(tableName).where({ key }).update("value", JSON.stringify(value)),
|
||||||
|
);
|
||||||
|
if (db.changes === 0) {
|
||||||
|
await asyncExecute(
|
||||||
|
db,
|
||||||
|
dex(tableName).insert({
|
||||||
|
key,
|
||||||
|
value: JSON.stringify(value),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// TODO: Optimize
|
||||||
|
"store.batchSet": async (ctx, kvs: KV[]) => {
|
||||||
|
for (let { key, value } of kvs) {
|
||||||
|
await apiObj["store.set"](ctx, key, value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"store.batchDelete": async (ctx, keys: string[]) => {
|
||||||
|
for (let key of keys) {
|
||||||
|
await apiObj["store.delete"](ctx, key);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"store.get": async (_ctx, key: string): Promise<any | null> => {
|
||||||
|
const result = await asyncQuery<Item>(
|
||||||
|
db,
|
||||||
|
dex(tableName).where({ key }).select("value"),
|
||||||
|
);
|
||||||
|
if (result.length) {
|
||||||
|
return JSON.parse(result[0].value);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"store.queryPrefix": async (ctx, prefix: string) => {
|
||||||
|
return (
|
||||||
|
await asyncQuery<Item>(
|
||||||
|
db,
|
||||||
|
dex(tableName)
|
||||||
|
.andWhereRaw(`"key" LIKE "${prefix}%"`)
|
||||||
|
.select("key", "value"),
|
||||||
|
)
|
||||||
|
).map(({ key, value }) => ({
|
||||||
|
key,
|
||||||
|
value: JSON.parse(value),
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
"store.query": async (_ctx, query: Query) => {
|
||||||
|
return (
|
||||||
|
await asyncQuery<Item>(
|
||||||
|
db,
|
||||||
|
queryToKnex(dex(tableName), query).select("key", "value"),
|
||||||
|
)
|
||||||
|
).map(({ key, value }: { key: string; value: string }) => ({
|
||||||
|
key,
|
||||||
|
value: JSON.parse(value),
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return apiObj;
|
||||||
|
}
|
|
@ -1,49 +0,0 @@
|
||||||
import { createSandbox } from "../environments/node_sandbox";
|
|
||||||
import { expect, test } from "@jest/globals";
|
|
||||||
import { System } from "../system";
|
|
||||||
import { storeSyscalls } from "./store.dexie_browser";
|
|
||||||
|
|
||||||
// For testing in node.js
|
|
||||||
require("fake-indexeddb/auto");
|
|
||||||
|
|
||||||
test("Test store", async () => {
|
|
||||||
let system = new System("server");
|
|
||||||
system.registerSyscalls([], storeSyscalls("test", "test"));
|
|
||||||
let plug = await system.load(
|
|
||||||
{
|
|
||||||
name: "test",
|
|
||||||
functions: {
|
|
||||||
test1: {
|
|
||||||
code: `(() => {
|
|
||||||
return {
|
|
||||||
default: async () => {
|
|
||||||
await self.syscall("store.set", "name", "Pete");
|
|
||||||
return await self.syscall("store.get", "name");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})()`,
|
|
||||||
},
|
|
||||||
test2: {
|
|
||||||
code: `(() => {
|
|
||||||
return {
|
|
||||||
default: async () => {
|
|
||||||
await self.syscall("store.set", "page1:bl:page2:10", {title: "Something", meta: 20});
|
|
||||||
await self.syscall("store.batchSet", [
|
|
||||||
{key: "page2:bl:page3", value: {title: "Something2", meta: 10}},
|
|
||||||
{key: "page2:bl:page4", value: {title: "Something3", meta: 10}},
|
|
||||||
]);
|
|
||||||
return await self.syscall("store.queryPrefix", "page2:");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})()`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
createSandbox
|
|
||||||
);
|
|
||||||
expect(await plug.invoke("test1", [])).toBe("Pete");
|
|
||||||
let queryResults = await plug.invoke("test2", []);
|
|
||||||
expect(queryResults.length).toBe(2);
|
|
||||||
expect(queryResults[0].value.meta).toBe(10);
|
|
||||||
await system.unloadAll();
|
|
||||||
});
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Hook, Manifest, RuntimeEnvironment } from "./types";
|
import { Hook, Manifest, RuntimeEnvironment } from "./types.ts";
|
||||||
import { EventEmitter } from "./event";
|
import { EventEmitter } from "./event.ts";
|
||||||
import { SandboxFactory } from "./sandbox";
|
import { SandboxFactory } from "./sandbox.ts";
|
||||||
import { Plug } from "./plug";
|
import { Plug } from "./plug.ts";
|
||||||
|
|
||||||
export interface SysCallMapping {
|
export interface SysCallMapping {
|
||||||
[key: string]: (ctx: SyscallContext, ...args: any) => Promise<any> | any;
|
[key: string]: (ctx: SyscallContext, ...args: any) => Promise<any> | any;
|
||||||
|
@ -10,8 +10,8 @@ export interface SysCallMapping {
|
||||||
export type SystemJSON<HookT> = Manifest<HookT>[];
|
export type SystemJSON<HookT> = Manifest<HookT>[];
|
||||||
|
|
||||||
export type SystemEvents<HookT> = {
|
export type SystemEvents<HookT> = {
|
||||||
plugLoaded: (plug: Plug<HookT>) => void;
|
plugLoaded: (plug: Plug<HookT>) => void | Promise<void>;
|
||||||
plugUnloaded: (name: string) => void;
|
plugUnloaded: (name: string) => void | Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SyscallContext = {
|
export type SyscallContext = {
|
||||||
|
@ -62,7 +62,7 @@ export class System<HookT> extends EventEmitter<SystemEvents<HookT>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async syscallWithContext(
|
syscallWithContext(
|
||||||
ctx: SyscallContext,
|
ctx: SyscallContext,
|
||||||
name: string,
|
name: string,
|
||||||
args: any[]
|
args: any[]
|
||||||
|
@ -82,7 +82,7 @@ export class System<HookT> extends EventEmitter<SystemEvents<HookT>> {
|
||||||
return Promise.resolve(syscall.callback(ctx, ...args));
|
return Promise.resolve(syscall.callback(ctx, ...args));
|
||||||
}
|
}
|
||||||
|
|
||||||
async localSyscall(
|
localSyscall(
|
||||||
contextPlugName: string,
|
contextPlugName: string,
|
||||||
syscallName: string,
|
syscallName: string,
|
||||||
args: any[]
|
args: any[]
|
||||||
|
@ -116,7 +116,7 @@ export class System<HookT> extends EventEmitter<SystemEvents<HookT>> {
|
||||||
console.log("Loading", name);
|
console.log("Loading", name);
|
||||||
await plug.load(manifest);
|
await plug.load(manifest);
|
||||||
this.plugs.set(name, plug);
|
this.plugs.set(name, plug);
|
||||||
this.emit("plugLoaded", plug);
|
await this.emit("plugLoaded", plug);
|
||||||
return plug;
|
return plug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
name: test
|
||||||
|
functions:
|
||||||
|
boot:
|
||||||
|
path: "./test_func.test.ts:hello"
|
|
@ -0,0 +1,7 @@
|
||||||
|
import * as YAML from "https://deno.land/std/encoding/yaml.ts";
|
||||||
|
|
||||||
|
export function hello() {
|
||||||
|
console.log(YAML.stringify({ hello: "world" }));
|
||||||
|
|
||||||
|
return "hello";
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import { System } from "./system";
|
import { System } from "./system.ts";
|
||||||
|
|
||||||
export interface Manifest<HookT> {
|
export interface Manifest<HookT> {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
import { collectNodesOfType, traverseTree } from "@silverbulletmd/common/tree";
|
import { collectNodesOfType } from "../../common/tree.ts";
|
||||||
import {
|
import {
|
||||||
batchSet,
|
batchSet,
|
||||||
queryPrefix,
|
queryPrefix,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall";
|
} from "../../plugos-silverbullet-syscall/index.ts";
|
||||||
import {
|
import {
|
||||||
getCurrentPage,
|
getCurrentPage,
|
||||||
matchBefore,
|
matchBefore,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
import type { IndexTreeEvent } from "../../web/app_event.ts";
|
||||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
import { removeQueries } from "../query/util.ts";
|
||||||
import { removeQueries } from "../query/util";
|
|
||||||
|
|
||||||
// Key space
|
// Key space
|
||||||
// a:pageName:anchorName => pos
|
// a:pageName:anchorName => pos
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
import type {
|
import type {
|
||||||
FileData,
|
FileData,
|
||||||
FileEncoding,
|
FileEncoding,
|
||||||
} from "@silverbulletmd/common/spaces/space_primitives";
|
} from "../../common/spaces/space_primitives.ts";
|
||||||
import {
|
import { renderToText, replaceNodesMatching } from "../../common/tree.ts";
|
||||||
renderToText,
|
import type { FileMeta } from "../../common/types.ts";
|
||||||
replaceNodesMatching,
|
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||||
} from "@silverbulletmd/common/tree";
|
|
||||||
import type { FileMeta } from "@silverbulletmd/common/types";
|
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
|
||||||
|
|
||||||
const pagePrefix = "💭 ";
|
const pagePrefix = "💭 ";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { queryPrefix } from "@silverbulletmd/plugos-silverbullet-syscall";
|
import { matchBefore } from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
import { matchBefore } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import { listCommands } from "../../plugos-silverbullet-syscall/system.ts";
|
||||||
import { listCommands } from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
|
||||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
|
||||||
|
|
||||||
export async function commandComplete() {
|
export async function commandComplete() {
|
||||||
let prefix = await matchBefore("\\{\\[[^\\]]*");
|
let prefix = await matchBefore("\\{\\[[^\\]]*");
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { getLogs } from "@plugos/plugos-syscall/sandbox";
|
import { getLogs } from "../../plugos-syscall/sandbox.ts";
|
||||||
import {
|
import {
|
||||||
getText,
|
getText,
|
||||||
hidePanel,
|
hidePanel,
|
||||||
showPanel,
|
showPanel,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||||
import { getServerLogs } from "@silverbulletmd/plugos-silverbullet-syscall/sandbox";
|
import { getServerLogs } from "../../plugos-silverbullet-syscall/sandbox.ts";
|
||||||
|
|
||||||
export async function parsePageCommand() {
|
export async function parsePageCommand() {
|
||||||
console.log(
|
console.log(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as clientStore from "@silverbulletmd/plugos-silverbullet-syscall/clientStore";
|
import * as clientStore from "../../plugos-silverbullet-syscall/clientStore.ts";
|
||||||
import { enableReadOnlyMode } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import { enableReadOnlyMode } from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
|
|
||||||
export async function editorLoad() {
|
export async function editorLoad() {
|
||||||
let readOnlyMode = await clientStore.get("readOnlyMode");
|
let readOnlyMode = await clientStore.get("readOnlyMode");
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
import type { IndexTreeEvent } from "../../web/app_event.ts";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
batchSet,
|
batchSet,
|
||||||
queryPrefix,
|
queryPrefix,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/index";
|
} from "../../plugos-silverbullet-syscall/index.ts";
|
||||||
import {
|
import {
|
||||||
collectNodesMatching,
|
|
||||||
collectNodesOfType,
|
collectNodesOfType,
|
||||||
ParseTree,
|
ParseTree,
|
||||||
renderToText,
|
renderToText,
|
||||||
replaceNodesMatching,
|
} from "../../common/tree.ts";
|
||||||
} from "@silverbulletmd/common/tree";
|
import { removeQueries } from "../query/util.ts";
|
||||||
import { removeQueries } from "../query/util";
|
import { applyQuery, QueryProviderEvent } from "../query/engine.ts";
|
||||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
|
||||||
|
|
||||||
export type Item = {
|
export type Item = {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { nodeAtPos } from "@silverbulletmd/common/tree";
|
import { nodeAtPos } from "../../common/tree.ts";
|
||||||
import {
|
import {
|
||||||
filterBox,
|
filterBox,
|
||||||
flashNotification,
|
flashNotification,
|
||||||
getCursor,
|
getCursor,
|
||||||
getText,
|
getText,
|
||||||
replaceRange,
|
replaceRange,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||||
import { dispatch as dispatchEvent } from "@plugos/plugos-syscall/event";
|
import { dispatch as dispatchEvent } from "../../plugos-syscall/event.ts";
|
||||||
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
import { invokeFunction } from "../../plugos-silverbullet-syscall/system.ts";
|
||||||
|
|
||||||
type UnfurlOption = {
|
type UnfurlOption = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ClickEvent } from "@silverbulletmd/web/app_event";
|
import type { ClickEvent } from "../../web/app_event.ts";
|
||||||
import {
|
import {
|
||||||
flashNotification,
|
flashNotification,
|
||||||
getCurrentPage,
|
getCurrentPage,
|
||||||
|
@ -6,10 +6,10 @@ import {
|
||||||
getText,
|
getText,
|
||||||
navigate as navigateTo,
|
navigate as navigateTo,
|
||||||
openUrl,
|
openUrl,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||||
import { nodeAtPos, ParseTree } from "@silverbulletmd/common/tree";
|
import { nodeAtPos, ParseTree } from "../../common/tree.ts";
|
||||||
import { invokeCommand } from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
import { invokeCommand } from "../../plugos-silverbullet-syscall/system.ts";
|
||||||
|
|
||||||
// Checks if the URL contains a protocol, if so keeps it, otherwise assumes an attachment
|
// Checks if the URL contains a protocol, if so keeps it, otherwise assumes an attachment
|
||||||
function patchUrl(url: string): string {
|
function patchUrl(url: string): string {
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import type { IndexEvent, IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
import type { IndexEvent, IndexTreeEvent } from "../../web/app_event.ts";
|
||||||
import {
|
import {
|
||||||
batchSet,
|
batchSet,
|
||||||
clearPageIndex as clearPageIndexSyscall,
|
clearPageIndex as clearPageIndexSyscall,
|
||||||
clearPageIndexForPage,
|
clearPageIndexForPage,
|
||||||
queryPrefix,
|
queryPrefix,
|
||||||
set,
|
set,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/index";
|
} from "../../plugos-silverbullet-syscall/index.ts";
|
||||||
|
|
||||||
import { set as storeSet } from "@plugos/plugos-syscall/store";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
flashNotification,
|
flashNotification,
|
||||||
|
@ -17,26 +15,26 @@ import {
|
||||||
matchBefore,
|
matchBefore,
|
||||||
navigate,
|
navigate,
|
||||||
prompt,
|
prompt,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
|
|
||||||
import { dispatch } from "@plugos/plugos-syscall/event";
|
import { dispatch } from "../../plugos-syscall/event.ts";
|
||||||
import {
|
import {
|
||||||
deletePage as deletePageSyscall,
|
deletePage as deletePageSyscall,
|
||||||
listPages,
|
listPages,
|
||||||
readPage,
|
readPage,
|
||||||
writePage,
|
writePage,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
} from "../../plugos-silverbullet-syscall/space.ts";
|
||||||
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
import { invokeFunction } from "../../plugos-silverbullet-syscall/system.ts";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||||
import {
|
import {
|
||||||
addParentPointers,
|
addParentPointers,
|
||||||
collectNodesMatching,
|
collectNodesMatching,
|
||||||
ParseTree,
|
ParseTree,
|
||||||
renderToText,
|
renderToText,
|
||||||
replaceNodesMatching,
|
replaceNodesMatching,
|
||||||
} from "@silverbulletmd/common/tree";
|
} from "../../common/tree.ts";
|
||||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
import { applyQuery, QueryProviderEvent } from "../query/engine.ts";
|
||||||
import { extractMeta } from "../query/data";
|
import { extractMeta } from "../query/data.ts";
|
||||||
|
|
||||||
// Key space:
|
// Key space:
|
||||||
// pl:toPage:pos => pageName
|
// pl:toPage:pos => pageName
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import { dispatch } from "@plugos/plugos-syscall/event";
|
import { dispatch } from "../../plugos-syscall/event.ts";
|
||||||
import { Manifest } from "@silverbulletmd/common/manifest";
|
import { Manifest } from "../../common/manifest.ts";
|
||||||
import {
|
import {
|
||||||
flashNotification,
|
flashNotification,
|
||||||
save,
|
save,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
import {
|
import {
|
||||||
deleteAttachment,
|
deleteAttachment,
|
||||||
listPlugs,
|
listPlugs,
|
||||||
writeAttachment,
|
writeAttachment,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
} from "../../plugos-silverbullet-syscall/space.ts";
|
||||||
import {
|
import {
|
||||||
invokeFunction,
|
invokeFunction,
|
||||||
reloadPlugs,
|
reloadPlugs,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
} from "../../plugos-silverbullet-syscall/system.ts";
|
||||||
|
|
||||||
import { readYamlPage } from "../lib/yaml_page";
|
import { readYamlPage } from "../lib/yaml_page.ts";
|
||||||
|
|
||||||
export async function updatePlugsCommand() {
|
export async function updatePlugsCommand() {
|
||||||
await save();
|
await save();
|
||||||
|
|
|
@ -2,17 +2,14 @@ import {
|
||||||
fullTextDelete,
|
fullTextDelete,
|
||||||
fullTextIndex,
|
fullTextIndex,
|
||||||
fullTextSearch,
|
fullTextSearch,
|
||||||
} from "@plugos/plugos-syscall/fulltext";
|
} from "../../plugos-syscall/fulltext.ts";
|
||||||
import { renderToText } from "@silverbulletmd/common/tree";
|
import { renderToText } from "../../common/tree.ts";
|
||||||
import { PageMeta } from "@silverbulletmd/common/types";
|
import { PageMeta } from "../../common/types.ts";
|
||||||
import { queryPrefix } from "@silverbulletmd/plugos-silverbullet-syscall";
|
import { queryPrefix } from "../../plugos-silverbullet-syscall/index.ts";
|
||||||
import {
|
import { navigate, prompt } from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
navigate,
|
import { IndexTreeEvent } from "../../web/app_event.ts";
|
||||||
prompt,
|
import { applyQuery, QueryProviderEvent } from "../query/engine.ts";
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import { removeQueries } from "../query/util.ts";
|
||||||
import { IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
|
||||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
|
||||||
import { removeQueries } from "../query/util";
|
|
||||||
|
|
||||||
const searchPrefix = "🔍 ";
|
const searchPrefix = "🔍 ";
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import {
|
import {
|
||||||
flashNotification,
|
flashNotification,
|
||||||
getText,
|
getText,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
import { listPages } from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
import { listPages } from "../../plugos-silverbullet-syscall/space.ts";
|
||||||
|
|
||||||
function countWords(str: string): number {
|
function countWords(str: string): number {
|
||||||
const matches = str.match(/[\w\d\'-]+/gi);
|
const matches = str.match(/[\w\d\'-]+/gi);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { collectNodesOfType } from "@silverbulletmd/common/tree";
|
import { collectNodesOfType } from "../../common/tree.ts";
|
||||||
import {
|
import {
|
||||||
batchSet,
|
batchSet,
|
||||||
queryPrefix,
|
queryPrefix,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall";
|
} from "../../plugos-silverbullet-syscall/index.ts";
|
||||||
import { matchBefore } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import { matchBefore } from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
import type { IndexTreeEvent } from "../../web/app_event.ts";
|
||||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
import { applyQuery, QueryProviderEvent } from "../query/engine.ts";
|
||||||
import { removeQueries } from "../query/util";
|
import { removeQueries } from "../query/util.ts";
|
||||||
|
|
||||||
// Key space
|
// Key space
|
||||||
// tag:TAG => true (for completion)
|
// tag:TAG => true (for completion)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {
|
||||||
readPage,
|
readPage,
|
||||||
writePage,
|
writePage,
|
||||||
getPageMeta,
|
getPageMeta,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
} from "../../plugos-silverbullet-syscall/space.ts";
|
||||||
import {
|
import {
|
||||||
filterBox,
|
filterBox,
|
||||||
getCurrentPage,
|
getCurrentPage,
|
||||||
|
@ -12,12 +12,12 @@ import {
|
||||||
moveCursor,
|
moveCursor,
|
||||||
navigate,
|
navigate,
|
||||||
prompt,
|
prompt,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||||
import { extractMeta } from "../query/data";
|
import { extractMeta } from "../query/data.ts";
|
||||||
import { renderToText } from "@silverbulletmd/common/tree";
|
import { renderToText } from "../../common/tree.ts";
|
||||||
import { niceDate } from "./dates";
|
import { niceDate } from "./dates.ts";
|
||||||
import { readSettings } from "../lib/settings_page";
|
import { readSettings } from "../lib/settings_page.ts";
|
||||||
|
|
||||||
export async function instantiateTemplateCommand() {
|
export async function instantiateTemplateCommand() {
|
||||||
let allPages = await listPages();
|
let allPages = await listPages();
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {
|
||||||
moveCursor,
|
moveCursor,
|
||||||
replaceRange,
|
replaceRange,
|
||||||
setSelection,
|
setSelection,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
|
|
||||||
export async function quoteSelection() {
|
export async function quoteSelection() {
|
||||||
let text = await getText();
|
let text = await getText();
|
||||||
|
@ -71,7 +71,7 @@ export async function linkSelection() {
|
||||||
pos = linkedText.length - 1;
|
pos = linkedText.length - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await replaceRange(selection.from, selection.to, linkedText)
|
await replaceRange(selection.from, selection.to, linkedText);
|
||||||
await moveCursor(selection.from + pos);
|
await moveCursor(selection.from + pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: global
|
name: global
|
||||||
dependencies:
|
dependencies:
|
||||||
yaml: "yaml@2"
|
"https://esm.sh/handlebars": "https://esm.sh/handlebars"
|
||||||
handlebars: "handlebars@4.7.7:/dist/handlebars"
|
"https://deno.land/std/encoding/yaml.ts": "https://deno.land/std/encoding/yaml.ts"
|
||||||
"@lezer/lr": "@lezer/lr@1.0.0"
|
"https://esm.sh/@lezer/lr": "https://esm.sh/@lezer/lr"
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { readYamlPage } from "./yaml_page";
|
import { readYamlPage } from "./yaml_page.ts";
|
||||||
import { notifyUser } from "./util";
|
import { notifyUser } from "./util.ts";
|
||||||
import YAML from "yaml";
|
import * as YAML from "https://deno.land/std@0.158.0/encoding/yaml.ts";
|
||||||
import { writePage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
|
||||||
|
import { writePage } from "../../plugos-silverbullet-syscall/space.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience function to read a specific set of settings from the `SETTINGS` page as well as default values
|
* Convenience function to read a specific set of settings from the `SETTINGS` page as well as default values
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { flashNotification } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
import { flashNotification } from "../../plugos-silverbullet-syscall/editor.ts";
|
||||||
|
|
||||||
export async function replaceAsync(
|
export async function replaceAsync(
|
||||||
str: string,
|
str: string,
|
||||||
|
@ -16,7 +16,9 @@ export async function replaceAsync(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isServer() {
|
export function isServer() {
|
||||||
return typeof window === 'undefined' || typeof window.document === "undefined"; // if something defines window the same way as the browser, this will fail.
|
return (
|
||||||
|
typeof window === "undefined" || typeof window.document === "undefined"
|
||||||
|
); // if something defines window the same way as the browser, this will fail.
|
||||||
}
|
}
|
||||||
|
|
||||||
// this helps keep if's condition as positive
|
// this helps keep if's condition as positive
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { findNodeOfType, traverseTree } from "@silverbulletmd/common/tree";
|
import { findNodeOfType, traverseTree } from "../../common/tree.ts";
|
||||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
import { parseMarkdown } from "../../plugos-silverbullet-syscall/markdown.ts";
|
||||||
import {
|
import {
|
||||||
readPage,
|
readPage,
|
||||||
writePage,
|
writePage,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
} from "../../plugos-silverbullet-syscall/space.ts";
|
||||||
import YAML from "yaml";
|
import * as YAML from "https://deno.land/std@0.158.0/encoding/yaml.ts";
|
||||||
|
|
||||||
export async function readYamlPage(
|
export async function readYamlPage(
|
||||||
pageName: string,
|
pageName: string,
|
||||||
|
|
|
@ -1,26 +1,21 @@
|
||||||
// Index key space:
|
// Index key space:
|
||||||
// data:page@pos
|
// data:page@pos
|
||||||
|
|
||||||
import type { IndexTreeEvent } from "@silverbulletmd/web/app_event";
|
import type { IndexTreeEvent } from "../../web/app_event.ts";
|
||||||
import {
|
import {
|
||||||
batchSet,
|
batchSet,
|
||||||
queryPrefix,
|
queryPrefix,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall";
|
} from "../../plugos-silverbullet-syscall/index.ts";
|
||||||
import {
|
import {
|
||||||
addParentPointers,
|
addParentPointers,
|
||||||
collectNodesOfType,
|
collectNodesOfType,
|
||||||
findNodeOfType,
|
findNodeOfType,
|
||||||
ParseTree,
|
ParseTree,
|
||||||
replaceNodesMatching,
|
replaceNodesMatching,
|
||||||
} from "@silverbulletmd/common/tree";
|
} from "../../common/tree.ts";
|
||||||
import {
|
import type { QueryProviderEvent } from "./engine.ts";
|
||||||
parse as parseYaml,
|
import { applyQuery } from "./engine.ts";
|
||||||
stringify as stringifyYaml,
|
import { removeQueries } from "./util.ts";
|
||||||
parseAllDocuments,
|
|
||||||
} from "yaml";
|
|
||||||
import type { QueryProviderEvent } from "./engine";
|
|
||||||
import { applyQuery } from "./engine";
|
|
||||||
import { removeQueries } from "./util";
|
|
||||||
|
|
||||||
export async function indexData({ name, tree }: IndexTreeEvent) {
|
export async function indexData({ name, tree }: IndexTreeEvent) {
|
||||||
let dataObjects: { key: string; value: Object }[] = [];
|
let dataObjects: { key: string; value: Object }[] = [];
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { collectNodesOfType, ParseTree } from "@silverbulletmd/common/tree";
|
import { collectNodesOfType, ParseTree } from "../../common/tree.ts";
|
||||||
import Handlebars from "handlebars";
|
// import Handlebars from "handlebars";
|
||||||
import YAML from "yaml";
|
import Handlebars from "https://esm.sh/handlebars";
|
||||||
|
import * as YAML from "https://deno.land/std@0.158.0/encoding/yaml.ts";
|
||||||
|
|
||||||
import { readPage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
import { readPage } from "../../plugos-silverbullet-syscall/space.ts";
|
||||||
import { niceDate } from "../core/dates";
|
import { niceDate } from "../core/dates.ts";
|
||||||
import { ParsedQuery } from "./parser";
|
import { ParsedQuery } from "./parser.ts";
|
||||||
|
|
||||||
export type QueryProviderEvent = {
|
export type QueryProviderEvent = {
|
||||||
query: ParsedQuery;
|
query: ParsedQuery;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {
|
||||||
reloadPage,
|
reloadPage,
|
||||||
save,
|
save,
|
||||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
||||||
import Handlebars from "handlebars";
|
import Handlebars from "https://esm.sh/handlebars";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
readPage,
|
readPage,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {
|
||||||
collectNodesMatching,
|
collectNodesMatching,
|
||||||
ParseTree,
|
ParseTree,
|
||||||
renderToText,
|
renderToText,
|
||||||
} from "@silverbulletmd/common/tree";
|
} from "../../common/tree.ts";
|
||||||
|
|
||||||
export const queryRegex =
|
export const queryRegex =
|
||||||
/(<!--\s*#query\s+(.+?)-->)(.+?)(<!--\s*\/query\s*-->)/gs;
|
/(<!--\s*#query\s+(.+?)-->)(.+?)(<!--\s*\/query\s*-->)/gs;
|
||||||
|
|
Loading…
Reference in New Issue