-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Depends on avsc, which has some weird polyfill (?) issues w/ finding buffer.SlowBuffer. We also need to address the issue of wasm-merging a whole node project in the GHA container. But with some massaging, this example does pass the integration test suite for transforms. Signed-off-by: Oren Leiman <[email protected]>
- Loading branch information
Showing
5 changed files
with
591 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
node_modules/**/* | ||
user_code.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as esbuild from 'esbuild' | ||
import { polyfillNode } from "esbuild-plugin-polyfill-node"; | ||
|
||
await esbuild.build({ | ||
entryPoints: ["src/index.ts"], | ||
outfile: "dist/schema_registry_example.js", | ||
bundle: true, | ||
external: [ | ||
// This package is provided by the Redpanda JavaScript runtime. | ||
"@redpanda-data/transform-sdk", | ||
"@redpanda-data/transform-sdk-sr", | ||
], | ||
target: "es2022", | ||
platform: "neutral", // We're running in Wasm | ||
plugins: [ | ||
polyfillNode({ | ||
globals: { | ||
// Allow a global Buffer variable if referenced. | ||
buffer: true, | ||
// Don't inject the process global, the Redpanda JavaScript runtime | ||
// does that. | ||
process: false, | ||
}, | ||
polyfills: { | ||
// Any NodeJS APIs that need to polyfilled can be added here. | ||
}, | ||
}), | ||
], | ||
}); |
Oops, something went wrong.