mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 02:52:29 +00:00

Instead of loading the working binding for the sole purpose of detecting whether we are inside the main thread unconditionally. PR-URL: https://github.com/nodejs/node/pull/25017 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
17 lines
443 B
JavaScript
17 lines
443 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
|
|
// This list must be computed before we require any modules to
|
|
// to eliminate the noise.
|
|
const list = process.moduleLoadList.slice();
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
const isMainThread = common.isMainThread;
|
|
const kMaxModuleCount = isMainThread ? 59 : 82;
|
|
|
|
assert(list.length <= kMaxModuleCount,
|
|
`Total length: ${list.length}\n` + list.join('\n')
|
|
);
|