13 lines
964 B
JavaScript
13 lines
964 B
JavaScript
import { build } from 'esbuild'
|
|
await build({
|
|
entryPoints: ['scripts/b03-policy-regression.ts'], outfile: '.tmp/b03-policy-regression.mjs',
|
|
bundle: true, platform: 'node', format: 'esm', logLevel: 'warning',
|
|
banner: { js: `import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);` },
|
|
plugins: [{ name: 'b03-offline-stubs', setup(plugin) {
|
|
plugin.onResolve({ filter: /^(electron|@anthropic-ai\/claude-agent-sdk)$/ }, args => ({ path: args.path, namespace: 'b03-stub' }))
|
|
plugin.onLoad({ filter: /.*/, namespace: 'b03-stub' }, args => ({ loader: 'js', contents: args.path === 'electron'
|
|
? `export const app={getPath:()=>process.env.CLAUDE_TEST_USER_DATA,getAppPath:()=>process.cwd()};export const safeStorage={isEncryptionAvailable:()=>false};`
|
|
: `export const query = args => globalThis.__b03Query(args); export const createSdkMcpServer = x => x; export const tool = (...args) => args;` }))
|
|
} }]
|
|
})
|