lopata 0.3.0 → 0.3.1
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 +2 -1
- package/src/api/handlers/email.ts +1 -1
- package/src/api/handlers/queue.ts +1 -1
- package/src/api/r2.ts +1 -1
- package/src/bindings/browser.ts +0 -3
- package/src/bindings/cache.ts +1 -1
- package/src/bindings/container.ts +4 -4
- package/src/bindings/crypto-extras.ts +1 -1
- package/src/bindings/durable-object.ts +1 -1
- package/src/bindings/images.ts +1 -1
- package/src/cli.ts +0 -0
- package/src/dashboard-serve.ts +1 -1
- package/src/plugin.ts +1 -1
- package/src/tracing/store.ts +1 -1
- package/src/tsconfig.json +1 -0
- package/src/vite-plugin/dev-server-plugin.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lopata",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"format": "dprint fmt",
|
|
29
29
|
"format:check": "dprint check",
|
|
30
30
|
"build:assets": "bun scripts/build-assets.ts",
|
|
31
|
+
"typecheck": "bunx --bun tsc --build",
|
|
31
32
|
"prepublishOnly": "bun scripts/build-assets.ts"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
package/src/api/r2.ts
CHANGED
|
@@ -53,7 +53,7 @@ export function handleR2Download(url: URL): Response {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const filename = key.split('/').pop() ?? key
|
|
56
|
-
const response = new Response(file as unknown as BodyInit, {
|
|
56
|
+
const response = new Response(file as unknown as Bun.BodyInit, {
|
|
57
57
|
headers: {
|
|
58
58
|
'Content-Disposition': `attachment; filename="${filename}"`,
|
|
59
59
|
'Content-Type': file.type || 'application/octet-stream',
|
package/src/bindings/browser.ts
CHANGED
|
@@ -26,12 +26,10 @@ export class BrowserBinding {
|
|
|
26
26
|
/** Launch a new browser and return a puppeteer Browser instance. */
|
|
27
27
|
async launch(opts?: { keep_alive?: number }): Promise<any> {
|
|
28
28
|
if (this.config.wsEndpoint) {
|
|
29
|
-
// @ts-expect-error — puppeteer-core is an optional dependency
|
|
30
29
|
const puppeteer = await import('puppeteer-core')
|
|
31
30
|
this._browser = await puppeteer.default.connect({ browserWSEndpoint: this.config.wsEndpoint })
|
|
32
31
|
return this._browser
|
|
33
32
|
}
|
|
34
|
-
// @ts-expect-error — puppeteer is an optional dependency
|
|
35
33
|
const puppeteer = await import('puppeteer')
|
|
36
34
|
this._browser = await puppeteer.default.launch({
|
|
37
35
|
headless: this.config.headless ?? true,
|
|
@@ -43,7 +41,6 @@ export class BrowserBinding {
|
|
|
43
41
|
/** Connect to an existing browser session by sessionId. */
|
|
44
42
|
async connect(sessionId: string): Promise<any> {
|
|
45
43
|
if (this.config.wsEndpoint) {
|
|
46
|
-
// @ts-expect-error — puppeteer-core is an optional dependency
|
|
47
44
|
const puppeteer = await import('puppeteer-core')
|
|
48
45
|
return puppeteer.default.connect({ browserWSEndpoint: this.config.wsEndpoint })
|
|
49
46
|
}
|
package/src/bindings/cache.ts
CHANGED
|
@@ -95,7 +95,7 @@ export class SqliteCache {
|
|
|
95
95
|
|
|
96
96
|
const headers = new Headers(JSON.parse(row.headers))
|
|
97
97
|
headers.set('cf-cache-status', 'HIT')
|
|
98
|
-
return new Response(row.body as unknown as BodyInit, { status: row.status, headers })
|
|
98
|
+
return new Response(row.body as unknown as Bun.BodyInit, { status: row.status, headers })
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
async put(request: Request | string, response: Response): Promise<void> {
|
|
@@ -24,7 +24,7 @@ export interface ContainerConfig {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
interface TcpPort {
|
|
27
|
-
fetch(input:
|
|
27
|
+
fetch(input: Request | string | URL, init?: RequestInit): Promise<Response>
|
|
28
28
|
connect(): never
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -215,7 +215,7 @@ export class ContainerRuntime {
|
|
|
215
215
|
/**
|
|
216
216
|
* Forward an HTTP request to the container.
|
|
217
217
|
*/
|
|
218
|
-
async fetch(input:
|
|
218
|
+
async fetch(input: Request | string | URL, init?: RequestInit, port?: number): Promise<Response> {
|
|
219
219
|
const targetPort = port ?? this.defaultPort
|
|
220
220
|
const hostPort = this._hostPorts.get(targetPort)
|
|
221
221
|
if (!hostPort) {
|
|
@@ -429,7 +429,7 @@ export class ContainerContext {
|
|
|
429
429
|
getTcpPort(port: number): TcpPort {
|
|
430
430
|
const runtime = this._runtime
|
|
431
431
|
return {
|
|
432
|
-
fetch(input:
|
|
432
|
+
fetch(input: Request | string | URL, init?: RequestInit): Promise<Response> {
|
|
433
433
|
return runtime.fetch(input, init, port)
|
|
434
434
|
},
|
|
435
435
|
connect(): never {
|
|
@@ -521,7 +521,7 @@ export class ContainerBase extends DurableObjectBase {
|
|
|
521
521
|
requestOrUrl: Request | string | URL,
|
|
522
522
|
portOrInit?: number | RequestInit,
|
|
523
523
|
portParam?: number,
|
|
524
|
-
): { input:
|
|
524
|
+
): { input: Request | string | URL; init?: RequestInit; port?: number } {
|
|
525
525
|
if (requestOrUrl instanceof Request) {
|
|
526
526
|
// containerFetch(request, port?)
|
|
527
527
|
const port = typeof portOrInit === 'number' ? portOrInit : portParam
|
|
@@ -26,7 +26,7 @@ export function cfTimingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuff
|
|
|
26
26
|
export class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
|
|
27
27
|
readonly digest: Promise<ArrayBuffer>
|
|
28
28
|
|
|
29
|
-
constructor(algorithm:
|
|
29
|
+
constructor(algorithm: string | { name: string }) {
|
|
30
30
|
const algo = typeof algorithm === 'string' ? algorithm : algorithm.name
|
|
31
31
|
|
|
32
32
|
// Map CF algorithm names to Bun.CryptoHasher names
|
|
@@ -997,7 +997,7 @@ export class DurableObjectNamespaceImpl {
|
|
|
997
997
|
|
|
998
998
|
// stub.fetch() — calls the DO's fetch() handler
|
|
999
999
|
if (prop === 'fetch') {
|
|
1000
|
-
return async (input:
|
|
1000
|
+
return async (input: Request | string | URL, init?: RequestInit) => {
|
|
1001
1001
|
const executor = self._getOrCreateExecutor(idStr, id)!
|
|
1002
1002
|
self._lastActivity.set(idStr, Date.now())
|
|
1003
1003
|
const request = input instanceof Request ? input : new Request(input instanceof URL ? input.href : input, init)
|
package/src/bindings/images.ts
CHANGED
package/src/cli.ts
CHANGED
|
File without changes
|
package/src/dashboard-serve.ts
CHANGED
|
@@ -77,7 +77,7 @@ export function handleDashboardRequest(request: Request): Response {
|
|
|
77
77
|
if (assetMatch && dashboardAssets) {
|
|
78
78
|
const asset = dashboardAssets.get(assetMatch[1]!)
|
|
79
79
|
if (asset) {
|
|
80
|
-
return new Response(asset.content as unknown as BodyInit, {
|
|
80
|
+
return new Response(asset.content as unknown as Bun.BodyInit, {
|
|
81
81
|
headers: {
|
|
82
82
|
'Content-Type': asset.contentType,
|
|
83
83
|
'Cache-Control': 'public, max-age=31536000, immutable',
|
package/src/plugin.ts
CHANGED
|
@@ -298,7 +298,7 @@ globalThis.fetch = ((input: any, init?: any): Promise<Response> => {
|
|
|
298
298
|
setSpanAttribute('http.response.headers', headersToRecord(response.headers))
|
|
299
299
|
|
|
300
300
|
// Capture response body from a clone (caller keeps the original stream)
|
|
301
|
-
const resBody = await readBodyLimited(response.clone())
|
|
301
|
+
const resBody = await readBodyLimited(response.clone() as Response)
|
|
302
302
|
if (resBody) setSpanAttribute('http.response.body', resBody)
|
|
303
303
|
|
|
304
304
|
return response
|
package/src/tracing/store.ts
CHANGED
package/src/tsconfig.json
CHANGED
|
@@ -467,7 +467,6 @@ function nodeReqToRequest(req: IncomingMessage): Request {
|
|
|
467
467
|
method,
|
|
468
468
|
headers,
|
|
469
469
|
body: hasBody ? nodeStreamToReadable(req) : undefined,
|
|
470
|
-
// @ts-expect-error duplex is needed for streaming request bodies
|
|
471
470
|
duplex: hasBody ? 'half' : undefined,
|
|
472
471
|
})
|
|
473
472
|
}
|