diff --git a/cli.js b/cli.js index 8bb317ce..3d9962a3 100755 --- a/cli.js +++ b/cli.js @@ -2,7 +2,7 @@ 'use strict' -const path = require('path') +const path = require('node:path') const commist = require('commist')() const argv = require('yargs-parser')(process.argv) const help = require('help-me')({ diff --git a/eject.js b/eject.js index 69bd80a3..8daddc98 100644 --- a/eject.js +++ b/eject.js @@ -1,6 +1,6 @@ 'use strict' -const path = require('path') +const path = require('node:path') const generify = require('generify') const argv = require('yargs-parser') const log = require('./log') diff --git a/generate-plugin.js b/generate-plugin.js index 87e64fd8..5b8f1121 100755 --- a/generate-plugin.js +++ b/generate-plugin.js @@ -3,15 +3,15 @@ const { readFile, writeFile -} = require('fs').promises -const { existsSync } = require('fs') -const path = require('path') +} = require('node:fs').promises +const { existsSync } = require('node:fs') +const path = require('node:path') const chalk = require('chalk') const generify = require('generify') const argv = require('yargs-parser') const cliPkg = require('./package') -const { execSync } = require('child_process') -const { promisify } = require('util') +const { execSync } = require('node:child_process') +const { promisify } = require('node:util') const log = require('./log') const pluginTemplate = { diff --git a/generate-readme.js b/generate-readme.js index b0c1bd57..410c49f4 100644 --- a/generate-readme.js +++ b/generate-readme.js @@ -1,10 +1,10 @@ 'use strict' -const { readFileSync, existsSync } = require('fs') -const path = require('path') +const { readFileSync, existsSync } = require('node:fs') +const path = require('node:path') const generify = require('generify') const argv = require('yargs-parser') -const { execSync } = require('child_process') +const { execSync } = require('node:child_process') const log = require('./log') function toMarkdownList (a) { diff --git a/generate.js b/generate.js index 68371321..0bd4683a 100755 --- a/generate.js +++ b/generate.js @@ -4,13 +4,13 @@ const { readFile, writeFile, existsSync -} = require('fs') -const path = require('path') +} = require('node:fs') +const path = require('node:path') const chalk = require('chalk') const generify = require('generify') const argv = require('yargs-parser') const cliPkg = require('./package') -const { execSync } = require('child_process') +const { execSync } = require('node:child_process') const log = require('./log') const javascriptTemplate = { diff --git a/lib/watch/index.js b/lib/watch/index.js index 12adee00..7b9589b6 100644 --- a/lib/watch/index.js +++ b/lib/watch/index.js @@ -1,12 +1,12 @@ 'use strict' -const path = require('path') -const cp = require('child_process') +const path = require('node:path') +const cp = require('node:child_process') const chalk = require('chalk') const { arrayToRegExp, logWatchVerbose } = require('./utils') const { GRACEFUL_SHUT } = require('./constants.js') -const EventEmitter = require('events') +const EventEmitter = require('node:events') const chokidar = require('chokidar') const forkPath = path.join(__dirname, './fork.js') diff --git a/lib/watch/utils.js b/lib/watch/utils.js index 894a2626..dae37507 100644 --- a/lib/watch/utils.js +++ b/lib/watch/utils.js @@ -1,7 +1,7 @@ 'use strict' const chalk = require('chalk') -const path = require('path') +const path = require('node:path') const arrayToRegExp = (arr) => { const reg = arr.map((file) => { diff --git a/start.js b/start.js index 610f37a9..18cf2018 100755 --- a/start.js +++ b/start.js @@ -124,7 +124,7 @@ async function runFastify (args, additionalOptions, serverOptions) { if (process.version.match(/v[0-6]\..*/g)) { stop('Fastify debug mode not compatible with Node.js version < 6') } else { - require('inspector').open( + require('node:inspector').open( opts.debugPort, opts.debugHost || isDocker() || isKubernetes() ? listenAddressDocker : undefined ) diff --git a/templates/app/app.js b/templates/app/app.js index 7c3927f0..4bf111cc 100644 --- a/templates/app/app.js +++ b/templates/app/app.js @@ -1,6 +1,6 @@ 'use strict' -const path = require('path') +const path = require('node:path') const AutoLoad = require('@fastify/autoload') // Pass --options via CLI arguments in command to enable these options. diff --git a/templates/app/test/helper.js b/templates/app/test/helper.js index d58c2b3d..67c3fe4d 100644 --- a/templates/app/test/helper.js +++ b/templates/app/test/helper.js @@ -4,7 +4,7 @@ // between our tests. const { build: buildApplication } = require('fastify-cli/helper') -const path = require('path') +const path = require('node:path') const AppPath = path.join(__dirname, '..', 'app.js') // Fill in this config with all the configurations diff --git a/test/cli.test.js b/test/cli.test.js index b0a78f94..d13ccc7a 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -1,9 +1,9 @@ 'use strict' const t = require('tap') -const { execSync } = require('child_process') -const { mkdirSync, readFileSync } = require('fs') -const path = require('path') +const { execSync } = require('node:child_process') +const { mkdirSync, readFileSync } = require('node:fs') +const path = require('node:path') const rimraf = require('rimraf') t.test('generate', async (t) => { diff --git a/test/eject-esm.test.js b/test/eject-esm.test.js index d49d01bc..2f8f1161 100644 --- a/test/eject-esm.test.js +++ b/test/eject-esm.test.js @@ -9,8 +9,8 @@ const { mkdirSync, readFileSync, readFile -} = require('fs') -const path = require('path') +} = require('node:fs') +const path = require('node:path') const rimraf = require('rimraf') const walker = require('walker') const workdir = path.join(__dirname, 'workdir') diff --git a/test/eject-ts.test.js b/test/eject-ts.test.js index f91ba6ab..5d3a7a70 100644 --- a/test/eject-ts.test.js +++ b/test/eject-ts.test.js @@ -5,8 +5,8 @@ process.env.TAP_BAIL = true const t = require('tap') -const { mkdirSync, readFileSync, readFile } = require('fs') -const path = require('path') +const { mkdirSync, readFileSync, readFile } = require('node:fs') +const path = require('node:path') const rimraf = require('rimraf') const walker = require('walker') const workdir = path.join(__dirname, 'workdir') diff --git a/test/eject.test.js b/test/eject.test.js index 92a3c27d..eee32f72 100644 --- a/test/eject.test.js +++ b/test/eject.test.js @@ -9,8 +9,8 @@ const { mkdirSync, readFileSync, readFile -} = require('fs') -const path = require('path') +} = require('node:fs') +const path = require('node:path') const rimraf = require('rimraf') const walker = require('walker') const workdir = path.join(__dirname, 'workdir') diff --git a/test/generate-esm.test.js b/test/generate-esm.test.js index 11d2953e..0215ea5b 100644 --- a/test/generate-esm.test.js +++ b/test/generate-esm.test.js @@ -11,16 +11,16 @@ const { readFile, promises: fsPromises, unlink -} = require('fs') -const path = require('path') -const { promisify } = require('util') +} = require('node:fs') +const path = require('node:path') +const { promisify } = require('node:util') const rimraf = require('rimraf') const walker = require('walker') const { generate, javascriptTemplate } = require('../generate') const workdir = path.join(__dirname, 'workdir') const appTemplateDir = path.join(__dirname, '..', 'templates', 'app-esm') const cliPkg = require('../package') -const { exec, execSync } = require('child_process') +const { exec, execSync } = require('node:child_process') const pExec = promisify(exec) const pUnlink = promisify(unlink) const minimatch = require('minimatch') diff --git a/test/generate-plugin.test.js b/test/generate-plugin.test.js index b655e717..40c1edb4 100644 --- a/test/generate-plugin.test.js +++ b/test/generate-plugin.test.js @@ -9,15 +9,15 @@ const { mkdirSync, readFileSync, readFile -} = require('fs') -const path = require('path') +} = require('node:fs') +const path = require('node:path') const rimraf = require('rimraf') const walker = require('walker') const { generate, pluginTemplate } = require('../generate-plugin') const workdir = path.join(__dirname, 'workdir') const templateDir = path.join(__dirname, '..', 'templates', 'plugin') const cliPkg = require('../package') -const { exec, execSync } = require('child_process') +const { exec, execSync } = require('node:child_process') const minimatch = require('minimatch') const strip = require('strip-ansi') const expected = {} diff --git a/test/generate-readme.test.js b/test/generate-readme.test.js index eeb81750..66d92bd8 100644 --- a/test/generate-readme.test.js +++ b/test/generate-readme.test.js @@ -1,7 +1,7 @@ 'use strict' -const path = require('path') -const fs = require('fs') +const path = require('node:path') +const fs = require('node:fs') const t = require('tap') const rimraf = require('rimraf') const { generate } = require('../generate-readme') diff --git a/test/generate-swagger.test.js b/test/generate-swagger.test.js index b97566b7..1f0501ca 100644 --- a/test/generate-swagger.test.js +++ b/test/generate-swagger.test.js @@ -1,4 +1,4 @@ -const path = require('path') +const path = require('node:path') const t = require('tap') const { test } = t const { generateSwagger } = require('../generate-swagger') diff --git a/test/generate-typescript-esm.test.js b/test/generate-typescript-esm.test.js index 9115a38e..72fcd80d 100644 --- a/test/generate-typescript-esm.test.js +++ b/test/generate-typescript-esm.test.js @@ -9,15 +9,15 @@ const { mkdirSync, readFileSync, readFile -} = require('fs') -const path = require('path') +} = require('node:fs') +const path = require('node:path') const rimraf = require('rimraf') const walker = require('walker') const { generate, typescriptTemplate } = require('../generate') const workdir = path.join(__dirname, 'workdir') const appTemplateDir = path.join(__dirname, '..', 'templates', 'app-ts') const cliPkg = require('../package') -const { exec, execSync } = require('child_process') +const { exec, execSync } = require('node:child_process') const minimatch = require('minimatch') const strip = require('strip-ansi') const expected = {} diff --git a/test/generate-typescript.test.js b/test/generate-typescript.test.js index 987b8868..444fb964 100644 --- a/test/generate-typescript.test.js +++ b/test/generate-typescript.test.js @@ -9,15 +9,15 @@ const { mkdirSync, readFileSync, readFile -} = require('fs') -const path = require('path') +} = require('node:fs') +const path = require('node:path') const rimraf = require('rimraf') const walker = require('walker') const { generate, typescriptTemplate } = require('../generate') const workdir = path.join(__dirname, 'workdir') const appTemplateDir = path.join(__dirname, '..', 'templates', 'app-ts') const cliPkg = require('../package') -const { exec, execSync } = require('child_process') +const { exec, execSync } = require('node:child_process') const minimatch = require('minimatch') const strip = require('strip-ansi') const expected = {} diff --git a/test/generate.test.js b/test/generate.test.js index e71141e8..0093cf3c 100644 --- a/test/generate.test.js +++ b/test/generate.test.js @@ -11,16 +11,16 @@ const { readFile, promises: fsPromises, unlink -} = require('fs') -const path = require('path') -const { promisify } = require('util') +} = require('node:fs') +const path = require('node:path') +const { promisify } = require('node:util') const rimraf = require('rimraf') const walker = require('walker') const { generate, javascriptTemplate } = require('../generate') const workdir = path.join(__dirname, 'workdir') const appTemplateDir = path.join(__dirname, '..', 'templates', 'app') const cliPkg = require('../package') -const { exec, execSync } = require('child_process') +const { exec, execSync } = require('node:child_process') const pExec = promisify(exec) const pUnlink = promisify(unlink) const minimatch = require('minimatch') diff --git a/test/helper.test.js b/test/helper.test.js index 6eb8613a..20607d9f 100644 --- a/test/helper.test.js +++ b/test/helper.test.js @@ -1,10 +1,10 @@ 'use strict' -const util = require('util') -const fs = require('fs') -const path = require('path') +const util = require('node:util') +const fs = require('node:fs') +const path = require('node:path') const { test } = require('tap') -const stream = require('stream') +const stream = require('node:stream') const helper = require('../helper') diff --git a/test/start.test.js b/test/start.test.js index 454e6732..7e91fb5c 100644 --- a/test/start.test.js +++ b/test/start.test.js @@ -1,14 +1,14 @@ /* global GLOBAL_MODULE_1, GLOBAL_MODULE_2 */ 'use strict' -const util = require('util') -const { once } = require('events') -const fs = require('fs') -const path = require('path') -const crypto = require('crypto') +const util = require('node:util') +const { once } = require('node:events') +const fs = require('node:fs') +const path = require('node:path') +const crypto = require('node:crypto') const semver = require('semver') const baseFilename = path.join(__dirname, 'fixtures', `test_${crypto.randomBytes(16).toString('hex')}`) -const { fork } = require('child_process') +const { fork } = require('node:child_process') const moduleSupport = semver.satisfies(process.version, '>= 14 || >= 12.17.0 < 13.0.0') const t = require('tap') @@ -226,7 +226,7 @@ test('should start fastify at given socket path', { skip: process.platform === ' const fastify = await start.start(argv) await new Promise((resolve, reject) => { - const request = require('http').request({ + const request = require('node:http').request({ method: 'GET', path: '/', socketPath: sockFile diff --git a/util.js b/util.js index c86ebe36..dfc49d68 100644 --- a/util.js +++ b/util.js @@ -1,6 +1,6 @@ -const fs = require('fs') -const path = require('path') -const url = require('url') +const fs = require('node:fs') +const path = require('node:path') +const url = require('node:url') const semver = require('semver') const pkgUp = require('pkg-up') const resolveFrom = require('resolve-from')