Skip to content

Commit

Permalink
perf: use node: prefix to bypass require.cache call for builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Sep 10, 2023
1 parent f2ff3a3 commit 3072311
Show file tree
Hide file tree
Showing 26 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

const path = require('path')
const url = require('url')
const { readdir } = require('fs').promises
const path = require('node:path')
const url = require('node:url')
const { readdir } = require('node:fs').promises
const pkgUp = require('pkg-up')

const isTsNode = (Symbol.for('ts-node.register.instance') in process) || !!process.env.TS_NODE_DEV
Expand Down
2 changes: 1 addition & 1 deletion scripts/unit-typescript-esbuild.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { exec } = require('child_process')
const { exec } = require('node:child_process')

const args = [
'node',
Expand Down
2 changes: 1 addition & 1 deletion scripts/unit-typescript-esm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { exec } = require('child_process')
const { exec } = require('node:child_process')

const args = [
'tap',
Expand Down
2 changes: 1 addition & 1 deletion scripts/unit-typescript-swc-node-register.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { exec } = require('child_process')
const { exec } = require('node:child_process')

const args = [
'tap',
Expand Down
2 changes: 1 addition & 1 deletion scripts/unit-typescript-swc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { exec } = require('child_process')
const { exec } = require('node:child_process')

const args = [
'tap',
Expand Down
2 changes: 1 addition & 1 deletion scripts/unit-typescript-tsm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { exec } = require('child_process')
const { exec } = require('node:child_process')

const args = [
'tap',
Expand Down
2 changes: 1 addition & 1 deletion scripts/unit-typescript-tsx.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { exec } = require('child_process')
const { exec } = require('node:child_process')

const args = [
'npx',
Expand Down
2 changes: 1 addition & 1 deletion scripts/unit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const { exec } = require('child_process')
const { exec } = require('node:child_process')

const child = exec('npm run unit:with-modules')

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

const path = require('path')
const path = require('node:path')
const autoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/autohooks/cascade.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const autoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/autohooks/disabled.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const autoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/autohooks/overwrite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const autoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/babel-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const t = require('tap')
const Fastify = require('fastify')
const AutoLoad = require('../../')
const { join } = require('path')
const { join } = require('node:path')

t.plan(7)

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

const fs = require('fs')
const path = require('path')
const fs = require('node:fs')
const path = require('node:path')
const autoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/cyclic-dependency/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const AutoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/deep/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const autoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/dependency/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const fastifyUrlData = require('@fastify/url-data')

const AutoLoad = require('../../../')
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/graph-dependency/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const AutoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/index-error/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const AutoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/module-error/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const AutoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/non-plugin/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const AutoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/options/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const fastifyUrlData = require('@fastify/url-data')

const AutoLoad = require('../../../')
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/route-parameters/basic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const autoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/route-parameters/disabled.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const autoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/syntax-error/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const AutoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down
2 changes: 1 addition & 1 deletion test/commonjs/ts-error/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const path = require('path')
const path = require('node:path')
const AutoLoad = require('../../../')

module.exports = function (fastify, opts, next) {
Expand Down

0 comments on commit 3072311

Please sign in to comment.