From 2efeb263d8096cadfa42be763ee0d8b542953a1e Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 17 Jul 2024 23:03:23 +0800 Subject: [PATCH] chore: add wasm pacakge test case --- packages/integrate-module/package.json | 1 + packages/integrate-module/src/index.ts | 11 +++++++++++ pnpm-lock.yaml | 15 +++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/packages/integrate-module/package.json b/packages/integrate-module/package.json index c6d4f4c..dc809e5 100644 --- a/packages/integrate-module/package.json +++ b/packages/integrate-module/package.json @@ -17,6 +17,7 @@ "@types/node": "^20.14.9", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", + "canvaskit-wasm": "^0.39.1", "ipaddr.js": "^2.2.0", "postgres": "^3.4.4", "react": "^18.3.1", diff --git a/packages/integrate-module/src/index.ts b/packages/integrate-module/src/index.ts index aa73604..ea33d74 100644 --- a/packages/integrate-module/src/index.ts +++ b/packages/integrate-module/src/index.ts @@ -8,6 +8,7 @@ import { renderToString } from 'react-dom/server' import { simpleGit } from 'simple-git' import ipaddr from 'ipaddr.js' import postgres from 'postgres' +import canvaskit from 'canvaskit-wasm' import { CompiledClass } from './compiled.js' import { foo } from './foo.mjs' @@ -72,3 +73,13 @@ await test('resolve postgres', () => { const sql = postgres() assert.ok(sql) }) + +await test('resolve canvaskit-wasm', async () => { + if (process.arch === 's390x') { + assert.ok('skipping test on s390x') + return + } + // @ts-expect-error + const canvas = await canvaskit() + assert.ok(canvas.MakeSurface(100, 100)) +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9dd0956..efd0f25 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -110,6 +110,9 @@ importers: '@types/react-dom': specifier: ^18.3.0 version: 18.3.0 + canvaskit-wasm: + specifier: ^0.39.1 + version: 0.39.1 ipaddr.js: specifier: ^2.2.0 version: 2.2.0 @@ -1350,6 +1353,9 @@ packages: engines: {node: '>=16'} hasBin: true + '@webgpu/types@0.1.21': + resolution: {integrity: sha512-pUrWq3V5PiSGFLeLxoGqReTZmiiXwY3jRkIG5sLLKjyqNxrwm/04b4nw7LSmGWJcKk59XOM/YRTUwOzo4MMlow==} + '@yarnpkg/lockfile@1.1.0': resolution: {integrity: sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==} @@ -1587,6 +1593,9 @@ packages: resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} engines: {node: '>=6'} + canvaskit-wasm@0.39.1: + resolution: {integrity: sha512-Gy3lCmhUdKq+8bvDrs9t8+qf7RvcjuQn+we7vTVVyqgOVO1UVfHpsnBxkTZw+R4ApEJ3D5fKySl9TU11hmjl/A==} + cbor@9.0.2: resolution: {integrity: sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ==} engines: {node: '>=16'} @@ -4981,6 +4990,8 @@ snapshots: - encoding - supports-color + '@webgpu/types@0.1.21': {} + '@yarnpkg/lockfile@1.1.0': {} '@yarnpkg/parsers@3.0.0-rc.46': @@ -5244,6 +5255,10 @@ snapshots: camelcase@5.3.1: {} + canvaskit-wasm@0.39.1: + dependencies: + '@webgpu/types': 0.1.21 + cbor@9.0.2: dependencies: nofilter: 3.1.0