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

refactor: prefix built-in node module imports #6236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ unreleased
* cleanup: remove AsyncLocalStorage check from tests
* cleanup: remove unnecessary require for global Buffer
* perf: use loop for acceptParams
* refactor: prefix built-in node module imports

5.0.1 / 2024-10-08
==========
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

var express = require('../..');
var hash = require('pbkdf2-password')()
var path = require('path');
var path = require('node:path');
var session = require('express-session');

var app = module.exports = express();
Expand Down
2 changes: 1 addition & 1 deletion examples/downloads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

var express = require('../../');
var path = require('path');
var path = require('node:path');

var app = module.exports = express();

Expand Down
2 changes: 1 addition & 1 deletion examples/ejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

var express = require('../../');
var path = require('path');
var path = require('node:path');

var app = module.exports = express();

Expand Down
2 changes: 1 addition & 1 deletion examples/error-pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

var express = require('../../');
var path = require('path');
var path = require('node:path');
var app = module.exports = express();
var logger = require('morgan');
var silent = process.env.NODE_ENV === 'test'
Expand Down
4 changes: 2 additions & 2 deletions examples/markdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

var escapeHtml = require('escape-html');
var express = require('../..');
var fs = require('fs');
var fs = require('node:fs');
var marked = require('marked');
var path = require('path');
var path = require('node:path');

var app = module.exports = express();

Expand Down
2 changes: 1 addition & 1 deletion examples/mvc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

var express = require('../..');
var logger = require('morgan');
var path = require('path');
var path = require('node:path');
var session = require('express-session');
var methodOverride = require('method-override');

Expand Down
4 changes: 2 additions & 2 deletions examples/mvc/lib/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

var express = require('../../..');
var fs = require('fs');
var path = require('path');
var fs = require('node:fs');
var path = require('node:path');

module.exports = function(parent, options){
var dir = path.join(__dirname, '..', 'controllers');
Expand Down
2 changes: 1 addition & 1 deletion examples/route-separation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

var express = require('../..');
var path = require('path');
var path = require('node:path');
var app = express();
var logger = require('morgan');
var cookieParser = require('cookie-parser');
Expand Down
2 changes: 1 addition & 1 deletion examples/search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

var express = require('../..');
var path = require('path');
var path = require('node:path');
var redis = require('redis');

var db = redis.createClient();
Expand Down
2 changes: 1 addition & 1 deletion examples/static-files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

var express = require('../..');
var logger = require('morgan');
var path = require('path');
var path = require('node:path');
var app = express();

// log requests
Expand Down
4 changes: 2 additions & 2 deletions examples/view-constructor/github-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Module dependencies.
*/

var https = require('https');
var path = require('path');
var https = require('node:https');
var path = require('node:path');
var extname = path.extname;

/**
Expand Down
2 changes: 1 addition & 1 deletion examples/view-locals/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

var express = require('../..');
var path = require('path');
var path = require('node:path');
var User = require('./user');
var app = express();

Expand Down
8 changes: 4 additions & 4 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ var finalhandler = require('finalhandler');
var methods = require('methods');
var debug = require('debug')('express:application');
var View = require('./view');
var http = require('http');
var http = require('node:http');
var compileETag = require('./utils').compileETag;
var compileQueryParser = require('./utils').compileQueryParser;
var compileTrust = require('./utils').compileTrust;
var merge = require('utils-merge');
var resolve = require('path').resolve;
var resolve = require('node:path').resolve;
var once = require('once')
var Router = require('router');

Expand Down Expand Up @@ -593,8 +593,8 @@ app.render = function render(name, options, callback) {
* and HTTPS server you may do so with the "http"
* and "https" modules as shown here:
*
* var http = require('http')
* , https = require('https')
* var http = require('node:http')
* , https = require('node:https')
* , express = require('express')
* , app = express();
*
Expand Down
2 changes: 1 addition & 1 deletion lib/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

var bodyParser = require('body-parser')
var EventEmitter = require('events').EventEmitter;
var EventEmitter = require('node:events').EventEmitter;
var mixin = require('merge-descriptors');
var proto = require('./application');
var Router = require('router');
Expand Down
4 changes: 2 additions & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
*/

var accepts = require('accepts');
var isIP = require('net').isIP;
var isIP = require('node:net').isIP;
var typeis = require('type-is');
var http = require('http');
var http = require('node:http');
var fresh = require('fresh');
var parseRange = require('range-parser');
var parse = require('parseurl');
Expand Down
6 changes: 3 additions & 3 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ var contentDisposition = require('content-disposition');
var createError = require('http-errors')
var encodeUrl = require('encodeurl');
var escapeHtml = require('escape-html');
var http = require('http');
var http = require('node:http');
var onFinished = require('on-finished');
var mime = require('mime-types')
var path = require('path');
var pathIsAbsolute = require('path').isAbsolute;
var path = require('node:path');
var pathIsAbsolute = require('node:path').isAbsolute;
var statuses = require('statuses')
var merge = require('utils-merge');
var sign = require('cookie-signature').sign;
Expand Down
4 changes: 2 additions & 2 deletions lib/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*/

var debug = require('debug')('express:view');
var path = require('path');
var fs = require('fs');
var path = require('node:path');
var fs = require('node:fs');

/**
* Module variables.
Expand Down
2 changes: 1 addition & 1 deletion test/Route.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

var after = require('after');
var assert = require('assert')
var assert = require('node:assert')
var express = require('../')
, Route = express.Route
, methods = require('methods')
Expand Down
2 changes: 1 addition & 1 deletion test/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var after = require('after');
var express = require('../')
, Router = express.Router
, methods = require('methods')
, assert = require('assert');
, assert = require('node:assert');

describe('Router', function(){
it('should return a function with router methods', function() {
Expand Down
6 changes: 3 additions & 3 deletions test/app.engine.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict'

var assert = require('assert')
var assert = require('node:assert')
var express = require('../')
, fs = require('fs');
var path = require('path')
, fs = require('node:fs');
var path = require('node:path')

function render(path, options, fn) {
fs.readFile(path, 'utf8', function(err, str){
Expand Down
2 changes: 1 addition & 1 deletion test/app.head.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var express = require('../');
var request = require('supertest');
var assert = require('assert');
var assert = require('node:assert');

describe('HEAD', function(){
it('should default to GET', function(done){
Expand Down
2 changes: 1 addition & 1 deletion test/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

var assert = require('assert')
var assert = require('node:assert')
var express = require('..')
var request = require('supertest')

Expand Down
2 changes: 1 addition & 1 deletion test/app.listen.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

var express = require('../')
var assert = require('assert')
var assert = require('node:assert')

describe('app.listen()', function(){
it('should wrap with an HTTP server', function(done){
Expand Down
2 changes: 1 addition & 1 deletion test/app.locals.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

var assert = require('assert')
var assert = require('node:assert')
var express = require('../')

describe('app', function(){
Expand Down
4 changes: 2 additions & 2 deletions test/app.render.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

var assert = require('assert')
var assert = require('node:assert')
var express = require('..');
var path = require('path')
var path = require('node:path')
var tmpl = require('./support/tmpl');

describe('app', function(){
Expand Down
2 changes: 1 addition & 1 deletion test/app.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('app', function(){
var app = express();

app.request.querystring = function(){
return require('url').parse(this.url).query;
return require('node:url').parse(this.url).query;
};

app.use(function(req, res){
Expand Down
2 changes: 1 addition & 1 deletion test/app.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var after = require('after');
var express = require('../')
, request = require('supertest')
, assert = require('assert')
, assert = require('node:assert')
, methods = require('methods');

var shouldSkipQuery = require('./support/utils').shouldSkipQuery
Expand Down
2 changes: 1 addition & 1 deletion test/app.routes.error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

var assert = require('assert')
var assert = require('node:assert')
var express = require('../')
, request = require('supertest');

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

var after = require('after');
var assert = require('assert')
var assert = require('node:assert')
var express = require('..');
var request = require('supertest');

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

var assert = require('assert');
var assert = require('node:assert');
var express = require('..');

describe('config', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/exports.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

var assert = require('assert')
var assert = require('node:assert')
var express = require('../');
var request = require('supertest');

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

var assert = require('assert')
var AsyncLocalStorage = require('async_hooks').AsyncLocalStorage
var assert = require('node:assert')
var AsyncLocalStorage = require('node:async_hooks').AsyncLocalStorage

var express = require('..')
var request = require('supertest')
Expand Down
4 changes: 2 additions & 2 deletions test/express.raw.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

var assert = require('assert')
var AsyncLocalStorage = require('async_hooks').AsyncLocalStorage
var assert = require('node:assert')
var AsyncLocalStorage = require('node:async_hooks').AsyncLocalStorage

var express = require('..')
var request = require('supertest')
Expand Down
4 changes: 2 additions & 2 deletions test/express.static.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

var assert = require('assert')
var assert = require('node:assert')
var express = require('..')
var path = require('path')
var path = require('node:path')
var request = require('supertest')
var utils = require('./support/utils')

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

var assert = require('assert')
var AsyncLocalStorage = require('async_hooks').AsyncLocalStorage
var assert = require('node:assert')
var AsyncLocalStorage = require('node:async_hooks').AsyncLocalStorage

var express = require('..')
var request = require('supertest')
Expand Down
4 changes: 2 additions & 2 deletions test/express.urlencoded.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

var assert = require('assert')
var AsyncLocalStorage = require('async_hooks').AsyncLocalStorage
var assert = require('node:assert')
var AsyncLocalStorage = require('node:async_hooks').AsyncLocalStorage

var express = require('..')
var request = require('supertest')
Expand Down
2 changes: 1 addition & 1 deletion test/middleware.basic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

var assert = require('assert')
var assert = require('node:assert')
var express = require('../');
var request = require('supertest');

Expand Down
2 changes: 1 addition & 1 deletion test/req.get.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var express = require('../')
, request = require('supertest')
, assert = require('assert');
, assert = require('node:assert');

describe('req', function(){
describe('.get(field)', function(){
Expand Down
2 changes: 1 addition & 1 deletion test/req.query.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

var assert = require('assert')
var assert = require('node:assert')
var express = require('../')
, request = require('supertest');

Expand Down
Loading
Loading