-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
229 changed files
with
4,799 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
node_modules/ | ||
yarn-error.log | ||
.DS_store | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "sumy"] | ||
path = sumy | ||
url = [email protected]:miso-belica/sumy.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
{ | ||
"name": "@summarizer/monorepo", | ||
"version": "0.0.0", | ||
"private": true, | ||
"license": "MIT", | ||
"workspaces": [ | ||
"worker", | ||
"logseq" | ||
] | ||
"name": "logseq-summarizer", | ||
"version": "0.0.2", | ||
"main": "index.html", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"preview": "vite preview" | ||
}, | ||
"devDependencies": { | ||
"vite": "^2.9.9", | ||
"vite-plugin-compile-time": "^0.1.2" | ||
}, | ||
"dependencies": { | ||
"@logseq/libs": "^0.0.6", | ||
"promise-worker": "^2.0.1" | ||
}, | ||
"logseq": { | ||
"id": "_trashhalo-logseq-summarizer", | ||
"icon": "./icon.png" | ||
} | ||
} |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../package.json |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+914 KB
public/pyodide/boost_histogram-1.3.1-cp310-cp310-emscripten_wasm32.whl
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<script src="https://cdn.jsdelivr.net/npm/jquery"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/js/jquery.terminal.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/js/unix_formatting.min.js"></script> | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/css/jquery.terminal.min.css" | ||
rel="stylesheet" | ||
/> | ||
<script src="./pyodide.js"></script> | ||
<style> | ||
.terminal { | ||
--size: 1.5; | ||
--color: rgba(255, 255, 255, 0.8); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<script> | ||
"use strict"; | ||
function sleep(s) { | ||
return new Promise((resolve) => setTimeout(resolve, s)); | ||
} | ||
|
||
async function main() { | ||
globalThis.pyodide = await loadPyodide(); | ||
let namespace = pyodide.globals.get("dict")(); | ||
pyodide.runPython( | ||
` | ||
import sys | ||
from pyodide import to_js | ||
from pyodide.console import PyodideConsole, repr_shorten, BANNER | ||
import __main__ | ||
BANNER = "Welcome to the Pyodide terminal emulator 🐍\\n" + BANNER | ||
pyconsole = PyodideConsole(__main__.__dict__) | ||
import builtins | ||
async def await_fut(fut): | ||
res = await fut | ||
if res is not None: | ||
builtins._ = res | ||
return to_js([res], depth=1) | ||
def clear_console(): | ||
pyconsole.buffer = [] | ||
`, | ||
{ globals: namespace } | ||
); | ||
let repr_shorten = namespace.get("repr_shorten"); | ||
let banner = namespace.get("BANNER"); | ||
let await_fut = namespace.get("await_fut"); | ||
let pyconsole = namespace.get("pyconsole"); | ||
let clear_console = namespace.get("clear_console"); | ||
namespace.destroy(); | ||
|
||
let ps1 = ">>> ", | ||
ps2 = "... "; | ||
|
||
async function lock() { | ||
let resolve; | ||
let ready = term.ready; | ||
term.ready = new Promise((res) => (resolve = res)); | ||
await ready; | ||
return resolve; | ||
} | ||
|
||
async function interpreter(command) { | ||
let unlock = await lock(); | ||
term.pause(); | ||
// multiline should be split (useful when pasting) | ||
for (const c of command.split("\n")) { | ||
let fut = pyconsole.push(c); | ||
term.set_prompt(fut.syntax_check === "incomplete" ? ps2 : ps1); | ||
switch (fut.syntax_check) { | ||
case "syntax-error": | ||
term.error(fut.formatted_error.trimEnd()); | ||
continue; | ||
case "incomplete": | ||
continue; | ||
case "complete": | ||
break; | ||
default: | ||
throw new Error(`Unexpected type ${ty}`); | ||
} | ||
// In JavaScript, await automatically also awaits any results of | ||
// awaits, so if an async function returns a future, it will await | ||
// the inner future too. This is not what we want so we | ||
// temporarily put it into a list to protect it. | ||
let wrapped = await_fut(fut); | ||
// complete case, get result / error and print it. | ||
try { | ||
let [value] = await wrapped; | ||
if (value !== undefined) { | ||
term.echo( | ||
repr_shorten.callKwargs(value, { | ||
separator: "\n[[;orange;]<long output truncated>]\n", | ||
}) | ||
); | ||
} | ||
if (pyodide.isPyProxy(value)) { | ||
value.destroy(); | ||
} | ||
} catch (e) { | ||
if (e.constructor.name === "PythonError") { | ||
const message = fut.formatted_error || e.message; | ||
term.error(message.trimEnd()); | ||
} else { | ||
throw e; | ||
} | ||
} finally { | ||
fut.destroy(); | ||
wrapped.destroy(); | ||
} | ||
} | ||
term.resume(); | ||
await sleep(10); | ||
unlock(); | ||
} | ||
|
||
let term = $("body").terminal(interpreter, { | ||
greetings: banner, | ||
prompt: ps1, | ||
completionEscape: false, | ||
completion: function (command, callback) { | ||
callback(pyconsole.complete(command).toJs()[0]); | ||
}, | ||
keymap: { | ||
"CTRL+C": async function (event, original) { | ||
clear_console(); | ||
term.enter(); | ||
term.echo("KeyboardInterrupt"); | ||
term.set_command(""); | ||
term.set_prompt(ps1); | ||
}, | ||
TAB: (event, original) => { | ||
const command = term.before_cursor(); | ||
// Disable completion for whitespaces. | ||
if (command.trim() === "") { | ||
term.insert("\t"); | ||
return false; | ||
} | ||
return original(event); | ||
}, | ||
}, | ||
}); | ||
window.term = term; | ||
pyconsole.stdout_callback = (s) => term.echo(s, { newline: false }); | ||
pyconsole.stderr_callback = (s) => { | ||
term.error(s.trimEnd()); | ||
}; | ||
term.ready = Promise.resolve(); | ||
pyodide._api.on_fatal = async (e) => { | ||
term.error( | ||
"Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers." | ||
); | ||
term.error("The cause of the fatal error was:"); | ||
term.error(e); | ||
term.error("Look in the browser console for more details."); | ||
await term.ready; | ||
term.pause(); | ||
await sleep(15); | ||
term.pause(); | ||
}; | ||
} | ||
window.console_ready = main(); | ||
</script> | ||
</body> | ||
</html> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.