Skip to content

Commit

Permalink
perf: use node: prefix to bypass require.cache call for builtins (#108
Browse files Browse the repository at this point in the history
)

* perf: use `node:` prefix to bypass require.cache call for builtins

See fastify/fastify-static#407

* docs: use `node:` prefix to bypass require.cache call for builtins
  • Loading branch information
Fdawgs authored Sep 10, 2023
1 parent e6cbf3a commit 91a9462
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ npm i @fastify/kafka
### Usage

```js
const crypto = require('crypto')
const crypto = require('node:crypto')
const fastify = require('fastify')()
const group = crypto.randomBytes(20).toString('hex')

Expand Down
2 changes: 1 addition & 1 deletion examples/basic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const crypto = require('crypto')
const crypto = require('node:crypto')
const fastify = require('fastify')({
logger: {
level: 'debug'
Expand Down
2 changes: 1 addition & 1 deletion examples/multiple-consumers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const crypto = require('crypto')
const crypto = require('node:crypto')
const fastifyKafka = require('..')
const fastify = require('fastify')

Expand Down
4 changes: 2 additions & 2 deletions lib/consumer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const EE = require('events').EventEmitter
const inherits = require('util').inherits
const EE = require('node:events').EventEmitter
const inherits = require('node:util').inherits
const Kafka = require('node-rdkafka')

function Consumer (opts, log, next, topicConf, metadataOptions) {
Expand Down
4 changes: 2 additions & 2 deletions lib/producer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const EE = require('events').EventEmitter
const inherits = require('util').inherits
const EE = require('node:events').EventEmitter
const inherits = require('node:util').inherits
const Kafka = require('node-rdkafka')

function Producer (opts, log, next, topicConf, metadataOptions) {
Expand Down
2 changes: 1 addition & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const crypto = require('crypto')
const crypto = require('node:crypto')

module.exports.getDefaultOptions = function getDefaultOptions () {
return {
Expand Down

0 comments on commit 91a9462

Please sign in to comment.