wesbos
04/27/2023, 3:36 PMkian
04/27/2023, 3:37 PMJames
04/27/2023, 3:37 PMOttomated
04/27/2023, 3:38 PMHardAtWork
04/27/2023, 3:42 PMwesbos
04/27/2023, 3:45 PMts
import { BskyAgent } from '@atproto/api';
export interface Env {
BSKY_USERNAME: string;
BSKY_PASS: string;
}
async function login() {
const agent = new BskyAgent({
service: 'https://bsky.social'
});
await agent.login({
identifier: process.env.BSKY_USERNAME as string,
password: process.env.BSKY_PASS as string,
})
return agent;
}
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext
): Promise<Response> {
// 1. Login
const agent = await login();
return new Response("Hello World!");
},
};
James
04/27/2023, 3:47 PM@atproto/api
is just so large that parsing it alone is taking that long 😦wesbos
04/27/2023, 3:47 PMJames
04/27/2023, 3:48 PMnew BskyAgent()
actually do any web reqs? Or are you seeing ~100ms of pure CPU time?kian
04/27/2023, 3:48 PMData
type to buffer
, which isn't anything to do with esbuild
and is uploaded with your Worker as a application/octet-stream
filekian
04/27/2023, 3:48 PMjs
// This is a combination of an esbuild plugin and a mutable array
// that we use to collect module references from source code.
// There will be modules that _shouldn't_ be inlined directly into
// the bundle. (eg. wasm modules, some text files, etc). We can include
// those files as modules in the multi part worker form upload. This
// plugin+array is used to collect references to these modules, reference
// them correctly in the bundle, and add them to the form upload.
wesbos
04/27/2023, 3:48 PMJames
04/27/2023, 3:49 PMwesbos
04/27/2023, 3:49 PMJames
04/27/2023, 3:50 PMJames
04/27/2023, 3:50 PMwesbos
04/27/2023, 3:50 PMwesbos
04/27/2023, 3:51 PMts
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext
): Promise<Response> {
// 1. Login
const agent = new BskyAgent({
service: 'https://bsky.social'
});
return new Response("Hello World!");
},
};
wesbos
04/27/2023, 3:52 PMJames
04/27/2023, 3:52 PMJames
04/27/2023, 3:53 PMJames
04/27/2023, 3:53 PMTom Sherman
04/27/2023, 3:53 PMJames
04/27/2023, 3:54 PMTom Sherman
04/27/2023, 3:54 PMwesbos
04/27/2023, 3:54 PMTom Sherman
04/27/2023, 3:55 PMkian
04/27/2023, 3:55 PM--minify
to your publishkian
04/27/2023, 3:55 PMkian
04/27/2023, 3:55 PM