Skip to content

Instantly share code, notes, and snippets.

@RhysSullivan
Last active October 25, 2025 07:20
Show Gist options
  • Select an option

  • Save RhysSullivan/92cff93a45d492951e1ff8dea6136c22 to your computer and use it in GitHub Desktop.

Select an option

Save RhysSullivan/92cff93a45d492951e1ff8dea6136c22 to your computer and use it in GitHub Desktop.
import { plugin } from "bun";
import { transform } from '@swc/core';
console.log('Workflow plugin loaded');
plugin({
name: 'workflow-transform',
setup(build: any) {
build.onLoad({ filter: /workflows\/.*\.(ts|tsx|js|jsx)$/ }, async (args: any) => {
const source = await Bun.file(args.path).text();
const result = await transform(source, {
filename: args.path,
jsc: {
experimental: {
plugins: [[require.resolve('@workflow/swc-plugin'), { mode: 'client' }]],
},
},
});
return {
contents: result.code,
loader: 'ts',
};
});
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment