feat(workers-runtime-sdk): support embedding javascript files in sdk#90
feat(workers-runtime-sdk): support embedding javascript files in sdk#90ryanking13 wants to merge 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This PR adds infrastructure for embedding JavaScript helper files in the Python SDK, migrating patchWaitUntil from workerd into a locally-compiled sdk.mjs.
Issues (ranked by severity)
-
Medium:
PyFuturetype does not match the workerd definition — Ints/sdk.ts,PyFuture.copy()returnsPromise<T>instead ofPyFuture<T>. The workerd original definestype PyFuture<T> = Promise<T> & { copy(): PyFuture<T>; destroy(): void }, meaning the copy also carriesdestroy. While this is type-level only (esbuild strips types, and the runtime object from Pyodide is the same regardless), the type annotation is misleading for anyone reasoning about the code or adding TS tooling later. The interface should also extendPromise<T>to be accurate. -
Medium: Freshness test won't run in CI —
packages/runtime-sdk/tests/test_js_sdk_compile.pyis never executed because.github/workflows/tests.ymlonly runspytest testsinpackages/cli. If the.mjsdrifts out of sync with the.tssource, nothing in CI will catch it. -
Low: esbuild version is not pinned —
npx --yes esbuilduses whatever version is globally cached or latest. Different environments may produce slightly different output (e.g., whitespace changes between esbuild versions), which would cause the--checkmode to report the file as out of date even when the TS source hasn't changed. Consider pinning the version, e.g.,npx --yes esbuild@0.25.0.
|
Review posted successfully on PR #90. Here's a summary of the feedback:
|
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
Requires cloudflare/workers-sdk#13311
This adds a JavaScript file in our Python SDK so that we can define logics in JS which cannot be implemented in Python side. I migrated
patchWaitUntilfunction that is currently in workerd as an example.