mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
lib: include url in bootstrap snapshot and remove unnecessary lazy-loads
PR-URL: https://github.com/nodejs/node/pull/38826 Refs: https://github.com/nodejs/node/issues/35711 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Khaidi Chu <i@2333.moe>
This commit is contained in:
@@ -362,6 +362,7 @@ process.emitWarning = emitWarning;
|
||||
require('fs');
|
||||
require('v8');
|
||||
require('vm');
|
||||
require('url');
|
||||
|
||||
function setupPrepareStackTrace() {
|
||||
const {
|
||||
|
||||
@@ -70,8 +70,7 @@ const {
|
||||
validateObject,
|
||||
} = require('internal/validators');
|
||||
|
||||
// Lazy loaded for startup performance.
|
||||
let querystring;
|
||||
const querystring = require('querystring');
|
||||
|
||||
const { platform } = process;
|
||||
const isWindows = platform === 'win32';
|
||||
@@ -1046,7 +1045,6 @@ function parseParams(qs) {
|
||||
} else if (encodeCheck > 0) {
|
||||
if (isHexTable[code] === 1) {
|
||||
if (++encodeCheck === 3) {
|
||||
querystring = require('querystring');
|
||||
encoded = true;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -32,6 +32,7 @@ const {
|
||||
|
||||
const { toASCII } = require('internal/idna');
|
||||
const { encodeStr, hexTable } = require('internal/querystring');
|
||||
const querystring = require('querystring');
|
||||
|
||||
const {
|
||||
ERR_INVALID_ARG_TYPE,
|
||||
@@ -149,9 +150,6 @@ const {
|
||||
CHAR_AT,
|
||||
} = require('internal/constants');
|
||||
|
||||
// Lazy loaded for startup performance.
|
||||
let querystring;
|
||||
|
||||
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
||||
if (url instanceof Url) return url;
|
||||
|
||||
@@ -271,7 +269,6 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
|
||||
if (simplePath[2]) {
|
||||
this.search = simplePath[2];
|
||||
if (parseQueryString) {
|
||||
if (querystring === undefined) querystring = require('querystring');
|
||||
this.query = querystring.parse(this.search.slice(1));
|
||||
} else {
|
||||
this.query = this.search.slice(1);
|
||||
@@ -473,7 +470,6 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
|
||||
this.query = rest.slice(questionIdx + 1, hashIdx);
|
||||
}
|
||||
if (parseQueryString) {
|
||||
if (querystring === undefined) querystring = require('querystring');
|
||||
this.query = querystring.parse(this.query);
|
||||
}
|
||||
} else if (parseQueryString) {
|
||||
@@ -638,7 +634,6 @@ Url.prototype.format = function format() {
|
||||
}
|
||||
|
||||
if (this.query !== null && typeof this.query === 'object') {
|
||||
if (querystring === undefined) querystring = require('querystring');
|
||||
query = querystring.stringify(this.query);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ const expectedModules = new Set([
|
||||
'NativeModule internal/blob',
|
||||
'NativeModule async_hooks',
|
||||
'NativeModule path',
|
||||
'NativeModule querystring',
|
||||
'NativeModule stream',
|
||||
'NativeModule stream/promises',
|
||||
'NativeModule string_decoder',
|
||||
|
||||
Reference in New Issue
Block a user