MCPcopy Index your code
hub / github.com/nodejs/node / initializeCjsConditions

Function initializeCjsConditions

lib/internal/modules/helpers.js:79–95  ·  view source on GitHub ↗

* Define the conditions that apply to the CommonJS loader. * @returns {void}

()

Source from the content-addressed store, hash-verified

77 * @returns {void}
78 */
79function initializeCjsConditions() {
80 const userConditions = getOptionValue('--conditions');
81 const noAddons = getOptionValue('--no-addons');
82 const addonConditions = noAddons ? [] : ['node-addons'];
83 // TODO: Use this set when resolving pkg#exports conditions in loader.js.
84 cjsConditionsArray = [
85 'require',
86 'node',
87 ...addonConditions,
88 ...userConditions,
89 ];
90 if (getOptionValue('--require-module')) {
91 cjsConditionsArray.push('module-sync');
92 }
93 ObjectFreeze(cjsConditionsArray);
94 cjsConditions = new SafeSet(cjsConditionsArray);
95}
96
97/**
98 * Get the conditions that apply to the CommonJS loader.

Callers 3

getCjsConditionsFunction · 0.85
getCjsConditionsArrayFunction · 0.85
initializeCJSFunction · 0.85

Calls 2

getOptionValueFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…