import {instantiate} from "../lib/deno_swc/lib/deno_swc.generated.js";
import {decompress} from "https://deno.land/x/lz4@v0.1.2/mod.ts";
import type {
	Config,
	JsMinifyOptions,
	ParseOptions,
	Program,
} from "https://esm.sh/@swc/core@1.2.212/types.d.ts";

const {
	parseSync,
	printSync,
	transformSync,
	minifySync,
} = await instantiate(decompress);

export function parse(source: string, opts: ParseOptions): Program{
	return parseSync(source, opts);
}

export function print(program: Program, opts?: Config): string{
	return printSync(program, opts ?? {}).code;
}

	return transformSync(source, opts).code;
}

export function minify(source: string, opts?: JsMinifyOptions): string{
	return minifySync(source, opts ?? {}).code;
}

export * from "https://esm.sh/@swc/core@1.2.212/types.d.ts";
