lopata 0.14.1 → 0.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/bindings/r2.ts
CHANGED
|
@@ -264,7 +264,7 @@ export class R2MultipartUpload {
|
|
|
264
264
|
this.limits = limits
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
async uploadPart(partNumber: number, data: ArrayBuffer |
|
|
267
|
+
async uploadPart(partNumber: number, data: ArrayBuffer | ArrayBufferView | string | ReadableStream): Promise<{ partNumber: number; etag: string }> {
|
|
268
268
|
// Verify upload exists and is not aborted/completed
|
|
269
269
|
const upload = this.db
|
|
270
270
|
.query<MultipartRow, [string, string]>(
|
|
@@ -276,10 +276,10 @@ export class R2MultipartUpload {
|
|
|
276
276
|
let buf: ArrayBuffer
|
|
277
277
|
if (typeof data === 'string') {
|
|
278
278
|
buf = new TextEncoder().encode(data).buffer as ArrayBuffer
|
|
279
|
-
} else if (data instanceof Uint8Array) {
|
|
280
|
-
buf = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) as ArrayBuffer
|
|
281
279
|
} else if (data instanceof ArrayBuffer) {
|
|
282
280
|
buf = data
|
|
281
|
+
} else if (ArrayBuffer.isView(data)) {
|
|
282
|
+
buf = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) as ArrayBuffer
|
|
283
283
|
} else {
|
|
284
284
|
// ReadableStream
|
|
285
285
|
const chunks: Uint8Array[] = []
|
|
@@ -495,11 +495,14 @@ export class FileR2Bucket {
|
|
|
495
495
|
}
|
|
496
496
|
|
|
497
497
|
private async readValue(
|
|
498
|
-
value: string | ArrayBuffer | ReadableStream | Blob | null,
|
|
498
|
+
value: string | ArrayBuffer | ArrayBufferView | ReadableStream | Blob | null,
|
|
499
499
|
): Promise<ArrayBuffer> {
|
|
500
500
|
if (value === null) return new ArrayBuffer(0)
|
|
501
501
|
if (typeof value === 'string') return new TextEncoder().encode(value).buffer as ArrayBuffer
|
|
502
502
|
if (value instanceof ArrayBuffer) return value
|
|
503
|
+
if (ArrayBuffer.isView(value)) {
|
|
504
|
+
return value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength) as ArrayBuffer
|
|
505
|
+
}
|
|
503
506
|
if (value instanceof Blob) return await value.arrayBuffer()
|
|
504
507
|
// ReadableStream
|
|
505
508
|
const chunks: Uint8Array[] = []
|
|
@@ -521,7 +524,7 @@ export class FileR2Bucket {
|
|
|
521
524
|
|
|
522
525
|
async put(
|
|
523
526
|
key: string,
|
|
524
|
-
value: string | ArrayBuffer | ReadableStream | Blob | null,
|
|
527
|
+
value: string | ArrayBuffer | ArrayBufferView | ReadableStream | Blob | null,
|
|
525
528
|
options?: R2PutOptions,
|
|
526
529
|
): Promise<R2Object | null> {
|
|
527
530
|
this.validateKey(key)
|
package/src/cli/dev.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// Capture deeper stacks in dev mode (default is 10, async boundaries still truncate)
|
|
2
2
|
Error.stackTraceLimit = 50
|
|
3
3
|
|
|
4
|
+
// Prevent unhandled rejections from worker code from crashing the dev server
|
|
5
|
+
process.on('unhandledRejection', (reason) => {
|
|
6
|
+
console.error('[lopata] Unhandled promise rejection:', reason)
|
|
7
|
+
})
|
|
8
|
+
|
|
4
9
|
import '../plugin'
|
|
5
10
|
import path from 'node:path'
|
|
6
11
|
import {
|
|
@@ -238,6 +238,11 @@ export function devServerPlugin(options: DevServerPluginOptions): Plugin {
|
|
|
238
238
|
// Deeper stacks in dev mode
|
|
239
239
|
Error.stackTraceLimit = 50
|
|
240
240
|
|
|
241
|
+
// Prevent unhandled rejections from worker code from crashing the dev server
|
|
242
|
+
process.on('unhandledRejection', (reason) => {
|
|
243
|
+
console.error('[lopata] Unhandled promise rejection:', reason)
|
|
244
|
+
})
|
|
245
|
+
|
|
241
246
|
// Lazy import runtime modules — runs through Bun's native loader
|
|
242
247
|
const configMod = await import('../config.ts')
|
|
243
248
|
const envMod = await import('../env.ts')
|