summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/odd-mirrors-beam.md5
-rw-r--r--packages/integrations/image/package.json3
-rw-r--r--packages/integrations/image/src/utils/workerPool.ts1
-rw-r--r--packages/integrations/image/src/vendor/squoosh/avif/avif_node_dec.ts36
-rw-r--r--packages/integrations/image/src/vendor/squoosh/avif/avif_node_enc.ts36
-rw-r--r--packages/integrations/image/src/vendor/squoosh/mozjpeg/mozjpeg_node_dec.ts36
-rw-r--r--packages/integrations/image/src/vendor/squoosh/mozjpeg/mozjpeg_node_enc.ts36
-rw-r--r--packages/integrations/image/src/vendor/squoosh/webp/webp_node_dec.ts36
-rw-r--r--packages/integrations/image/src/vendor/squoosh/webp/webp_node_enc.ts36
-rw-r--r--pnpm-lock.yaml2
10 files changed, 12 insertions, 215 deletions
diff --git a/.changeset/odd-mirrors-beam.md b/.changeset/odd-mirrors-beam.md
new file mode 100644
index 000000000..7add2f21e
--- /dev/null
+++ b/.changeset/odd-mirrors-beam.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/image': patch
+---
+
+Fix the integration failing to work properly on Node 18+
diff --git a/packages/integrations/image/package.json b/packages/integrations/image/package.json
index bd6039145..798bdff0a 100644
--- a/packages/integrations/image/package.json
+++ b/packages/integrations/image/package.json
@@ -48,8 +48,7 @@
"kleur": "^4.1.5",
"magic-string": "^0.25.9",
"mime": "^3.0.0",
- "slash": "^4.0.0",
- "web-streams-polyfill": "^3.2.1"
+ "slash": "^4.0.0"
},
"devDependencies": {
"@types/http-cache-semantics": "^4.0.1",
diff --git a/packages/integrations/image/src/utils/workerPool.ts b/packages/integrations/image/src/utils/workerPool.ts
index 5c4c45c6e..6f953998e 100644
--- a/packages/integrations/image/src/utils/workerPool.ts
+++ b/packages/integrations/image/src/utils/workerPool.ts
@@ -1,5 +1,4 @@
/* tslint-disable ban-types */
-import { TransformStream } from 'web-streams-polyfill';
import { parentPort, Worker } from 'worker_threads';
function uuid() {
diff --git a/packages/integrations/image/src/vendor/squoosh/avif/avif_node_dec.ts b/packages/integrations/image/src/vendor/squoosh/avif/avif_node_dec.ts
index cc076bb2b..8f2bbbbf8 100644
--- a/packages/integrations/image/src/vendor/squoosh/avif/avif_node_dec.ts
+++ b/packages/integrations/image/src/vendor/squoosh/avif/avif_node_dec.ts
@@ -384,22 +384,6 @@ var Module = (function () {
}
}
function getBinaryPromise() {
- if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
- if (typeof fetch === 'function') {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' })
- .then(function (response) {
- if (!response['ok']) {
- throw (
- "failed to load wasm binary file at '" + wasmBinaryFile + "'"
- )
- }
- return response['arrayBuffer']()
- })
- .catch(function () {
- return getBinary(wasmBinaryFile)
- })
- }
- }
return Promise.resolve().then(function () {
return getBinary(wasmBinaryFile)
})
@@ -431,25 +415,7 @@ var Module = (function () {
})
}
function instantiateAsync() {
- if (
- !wasmBinary &&
- typeof WebAssembly.instantiateStreaming === 'function' &&
- !isDataURI(wasmBinaryFile) &&
- typeof fetch === 'function'
- ) {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' }).then(
- function (response) {
- var result = WebAssembly.instantiateStreaming(response, info)
- return result.then(receiveInstantiationResult, function (reason) {
- err('wasm streaming compile failed: ' + reason)
- err('falling back to ArrayBuffer instantiation')
- return instantiateArrayBuffer(receiveInstantiationResult)
- })
- }
- )
- } else {
- return instantiateArrayBuffer(receiveInstantiationResult)
- }
+ return instantiateArrayBuffer(receiveInstantiationResult)
}
if (Module['instantiateWasm']) {
try {
diff --git a/packages/integrations/image/src/vendor/squoosh/avif/avif_node_enc.ts b/packages/integrations/image/src/vendor/squoosh/avif/avif_node_enc.ts
index 8d4fa4409..cc1a3df22 100644
--- a/packages/integrations/image/src/vendor/squoosh/avif/avif_node_enc.ts
+++ b/packages/integrations/image/src/vendor/squoosh/avif/avif_node_enc.ts
@@ -384,22 +384,6 @@ var Module = (function () {
}
}
function getBinaryPromise() {
- if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
- if (typeof fetch === 'function') {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' })
- .then(function (response) {
- if (!response['ok']) {
- throw (
- "failed to load wasm binary file at '" + wasmBinaryFile + "'"
- )
- }
- return response['arrayBuffer']()
- })
- .catch(function () {
- return getBinary(wasmBinaryFile)
- })
- }
- }
return Promise.resolve().then(function () {
return getBinary(wasmBinaryFile)
})
@@ -431,25 +415,7 @@ var Module = (function () {
})
}
function instantiateAsync() {
- if (
- !wasmBinary &&
- typeof WebAssembly.instantiateStreaming === 'function' &&
- !isDataURI(wasmBinaryFile) &&
- typeof fetch === 'function'
- ) {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' }).then(
- function (response) {
- var result = WebAssembly.instantiateStreaming(response, info)
- return result.then(receiveInstantiationResult, function (reason) {
- err('wasm streaming compile failed: ' + reason)
- err('falling back to ArrayBuffer instantiation')
- return instantiateArrayBuffer(receiveInstantiationResult)
- })
- }
- )
- } else {
- return instantiateArrayBuffer(receiveInstantiationResult)
- }
+ return instantiateArrayBuffer(receiveInstantiationResult)
}
if (Module['instantiateWasm']) {
try {
diff --git a/packages/integrations/image/src/vendor/squoosh/mozjpeg/mozjpeg_node_dec.ts b/packages/integrations/image/src/vendor/squoosh/mozjpeg/mozjpeg_node_dec.ts
index f18f5db1b..7e8e62c3b 100644
--- a/packages/integrations/image/src/vendor/squoosh/mozjpeg/mozjpeg_node_dec.ts
+++ b/packages/integrations/image/src/vendor/squoosh/mozjpeg/mozjpeg_node_dec.ts
@@ -391,22 +391,6 @@ var Module = (function () {
}
}
function getBinaryPromise() {
- if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
- if (typeof fetch === 'function') {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' })
- .then(function (response) {
- if (!response['ok']) {
- throw (
- "failed to load wasm binary file at '" + wasmBinaryFile + "'"
- )
- }
- return response['arrayBuffer']()
- })
- .catch(function () {
- return getBinary(wasmBinaryFile)
- })
- }
- }
return Promise.resolve().then(function () {
return getBinary(wasmBinaryFile)
})
@@ -438,25 +422,7 @@ var Module = (function () {
})
}
function instantiateAsync() {
- if (
- !wasmBinary &&
- typeof WebAssembly.instantiateStreaming === 'function' &&
- !isDataURI(wasmBinaryFile) &&
- typeof fetch === 'function'
- ) {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' }).then(
- function (response) {
- var result = WebAssembly.instantiateStreaming(response, info)
- return result.then(receiveInstantiationResult, function (reason) {
- err('wasm streaming compile failed: ' + reason)
- err('falling back to ArrayBuffer instantiation')
- return instantiateArrayBuffer(receiveInstantiationResult)
- })
- }
- )
- } else {
- return instantiateArrayBuffer(receiveInstantiationResult)
- }
+ return instantiateArrayBuffer(receiveInstantiationResult)
}
if (Module['instantiateWasm']) {
try {
diff --git a/packages/integrations/image/src/vendor/squoosh/mozjpeg/mozjpeg_node_enc.ts b/packages/integrations/image/src/vendor/squoosh/mozjpeg/mozjpeg_node_enc.ts
index 283884bbb..82f274648 100644
--- a/packages/integrations/image/src/vendor/squoosh/mozjpeg/mozjpeg_node_enc.ts
+++ b/packages/integrations/image/src/vendor/squoosh/mozjpeg/mozjpeg_node_enc.ts
@@ -391,22 +391,6 @@ var Module = (function () {
}
}
function getBinaryPromise() {
- if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
- if (typeof fetch === 'function') {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' })
- .then(function (response) {
- if (!response['ok']) {
- throw (
- "failed to load wasm binary file at '" + wasmBinaryFile + "'"
- )
- }
- return response['arrayBuffer']()
- })
- .catch(function () {
- return getBinary(wasmBinaryFile)
- })
- }
- }
return Promise.resolve().then(function () {
return getBinary(wasmBinaryFile)
})
@@ -438,25 +422,7 @@ var Module = (function () {
})
}
function instantiateAsync() {
- if (
- !wasmBinary &&
- typeof WebAssembly.instantiateStreaming === 'function' &&
- !isDataURI(wasmBinaryFile) &&
- typeof fetch === 'function'
- ) {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' }).then(
- function (response) {
- var result = WebAssembly.instantiateStreaming(response, info)
- return result.then(receiveInstantiationResult, function (reason) {
- err('wasm streaming compile failed: ' + reason)
- err('falling back to ArrayBuffer instantiation')
- return instantiateArrayBuffer(receiveInstantiationResult)
- })
- }
- )
- } else {
- return instantiateArrayBuffer(receiveInstantiationResult)
- }
+ return instantiateArrayBuffer(receiveInstantiationResult)
}
if (Module['instantiateWasm']) {
try {
diff --git a/packages/integrations/image/src/vendor/squoosh/webp/webp_node_dec.ts b/packages/integrations/image/src/vendor/squoosh/webp/webp_node_dec.ts
index b23af7bf0..12c9f3921 100644
--- a/packages/integrations/image/src/vendor/squoosh/webp/webp_node_dec.ts
+++ b/packages/integrations/image/src/vendor/squoosh/webp/webp_node_dec.ts
@@ -367,22 +367,6 @@ var Module = (function () {
}
}
function getBinaryPromise() {
- if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
- if (typeof fetch === 'function') {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' })
- .then(function (response) {
- if (!response['ok']) {
- throw (
- "failed to load wasm binary file at '" + wasmBinaryFile + "'"
- )
- }
- return response['arrayBuffer']()
- })
- .catch(function () {
- return getBinary(wasmBinaryFile)
- })
- }
- }
return Promise.resolve().then(function () {
return getBinary(wasmBinaryFile)
})
@@ -414,25 +398,7 @@ var Module = (function () {
})
}
function instantiateAsync() {
- if (
- !wasmBinary &&
- typeof WebAssembly.instantiateStreaming === 'function' &&
- !isDataURI(wasmBinaryFile) &&
- typeof fetch === 'function'
- ) {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' }).then(
- function (response) {
- var result = WebAssembly.instantiateStreaming(response, info)
- return result.then(receiveInstantiationResult, function (reason) {
- err('wasm streaming compile failed: ' + reason)
- err('falling back to ArrayBuffer instantiation')
- return instantiateArrayBuffer(receiveInstantiationResult)
- })
- }
- )
- } else {
- return instantiateArrayBuffer(receiveInstantiationResult)
- }
+ return instantiateArrayBuffer(receiveInstantiationResult)
}
if (Module['instantiateWasm']) {
try {
diff --git a/packages/integrations/image/src/vendor/squoosh/webp/webp_node_enc.ts b/packages/integrations/image/src/vendor/squoosh/webp/webp_node_enc.ts
index c34118ebe..aa4a139eb 100644
--- a/packages/integrations/image/src/vendor/squoosh/webp/webp_node_enc.ts
+++ b/packages/integrations/image/src/vendor/squoosh/webp/webp_node_enc.ts
@@ -367,22 +367,6 @@ var Module = (function () {
}
}
function getBinaryPromise() {
- if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
- if (typeof fetch === 'function') {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' })
- .then(function (response) {
- if (!response['ok']) {
- throw (
- "failed to load wasm binary file at '" + wasmBinaryFile + "'"
- )
- }
- return response['arrayBuffer']()
- })
- .catch(function () {
- return getBinary(wasmBinaryFile)
- })
- }
- }
return Promise.resolve().then(function () {
return getBinary(wasmBinaryFile)
})
@@ -414,25 +398,7 @@ var Module = (function () {
})
}
function instantiateAsync() {
- if (
- !wasmBinary &&
- typeof WebAssembly.instantiateStreaming === 'function' &&
- !isDataURI(wasmBinaryFile) &&
- typeof fetch === 'function'
- ) {
- return fetch(wasmBinaryFile, { credentials: 'same-origin' }).then(
- function (response) {
- var result = WebAssembly.instantiateStreaming(response, info)
- return result.then(receiveInstantiationResult, function (reason) {
- err('wasm streaming compile failed: ' + reason)
- err('falling back to ArrayBuffer instantiation')
- return instantiateArrayBuffer(receiveInstantiationResult)
- })
- }
- )
- } else {
- return instantiateArrayBuffer(receiveInstantiationResult)
- }
+ return instantiateArrayBuffer(receiveInstantiationResult)
}
if (Module['instantiateWasm']) {
try {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 53f439ebb..fce38d966 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -2694,7 +2694,6 @@ importers:
sharp: ^0.31.0
slash: ^4.0.0
vite: ^4.0.3
- web-streams-polyfill: ^3.2.1
dependencies:
'@altano/tiny-async-pool': 1.0.2
http-cache-semantics: 4.1.0
@@ -2703,7 +2702,6 @@ importers:
magic-string: 0.25.9
mime: 3.0.0
slash: 4.0.0
- web-streams-polyfill: 3.2.1
devDependencies:
'@types/http-cache-semantics': 4.0.1
'@types/mime': 2.0.3