fix: resolve peer dependency and matrix-sdk-crypto-wasm issues

This commit is contained in:
hazre committed 2026-03-11 17:23:52 +01:00
1 parent 8f9095a393
commit fcfe06fc95
6 files changed
+183 -745

No files matched your search

+5 -1
View File
@@ -5,7 +5,11 @@
"interface": true,
"type": true
},
"ignoreDependencies": ["buffer", "@element-hq/element-call-embedded", "workbox-precaching"],
"ignoreDependencies": [
"buffer",
"@element-hq/element-call-embedded",
"@matrix-org/matrix-sdk-crypto-wasm"
],
"ignoreBinaries": ["knope"],
"rules": {
"exports": "off",
+3 -10
View File
@@ -37,7 +37,7 @@
"@use-gesture/react": "10.3.1",
"@vanilla-extract/css": "^1.18.0",
"@vanilla-extract/recipes": "^0.5.7",
"@vanilla-extract/vite-plugin": "^3.9.5",
"@vanilla-extract/vite-plugin": "^5.1.4",
"await-to-js": "^3.0.0",
"badwords-list": "^2.0.1-4",
"blurhash": "^2.0.5",
@@ -49,9 +49,10 @@
"emojibase": "^15.3.1",
"emojibase-data": "^15.3.2",
"eslint-plugin-react": "7.37.5",
"eventemitter3": "^5.0.4",
"file-saver": "^2.0.5",
"focus-trap-react": "^10.3.1",
"folds": "^2.6.1",
"folds": "^2.6.2",
"framer-motion": "12.34.3",
"html-dom-parser": "^5.1.8",
"html-react-parser": "^4.2.10",
@@ -121,13 +122,5 @@
"vite-plugin-svgr": "4.5.0",
"vite-plugin-top-level-await": "^1.6.0",
"wrangler": "^4.70.0"
},
"overrides": {
"serialize-javascript": ">=7.0.3",
"rollup": ">=4.59.0",
"minimatch": ">=10.2.3",
"lodash": ">=4.17.23",
"esbuild": ">=0.25.0",
"brace-expansion": ">=1.1.12"
}
}
+135 -711
View File
File diff suppressed because it is too large. Load diff
+19 -2
View File
@@ -1,8 +1,25 @@
engineStrict: true
minimumReleaseAge: 1440
allowBuilds:
'@swc/core': true
esbuild: true
sharp: true
unrs-resolver: true
workerd: true
minimumReleaseAge: 1440
engineStrict: true
overrides:
serialize-javascript: '>=7.0.3'
rollup: '>=4.59.0'
minimatch: '>=10.2.3'
lodash: '>=4.17.23'
esbuild: '>=0.25.0'
brace-expansion: '>=1.1.12'
peerDependencyRules:
allowedVersions:
'folds>@vanilla-extract/css': '1.18.0'
'folds>@vanilla-extract/recipes': '0.5.7'
'folds>classnames': '2.5.1'
'folds>react': '18.3.1'
'folds>react-dom': '18.3.1'
+1 -1
View File
@@ -1,5 +1,5 @@
import { ClientWidgetApi } from 'matrix-widget-api';
import EventEmitter from 'events';
import EventEmitter from 'eventemitter3';
import { CallControlState } from './CallControlState';
import { ElementMediaStateDetail, ElementMediaStatePayload, ElementWidgetActions } from './types';
+20 -20
View File
@@ -15,6 +15,7 @@ import { constants as zlibConstants } from 'zlib';
import fs from 'fs';
import path from 'path';
import { cloudflare } from '@cloudflare/vite-plugin';
import { createRequire } from 'module';
import buildConfig from './build.config';
const packageJson = JSON.parse(
@@ -89,30 +90,25 @@ const copyFiles = {
],
};
function serverMatrixSdkCryptoWasm(wasmFilePath: string) {
const require = createRequire(import.meta.url);
function serverMatrixSdkCryptoWasm() {
const resolvedPath = path.join(
path.dirname(require.resolve('@matrix-org/matrix-sdk-crypto-wasm')),
'pkg/matrix_sdk_crypto_wasm_bg.wasm'
);
return {
name: 'vite-plugin-serve-matrix-sdk-crypto-wasm',
configureServer(server: ViteDevServer) {
server.middlewares.use((req, res, next) => {
if (req.url === wasmFilePath) {
const resolvedPath = path.join(
path.resolve(),
'/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm'
);
if (fs.existsSync(resolvedPath)) {
res.setHeader('Content-Type', 'application/wasm');
res.setHeader('Cache-Control', 'no-cache');
const fileStream = fs.createReadStream(resolvedPath);
fileStream.pipe(res);
} else {
res.writeHead(404);
res.end('File not found');
}
} else {
if (!req.url?.endsWith('matrix_sdk_crypto_wasm_bg.wasm')) {
next();
return;
}
res.setHeader('Content-Type', 'application/wasm');
res.setHeader('Cache-Control', 'no-cache');
fs.createReadStream(resolvedPath).pipe(res);
});
},
};
@@ -151,7 +147,7 @@ export default defineConfig({
},
},
plugins: [
serverMatrixSdkCryptoWasm('/node_modules/.vite/deps/pkg/matrix_sdk_crypto_wasm_bg.wasm'),
serverMatrixSdkCryptoWasm(),
topLevelAwait({
// The export name of top-level await promise for each chunk module
promiseExportName: '__tla',
@@ -199,7 +195,11 @@ export default defineConfig({
force: true,
// Keep matrix-widget-api prebundled so matrix-js-sdk can import its named exports in dev.
// Force CJS interop for stability across optimizer cache rebuilds.
include: ['matrix-widget-api'],
include: [
'matrix-widget-api',
'workbox-precaching',
'@vanilla-extract/recipes/createRuntimeFn',
],
needsInterop: ['matrix-widget-api'],
esbuildOptions: {
define: {