diff --git a/benchmark/bench.js b/benchmark/bench.js index 46a5f0c..b30ad32 100644 --- a/benchmark/bench.js +++ b/benchmark/bench.js @@ -4,7 +4,7 @@ const redisStoreFactory = require('connect-redis') const Fastify = require('fastify') const Redis = require('ioredis') const fileStoreFactory = require('session-file-store') -const { isMainThread } = require('worker_threads') +const { isMainThread } = require('node:worker_threads') const fastifySession = require('..') const fastifyCookie = require('@fastify/cookie') diff --git a/lib/idGenerator.js b/lib/idGenerator.js index d4e351d..e0d4cc7 100644 --- a/lib/idGenerator.js +++ b/lib/idGenerator.js @@ -1,6 +1,6 @@ 'use strict' -const randomBytes = require('crypto').randomBytes +const randomBytes = require('node:crypto').randomBytes const cacheSize = 24 << 7 let pos = 0 diff --git a/lib/session.js b/lib/session.js index 5fd1d5a..26247ad 100644 --- a/lib/session.js +++ b/lib/session.js @@ -1,6 +1,6 @@ 'use strict' -const crypto = require('crypto') +const crypto = require('node:crypto') const Cookie = require('./cookie') const { configure: configureStringifier } = require('safe-stable-stringify') diff --git a/lib/store.js b/lib/store.js index 818f5b9..c05d534 100644 --- a/lib/store.js +++ b/lib/store.js @@ -1,7 +1,7 @@ 'use strict' -const EventEmitter = require('events').EventEmitter -const util = require('util') +const EventEmitter = require('node:events').EventEmitter +const util = require('node:util') function Store (storeMap = new Map()) { this.store = storeMap diff --git a/test/fastifySession.checkOptions.test.js b/test/fastifySession.checkOptions.test.js index bdd1b2e..d11868c 100644 --- a/test/fastifySession.checkOptions.test.js +++ b/test/fastifySession.checkOptions.test.js @@ -4,7 +4,7 @@ const test = require('tap').test const Fastify = require('fastify') const fastifyCookie = require('@fastify/cookie') const fastifySession = require('..') -const crypto = require('crypto') +const crypto = require('node:crypto') test('fastifySession.checkOptions: register should fail if no secret is specified', async t => { t.plan(1) diff --git a/test/memorystore.test.js b/test/memorystore.test.js index e9dc093..25fc838 100644 --- a/test/memorystore.test.js +++ b/test/memorystore.test.js @@ -2,7 +2,7 @@ const test = require('tap').test const { MemoryStore } = require('../lib/store') -const { EventEmitter } = require('stream') +const { EventEmitter } = require('node:stream') test('MemoryStore.constructor: created MemoryStore should be an EventEmitter', (t) => { t.plan(2)