Skip to content

Commit

Permalink
add module register hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrenner committed Feb 13, 2025
1 parent ee6423f commit 710a873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion initialize.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ if (isMainThread) {
const require = Module.createRequire(import.meta.url)
require('./init.js')
if (Module.register) {
Module.register('./loader-hook.mjs', import.meta.url)
Module.register('./loader-hook.mjs', import.meta.url, {
data: { exclude: [/langsmith/, /openai\/_shims/] }
})
}
}
4 changes: 3 additions & 1 deletion register.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { register } = require('node:module')
const { pathToFileURL } = require('node:url')

register('./loader-hook.mjs', pathToFileURL(__filename))
register('./loader-hook.mjs', pathToFileURL(__filename), {
data: { exclude: [/langsmith/, /openai\/_shims/] }
})

0 comments on commit 710a873

Please sign in to comment.