Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4884991

Browse filesBrowse files
joyeecheungdanielleadams
authored andcommitted
lib: include url in bootstrap snapshot and remove unnecessary lazy-loads
PR-URL: #38826 Refs: #35711 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Khaidi Chu <i@2333.moe>
1 parent eb7c932 commit 4884991
Copy full SHA for 4884991

File tree

Expand file treeCollapse file tree

4 files changed

+4
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+4
-9
lines changed
Open diff view settings
Collapse file

‎lib/internal/bootstrap/node.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap/node.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ process.emitWarning = emitWarning;
362362
require('fs');
363363
require('v8');
364364
require('vm');
365+
require('url');
365366

366367
function setupPrepareStackTrace() {
367368
const {
Collapse file

‎lib/internal/url.js‎

Copy file name to clipboardExpand all lines: lib/internal/url.js
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ const {
7070
validateObject,
7171
} = require('internal/validators');
7272

73-
// Lazy loaded for startup performance.
74-
let querystring;
73+
const querystring = require('querystring');
7574

7675
const { platform } = process;
7776
const isWindows = platform === 'win32';
@@ -1046,7 +1045,6 @@ function parseParams(qs) {
10461045
} else if (encodeCheck > 0) {
10471046
if (isHexTable[code] === 1) {
10481047
if (++encodeCheck === 3) {
1049-
querystring = require('querystring');
10501048
encoded = true;
10511049
}
10521050
} else {
Collapse file

‎lib/url.js‎

Copy file name to clipboardExpand all lines: lib/url.js
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const {
3232

3333
const { toASCII } = require('internal/idna');
3434
const { encodeStr, hexTable } = require('internal/querystring');
35+
const querystring = require('querystring');
3536

3637
const {
3738
ERR_INVALID_ARG_TYPE
@@ -148,9 +149,6 @@ const {
148149
CHAR_AT,
149150
} = require('internal/constants');
150151

151-
// Lazy loaded for startup performance.
152-
let querystring;
153-
154152
function urlParse(url, parseQueryString, slashesDenoteHost) {
155153
if (url instanceof Url) return url;
156154

@@ -256,7 +254,6 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
256254
if (simplePath[2]) {
257255
this.search = simplePath[2];
258256
if (parseQueryString) {
259-
if (querystring === undefined) querystring = require('querystring');
260257
this.query = querystring.parse(this.search.slice(1));
261258
} else {
262259
this.query = this.search.slice(1);
@@ -445,7 +442,6 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
445442
this.query = rest.slice(questionIdx + 1, hashIdx);
446443
}
447444
if (parseQueryString) {
448-
if (querystring === undefined) querystring = require('querystring');
449445
this.query = querystring.parse(this.query);
450446
}
451447
} else if (parseQueryString) {
@@ -610,7 +606,6 @@ Url.prototype.format = function format() {
610606
}
611607

612608
if (this.query !== null && typeof this.query === 'object') {
613-
if (querystring === undefined) querystring = require('querystring');
614609
query = querystring.stringify(this.query);
615610
}
616611

Collapse file

‎test/parallel/test-bootstrap-modules.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-bootstrap-modules.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const expectedModules = new Set([
116116
'NativeModule internal/blob',
117117
'NativeModule async_hooks',
118118
'NativeModule path',
119+
'NativeModule querystring',
119120
'NativeModule stream',
120121
'NativeModule stream/promises',
121122
'NativeModule string_decoder',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.