@disjukr/execute 0.0.0-stage → 0.1.1

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.
Files changed (45) hide show
  1. package/README.md +42 -2
  2. package/bin/copy-assets.js +15 -0
  3. package/dist/assets/gdi32.dll +0 -0
  4. package/dist/assets/i386-display.dll +0 -0
  5. package/dist/assets/i386-dsound.dll +0 -0
  6. package/dist/assets/i386-gdi32.dll +0 -0
  7. package/dist/assets/i386-kernel32.dll +0 -0
  8. package/dist/assets/i386-shell32.dll +0 -0
  9. package/dist/assets/i386-user32.dll +0 -0
  10. package/dist/assets/i386-winmm.dll +0 -0
  11. package/dist/assets/kernelbase-936.dll +0 -0
  12. package/dist/assets/kernelbase-949.dll +0 -0
  13. package/dist/assets/kernelbase-950.dll +0 -0
  14. package/dist/assets/kernelbase.dll +0 -0
  15. package/dist/assets/pe.js +6 -0
  16. package/dist/assets/process-server.wasm +0 -0
  17. package/dist/assets/process-services.js +45 -0
  18. package/dist/assets/process-worker.js +73 -0
  19. package/dist/assets/process.wasm +0 -0
  20. package/dist/assets/run.js +531 -0
  21. package/dist/assets/server-worker.js +397 -0
  22. package/dist/assets/shell32.dll +0 -0
  23. package/dist/assets/threads.js +60 -0
  24. package/dist/assets/user32.dll +0 -0
  25. package/dist/assets/webaudio-tinysynth.min.js +1 -0
  26. package/dist/assets/wow64host.exe +0 -0
  27. package/dist/index.js +1347 -0
  28. package/dist/licenses/GPL-3.0-only.txt +232 -0
  29. package/dist/licenses/LICENSE +44 -0
  30. package/dist/licenses/TinySynth +201 -0
  31. package/dist/licenses/Wine +17 -0
  32. package/dist/licenses/Wine-LGPL +502 -0
  33. package/dist/licenses/kwemu +340 -0
  34. package/dist/style.css +809 -0
  35. package/dist/types/demo.d.ts +1 -0
  36. package/dist/types/executable-icon.d.ts +1 -0
  37. package/dist/types/file-system.d.ts +13 -0
  38. package/dist/types/guest-files.d.ts +29 -0
  39. package/dist/types/index.d.ts +27 -0
  40. package/dist/types/launch.d.ts +91 -0
  41. package/dist/types/pe.d.ts +1 -0
  42. package/dist/types/process-group.d.ts +1 -0
  43. package/dist/types/window-thumbnail.d.ts +11 -0
  44. package/dist/types/windows-path.d.ts +1 -0
  45. package/package.json +49 -4
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function executableIcon(bytes: ArrayBuffer): Blob | undefined;
@@ -0,0 +1,13 @@
1
+ export type FileContents = Blob | Uint8Array;
2
+ export interface ExecuteFileSystem {
3
+ /** Read an absolute Windows path. Return undefined when it does not exist. */
4
+ readFile(path: string): FileContents | undefined | Promise<FileContents | undefined>;
5
+ /** Replace the entire file. Resolve after the new contents are available to readers. */
6
+ writeFile?(path: string, contents: Uint8Array): void | Promise<void>;
7
+ }
8
+ export declare function memoryFileSystem(initial?: Record<string, FileContents>): {
9
+ readFile: (path: string) => FileContents | undefined;
10
+ writeFile(path: string, contents: FileContents): void;
11
+ removeFile(path: string): void;
12
+ };
13
+ export declare function readBytes(fs: ExecuteFileSystem, path: string): Promise<Uint8Array<ArrayBufferLike> | undefined>;
@@ -0,0 +1,29 @@
1
+ import type { ExecuteFileSystem } from "./file-system";
2
+ type Request = {
3
+ op: "fileOpen";
4
+ path: string;
5
+ access: number;
6
+ share: number;
7
+ mode: number;
8
+ } | {
9
+ op: "fileBeginRead";
10
+ handle: number;
11
+ count: number;
12
+ } | {
13
+ op: "fileWrite";
14
+ handle: number;
15
+ bytes: Uint8Array;
16
+ } | {
17
+ op: "fileClose";
18
+ handle: number;
19
+ };
20
+ interface Reply {
21
+ status: number;
22
+ values?: number[];
23
+ bytes?: Uint8Array;
24
+ }
25
+ export declare function guestFiles(fs: ExecuteFileSystem): {
26
+ request: (pid: number, q: Request) => Promise<Reply>;
27
+ release(pid?: number): void;
28
+ };
29
+ export {};
@@ -0,0 +1,27 @@
1
+ import { type ExecuteLocale } from "./launch";
2
+ import type { JSX } from "@solidjs/web";
3
+ import { type ExecuteFileSystem } from "./file-system.js";
4
+ export { memoryFileSystem, type ExecuteFileSystem, type FileContents, } from "./file-system.js";
5
+ export type { ExecuteLocale } from "./launch";
6
+ export interface DesktopShortcut {
7
+ path: string;
8
+ label?: string;
9
+ }
10
+ export interface ExecuteDesktopProps {
11
+ /** Public directory containing the runtime assets. Defaults to ./execute-runtime/. */
12
+ assetsURL?: string | URL;
13
+ muted?: boolean;
14
+ locale?: ExecuteLocale;
15
+ fileSystem: ExecuteFileSystem;
16
+ shortcuts: readonly DesktopShortcut[];
17
+ onShortcutRename?: (path: string, label: string) => void;
18
+ onShortcutRemove?: (path: string) => void;
19
+ taskbarStart?: JSX.Element;
20
+ desktopMenuItems?: readonly {
21
+ label: string;
22
+ onSelect: () => void;
23
+ }[];
24
+ onOutput?: (chunk: Uint8Array) => void;
25
+ onError?: (error: Error) => void;
26
+ }
27
+ export declare function ExecuteDesktop(props: ExecuteDesktopProps): JSX.Element;
@@ -0,0 +1,91 @@
1
+ import { type ExecuteFileSystem } from "./file-system";
2
+ export type MenuItem = {
3
+ text: string;
4
+ flags?: number;
5
+ id?: number;
6
+ children?: MenuItem[];
7
+ run?: () => void;
8
+ };
9
+ export type SurfaceOpen = {
10
+ kind: "surfaceOpen";
11
+ pid: number;
12
+ hwnd: number;
13
+ tid: number;
14
+ title: string;
15
+ style: number;
16
+ exStyle: number;
17
+ owner: number;
18
+ element: HTMLElement;
19
+ canvas: HTMLCanvasElement;
20
+ caption: HTMLElement;
21
+ setMaximized: (value: boolean, place?: () => void) => void;
22
+ onPaint: (callback: () => void) => () => void;
23
+ icon?: Uint8Array<ArrayBuffer>;
24
+ };
25
+ export type ShellEvent = SurfaceOpen | {
26
+ kind: "processStarted";
27
+ pid: number;
28
+ path: string;
29
+ } | {
30
+ kind: "processClosed";
31
+ pid: number;
32
+ } | {
33
+ kind: "surfaceClosed" | "surfaceHidden" | "surfaceShown";
34
+ hwnd: number;
35
+ } | {
36
+ kind: "trayRemove";
37
+ key: string;
38
+ } | {
39
+ kind: "trayIcon";
40
+ key: string;
41
+ tip: string;
42
+ image?: Uint8Array<ArrayBuffer>;
43
+ } | {
44
+ kind: "popup";
45
+ tid: number;
46
+ x: number;
47
+ y: number;
48
+ items: MenuItem[];
49
+ } | {
50
+ kind: "popupClosed";
51
+ tid: number;
52
+ } | {
53
+ kind: "drained";
54
+ };
55
+ export type SendCommand = (command: {
56
+ kind: "activate" | "deactivate" | "close";
57
+ tid: number;
58
+ hwnd: number;
59
+ } | {
60
+ kind: "trayInput";
61
+ key: string;
62
+ context: boolean;
63
+ x: number;
64
+ y: number;
65
+ } | {
66
+ kind: "popupResult";
67
+ tid: number;
68
+ id: number;
69
+ }) => void;
70
+ declare const locales: {
71
+ readonly ko_KR: readonly [949, "euc-kr"];
72
+ readonly ja_JP: readonly [932, "shift_jis"];
73
+ readonly zh_CN: readonly [936, "gbk"];
74
+ readonly zh_TW: readonly [950, "big5"];
75
+ };
76
+ export type ExecuteLocale = keyof typeof locales;
77
+ interface LaunchOptions {
78
+ display: HTMLElement;
79
+ assetsURL?: string | URL;
80
+ locale?: ExecuteLocale;
81
+ audioState?: EventTarget;
82
+ isMuted?: () => boolean;
83
+ fileSystem: ExecuteFileSystem;
84
+ commandLine?: string;
85
+ signal: AbortSignal;
86
+ onShellEvent: (event: ShellEvent, send: SendCommand) => void;
87
+ onOutput?: (chunk: Uint8Array) => void;
88
+ }
89
+ /** Run a Windows executable in an isolated browser process group. */
90
+ export declare function runExecutable(path: string, { display, assetsURL, locale, audioState, isMuted, fileSystem, commandLine, signal, onShellEvent, onOutput, }: LaunchOptions): Promise<any>;
91
+ export {};
@@ -0,0 +1 @@
1
+ export declare function isI386(bytes: any): boolean;
@@ -0,0 +1 @@
1
+ export declare function runProcessGroup(module: any, files: any, path: any, write: any, options?: {}): Promise<any>;
@@ -0,0 +1,11 @@
1
+ import type { SurfaceOpen } from "./launch";
2
+ interface ThumbnailProps {
3
+ surface: SurfaceOpen;
4
+ title: string;
5
+ icon?: string;
6
+ select: () => void;
7
+ close: () => void;
8
+ peek: (enabled: boolean) => void;
9
+ }
10
+ export declare function WindowThumbnail(props: ThumbnailProps): import("@solidjs/web").JSX.Element;
11
+ export {};
@@ -0,0 +1 @@
1
+ export declare function windowsPath(input: string, directory?: string): string;
package/package.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
2
  "name": "@disjukr/execute",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Run Windows executables in the browser with Wine and WebAssembly.",
5
+ "license": "SEE LICENSE IN dist/licenses/LICENSE",
6
+ "type": "module",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/types/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./style.css": "./dist/style.css"
16
+ },
17
+ "bin": {
18
+ "execute-runtime-assets": "bin/copy-assets.js"
19
+ },
20
+ "files": [
21
+ "dist/assets",
22
+ "dist/index.js",
23
+ "dist/style.css",
24
+ "dist/licenses",
25
+ "dist/types",
26
+ "bin/copy-assets.js"
27
+ ],
28
+ "scripts": {
29
+ "dev": "node build.js dist && vite",
30
+ "build": "node build.js dist",
31
+ "test": "node build.js ../build/windows-tests --with-tests && node tests/check.mjs ../build/windows-tests",
32
+ "prepack": "node build.js dist",
33
+ "test:desktop": "node tests/desktop.mjs",
34
+ "check": "tsc --noEmit -p tsconfig.json"
35
+ },
36
+ "devDependencies": {
37
+ "@solidjs/vite-plugin": "3.0.1",
38
+ "typescript": "~7.0.2",
39
+ "vite": "8.4.1",
40
+ "webaudio-tinysynth": "^1.1.3"
41
+ },
42
+ "peerDependencies": {
43
+ "@solidjs/web": "^2.0.4",
44
+ "solid-js": "^2.0.4"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/disjukr/execute.git",
49
+ "directory": "lib"
50
+ }
51
+ }