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

Merged
merged 1 commit into from
Jan 10, 2025
Merged
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
@@ -7,6 +7,7 @@ unreleased
* cleanup: remove unnecessary require for global Buffer
* perf: use loop for acceptParams
* Replace `methods` dependency with standard library
* refactor: prefix built-in node module imports

5.0.1 / 2024-10-08
==========
2 changes: 1 addition & 1 deletion examples/auth/index.js
Original file line number Diff line number Diff line change
@@ -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();
2 changes: 1 addition & 1 deletion examples/downloads/index.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
*/

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

var app = module.exports = express();

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

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

var app = module.exports = express();

2 changes: 1 addition & 1 deletion examples/error-pages/index.js
Original file line number Diff line number Diff line change
@@ -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'
4 changes: 2 additions & 2 deletions examples/markdown/index.js
Original file line number Diff line number Diff line change
@@ -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();

2 changes: 1 addition & 1 deletion examples/mvc/index.js
Original file line number Diff line number Diff line change
@@ -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');

4 changes: 2 additions & 2 deletions examples/mvc/lib/boot.js
Original file line number Diff line number Diff line change
@@ -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');
2 changes: 1 addition & 1 deletion examples/route-separation/index.js
Original file line number Diff line number Diff line change
@@ -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');
2 changes: 1 addition & 1 deletion examples/search/index.js
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
*/

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

var db = redis.createClient();
2 changes: 1 addition & 1 deletion examples/static-files/index.js
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions examples/view-constructor/github-view.js
Original file line number Diff line number Diff line change
@@ -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;

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

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

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

@@ -468,8 +468,8 @@ app.disable = function disable(setting) {
* Delegate `.VERB(...)` calls to `router.VERB(...)`.
*/

methods.forEach(function(method){
app[method] = function(path){
methods.forEach(function (method) {
app[method] = function (path) {
if (method === 'get' && arguments.length === 1) {
// app.get(setting)
return this.set(path);
@@ -583,8 +583,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();
*
@@ -595,7 +595,7 @@ app.render = function render(name, options, callback) {
* @public
*/

app.listen = function listen () {
app.listen = function listen() {
var server = http.createServer(this)
var args = Array.prototype.slice.call(arguments)
if (typeof args[args.length - 1] === 'function') {
2 changes: 1 addition & 1 deletion lib/express.js
Original file line number Diff line number Diff line change
@@ -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');
4 changes: 2 additions & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
@@ -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');
6 changes: 3 additions & 3 deletions lib/response.js
Original file line number Diff line number Diff line change
@@ -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 sign = require('cookie-signature').sign;
var normalizeType = require('./utils').normalizeType;
4 changes: 2 additions & 2 deletions lib/view.js
Original file line number Diff line number Diff line change
@@ -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.
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('../lib/utils').methods
Loading