Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Try to install wasm version of sharp

Chocobozzzd92f43143b39
diff --git a/package.json b/package.json
index 88921788fe..162383802f 100644
--- a/package.json
+++ b/package.json
@@ -93,6 +93,7 @@
"@aws-sdk/lib-storage": "^3.1043.0",
"@aws-sdk/s3-request-presigner": "^3.1043.0",
"@commander-js/extra-typings": "^14.0.0",
+ "@img/sharp-wasm32": "^0.34.5",
"@misskey-dev/node-http-message-signatures": "^0.0.10",
"@node-oauth/oauth2-server": "^5.3.0",
"@opentelemetry/api": "^1.9.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5a43fca848..960c625db6 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -12,6 +12,9 @@ patchedDependencies:
'@types/markdown-it':
hash: b68247cf64808c60a86b4f1ee56430de5e1b3d0fb2023e0c82242537f4f27937
path: pnpm-patches/@types__markdown-it.patch
+ sharp:
+ hash: 6360e5a7ee3bb2fcc71d0f3c8a8532b01555e32108f8ec2eedcbfaba4ea25704
+ path: pnpm-patches/sharp.patch
tinykeys:
hash: 6855931e9590b29110de8402432514ff7aa294934a067557e96dc7eb46f365e3
path: pnpm-patches/tinykeys.patch
@@ -35,6 +38,9 @@ importers:
'@commander-js/extra-typings':
specifier: ^14.0.0
version: 14.0.0([email protected])
+ '@img/sharp-wasm32':
+ specifier: ^0.34.5
+ version: 0.34.5
'@misskey-dev/node-http-message-signatures':
specifier: ^0.0.10
version: 0.0.10
@@ -322,7 +328,7 @@ importers:
sharp:
specifier: ^0.34.5
- version: 0.34.5
+ version: 0.34.5(patch_hash=6360e5a7ee3bb2fcc71d0f3c8a8532b01555e32108f8ec2eedcbfaba4ea25704)
short-uuid:
specifier: ^6.0.3
version: 6.0.3
@@ -13103,7 +13109,6 @@ snapshots:
'@emnapi/[email protected]':
dependencies:
tslib: 2.8.1
- optional: true
'@emnapi/[email protected]':
dependencies:
@@ -13460,7 +13465,6 @@ snapshots:
dependencies:
'@emnapi/runtime': 1.10.0
- optional: true
optional: true
@@ -22976,7 +22980,7 @@ snapshots:
safe-buffer: 5.2.1
to-buffer: 1.2.2
+ [email protected](patch_hash=6360e5a7ee3bb2fcc71d0f3c8a8532b01555e32108f8ec2eedcbfaba4ea25704):
dependencies:
'@img/colour': 1.1.0
detect-libc: 2.1.2
diff --git a/pnpm-patches/sharp.patch b/pnpm-patches/sharp.patch
new file mode 100644
index 0000000000..4e021efb07
--- /dev/null
+++ b/pnpm-patches/sharp.patch
@@ -0,0 +1,23 @@
+diff --git a/lib/sharp.js b/lib/sharp.js
+index 1081c9314de1b669b0744a931a3b6b570c9f6609..09aec3fc832cf50ced4457a6d2ba20c71dde165a 100644
+--- a/lib/sharp.js
++++ b/lib/sharp.js
+@@ -31,10 +31,15 @@ for (path of paths) {
+ }
+
+ if (sharp && path.startsWith('@img/sharp-linux-x64') && !sharp._isUsingX64V2()) {
+- const err = new Error('Prebuilt binaries for linux-x64 require v2 microarchitecture');
+- err.code = 'Unsupported CPU';
+- errors.push(err);
+ sharp = null;
++
++ try {
++ sharp = require('@img/sharp-wasm32/sharp.node');
++ } catch (err2) {
++ const err = new Error('Prebuilt binaries for linux-x64 require v2 microarchitecture');
++ err.code = 'Unsupported CPU';
++ errors.push(err);
++ }
+ }
+
+ if (sharp) {
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index bbbfb196f1..468c284144 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -30,5 +30,6 @@ onlyBuiltDependencies:
patchedDependencies:
'@types/markdown-it': pnpm-patches/@types__markdown-it.patch
+ sharp: pnpm-patches/sharp.patch
tinykeys: pnpm-patches/tinykeys.patch
video.js: pnpm-patches/video.js.patch