From 6787db9ad786ffe30c9e18200b19c64e3fae97da Mon Sep 17 00:00:00 2001 From: cidungfrog27 Date: Thu, 6 Nov 2025 16:36:50 +0100 Subject: [PATCH 1/2] TS type population --- src/index.d.ts | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/index.d.ts b/src/index.d.ts index e69de29..fb5c2d0 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -0,0 +1,57 @@ +export class Terminal {} +export class Process {} + +export class BinaryFile { + write(data: ArrayBuffer): Promise; + + read(length: number): Promise; + + getSize(): Promise; + + close(): Promise; +} + +export class TextFile { + write(data: string): Promise; + + read(length: number): Promise; + + getSize(): Promise; + + close(): Promise; +} + + +export class BrowserPod { + static boot(opts: { + nodeVersion?: string; + apiKey: string; + }): Promise; + + run( + executable: string, + args: Array, + opts: { + terminal: Terminal, + env?: Array; + cwd?: string, + echo?: boolean + } + ): Promise; + + onPortal(cb: ( args: { url: string, port: number }) => void): void; + + createDirectory( + path: string, + opts?: { recursive?: boolean } + ): Promise; + + createFile(path: string, mode: string): Promise; + + openFile(path: string, mode: string): Promise; + + createDefaultTerminal( + consoleDiv: HTMLElement, + ): Promise; +} + From 66059421e4315fc98bc4c8b0bdb5bb92f0766d4e Mon Sep 17 00:00:00 2001 From: cidungfrog27 Date: Mon, 17 Nov 2025 17:28:11 +0100 Subject: [PATCH 2/2] ci: add type-check workflow --- .github/workflows/validate-types.yml | 26 ++++++++++++++++++++++++++ src/tsconfig.json | 10 ++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/validate-types.yml create mode 100644 src/tsconfig.json diff --git a/.github/workflows/validate-types.yml b/.github/workflows/validate-types.yml new file mode 100644 index 0000000..7f541c5 --- /dev/null +++ b/.github/workflows/validate-types.yml @@ -0,0 +1,26 @@ +name: Validate Types + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run type tests (explicit src tsconfig) + run: npx tsc --noEmit -p src/tsconfig.json diff --git a/src/tsconfig.json b/src/tsconfig.json new file mode 100644 index 0000000..1fa7298 --- /dev/null +++ b/src/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "strict": true, + "target": "ES2020", + "module": "ESNext", + "moduleResolution": "bundler", + "lib": ["ES2020", "DOM"] + }, + "include": ["index.d.ts"] +}