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 fb45df9 commit fa99686
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/commands/publish.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const assert = require('assert').strict
const assert = require('node:assert').strict
const pino = require('pino')
const { validate } = require('../validation')
const draft = require('./draft')
Expand Down
6 changes: 3 additions & 3 deletions lib/editor.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict'

const fs = require('fs')
const { promisify } = require('util')
const fs = require('node:fs')
const { promisify } = require('node:util')
const open = require('open-editor')
const tempWrite = require('temp-write')
const { spawn } = require('child_process')
const { spawn } = require('node:child_process')

const readFile = promisify(fs.readFile)

Expand Down
6 changes: 3 additions & 3 deletions lib/git-directory.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

const { join } = require('path')
const { readFileSync } = require('fs')
const { promisify } = require('util')
const { join } = require('node:path')
const { readFileSync } = require('node:fs')
const { promisify } = require('node:util')
const SimpleGit = require('simple-git')

module.exports = function gitDirectory (path) {
Expand Down
4 changes: 2 additions & 2 deletions lib/man.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const path = require('path')
const { readFileSync } = require('fs')
const path = require('node:path')
const { readFileSync } = require('node:fs')

module.exports.needToShowHelp = function (file, opts) {
if (opts.help || opts._.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion lib/npm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

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

function runSpawn (cwd, cmd, args) {
return new Promise((resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion test/command-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const t = require('tap')
const h = require('./helper')
const fs = require('fs')
const fs = require('node:fs')

const cmd = h.buildProxyCommand('../lib/commands/config')
const LocalConf = require('../lib/local-conf')
Expand Down
2 changes: 1 addition & 1 deletion test/command-draft.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const t = require('tap')
const { join } = require('path')
const { join } = require('node:path')
const h = require('./helper')

const cmd = h.buildProxyCommand('../lib/commands/draft', {
Expand Down
4 changes: 2 additions & 2 deletions test/command-publish.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

const { EventEmitter } = require('events')
const { EventEmitter } = require('node:events')
const t = require('tap')
const { join } = require('path')
const { join } = require('node:path')
const proxyquire = require('proxyquire')
const h = require('./helper')

Expand Down
6 changes: 3 additions & 3 deletions test/helper.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

const { spawn } = require('child_process')
const fs = require('fs')
const path = require('path')
const { spawn } = require('node:child_process')
const fs = require('node:fs')
const path = require('node:path')
const proxyquire = require('proxyquire')

const factorySimpleGit = require('./proxy/simple-git-proxy')
Expand Down

0 comments on commit fa99686

Please sign in to comment.