-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathbundle-driver.mjs
More file actions
executable file
·43 lines (40 loc) · 1.21 KB
/
bundle-driver.mjs
File metadata and controls
executable file
·43 lines (40 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env node
import * as esbuild from 'esbuild';
import { fileURLToPath } from 'node:url';
import { isBuiltin } from 'node:module';
import path from 'node:path';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.join(__dirname, '..');
await esbuild.build({
entryPoints: [path.join(rootDir, 'src/index.ts')],
bundle: true,
outfile: path.join(rootDir, 'test/tools/runner/driver.bundle.js'),
platform: 'node',
format: 'cjs',
target: 'node20',
external: [
'bson',
'mongodb-connection-string-url',
'@mongodb-js/saslprep',
'@mongodb-js/zstd',
'mongodb-client-encryption',
'snappy',
'@napi-rs/snappy*',
'kerberos',
'gcp-metadata',
'@aws-sdk/credential-providers'
],
plugins: [{
name: 'externalize-node-builtins',
setup(build) {
build.onResolve({ filter: /.*/ }, args => {
if (isBuiltin(args.path)) {
return { path: args.path, external: true };
}
});
}
}],
sourcemap: 'inline',
logLevel: 'info'
});
console.log('✓ Driver bundle created at test/tools/runner/driver.bundle.js');