Skip to content

Commit

Permalink
http2: order declarations in core.js
Browse files Browse the repository at this point in the history
Order declarations:

* public modules in alphabetical order
* internal modules in alphabetical order
* process.binding() calls in alphabetical order
* exports in alphabetical order

PR-URL: #21689
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and targos committed Jul 12, 2018
1 parent b758006 commit 07160cd
Showing 1 changed file with 45 additions and 42 deletions.
87 changes: 45 additions & 42 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@

/* eslint-disable no-use-before-define */

const internalUtil = require('internal/util');
internalUtil.assertCrypto();
const {
assertCrypto,
customInspectSymbol: kInspect,
promisify
} = require('internal/util');

assertCrypto();

const { internalBinding } = require('internal/bootstrap/loaders');
const { async_id_symbol } = require('internal/async_hooks').symbols;
const { UV_EOF } = process.binding('uv');
const http = require('http');
const binding = process.binding('http2');
const { FileHandle } = process.binding('fs');
const { StreamPipe } = internalBinding('stream_pipe');
const assert = require('assert');
const EventEmitter = require('events');
const fs = require('fs');
const http = require('http');
const net = require('net');
const { Duplex } = require('stream');
const tls = require('tls');
const { URL } = require('url');
const util = require('util');
const fs = require('fs');

const { kIncomingMessage } = require('_http_common');
const { kServerResponse } = require('_http_server');
const { StreamWrap } = require('_stream_wrap');

const { defaultTriggerAsyncIdScope } = require('internal/async_hooks');
const { async_id_symbol } = require('internal/async_hooks').symbols;
const { internalBinding } = require('internal/bootstrap/loaders');
const {
codes: {
ERR_HTTP2_ALTSVC_INVALID_ORIGIN,
Expand Down Expand Up @@ -61,30 +70,11 @@ const {
ERR_SOCKET_CLOSED
}
} = require('internal/errors');
const { StreamWrap } = require('_stream_wrap');
const { Duplex } = require('stream');
const { URL } = require('url');
const { utcDate } = require('internal/http');
const { onServerStream,
Http2ServerRequest,
Http2ServerResponse,
} = require('internal/http2/compat');
const { utcDate } = require('internal/http');
const {
promisify,
customInspectSymbol: kInspect
} = internalUtil;
const { isArrayBufferView } = require('internal/util/types');
const { defaultTriggerAsyncIdScope } = require('internal/async_hooks');
const { _connectionListener: httpConnectionListener } = http;
const { createPromise, promiseResolve } = process.binding('util');
const debug = util.debuglog('http2');

const kMaxFrameSize = (2 ** 24) - 1;
const kMaxInt = (2 ** 32) - 1;
const kMaxStreams = (2 ** 31) - 1;

// eslint-disable-next-line no-control-regex
const kQuotedString = /^[\x09\x20-\x5b\x5d-\x7e\x80-\xff]*$/;

const {
assertIsObject,
Expand All @@ -104,27 +94,40 @@ const {
updateOptionsBuffer,
updateSettingsBuffer
} = require('internal/http2/util');

const {
kTimeout,
setUnrefTimeout,
validateTimerDuration
} = require('internal/timers');
const {
createWriteWrap,
writeGeneric,
writevGeneric
} = require('internal/stream_base_commons');
const {
kTimeout,
setUnrefTimeout,
validateTimerDuration
} = require('internal/timers');
const { isArrayBufferView } = require('internal/util/types');

const { FileHandle } = process.binding('fs');
const binding = process.binding('http2');
const { ShutdownWrap } = process.binding('stream_wrap');
const { createPromise, promiseResolve } = process.binding('util');
const { UV_EOF } = process.binding('uv');

const { StreamPipe } = internalBinding('stream_pipe');
const { _connectionListener: httpConnectionListener } = http;
const debug = util.debuglog('http2');

const kMaxFrameSize = (2 ** 24) - 1;
const kMaxInt = (2 ** 32) - 1;
const kMaxStreams = (2 ** 31) - 1;

// eslint-disable-next-line no-control-regex
const kQuotedString = /^[\x09\x20-\x5b\x5d-\x7e\x80-\xff]*$/;

const { constants, nameForErrorCode } = binding;

const NETServer = net.Server;
const TLSServer = tls.Server;

const { kIncomingMessage } = require('_http_common');
const { kServerResponse } = require('_http_server');

const kAlpnProtocol = Symbol('alpnProtocol');
const kAuthority = Symbol('authority');
const kEncrypted = Symbol('encrypted');
Expand Down Expand Up @@ -2815,13 +2818,13 @@ function getUnpackedSettings(buf, options = {}) {

// Exports
module.exports = {
connect,
constants,
createServer,
createSecureServer,
getDefaultSettings,
getPackedSettings,
getUnpackedSettings,
createServer,
createSecureServer,
connect,
Http2Session,
Http2Stream,
Http2ServerRequest,
Expand Down

0 comments on commit 07160cd

Please sign in to comment.