Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: use node: prefix to bypass require.cache call for builtins #325

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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