Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: extract backend #684

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SukkaW
Copy link

@SukkaW SukkaW commented Dec 10, 2024

The first PR toward fixing #226.

This PR moves all esbuild import to the backend folder. This allows future backends (such as swc or even something else) to be implemented.

The PR also specifies the interface for the backend:

export interface Backend<ExtendedTransformOptions> {
	evalTransformSync: (evalCode: string, inputType?: string) => string;
	replTransform: (code: string, filename: string) => Promise<string>;
	transformSync: (
		code: string,
		filePath: string,
		extendOptions?: ExtendedTransformOptions,
	) => Transformed,
	transform: (
		code: string,
		filePath: string,
		extendOptions?: ExtendedTransformOptions,
	) => Promise<Transformed>,
}

@SukkaW
Copy link
Author

SukkaW commented Dec 10, 2024

All CI passed, see SukkaW#1

cc @privatenumber

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant