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 #53

Merged
merged 2 commits 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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ $ npm test
This simple example will send a specific file to all requests.

```js
var http = require('http')
var http = require('node:http')
var send = require('send')

var server = http.createServer(function onRequest (req, res) {
Expand All @@ -191,7 +191,7 @@ given directory as the top-level. For example, a request
`GET /foo.txt` will send back `/www/public/foo.txt`.

```js
var http = require('http')
var http = require('node:http')
var parseUrl = require('parseurl')
var send = require('@fastify/send')

Expand All @@ -206,7 +206,7 @@ server.listen(3000)
### Custom file types

```js
var http = require('http')
var http = require('node:http')
var parseUrl = require('parseurl')
var send = require('@fastify/send')

Expand All @@ -232,8 +232,8 @@ This is an example of serving up a structure of directories with a
custom function to render a listing of a directory.

```js
var http = require('http')
var fs = require('fs')
var http = require('node:http')
var fs = require('node:fs')
var parseUrl = require('parseurl')
var send = require('@fastify/send')

Expand Down Expand Up @@ -270,7 +270,7 @@ function directory (res, path) {
### Serving from a root directory with custom error-handling

```js
var http = require('http')
var http = require('node:http')
var parseUrl = require('parseurl')
var send = require('@fastify/send')

Expand Down
4 changes: 2 additions & 2 deletions examples/simple.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

const http = require('http')
const http = require('node:http')
const send = require('..')
const path = require('path')
const path = require('node:path')

const indexPath = path.join(__dirname, 'index.html')

Expand Down
6 changes: 3 additions & 3 deletions test/SendStream-pipe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

const { test } = require('tap')
const after = require('after')
const http = require('http')
const path = require('path')
const http = require('node:http')
const path = require('node:path')
const request = require('supertest')
const SendStream = require('../lib/SendStream')
const os = require('os')
const os = require('node:os')
const { shouldNotHaveBody, createServer, shouldNotHaveHeader } = require('./utils')

const dateRegExp = /^\w{3}, \d+ \w+ \d+ \d+:\d+:\d+ \w+$/
Expand Down
6 changes: 3 additions & 3 deletions test/SendStream.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict'

const { test } = require('tap')
const fs = require('fs')
const http = require('http')
const path = require('path')
const fs = require('node:fs')
const http = require('node:http')
const path = require('node:path')
const request = require('supertest')
const SendStream = require('..').SendStream
const { shouldNotHaveHeader, createServer } = require('./utils')
Expand Down
2 changes: 1 addition & 1 deletion test/mime.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const { test } = require('tap')
const path = require('path')
const path = require('node:path')
const request = require('supertest')
const send = require('..')
const { shouldNotHaveHeader, createServer } = require('./utils')
Expand Down
2 changes: 1 addition & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const http = require('http')
const http = require('node:http')
const send = require('..')

module.exports.shouldNotHaveHeader = function shouldNotHaveHeader (header, t) {
Expand Down
Loading