Skip to content

Commit 8eafc59

Browse files
Add desktop TypeScript type definitions and Cloudflare functions
1 parent f45e2f3 commit 8eafc59

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

apps/desktop/functions/[[path]].ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import type { ServerBuild } from '@remix-run/cloudflare';
2+
import { createPagesFunctionHandler } from '@remix-run/cloudflare-pages';
3+
4+
export const onRequest: PagesFunction = async (context) => {
5+
const serverBuild = (await import('../build/server')) as unknown as ServerBuild;
6+
7+
const handler = createPagesFunctionHandler({
8+
build: serverBuild,
9+
});
10+
11+
return handler(context);
12+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @note For some reason the types aren't picked up from node_modules so I declared the module here
3+
* with only the function that we use.
4+
*/
5+
declare module 'istextorbinary' {
6+
export interface EncodingOpts {
7+
/** Defaults to 24 */
8+
chunkLength?: number;
9+
10+
/** If not provided, will check the start, beginning, and end */
11+
chunkBegin?: number;
12+
}
13+
14+
export function getEncoding(buffer: Buffer | null, opts?: EncodingOpts): 'utf8' | 'binary' | null;
15+
}

0 commit comments

Comments
 (0)