# vendor-xmldom.ts · versecafe/parsed_it

[View on GitCafe](https://git.cafe/versecafe/parsed_it/blob/vendor-xmldom/vendor-xmldom.ts)

Repository: [versecafe/parsed_it](https://git.cafe/versecafe/parsed_it)

Visibility: public

Requested revision: refs/heads/vendor-xmldom

Commit: e975aab9109d729569c24dec200935e10c056157

Blob: fb9bbccd6b246ad58e7398a7ccf926fafee52e77

Size: 816 bytes

[Immutable source](https://git.cafe/versecafe/parsed_it/blob/e975aab9109d729569c24dec200935e10c056157/vendor-xmldom.ts?format=markdown)

```
import { join } from "node:path";
import { mkdir, writeFile } from "node:fs/promises";

const outdir = join(import.meta.dir, "src/parsed_it/vendor");
await mkdir(outdir, { recursive: true });

// create a temporary entry point that re-exports from the npm package
const entryContent = `export { DOMParser, XMLSerializer } from "@xmldom/xmldom";`;
const entryPath = join(outdir, "_xmldom_entry.js");
await writeFile(entryPath, entryContent);

const result = await Bun.build({
	entrypoints: [entryPath],
	outdir,
	target: "node",
	format: "esm",
	naming: "xmldom.mjs",
});

if (!result.success) {
	console.error("Build failed:");
	for (const log of result.logs) {
		console.error(log);
	}
	process.exit(1);
}

console.log("Build succeeded:");
for (const output of result.outputs) {
	console.log(`  ${output.path}`);
}

```
