11cb0ef41Sopenharmony_ci// Copyright Joyent, Inc. and other Node contributors. 21cb0ef41Sopenharmony_ci// 31cb0ef41Sopenharmony_ci// Permission is hereby granted, free of charge, to any person obtaining a 41cb0ef41Sopenharmony_ci// copy of this software and associated documentation files (the 51cb0ef41Sopenharmony_ci// "Software"), to deal in the Software without restriction, including 61cb0ef41Sopenharmony_ci// without limitation the rights to use, copy, modify, merge, publish, 71cb0ef41Sopenharmony_ci// distribute, sublicense, and/or sell copies of the Software, and to permit 81cb0ef41Sopenharmony_ci// persons to whom the Software is furnished to do so, subject to the 91cb0ef41Sopenharmony_ci// following conditions: 101cb0ef41Sopenharmony_ci// 111cb0ef41Sopenharmony_ci// The above copyright notice and this permission notice shall be included 121cb0ef41Sopenharmony_ci// in all copies or substantial portions of the Software. 131cb0ef41Sopenharmony_ci// 141cb0ef41Sopenharmony_ci// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 151cb0ef41Sopenharmony_ci// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 161cb0ef41Sopenharmony_ci// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 171cb0ef41Sopenharmony_ci// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 181cb0ef41Sopenharmony_ci// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 191cb0ef41Sopenharmony_ci// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 201cb0ef41Sopenharmony_ci// USE OR OTHER DEALINGS IN THE SOFTWARE. 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci'use strict'; 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ciconst { 251cb0ef41Sopenharmony_ci ArrayIsArray, 261cb0ef41Sopenharmony_ci ArrayPrototypeJoin, 271cb0ef41Sopenharmony_ci ArrayPrototypePop, 281cb0ef41Sopenharmony_ci Date, 291cb0ef41Sopenharmony_ci DatePrototypeGetDate, 301cb0ef41Sopenharmony_ci DatePrototypeGetHours, 311cb0ef41Sopenharmony_ci DatePrototypeGetMinutes, 321cb0ef41Sopenharmony_ci DatePrototypeGetMonth, 331cb0ef41Sopenharmony_ci DatePrototypeGetSeconds, 341cb0ef41Sopenharmony_ci Error, 351cb0ef41Sopenharmony_ci FunctionPrototypeBind, 361cb0ef41Sopenharmony_ci NumberIsSafeInteger, 371cb0ef41Sopenharmony_ci ObjectDefineProperties, 381cb0ef41Sopenharmony_ci ObjectDefineProperty, 391cb0ef41Sopenharmony_ci ObjectGetOwnPropertyDescriptors, 401cb0ef41Sopenharmony_ci ObjectKeys, 411cb0ef41Sopenharmony_ci ObjectPrototypeToString, 421cb0ef41Sopenharmony_ci ObjectSetPrototypeOf, 431cb0ef41Sopenharmony_ci ObjectValues, 441cb0ef41Sopenharmony_ci ReflectApply, 451cb0ef41Sopenharmony_ci StringPrototypePadStart, 461cb0ef41Sopenharmony_ci} = primordials; 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ciconst { 491cb0ef41Sopenharmony_ci codes: { 501cb0ef41Sopenharmony_ci ERR_FALSY_VALUE_REJECTION, 511cb0ef41Sopenharmony_ci ERR_INVALID_ARG_TYPE, 521cb0ef41Sopenharmony_ci ERR_OUT_OF_RANGE, 531cb0ef41Sopenharmony_ci }, 541cb0ef41Sopenharmony_ci errnoException, 551cb0ef41Sopenharmony_ci exceptionWithHostPort, 561cb0ef41Sopenharmony_ci hideStackFrames, 571cb0ef41Sopenharmony_ci} = require('internal/errors'); 581cb0ef41Sopenharmony_ciconst { 591cb0ef41Sopenharmony_ci format, 601cb0ef41Sopenharmony_ci formatWithOptions, 611cb0ef41Sopenharmony_ci inspect, 621cb0ef41Sopenharmony_ci stripVTControlCharacters, 631cb0ef41Sopenharmony_ci} = require('internal/util/inspect'); 641cb0ef41Sopenharmony_ciconst { debuglog } = require('internal/util/debuglog'); 651cb0ef41Sopenharmony_ciconst { 661cb0ef41Sopenharmony_ci validateFunction, 671cb0ef41Sopenharmony_ci validateNumber, 681cb0ef41Sopenharmony_ci} = require('internal/validators'); 691cb0ef41Sopenharmony_ciconst { isBuffer } = require('buffer').Buffer; 701cb0ef41Sopenharmony_ciconst types = require('internal/util/types'); 711cb0ef41Sopenharmony_ci 721cb0ef41Sopenharmony_ciconst { 731cb0ef41Sopenharmony_ci deprecate, 741cb0ef41Sopenharmony_ci getSystemErrorMap, 751cb0ef41Sopenharmony_ci getSystemErrorName: internalErrorName, 761cb0ef41Sopenharmony_ci promisify, 771cb0ef41Sopenharmony_ci toUSVString, 781cb0ef41Sopenharmony_ci defineLazyProperties, 791cb0ef41Sopenharmony_ci} = require('internal/util'); 801cb0ef41Sopenharmony_ci 811cb0ef41Sopenharmony_cilet abortController; 821cb0ef41Sopenharmony_ci 831cb0ef41Sopenharmony_cifunction lazyAbortController() { 841cb0ef41Sopenharmony_ci abortController ??= require('internal/abort_controller'); 851cb0ef41Sopenharmony_ci return abortController; 861cb0ef41Sopenharmony_ci} 871cb0ef41Sopenharmony_ci 881cb0ef41Sopenharmony_cilet internalDeepEqual; 891cb0ef41Sopenharmony_ci 901cb0ef41Sopenharmony_ci/** 911cb0ef41Sopenharmony_ci * @deprecated since v4.0.0 921cb0ef41Sopenharmony_ci * @param {any} arg 931cb0ef41Sopenharmony_ci * @returns {arg is boolean} 941cb0ef41Sopenharmony_ci */ 951cb0ef41Sopenharmony_cifunction isBoolean(arg) { 961cb0ef41Sopenharmony_ci return typeof arg === 'boolean'; 971cb0ef41Sopenharmony_ci} 981cb0ef41Sopenharmony_ci 991cb0ef41Sopenharmony_ci/** 1001cb0ef41Sopenharmony_ci * @deprecated since v4.0.0 1011cb0ef41Sopenharmony_ci * @param {any} arg 1021cb0ef41Sopenharmony_ci * @returns {arg is null} 1031cb0ef41Sopenharmony_ci */ 1041cb0ef41Sopenharmony_cifunction isNull(arg) { 1051cb0ef41Sopenharmony_ci return arg === null; 1061cb0ef41Sopenharmony_ci} 1071cb0ef41Sopenharmony_ci 1081cb0ef41Sopenharmony_ci/** 1091cb0ef41Sopenharmony_ci * @deprecated since v4.0.0 1101cb0ef41Sopenharmony_ci * @param {any} arg 1111cb0ef41Sopenharmony_ci * @returns {arg is (null | undefined)} 1121cb0ef41Sopenharmony_ci */ 1131cb0ef41Sopenharmony_cifunction isNullOrUndefined(arg) { 1141cb0ef41Sopenharmony_ci return arg === null || arg === undefined; 1151cb0ef41Sopenharmony_ci} 1161cb0ef41Sopenharmony_ci 1171cb0ef41Sopenharmony_ci/** 1181cb0ef41Sopenharmony_ci * @deprecated since v4.0.0 1191cb0ef41Sopenharmony_ci * @param {any} arg 1201cb0ef41Sopenharmony_ci * @returns {arg is number} 1211cb0ef41Sopenharmony_ci */ 1221cb0ef41Sopenharmony_cifunction isNumber(arg) { 1231cb0ef41Sopenharmony_ci return typeof arg === 'number'; 1241cb0ef41Sopenharmony_ci} 1251cb0ef41Sopenharmony_ci 1261cb0ef41Sopenharmony_ci/** 1271cb0ef41Sopenharmony_ci * @param {any} arg 1281cb0ef41Sopenharmony_ci * @returns {arg is string} 1291cb0ef41Sopenharmony_ci */ 1301cb0ef41Sopenharmony_cifunction isString(arg) { 1311cb0ef41Sopenharmony_ci return typeof arg === 'string'; 1321cb0ef41Sopenharmony_ci} 1331cb0ef41Sopenharmony_ci 1341cb0ef41Sopenharmony_ci/** 1351cb0ef41Sopenharmony_ci * @deprecated since v4.0.0 1361cb0ef41Sopenharmony_ci * @param {any} arg 1371cb0ef41Sopenharmony_ci * @returns {arg is symbol} 1381cb0ef41Sopenharmony_ci */ 1391cb0ef41Sopenharmony_cifunction isSymbol(arg) { 1401cb0ef41Sopenharmony_ci return typeof arg === 'symbol'; 1411cb0ef41Sopenharmony_ci} 1421cb0ef41Sopenharmony_ci 1431cb0ef41Sopenharmony_ci/** 1441cb0ef41Sopenharmony_ci * @deprecated since v4.0.0 1451cb0ef41Sopenharmony_ci * @param {any} arg 1461cb0ef41Sopenharmony_ci * @returns {arg is undefined} 1471cb0ef41Sopenharmony_ci */ 1481cb0ef41Sopenharmony_cifunction isUndefined(arg) { 1491cb0ef41Sopenharmony_ci return arg === undefined; 1501cb0ef41Sopenharmony_ci} 1511cb0ef41Sopenharmony_ci 1521cb0ef41Sopenharmony_ci/** 1531cb0ef41Sopenharmony_ci * @deprecated since v4.0.0 1541cb0ef41Sopenharmony_ci * @param {any} arg 1551cb0ef41Sopenharmony_ci * @returns {a is NonNullable<object>} 1561cb0ef41Sopenharmony_ci */ 1571cb0ef41Sopenharmony_cifunction isObject(arg) { 1581cb0ef41Sopenharmony_ci return arg !== null && typeof arg === 'object'; 1591cb0ef41Sopenharmony_ci} 1601cb0ef41Sopenharmony_ci 1611cb0ef41Sopenharmony_ci/** 1621cb0ef41Sopenharmony_ci * @deprecated since v4.0.0 1631cb0ef41Sopenharmony_ci * @param {any} e 1641cb0ef41Sopenharmony_ci * @returns {arg is Error} 1651cb0ef41Sopenharmony_ci */ 1661cb0ef41Sopenharmony_cifunction isError(e) { 1671cb0ef41Sopenharmony_ci return ObjectPrototypeToString(e) === '[object Error]' || e instanceof Error; 1681cb0ef41Sopenharmony_ci} 1691cb0ef41Sopenharmony_ci 1701cb0ef41Sopenharmony_ci/** 1711cb0ef41Sopenharmony_ci * @deprecated since v4.0.0 1721cb0ef41Sopenharmony_ci * @param {any} arg 1731cb0ef41Sopenharmony_ci * @returns {arg is Function} 1741cb0ef41Sopenharmony_ci */ 1751cb0ef41Sopenharmony_cifunction isFunction(arg) { 1761cb0ef41Sopenharmony_ci return typeof arg === 'function'; 1771cb0ef41Sopenharmony_ci} 1781cb0ef41Sopenharmony_ci 1791cb0ef41Sopenharmony_ci/** 1801cb0ef41Sopenharmony_ci * @deprecated since v4.0.0 1811cb0ef41Sopenharmony_ci * @param {any} arg 1821cb0ef41Sopenharmony_ci * @returns {arg is (boolean | null | number | string | symbol | undefined)} 1831cb0ef41Sopenharmony_ci */ 1841cb0ef41Sopenharmony_cifunction isPrimitive(arg) { 1851cb0ef41Sopenharmony_ci return arg === null || 1861cb0ef41Sopenharmony_ci (typeof arg !== 'object' && typeof arg !== 'function'); 1871cb0ef41Sopenharmony_ci} 1881cb0ef41Sopenharmony_ci 1891cb0ef41Sopenharmony_ci/** 1901cb0ef41Sopenharmony_ci * @param {number} n 1911cb0ef41Sopenharmony_ci * @returns {string} 1921cb0ef41Sopenharmony_ci */ 1931cb0ef41Sopenharmony_cifunction pad(n) { 1941cb0ef41Sopenharmony_ci return StringPrototypePadStart(n.toString(), 2, '0'); 1951cb0ef41Sopenharmony_ci} 1961cb0ef41Sopenharmony_ci 1971cb0ef41Sopenharmony_ciconst months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 1981cb0ef41Sopenharmony_ci 'Oct', 'Nov', 'Dec']; 1991cb0ef41Sopenharmony_ci 2001cb0ef41Sopenharmony_ci/** 2011cb0ef41Sopenharmony_ci * @returns {string} 26 Feb 16:19:34 2021cb0ef41Sopenharmony_ci */ 2031cb0ef41Sopenharmony_cifunction timestamp() { 2041cb0ef41Sopenharmony_ci const d = new Date(); 2051cb0ef41Sopenharmony_ci const t = ArrayPrototypeJoin([ 2061cb0ef41Sopenharmony_ci pad(DatePrototypeGetHours(d)), 2071cb0ef41Sopenharmony_ci pad(DatePrototypeGetMinutes(d)), 2081cb0ef41Sopenharmony_ci pad(DatePrototypeGetSeconds(d)), 2091cb0ef41Sopenharmony_ci ], ':'); 2101cb0ef41Sopenharmony_ci return `${DatePrototypeGetDate(d)} ${months[DatePrototypeGetMonth(d)]} ${t}`; 2111cb0ef41Sopenharmony_ci} 2121cb0ef41Sopenharmony_ci 2131cb0ef41Sopenharmony_cilet console; 2141cb0ef41Sopenharmony_ci/** 2151cb0ef41Sopenharmony_ci * Log is just a thin wrapper to console.log that prepends a timestamp 2161cb0ef41Sopenharmony_ci * @deprecated since v6.0.0 2171cb0ef41Sopenharmony_ci * @type {(...args: any[]) => void} 2181cb0ef41Sopenharmony_ci */ 2191cb0ef41Sopenharmony_cifunction log(...args) { 2201cb0ef41Sopenharmony_ci if (!console) { 2211cb0ef41Sopenharmony_ci console = require('internal/console/global'); 2221cb0ef41Sopenharmony_ci } 2231cb0ef41Sopenharmony_ci console.log('%s - %s', timestamp(), format(...args)); 2241cb0ef41Sopenharmony_ci} 2251cb0ef41Sopenharmony_ci 2261cb0ef41Sopenharmony_ci/** 2271cb0ef41Sopenharmony_ci * Inherit the prototype methods from one constructor into another. 2281cb0ef41Sopenharmony_ci * 2291cb0ef41Sopenharmony_ci * The Function.prototype.inherits from lang.js rewritten as a standalone 2301cb0ef41Sopenharmony_ci * function (not on Function.prototype). NOTE: If this file is to be loaded 2311cb0ef41Sopenharmony_ci * during bootstrapping this function needs to be rewritten using some native 2321cb0ef41Sopenharmony_ci * functions as prototype setup using normal JavaScript does not work as 2331cb0ef41Sopenharmony_ci * expected during bootstrapping (see mirror.js in r114903). 2341cb0ef41Sopenharmony_ci * @param {Function} ctor Constructor function which needs to inherit the 2351cb0ef41Sopenharmony_ci * prototype. 2361cb0ef41Sopenharmony_ci * @param {Function} superCtor Constructor function to inherit prototype from. 2371cb0ef41Sopenharmony_ci * @throws {TypeError} Will error if either constructor is null, or if 2381cb0ef41Sopenharmony_ci * the super constructor lacks a prototype. 2391cb0ef41Sopenharmony_ci */ 2401cb0ef41Sopenharmony_cifunction inherits(ctor, superCtor) { 2411cb0ef41Sopenharmony_ci 2421cb0ef41Sopenharmony_ci if (ctor === undefined || ctor === null) 2431cb0ef41Sopenharmony_ci throw new ERR_INVALID_ARG_TYPE('ctor', 'Function', ctor); 2441cb0ef41Sopenharmony_ci 2451cb0ef41Sopenharmony_ci if (superCtor === undefined || superCtor === null) 2461cb0ef41Sopenharmony_ci throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor); 2471cb0ef41Sopenharmony_ci 2481cb0ef41Sopenharmony_ci if (superCtor.prototype === undefined) { 2491cb0ef41Sopenharmony_ci throw new ERR_INVALID_ARG_TYPE('superCtor.prototype', 2501cb0ef41Sopenharmony_ci 'Object', superCtor.prototype); 2511cb0ef41Sopenharmony_ci } 2521cb0ef41Sopenharmony_ci ObjectDefineProperty(ctor, 'super_', { 2531cb0ef41Sopenharmony_ci __proto__: null, 2541cb0ef41Sopenharmony_ci value: superCtor, 2551cb0ef41Sopenharmony_ci writable: true, 2561cb0ef41Sopenharmony_ci configurable: true, 2571cb0ef41Sopenharmony_ci }); 2581cb0ef41Sopenharmony_ci ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype); 2591cb0ef41Sopenharmony_ci} 2601cb0ef41Sopenharmony_ci 2611cb0ef41Sopenharmony_ci/** 2621cb0ef41Sopenharmony_ci * @deprecated since v6.0.0 2631cb0ef41Sopenharmony_ci * @template T 2641cb0ef41Sopenharmony_ci * @template S 2651cb0ef41Sopenharmony_ci * @param {T} target 2661cb0ef41Sopenharmony_ci * @param {S} source 2671cb0ef41Sopenharmony_ci * @returns {S extends null ? T : (T & S)} 2681cb0ef41Sopenharmony_ci */ 2691cb0ef41Sopenharmony_cifunction _extend(target, source) { 2701cb0ef41Sopenharmony_ci // Don't do anything if source isn't an object 2711cb0ef41Sopenharmony_ci if (source === null || typeof source !== 'object') return target; 2721cb0ef41Sopenharmony_ci 2731cb0ef41Sopenharmony_ci const keys = ObjectKeys(source); 2741cb0ef41Sopenharmony_ci let i = keys.length; 2751cb0ef41Sopenharmony_ci while (i--) { 2761cb0ef41Sopenharmony_ci target[keys[i]] = source[keys[i]]; 2771cb0ef41Sopenharmony_ci } 2781cb0ef41Sopenharmony_ci return target; 2791cb0ef41Sopenharmony_ci} 2801cb0ef41Sopenharmony_ci 2811cb0ef41Sopenharmony_ciconst callbackifyOnRejected = hideStackFrames((reason, cb) => { 2821cb0ef41Sopenharmony_ci // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). 2831cb0ef41Sopenharmony_ci // Because `null` is a special error value in callbacks which means "no error 2841cb0ef41Sopenharmony_ci // occurred", we error-wrap so the callback consumer can distinguish between 2851cb0ef41Sopenharmony_ci // "the promise rejected with null" or "the promise fulfilled with undefined". 2861cb0ef41Sopenharmony_ci if (!reason) { 2871cb0ef41Sopenharmony_ci reason = new ERR_FALSY_VALUE_REJECTION(reason); 2881cb0ef41Sopenharmony_ci } 2891cb0ef41Sopenharmony_ci return cb(reason); 2901cb0ef41Sopenharmony_ci}); 2911cb0ef41Sopenharmony_ci 2921cb0ef41Sopenharmony_ci/** 2931cb0ef41Sopenharmony_ci * @template {(...args: any[]) => Promise<any>} T 2941cb0ef41Sopenharmony_ci * @param {T} original 2951cb0ef41Sopenharmony_ci * @returns {T extends (...args: infer TArgs) => Promise<infer TReturn> ? 2961cb0ef41Sopenharmony_ci * ((...params: [...TArgs, ((err: Error, ret: TReturn) => any)]) => void) : 2971cb0ef41Sopenharmony_ci * never 2981cb0ef41Sopenharmony_ci * } 2991cb0ef41Sopenharmony_ci */ 3001cb0ef41Sopenharmony_cifunction callbackify(original) { 3011cb0ef41Sopenharmony_ci validateFunction(original, 'original'); 3021cb0ef41Sopenharmony_ci 3031cb0ef41Sopenharmony_ci // We DO NOT return the promise as it gives the user a false sense that 3041cb0ef41Sopenharmony_ci // the promise is actually somehow related to the callback's execution 3051cb0ef41Sopenharmony_ci // and that the callback throwing will reject the promise. 3061cb0ef41Sopenharmony_ci function callbackified(...args) { 3071cb0ef41Sopenharmony_ci const maybeCb = ArrayPrototypePop(args); 3081cb0ef41Sopenharmony_ci validateFunction(maybeCb, 'last argument'); 3091cb0ef41Sopenharmony_ci const cb = FunctionPrototypeBind(maybeCb, this); 3101cb0ef41Sopenharmony_ci // In true node style we process the callback on `nextTick` with all the 3111cb0ef41Sopenharmony_ci // implications (stack, `uncaughtException`, `async_hooks`) 3121cb0ef41Sopenharmony_ci ReflectApply(original, this, args) 3131cb0ef41Sopenharmony_ci .then((ret) => process.nextTick(cb, null, ret), 3141cb0ef41Sopenharmony_ci (rej) => process.nextTick(callbackifyOnRejected, rej, cb)); 3151cb0ef41Sopenharmony_ci } 3161cb0ef41Sopenharmony_ci 3171cb0ef41Sopenharmony_ci const descriptors = ObjectGetOwnPropertyDescriptors(original); 3181cb0ef41Sopenharmony_ci // It is possible to manipulate a functions `length` or `name` property. This 3191cb0ef41Sopenharmony_ci // guards against the manipulation. 3201cb0ef41Sopenharmony_ci if (typeof descriptors.length.value === 'number') { 3211cb0ef41Sopenharmony_ci descriptors.length.value++; 3221cb0ef41Sopenharmony_ci } 3231cb0ef41Sopenharmony_ci if (typeof descriptors.name.value === 'string') { 3241cb0ef41Sopenharmony_ci descriptors.name.value += 'Callbackified'; 3251cb0ef41Sopenharmony_ci } 3261cb0ef41Sopenharmony_ci const propertiesValues = ObjectValues(descriptors); 3271cb0ef41Sopenharmony_ci for (let i = 0; i < propertiesValues.length; i++) { 3281cb0ef41Sopenharmony_ci // We want to use null-prototype objects to not rely on globally mutable 3291cb0ef41Sopenharmony_ci // %Object.prototype%. 3301cb0ef41Sopenharmony_ci ObjectSetPrototypeOf(propertiesValues[i], null); 3311cb0ef41Sopenharmony_ci } 3321cb0ef41Sopenharmony_ci ObjectDefineProperties(callbackified, descriptors); 3331cb0ef41Sopenharmony_ci return callbackified; 3341cb0ef41Sopenharmony_ci} 3351cb0ef41Sopenharmony_ci 3361cb0ef41Sopenharmony_ci/** 3371cb0ef41Sopenharmony_ci * @param {number} err 3381cb0ef41Sopenharmony_ci * @returns {string} 3391cb0ef41Sopenharmony_ci */ 3401cb0ef41Sopenharmony_cifunction getSystemErrorName(err) { 3411cb0ef41Sopenharmony_ci validateNumber(err, 'err'); 3421cb0ef41Sopenharmony_ci if (err >= 0 || !NumberIsSafeInteger(err)) { 3431cb0ef41Sopenharmony_ci throw new ERR_OUT_OF_RANGE('err', 'a negative integer', err); 3441cb0ef41Sopenharmony_ci } 3451cb0ef41Sopenharmony_ci return internalErrorName(err); 3461cb0ef41Sopenharmony_ci} 3471cb0ef41Sopenharmony_ci 3481cb0ef41Sopenharmony_ci// Keep the `exports =` so that various functions can still be monkeypatched 3491cb0ef41Sopenharmony_cimodule.exports = { 3501cb0ef41Sopenharmony_ci _errnoException: errnoException, 3511cb0ef41Sopenharmony_ci _exceptionWithHostPort: exceptionWithHostPort, 3521cb0ef41Sopenharmony_ci _extend, 3531cb0ef41Sopenharmony_ci callbackify, 3541cb0ef41Sopenharmony_ci debug: debuglog, 3551cb0ef41Sopenharmony_ci debuglog, 3561cb0ef41Sopenharmony_ci deprecate, 3571cb0ef41Sopenharmony_ci format, 3581cb0ef41Sopenharmony_ci formatWithOptions, 3591cb0ef41Sopenharmony_ci getSystemErrorMap, 3601cb0ef41Sopenharmony_ci getSystemErrorName, 3611cb0ef41Sopenharmony_ci inherits, 3621cb0ef41Sopenharmony_ci inspect, 3631cb0ef41Sopenharmony_ci isArray: ArrayIsArray, 3641cb0ef41Sopenharmony_ci isBoolean, 3651cb0ef41Sopenharmony_ci isBuffer, 3661cb0ef41Sopenharmony_ci isDeepStrictEqual(a, b) { 3671cb0ef41Sopenharmony_ci if (internalDeepEqual === undefined) { 3681cb0ef41Sopenharmony_ci internalDeepEqual = require('internal/util/comparisons') 3691cb0ef41Sopenharmony_ci .isDeepStrictEqual; 3701cb0ef41Sopenharmony_ci } 3711cb0ef41Sopenharmony_ci return internalDeepEqual(a, b); 3721cb0ef41Sopenharmony_ci }, 3731cb0ef41Sopenharmony_ci isNull, 3741cb0ef41Sopenharmony_ci isNullOrUndefined, 3751cb0ef41Sopenharmony_ci isNumber, 3761cb0ef41Sopenharmony_ci isString, 3771cb0ef41Sopenharmony_ci isSymbol, 3781cb0ef41Sopenharmony_ci isUndefined, 3791cb0ef41Sopenharmony_ci isRegExp: types.isRegExp, 3801cb0ef41Sopenharmony_ci isObject, 3811cb0ef41Sopenharmony_ci isDate: types.isDate, 3821cb0ef41Sopenharmony_ci isError, 3831cb0ef41Sopenharmony_ci isFunction, 3841cb0ef41Sopenharmony_ci isPrimitive, 3851cb0ef41Sopenharmony_ci log, 3861cb0ef41Sopenharmony_ci promisify, 3871cb0ef41Sopenharmony_ci stripVTControlCharacters, 3881cb0ef41Sopenharmony_ci toUSVString, 3891cb0ef41Sopenharmony_ci get transferableAbortSignal() { 3901cb0ef41Sopenharmony_ci return lazyAbortController().transferableAbortSignal; 3911cb0ef41Sopenharmony_ci }, 3921cb0ef41Sopenharmony_ci get transferableAbortController() { 3931cb0ef41Sopenharmony_ci return lazyAbortController().transferableAbortController; 3941cb0ef41Sopenharmony_ci }, 3951cb0ef41Sopenharmony_ci get aborted() { 3961cb0ef41Sopenharmony_ci return lazyAbortController().aborted; 3971cb0ef41Sopenharmony_ci }, 3981cb0ef41Sopenharmony_ci types, 3991cb0ef41Sopenharmony_ci}; 4001cb0ef41Sopenharmony_ci 4011cb0ef41Sopenharmony_cidefineLazyProperties( 4021cb0ef41Sopenharmony_ci module.exports, 4031cb0ef41Sopenharmony_ci 'internal/util/parse_args/parse_args', 4041cb0ef41Sopenharmony_ci ['parseArgs'], 4051cb0ef41Sopenharmony_ci); 4061cb0ef41Sopenharmony_ci 4071cb0ef41Sopenharmony_cidefineLazyProperties( 4081cb0ef41Sopenharmony_ci module.exports, 4091cb0ef41Sopenharmony_ci 'internal/encoding', 4101cb0ef41Sopenharmony_ci ['TextDecoder', 'TextEncoder'], 4111cb0ef41Sopenharmony_ci); 4121cb0ef41Sopenharmony_ci 4131cb0ef41Sopenharmony_cidefineLazyProperties( 4141cb0ef41Sopenharmony_ci module.exports, 4151cb0ef41Sopenharmony_ci 'internal/mime', 4161cb0ef41Sopenharmony_ci ['MIMEType', 'MIMEParams'], 4171cb0ef41Sopenharmony_ci); 418