From 3dec0d6fcb6f9fdb61a560905f130fd5ac24d6cf Mon Sep 17 00:00:00 2001 From: Chris Dickinson Date: Tue, 16 Jul 2024 12:36:44 -0700 Subject: [PATCH] ci: add jsr slow types check (#76) JSR prevents packages with "slow types" [1] from being published to the registry without special configuration. Add a CI check for slow types and fix existing failures. --- .github/workflows/ci.yml | 10 ++++++++++ jsr.json | 14 ++++++++++++-- src/call-context.ts | 10 +++++----- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7843d19..13e8283 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,16 @@ jobs: - name: Test run: npm run test + jsr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: denoland/setup-deno@v1.1.2 + + - name: jsr slow types check + run: deno publish --dry-run + docs: runs-on: ubuntu-latest steps: diff --git a/jsr.json b/jsr.json index 52879d3..e80c51b 100644 --- a/jsr.json +++ b/jsr.json @@ -2,6 +2,16 @@ "name": "@extism/extism", "version": "0.0.0-replaced-by-ci", "exports": "./src/mod.ts", - "include": ["./src/**/*.ts", "LICENSE", "README.md", "types", "tsconfig.json"], - "exclude": ["./src/mod.test.ts"] + "publish": { + "include": [ + "./src/**/*.ts", + "LICENSE", + "README.md", + "types", + "tsconfig.json" + ], + "exclude": [ + "./src/mod.test.ts" + ] + } } diff --git a/src/call-context.ts b/src/call-context.ts index d2f028e..9b67273 100644 --- a/src/call-context.ts +++ b/src/call-context.ts @@ -188,7 +188,7 @@ export class CallContext { return this.alloc(n); }, - free: (addr: number) => { + free: (addr: number): void => { this.#blocks[Block.addressToIndex(addr)] = null; }, @@ -206,14 +206,14 @@ export class CallContext { return block?.view.getBigUint64(Number(offset), true) as bigint; }, - store_u8: (addr: bigint, n: number) => { + store_u8: (addr: bigint, n: number): void => { const blockIdx = Block.addressToIndex(addr); const offset = Block.maskAddress(addr); const block = this.#blocks[blockIdx]; block?.view.setUint8(Number(offset), Number(n)); }, - store_u64: (addr: bigint, n: bigint) => { + store_u64: (addr: bigint, n: bigint): void => { const blockIdx = Block.addressToIndex(addr); const offset = Block.maskAddress(addr); const block = this.#blocks[blockIdx]; @@ -239,7 +239,7 @@ export class CallContext { return this.#input?.view.getBigUint64(Number(offset), true) as bigint; }, - output_set: (addr: bigint, length: bigint) => { + output_set: (addr: bigint, length: bigint): void => { const blockIdx = Block.addressToIndex(addr); const block = this.#blocks[blockIdx]; if (!block) { @@ -253,7 +253,7 @@ export class CallContext { this.#stack[this.#stack.length - 1][1] = blockIdx; }, - error_set: (addr: bigint) => { + error_set: (addr: bigint): void => { const blockIdx = Block.addressToIndex(addr); const block = this.#blocks[blockIdx]; if (!block) {