From 3d2761a2b1ed22857415f47d1fb461a5a429225e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Sat, 13 May 2023 20:03:32 +0100 Subject: [PATCH] fix: initial working version with libparakeet --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- src/decrypt-worker/client.ts | 3 +++ vite.config.ts | 15 +++++++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4cc9696..95000f4 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@chakra-ui/react": "^2.6.1", "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", - "@jixun/libparakeet": "0.0.0-exp.10", + "@jixun/libparakeet": "0.0.0-exp.12", "@reduxjs/toolkit": "^1.9.5", "framer-motion": "^10.12.8", "nanoid": "^4.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1ae68ae..be1ba17 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,8 +14,8 @@ dependencies: specifier: ^11.11.0 version: 11.11.0(@emotion/react@11.11.0)(@types/react@18.0.28)(react@18.2.0) '@jixun/libparakeet': - specifier: 0.0.0-exp.10 - version: 0.0.0-exp.10 + specifier: 0.0.0-exp.12 + version: 0.0.0-exp.12 '@reduxjs/toolkit': specifier: ^1.9.5 version: 1.9.5(react-redux@8.0.5)(react@18.2.0) @@ -1780,8 +1780,8 @@ packages: resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} dev: true - /@jixun/libparakeet@0.0.0-exp.10: - resolution: {integrity: sha512-mDV3aBhWytgvr8gRza28+bDyCKLFet3qqrw+tos8Cz/Bg/tZneYlS5qP4w24cEfrV83OxI2NSOVYgZIN4S2RUw==} + /@jixun/libparakeet@0.0.0-exp.12: + resolution: {integrity: sha512-vtXUSDJMnirr8bz1oG29K+sfDz7T7V+tC4rnzS5Xon3wrUZq5Eth2icPMDYYC5UWEgfxEy/qr19/Em59v492nA==} dev: false /@jridgewell/gen-mapping@0.3.3: diff --git a/src/decrypt-worker/client.ts b/src/decrypt-worker/client.ts index 514412a..95a52fd 100644 --- a/src/decrypt-worker/client.ts +++ b/src/decrypt-worker/client.ts @@ -5,6 +5,9 @@ import { DECRYPTION_WORKER_ACTION_NAME } from './constants'; // TODO: Worker pool? export const workerClient = new Worker(new URL('./worker', import.meta.url), { type: 'module' }); +// FIXME: report the error so is obvious to the user. +workerClient.onerror = (err) => console.error(err); + class DecryptionQueue extends ConcurrentQueue<{ id: string; blobURI: string }> { constructor(private workerClientBus: WorkerClientBus, maxQueue?: number) { super(maxQueue); diff --git a/vite.config.ts b/vite.config.ts index dc25aab..922f8c7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,6 +6,21 @@ import topLevelAwait from 'vite-plugin-top-level-await'; // https://vitejs.dev/config/ export default defineConfig({ + server: { + fs: { + // Note: + // This is _insecure_, but is required to get pnpm link to work. + // strict: false, + + allow: [ + 'src', + 'node_modules', + + // Allow pnpm to link. + '../libparakeet-js', + ], + }, + }, base: './', optimizeDeps: { exclude: ['@jixun/libparakeet'],