diff --git a/README.md b/README.md index 69653e8..85ef2ba 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,7 @@ Here is an example using the [`@fastify/basic-auth`](https://github.com/fastify/ ##### Example ```js const fastify = require('fastify')() -const crypto = require('crypto') +const crypto = require('node:crypto') fastify.register(require('@fastify/swagger')) diff --git a/index.js b/index.js index 956aefd..b02d42a 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,8 @@ 'use strict' const fp = require('fastify-plugin') -const { readFile } = require('fs/promises') -const path = require('path') +const { readFile } = require('node:fs/promises') +const path = require('node:path') async function fastifySwaggerUi (fastify, opts) { fastify.decorate('swaggerCSP', require('./static/csp.json')) diff --git a/lib/routes.js b/lib/routes.js index f8537f5..ba65144 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -1,6 +1,6 @@ 'use strict' -const path = require('path') +const path = require('node:path') const yaml = require('yaml') const fastifyStatic = require('@fastify/static') const rfdc = require('rfdc')() diff --git a/scripts/prepare-swagger-ui.js b/scripts/prepare-swagger-ui.js index e1d9941..3065ac5 100644 --- a/scripts/prepare-swagger-ui.js +++ b/scripts/prepare-swagger-ui.js @@ -1,8 +1,8 @@ -const fs = require('fs') +const fs = require('node:fs') const fse = require('fs-extra') -const crypto = require('crypto') +const crypto = require('node:crypto') const swaggerUiAssetPath = require('swagger-ui-dist').getAbsoluteFSPath() -const resolve = require('path').resolve +const resolve = require('node:path').resolve const folderName = 'static' diff --git a/test/route.test.js b/test/route.test.js index d21578a..08e9051 100644 --- a/test/route.test.js +++ b/test/route.test.js @@ -15,8 +15,8 @@ const { swaggerOption } = require('../examples/options') -const resolve = require('path').resolve -const readFileSync = require('fs').readFileSync +const resolve = require('node:path').resolve +const readFileSync = require('node:fs').readFileSync const schemaParamsWithoutDesc = { schema: { diff --git a/test/static.test.js b/test/static.test.js index 56c9cdc..926a87e 100644 --- a/test/static.test.js +++ b/test/static.test.js @@ -5,8 +5,8 @@ const Fastify = require('fastify') const fastifySwagger = require('@fastify/swagger') const fastifySwaggerUi = require('../index') const yaml = require('yaml') -const readFileSync = require('fs').readFileSync -const resolve = require('path').resolve +const readFileSync = require('node:fs').readFileSync +const resolve = require('node:path').resolve test('swagger route returns yaml', async (t) => { const config = {