8000 Added @xterm/addon-web-links to the terminal by WebReflection · Pull Request #2027 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

Added @xterm/addon-web-links to the terminal #2027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pyscript.core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyscript.core/package.json
8000
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pyscript/core",
"version": "0.4.20",
"version": "0.4.21",
"type": "module",
"description": "PyScript",
"module": "./index.js",
Expand Down Expand Up @@ -59,6 +59,7 @@
"@rollup/plugin-terser": "^0.4.4",
"@webreflection/toml-j0.4": "^1.1.3",
"@xterm/addon-fit": "^0.10.0",
"@xterm/addon-web-links": "^0.11.0",
"chokidar": "^3.6.0",
"codemirror": "^6.0.1",
"eslint": "^9.0.0",
Expand Down
3 changes: 3 additions & 0 deletions pyscript.core/rollup/3rd-party.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const modules = {
"xterm_addon-fit.js": fetch(`${CDN}/@xterm/addon-fit/+esm`).then((b) =>
b.text(),
),
"xterm_addon-web-links.js": fetch(
`${CDN}/@xterm/addon-web-links/+esm`,
).then((b) => b.text()),
"xterm.css": fetch(`${CDN}/xterm@${v("xterm")}/css/xterm.min.css`).then(
(b) => b.text(),
),
Expand Down
15 changes: 10 additions & 5 deletions pyscript.core/src/plugins/py-terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,15 @@ const workerReady = ({ interpreter, io, run, type }, { sync }) => {

const pyTerminal = async (element) => {
// lazy load these only when a valid terminal is found
const [{ Terminal }, { Readline }, { FitAddon }] = await Promise.all([
import(/* webpackIgnore: true */ "../3rd-party/xterm.js"),
import(/* webpackIgnore: true */ "../3rd-party/xterm-readline.js"),
import(/* webpackIgnore: true */ "../3rd-party/xterm_addon-fit.js"),
]);
const [{ Terminal }, { Readline }, { FitAddon }, { WebLinksAddon }] =
await Promise.all([
import(/* webpackIgnore: true */ "../3rd-party/xterm.js"),
import(/* webpackIgnore: true */ "../3rd-party/xterm-readline.js"),
import(/* webpackIgnore: true */ "../3rd-party/xterm_addon-fit.js"),
import(
/* webpackIgnore: true */ "../3rd-party/xterm_addon-web-links.js"
),
]);

const readline = new Readline();
< 8000 /td>
Expand Down Expand Up @@ -167,6 +171,7 @@ const pyTerminal = async (element) => {
const fitAddon = new FitAddon();
terminal.loadAddon(fitAddon);
terminal.loadAddon(readline);
terminal.loadAddon(new WebLinksAddon());
terminal.open(target);
fitAddon.fit();
terminal.focus();
Expand Down
4 changes: 4 additions & 0 deletions pyscript.core/types/3rd-party/xterm_addon-web-links.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare var r: any;
declare var n: any;
declare var t: {};
export { r as WebLinksAddon, n as __esModule, t as default };
0