46e1b5be65
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 lines
621 B
JavaScript
10 lines
621 B
JavaScript
// 把 xacro-parser 打成一个浏览器可直接 import 的文件:vendor/xacro/xacro-parser.js
|
|
// 只在升级依赖时运行:node scripts/xacro-bundle.mjs
|
|
import { build } from 'esbuild';
|
|
import { writeFileSync, rmSync } from 'node:fs';
|
|
const entry = new URL('./.xacro-entry.mjs', import.meta.url).pathname;
|
|
writeFileSync(entry, "export { XacroParser } from 'xacro-parser/src/XacroParser.js';\n");
|
|
await build({ entryPoints: [entry], bundle: true, format: 'esm', minify: true, platform: 'browser', outfile: new URL('../vendor/xacro/xacro-parser.js', import.meta.url).pathname });
|
|
rmSync(entry);
|
|
console.log('ok');
|