@kispace-io/extension-linuxterminal 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- {
1
+ declare const _default: {
2
2
  "namespace": "extensions",
3
3
  "en": {
4
4
  "EXT_LINUXTERMINAL_NAME": "Linux terminal",
@@ -8,4 +8,6 @@
8
8
  "EXT_LINUXTERMINAL_NAME": "Linux-Terminal",
9
9
  "EXT_LINUXTERMINAL_DESC": "Linux-Terminalansicht"
10
10
  }
11
- }
11
+ };
12
+
13
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ import { contributionRegistry, SYSTEM_LANGUAGE_BUNDLES, i18nLazy, extensionRegistry } from "@kispace-io/core";
2
+ const namespace = "extensions";
3
+ const en = { "EXT_LINUXTERMINAL_NAME": "Linux terminal", "EXT_LINUXTERMINAL_DESC": "Linux terminal view" };
4
+ const de = { "EXT_LINUXTERMINAL_NAME": "Linux-Terminal", "EXT_LINUXTERMINAL_DESC": "Linux-Terminalansicht" };
5
+ const bundle = {
6
+ namespace,
7
+ en,
8
+ de
9
+ };
10
+ contributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle);
11
+ const t = i18nLazy("extensions");
12
+ extensionRegistry.registerExtension({
13
+ id: "system.linuxterminal",
14
+ name: t("EXT_LINUXTERMINAL_NAME"),
15
+ description: t("EXT_LINUXTERMINAL_DESC"),
16
+ loader: () => import("./k-linuxterminal-CKyr5M0k.js"),
17
+ icon: "terminal",
18
+ experimental: true
19
+ });
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { extensionRegistry, i18nLazy, contributionRegistry, SYSTEM_LANGUAGE_BUNDLES } from '@kispace-io/core';\nimport bundle from './i18n.json';\n\ncontributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle as any);\n\nconst t = i18nLazy('extensions');\n\nextensionRegistry.registerExtension({\n id: \"system.linuxterminal\",\n name: t('EXT_LINUXTERMINAL_NAME'),\n description: t('EXT_LINUXTERMINAL_DESC'),\n loader: () => import(\"./k-linuxterminal\"),\n icon: \"terminal\",\n experimental: true,\n \n});\n"],"names":[],"mappings":";;;;;;;;;AAGA,qBAAqB,qBAAqB,yBAAyB,MAAa;AAEhF,MAAM,IAAI,SAAS,YAAY;AAE/B,kBAAkB,kBAAkB;AAAA,EAClC,IAAI;AAAA,EACJ,MAAM,EAAE,wBAAwB;AAAA,EAChC,aAAa,EAAE,wBAAwB;AAAA,EACvC,QAAQ,MAAM,OAAO,+BAAmB;AAAA,EACxC,MAAM;AAAA,EACN,cAAc;AAEhB,CAAC;"}
@@ -0,0 +1,80 @@
1
+ import { html, unsafeCSS, css } from "lit";
2
+ import { customElement } from "lit/decorators.js";
3
+ import { createRef, ref } from "lit/directives/ref.js";
4
+ import styles from "@xterm/xterm/css/xterm.css?raw";
5
+ import { KElement } from "@kispace-io/core";
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = decorator(result) || result;
12
+ return result;
13
+ };
14
+ const CheerpX = window.CheerpX;
15
+ let KLinuxTerminal = class extends KElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.consoleRef = createRef();
19
+ }
20
+ async doInitUI() {
21
+ const cloudDevice = await CheerpX.CloudDevice.create(
22
+ "wss://disks.webvm.io/debian_large_20230522_5044875331.ext2"
23
+ );
24
+ const idbDevice = await CheerpX.IDBDevice.create("block1");
25
+ const overlayDevice = await CheerpX.OverlayDevice.create(
26
+ cloudDevice,
27
+ idbDevice
28
+ );
29
+ const webDevice = await CheerpX.WebDevice.create("");
30
+ const dataDevice = await CheerpX.DataDevice.create();
31
+ const cx = await CheerpX.Linux.create({
32
+ mounts: [
33
+ { type: "ext2", path: "/", dev: overlayDevice },
34
+ { type: "dir", path: "/app", dev: webDevice },
35
+ { type: "dir", path: "/data", dev: dataDevice },
36
+ { type: "devs", path: "/dev" }
37
+ ]
38
+ });
39
+ cx.setConsole(this.consoleRef.value);
40
+ await cx.run("/bin/bash", ["--login"], {
41
+ env: [
42
+ "HOME=/home/user",
43
+ "HOME=/home/user",
44
+ "USER=user",
45
+ "SHELL=/bin/bash",
46
+ "EDITOR=vim",
47
+ "LANG=en_US.UTF-8",
48
+ "LC_ALL=C"
49
+ ],
50
+ cwd: "/home/user",
51
+ uid: 1e3,
52
+ gid: 1e3
53
+ });
54
+ }
55
+ render() {
56
+ return html`
57
+ <pre class="console" ${ref(this.consoleRef)}></pre>
58
+ `;
59
+ }
60
+ };
61
+ KLinuxTerminal.styles = [
62
+ unsafeCSS(styles),
63
+ css`
64
+ :host {
65
+ display: flex;
66
+ flex: 1;
67
+ }
68
+
69
+ pre.console {
70
+ flex: 1;
71
+ }
72
+ `
73
+ ];
74
+ KLinuxTerminal = __decorateClass([
75
+ customElement("k-linux-terminal")
76
+ ], KLinuxTerminal);
77
+ export {
78
+ KLinuxTerminal
79
+ };
80
+ //# sourceMappingURL=k-linuxterminal-CKyr5M0k.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"k-linuxterminal-CKyr5M0k.js","sources":["../src/k-linuxterminal.ts"],"sourcesContent":["import {css, html, unsafeCSS} from 'lit'\nimport {customElement} from 'lit/decorators.js'\nimport {createRef, ref} from \"lit/directives/ref.js\";\nimport styles from \"@xterm/xterm/css/xterm.css?raw\";\nimport {KElement} from \"@kispace-io/core\";\n\n// @ts-ignore\nconst CheerpX = window.CheerpX;\n\n@customElement('k-linux-terminal')\nexport class KLinuxTerminal extends KElement {\n private consoleRef = createRef()\n\n protected async doInitUI() {\n// The read-only disk image from Leaning Technologies' fast cloud backend\n const cloudDevice = await CheerpX.CloudDevice.create(\n \"wss://disks.webvm.io/debian_large_20230522_5044875331.ext2\"\n );\n // Read-write local storage for disk blocks, it is used both as a cache and as persisteny writable storage\n const idbDevice = await CheerpX.IDBDevice.create(\"block1\");\n // A device to overlay the local changes to the disk with the remote read-only image\n const overlayDevice = await CheerpX.OverlayDevice.create(\n cloudDevice,\n idbDevice\n );\n // Direct acces to files in your HTTP server\n const webDevice = await CheerpX.WebDevice.create(\"\");\n // Convenient access to JavaScript binary data and strings\n const dataDevice = await CheerpX.DataDevice.create();\n\n const cx = await CheerpX.Linux.create({\n mounts: [\n {type: \"ext2\", path: \"/\", dev: overlayDevice},\n {type: \"dir\", path: \"/app\", dev: webDevice},\n {type: \"dir\", path: \"/data\", dev: dataDevice},\n {type: \"devs\", path: \"/dev\"},\n ],\n });\n\n // Interact with a console\n cx.setConsole(this.consoleRef.value);\n\n // Run a full-featured shell in your browser.\n await cx.run(\"/bin/bash\", [\"--login\"], {\n env: [\n \"HOME=/home/user\",\n \"HOME=/home/user\",\n \"USER=user\",\n \"SHELL=/bin/bash\",\n \"EDITOR=vim\",\n \"LANG=en_US.UTF-8\",\n \"LC_ALL=C\",\n ],\n cwd: \"/home/user\",\n uid: 1000,\n gid: 1000,\n });\n }\n\n render() {\n return html`\n <pre class=\"console\" ${ref(this.consoleRef)}></pre>\n `;\n }\n\n static styles = [unsafeCSS(styles),\n css`\n :host {\n display: flex;\n flex: 1;\n }\n\n pre.console {\n flex: 1;\n }\n `]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'k-linux-terminal': KLinuxTerminal\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAOA,MAAM,UAAU,OAAO;AAGhB,IAAM,iBAAN,cAA6B,SAAS;AAAA,EAAtC,cAAA;AAA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 +1,13 @@
1
+ import { KElement } from '@kispace-io/core';
2
+ export declare class KLinuxTerminal extends KElement {
3
+ private consoleRef;
4
+ protected doInitUI(): Promise<void>;
5
+ render(): import('lit-html').TemplateResult<1>;
6
+ static styles: import('lit').CSSResult[];
7
+ }
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'k-linux-terminal': KLinuxTerminal;
11
+ }
12
+ }
13
+ //# sourceMappingURL=k-linuxterminal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"k-linuxterminal.d.ts","sourceRoot":"","sources":["../src/k-linuxterminal.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAK1C,qBACa,cAAe,SAAQ,QAAQ;IACxC,OAAO,CAAC,UAAU,CAAc;cAEhB,QAAQ;IA8CxB,MAAM;IAMN,MAAM,CAAC,MAAM,4BAUP;CACT;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,kBAAkB,EAAE,cAAc,CAAA;KACrC;CACJ"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@kispace-io/extension-linuxterminal",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
- "main": "./src/index.ts",
5
+ "main": "./dist/index.js",
6
6
  "exports": {
7
7
  ".": {
8
- "import": "./src/index.ts",
9
- "types": "./src/index.ts"
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
10
  }
11
11
  },
12
12
  "dependencies": {
@@ -14,6 +14,16 @@
14
14
  "@xterm/xterm": "^5.5.0"
15
15
  },
16
16
  "devDependencies": {
17
- "typescript": "^5.9.3"
17
+ "typescript": "^5.9.3",
18
+ "vite": "^7.1.12",
19
+ "vite-plugin-dts": "^4.5.4"
20
+ },
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "build": "vite build"
18
28
  }
19
29
  }
package/src/index.ts DELETED
@@ -1,16 +0,0 @@
1
- import { extensionRegistry, i18nLazy, contributionRegistry, SYSTEM_LANGUAGE_BUNDLES } from '@kispace-io/core';
2
- import bundle from './i18n.json';
3
-
4
- contributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle as any);
5
-
6
- const t = i18nLazy('extensions');
7
-
8
- extensionRegistry.registerExtension({
9
- id: "system.linuxterminal",
10
- name: t('EXT_LINUXTERMINAL_NAME'),
11
- description: t('EXT_LINUXTERMINAL_DESC'),
12
- loader: () => import("./k-linuxterminal"),
13
- icon: "terminal",
14
- experimental: true,
15
-
16
- });
@@ -1,83 +0,0 @@
1
- import {css, html, unsafeCSS} from 'lit'
2
- import {customElement} from 'lit/decorators.js'
3
- import {createRef, ref} from "lit/directives/ref.js";
4
- import styles from "@xterm/xterm/css/xterm.css?raw";
5
- import {KElement} from "@kispace-io/core";
6
-
7
- // @ts-ignore
8
- const CheerpX = window.CheerpX;
9
-
10
- @customElement('k-linux-terminal')
11
- export class KLinuxTerminal extends KElement {
12
- private consoleRef = createRef()
13
-
14
- protected async doInitUI() {
15
- // The read-only disk image from Leaning Technologies' fast cloud backend
16
- const cloudDevice = await CheerpX.CloudDevice.create(
17
- "wss://disks.webvm.io/debian_large_20230522_5044875331.ext2"
18
- );
19
- // Read-write local storage for disk blocks, it is used both as a cache and as persisteny writable storage
20
- const idbDevice = await CheerpX.IDBDevice.create("block1");
21
- // A device to overlay the local changes to the disk with the remote read-only image
22
- const overlayDevice = await CheerpX.OverlayDevice.create(
23
- cloudDevice,
24
- idbDevice
25
- );
26
- // Direct acces to files in your HTTP server
27
- const webDevice = await CheerpX.WebDevice.create("");
28
- // Convenient access to JavaScript binary data and strings
29
- const dataDevice = await CheerpX.DataDevice.create();
30
-
31
- const cx = await CheerpX.Linux.create({
32
- mounts: [
33
- {type: "ext2", path: "/", dev: overlayDevice},
34
- {type: "dir", path: "/app", dev: webDevice},
35
- {type: "dir", path: "/data", dev: dataDevice},
36
- {type: "devs", path: "/dev"},
37
- ],
38
- });
39
-
40
- // Interact with a console
41
- cx.setConsole(this.consoleRef.value);
42
-
43
- // Run a full-featured shell in your browser.
44
- await cx.run("/bin/bash", ["--login"], {
45
- env: [
46
- "HOME=/home/user",
47
- "HOME=/home/user",
48
- "USER=user",
49
- "SHELL=/bin/bash",
50
- "EDITOR=vim",
51
- "LANG=en_US.UTF-8",
52
- "LC_ALL=C",
53
- ],
54
- cwd: "/home/user",
55
- uid: 1000,
56
- gid: 1000,
57
- });
58
- }
59
-
60
- render() {
61
- return html`
62
- <pre class="console" ${ref(this.consoleRef)}></pre>
63
- `;
64
- }
65
-
66
- static styles = [unsafeCSS(styles),
67
- css`
68
- :host {
69
- display: flex;
70
- flex: 1;
71
- }
72
-
73
- pre.console {
74
- flex: 1;
75
- }
76
- `]
77
- }
78
-
79
- declare global {
80
- interface HTMLElementTagNameMap {
81
- 'k-linux-terminal': KLinuxTerminal
82
- }
83
- }
package/tsconfig.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "strict": true,
7
- "skipLibCheck": true
8
- },
9
- "include": [
10
- "src/**/*"
11
- ]
12
- }