-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esbuild: ensure aws-sdk can be built (#3591)
* fix esbuild aws-sdk issue by forgoing use of proxy file in favor of injecting instrumentation code directly into the module code --------- Co-authored-by: Ayan Khan <[email protected]>
- Loading branch information
1 parent
ed839d9
commit 5494f6b
Showing
7 changed files
with
92 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require('../../').init() // dd-trace | ||
|
||
const aws = require('aws-sdk') | ||
|
||
void aws.util.inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env node | ||
/* eslint-disable no-console */ | ||
const { spawnSync } = require('child_process') | ||
|
||
const ddPlugin = require('../../esbuild') // dd-trace/esbuild | ||
const esbuild = require('esbuild') | ||
|
||
const SCRIPT = './aws-sdk-out.js' | ||
|
||
esbuild.build({ | ||
entryPoints: ['aws-sdk.js'], | ||
bundle: true, | ||
outfile: SCRIPT, | ||
plugins: [ddPlugin], | ||
platform: 'node', | ||
target: ['node16'], | ||
external: [ ] | ||
}).then(() => { | ||
const { status, stdout, stderr } = spawnSync('node', [SCRIPT]) | ||
if (stdout.length) { | ||
console.log(stdout.toString()) | ||
} | ||
if (stderr.length) { | ||
console.error(stderr.toString()) | ||
} | ||
if (status) { | ||
throw new Error('generated script failed to run') | ||
} | ||
console.log('ok') | ||
}).catch((err) => { | ||
console.error(err) | ||
process.exit(1) | ||
}).finally(() => { | ||
// fs.rmSync(SCRIPT) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
"author": "Thomas Hunter II <[email protected]>", | ||
"license": "ISC", | ||
"dependencies": { | ||
"aws-sdk": "^2.1446.0", | ||
"axios": "^0.21.2", | ||
"esbuild": "0.16.12", | ||
"express": "^4.16.2", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters