Skip to content

Commit fa5a327

Browse files
authoredJun 27, 2023
feat: initial ESM support (elastic#3381)
This adds initial and ECMAScript Module (ESM) support, i.e. `import ...`, via the `--experimental-loader=elastic-apm-node/loader.mjs` node option. This instruments a subset of modules -- more will follow in subsequent changes. Other changes: - Fixes a fastify instrumentation issue where the exported `fastify.errorCodes` was broken by instrumentation (both CJS and ESM). - Adds a `runTestFixtures` utility that should be useful for running out of process instrumentation/agent tests. Closes: elastic#1952 Refs: elastic#2343
1 parent d8acbf2 commit fa5a327

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2006
-570
lines changed
 

‎.eslintrc.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
},
2222
"ignorePatterns": [
2323
"/*.example.js", // a pattern for uncommited local dev files to avoid linting
24+
"/*.example.mjs", // a pattern for uncommited local dev files to avoid linting
2425
"/.nyc_output",
2526
"/build",
2627
"node_modules",
@@ -40,6 +41,10 @@
4041
"/test/types/transpile/index.js",
4142
"/test/types/transpile-default/index.js",
4243
"/test_output",
43-
"tmp"
44+
"tmp",
45+
// These files use top-level await, which is *fine* for ESM files but, IIUC,
46+
// not supported by eslint until v8.
47+
"/test/instrumentation/modules/fixtures/use-fastify.mjs",
48+
"/test/instrumentation/modules/http/fixtures/use-dynamic-import.mjs"
4449
]
4550
}

‎.tav.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ pg-old-node:
115115
versions: '4.0.0 || 4.5.7 || 5.2.1 || 6.4.2 || 7.18.2 || 8.0.3 || 8.1.0 || 8.2.2 || 8.3.3 || 8.4.2 || 8.5.1 || 8.6.0 || 8.7.3 || 8.8.0 || 8.9.0 || 8.10.0 || >8.10.0 <9'
116116
node: '<14'
117117
peerDependencies:
118-
- bluebird@^3.0.0
119-
- knex@^0.17.3
118+
- knex@^0.20 # latest knex that supports back to node v8
120119
commands:
121120
- node test/instrumentation/modules/pg/pg.test.js
122121
- node test/instrumentation/modules/pg/knex.test.js
@@ -129,9 +128,6 @@ pg-new-node:
129128
# Maintenance note: This should be updated for newer MAJOR.MINOR releases.
130129
versions: '8.0.3 || 8.1.0 || 8.2.2 || 8.3.3 || 8.4.2 || 8.5.1 || 8.6.0 || 8.7.3 || 8.8.0 || 8.9.0 || 8.10.0 || >8.10.0 <9'
131130
node: '>=14'
132-
peerDependencies:
133-
- bluebird@^3.0.0
134-
- knex@^0.17.3
135131
commands:
136132
- node test/instrumentation/modules/pg/pg.test.js
137133
- node test/instrumentation/modules/pg/knex.test.js

0 commit comments

Comments
 (0)
Please sign in to comment.