Pinsave/counterstrike
1
1/**2 * @since v0.3.73 */4declare module "module" {5 import { URL } from "node:url";6 class Module {7 constructor(id: string, parent?: Module);8 }9 interface Module extends NodeJS.Module {}10 namespace Module {11 export { Module };12 }13 namespace Module {14 /**15 * A list of the names of all modules provided by Node.js. Can be used to verify16 * if a module is maintained by a third party or not.17 *18 * Note: the list doesn't contain prefix-only modules like `node:test`.19 * @since v9.3.0, v8.10.0, v6.13.020 */21 const builtinModules: readonly string[];22 /**23 * @since v12.2.024 * @param path Filename to be used to construct the require25 * function. Must be a file URL object, file URL string, or absolute path26 * string.27 */28 function createRequire(path: string | URL): NodeJS.Require;29 namespace constants {30 /**31 * The following constants are returned as the `status` field in the object returned by32 * {@link enableCompileCache} to indicate the result of the attempt to enable the33 * [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache).34 * @since v22.8.035 */36 namespace compileCacheStatus {37 /**38 * Node.js has enabled the compile cache successfully. The directory used to store the39 * compile cache will be returned in the `directory` field in the40 * returned object.41 */42 const ENABLED: number;43 /**44 * The compile cache has already been enabled before, either by a previous call to45 * {@link enableCompileCache}, or by the `NODE_COMPILE_CACHE=dir`46 * environment variable. The directory used to store the47 * compile cache will be returned in the `directory` field in the48 * returned object.49 */50 const ALREADY_ENABLED: number;51 /**52 * Node.js fails to enable the compile cache. This can be caused by the lack of53 * permission to use the specified directory, or various kinds of file system errors.54 * The detail of the failure will be returned in the `message` field in the55 * returned object.56 */57 const FAILED: number;58 /**59 * Node.js cannot enable the compile cache because the environment variable60 * `NODE_DISABLE_COMPILE_CACHE=1` has been set.61 */62 const DISABLED: number;63 }64 }65 interface EnableCompileCacheResult {66 /**67 * One of the {@link constants.compileCacheStatus}68 */69 status: number;70 /**71 * If Node.js cannot enable the compile cache, this contains72 * the error message. Only set if `status` is `module.constants.compileCacheStatus.FAILED`.73 */74 message?: string;75 /**76 * If the compile cache is enabled, this contains the directory77 * where the compile cache is stored. Only set if `status` is78 * `module.constants.compileCacheStatus.ENABLED` or79 * `module.constants.compileCacheStatus.ALREADY_ENABLED`.80 */81 directory?: string;82 }83 /**84 * Enable [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)85 * in the current Node.js instance.86 *87 * If `cacheDir` is not specified, Node.js will either use the directory specified by the88 * `NODE_COMPILE_CACHE=dir` environment variable if it's set, or use89 * `path.join(os.tmpdir(), 'node-compile-cache')` otherwise. For general use cases, it's90 * recommended to call `module.enableCompileCache()` without specifying the `cacheDir`,91 * so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment92 * variable when necessary.93 *94 * Since compile cache is supposed to be a quiet optimization that is not required for the95 * application to be functional, this method is designed to not throw any exception when the96 * compile cache cannot be enabled. Instead, it will return an object containing an error97 * message in the `message` field to aid debugging.98 * If compile cache is enabled successfully, the `directory` field in the returned object99 * contains the path to the directory where the compile cache is stored. The `status`100 * field in the returned object would be one of the `module.constants.compileCacheStatus`101 * values to indicate the result of the attempt to enable the102 * [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache).103 *104 * This method only affects the current Node.js instance. To enable it in child worker threads,105 * either call this method in child worker threads too, or set the106 * `process.env.NODE_COMPILE_CACHE` value to compile cache directory so the behavior can107 * be inherited into the child workers. The directory can be obtained either from the108 * `directory` field returned by this method, or with {@link getCompileCacheDir}.109 * @since v22.8.0110 * @param cacheDir Optional path to specify the directory where the compile cache111 * will be stored/retrieved.112 */113 function enableCompileCache(cacheDir?: string): EnableCompileCacheResult;114 /**115 * Flush the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)116 * accumulated from modules already loaded117 * in the current Node.js instance to disk. This returns after all the flushing118 * file system operations come to an end, no matter they succeed or not. If there119 * are any errors, this will fail silently, since compile cache misses should not120 * interfere with the actual operation of the application.121 * @since v22.10.0122 */123 function flushCompileCache(): void;124 /**125 * @since v22.8.0126 * @return Path to the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)127 * directory if it is enabled, or `undefined` otherwise.128 */129 function getCompileCacheDir(): string | undefined;130 /**131 * ```text132 * /path/to/project133 * ├ packages/134 * ├ bar/135 * ├ bar.js136 * └ package.json // name = '@foo/bar'137 * └ qux/138 * ├ node_modules/139 * └ some-package/140 * └ package.json // name = 'some-package'141 * ├ qux.js142 * └ package.json // name = '@foo/qux'143 * ├ main.js144 * └ package.json // name = '@foo'145 * ```146 * ```js147 * // /path/to/project/packages/bar/bar.js148 * import { findPackageJSON } from 'node:module';149 *150 * findPackageJSON('..', import.meta.url);151 * // '/path/to/project/package.json'152 * // Same result when passing an absolute specifier instead:153 * findPackageJSON(new URL('../', import.meta.url));154 * findPackageJSON(import.meta.resolve('../'));155 *156 * findPackageJSON('some-package', import.meta.url);157 * // '/path/to/project/packages/bar/node_modules/some-package/package.json'158 * // When passing an absolute specifier, you might get a different result if the159 * // resolved module is inside a subfolder that has nested `package.json`.160 * findPackageJSON(import.meta.resolve('some-package'));161 * // '/path/to/project/packages/bar/node_modules/some-package/some-subfolder/package.json'162 *163 * findPackageJSON('@foo/qux', import.meta.url);164 * // '/path/to/project/packages/qux/package.json'165 * ```166 * @since v22.14.0167 * @param specifier The specifier for the module whose `package.json` to168 * retrieve. When passing a _bare specifier_, the `package.json` at the root of169 * the package is returned. When passing a _relative specifier_ or an _absolute specifier_,170 * the closest parent `package.json` is returned.171 * @param base The absolute location (`file:` URL string or FS path) of the172 * containing module. For CJS, use `__filename` (not `__dirname`!); for ESM, use173 * `import.meta.url`. You do not need to pass it if `specifier` is an _absolute specifier_.174 * @returns A path if the `package.json` is found. When `startLocation`175 * is a package, the package's root `package.json`; when a relative or unresolved, the closest176 * `package.json` to the `startLocation`.177 */178 function findPackageJSON(specifier: string | URL, base?: string | URL): string | undefined;179 /**180 * @since v18.6.0, v16.17.0181 */182 function isBuiltin(moduleName: string): boolean;183 interface RegisterOptions<Data> {184 /**185 * If you want to resolve `specifier` relative to a186 * base URL, such as `import.meta.url`, you can pass that URL here. This187 * property is ignored if the `parentURL` is supplied as the second argument.188 * @default 'data:'189 */190 parentURL?: string | URL | undefined;191 /**192 * Any arbitrary, cloneable JavaScript value to pass into the193 * {@link initialize} hook.194 */195 data?: Data | undefined;196 /**197 * [Transferable objects](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html#portpostmessagevalue-transferlist)198 * to be passed into the `initialize` hook.199 */200 transferList?: any[] | undefined;201 }202 /* eslint-disable @definitelytyped/no-unnecessary-generics */203 /**204 * Register a module that exports hooks that customize Node.js module205 * resolution and loading behavior. See206 * [Customization hooks](https://nodejs.org/docs/latest-v24.x/api/module.html#customization-hooks).207 *208 * This feature requires `--allow-worker` if used with the209 * [Permission Model](https://nodejs.org/docs/latest-v24.x/api/permissions.html#permission-model).210 * @since v20.6.0, v18.19.0211 * @param specifier Customization hooks to be registered; this should be212 * the same string that would be passed to `import()`, except that if it is213 * relative, it is resolved relative to `parentURL`.214 * @param parentURL f you want to resolve `specifier` relative to a base215 * URL, such as `import.meta.url`, you can pass that URL here.216 */217 function register<Data = any>(218 specifier: string | URL,219 parentURL?: string | URL,220 options?: RegisterOptions<Data>,221 ): void;222 function register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;223 interface RegisterHooksOptions {224 /**225 * See [load hook](https://nodejs.org/docs/latest-v24.x/api/module.html#loadurl-context-nextload).226 * @default undefined227 */228 load?: LoadHookSync | undefined;229 /**230 * See [resolve hook](https://nodejs.org/docs/latest-v24.x/api/module.html#resolvespecifier-context-nextresolve).231 * @default undefined232 */233 resolve?: ResolveHookSync | undefined;234 }235 interface ModuleHooks {236 /**237 * Deregister the hook instance.238 */239 deregister(): void;240 }241 /**242 * Register [hooks](https://nodejs.org/docs/latest-v24.x/api/module.html#customization-hooks)243 * that customize Node.js module resolution and loading behavior.244 * @since v22.15.0245 * @experimental246 */247 function registerHooks(options: RegisterHooksOptions): ModuleHooks;248 interface StripTypeScriptTypesOptions {249 /**250 * Possible values are:251 * * `'strip'` Only strip type annotations without performing the transformation of TypeScript features.252 * * `'transform'` Strip type annotations and transform TypeScript features to JavaScript.253 * @default 'strip'254 */255 mode?: "strip" | "transform" | undefined;256 /**257 * Only when `mode` is `'transform'`, if `true`, a source map258 * will be generated for the transformed code.259 * @default false260 */261 sourceMap?: boolean | undefined;262 /**263 * Specifies the source url used in the source map.264 */265 sourceUrl?: string | undefined;266 }267 /**268 * `module.stripTypeScriptTypes()` removes type annotations from TypeScript code. It269 * can be used to strip type annotations from TypeScript code before running it270 * with `vm.runInContext()` or `vm.compileFunction()`.271 * By default, it will throw an error if the code contains TypeScript features272 * that require transformation such as `Enums`,273 * see [type-stripping](https://nodejs.org/docs/latest-v24.x/api/typescript.md#type-stripping) for more information.274 * When mode is `'transform'`, it also transforms TypeScript features to JavaScript,275 * see [transform TypeScript features](https://nodejs.org/docs/latest-v24.x/api/typescript.md#typescript-features) for more information.276 * When mode is `'strip'`, source maps are not generated, because locations are preserved.277 * If `sourceMap` is provided, when mode is `'strip'`, an error will be thrown.278 *279 * _WARNING_: The output of this function should not be considered stable across Node.js versions,280 * due to changes in the TypeScript parser.281 *282 * ```js283 * import { stripTypeScriptTypes } from 'node:module';284 * const code = 'const a: number = 1;';285 * const strippedCode = stripTypeScriptTypes(code);286 * console.log(strippedCode);287 * // Prints: const a = 1;288 * ```289 *290 * If `sourceUrl` is provided, it will be used appended as a comment at the end of the output:291 *292 * ```js293 * import { stripTypeScriptTypes } from 'node:module';294 * const code = 'const a: number = 1;';295 * const strippedCode = stripTypeScriptTypes(code, { mode: 'strip', sourceUrl: 'source.ts' });296 * console.log(strippedCode);297 * // Prints: const a = 1\n\n//# sourceURL=source.ts;298 * ```299 *300 * When `mode` is `'transform'`, the code is transformed to JavaScript:301 *302 * ```js303 * import { stripTypeScriptTypes } from 'node:module';304 * const code = `305 * namespace MathUtil {306 * export const add = (a: number, b: number) => a + b;307 * }`;308 * const strippedCode = stripTypeScriptTypes(code, { mode: 'transform', sourceMap: true });309 * console.log(strippedCode);310 * // Prints:311 * // var MathUtil;312 * // (function(MathUtil) {313 * // MathUtil.add = (a, b)=>a + b;314 * // })(MathUtil || (MathUtil = {}));315 * // # sourceMappingURL=data:application/json;base64, ...316 * ```317 * @since v22.13.0318 * @param code The code to strip type annotations from.319 * @returns The code with type annotations stripped.320 */321 function stripTypeScriptTypes(code: string, options?: StripTypeScriptTypesOptions): string;322 /* eslint-enable @definitelytyped/no-unnecessary-generics */323 /**324 * The `module.syncBuiltinESMExports()` method updates all the live bindings for325 * builtin `ES Modules` to match the properties of the `CommonJS` exports. It326 * does not add or remove exported names from the `ES Modules`.327 *328 * ```js329 * import fs from 'node:fs';330 * import assert from 'node:assert';331 * import { syncBuiltinESMExports } from 'node:module';332 *333 * fs.readFile = newAPI;334 *335 * delete fs.readFileSync;336 *337 * function newAPI() {338 * // ...339 * }340 *341 * fs.newAPI = newAPI;342 *343 * syncBuiltinESMExports();344 *345 * import('node:fs').then((esmFS) => {346 * // It syncs the existing readFile property with the new value347 * assert.strictEqual(esmFS.readFile, newAPI);348 * // readFileSync has been deleted from the required fs349 * assert.strictEqual('readFileSync' in fs, false);350 * // syncBuiltinESMExports() does not remove readFileSync from esmFS351 * assert.strictEqual('readFileSync' in esmFS, true);352 * // syncBuiltinESMExports() does not add names353 * assert.strictEqual(esmFS.newAPI, undefined);354 * });355 * ```356 * @since v12.12.0357 */358 function syncBuiltinESMExports(): void;359 interface ImportAttributes extends NodeJS.Dict<string> {360 type?: string | undefined;361 }362 type ModuleFormat =363 | "addon"364 | "builtin"365 | "commonjs"366 | "commonjs-typescript"367 | "json"368 | "module"369 | "module-typescript"370 | "wasm";371 type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;372 /**373 * The `initialize` hook provides a way to define a custom function that runs in374 * the hooks thread when the hooks module is initialized. Initialization happens375 * when the hooks module is registered via {@link register}.376 *377 * This hook can receive data from a {@link register} invocation, including378 * ports and other transferable objects. The return value of `initialize` can be a379 * `Promise`, in which case it will be awaited before the main application thread380 * execution resumes.381 */382 type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;383 interface ResolveHookContext {384 /**385 * Export conditions of the relevant `package.json`386 */387 conditions: string[];388 /**389 * An object whose key-value pairs represent the assertions for the module to import390 */391 importAttributes: ImportAttributes;392 /**393 * The module importing this one, or undefined if this is the Node.js entry point394 */395 parentURL: string | undefined;396 }397 interface ResolveFnOutput {398 /**399 * A hint to the load hook (it might be ignored); can be an intermediary value.400 */401 format?: string | null | undefined;402 /**403 * The import attributes to use when caching the module (optional; if excluded the input will be used)404 */405 importAttributes?: ImportAttributes | undefined;406 /**407 * A signal that this hook intends to terminate the chain of `resolve` hooks.408 * @default false409 */410 shortCircuit?: boolean | undefined;411 /**412 * The absolute URL to which this input resolves413 */414 url: string;415 }416 /**417 * The `resolve` hook chain is responsible for telling Node.js where to find and418 * how to cache a given `import` statement or expression, or `require` call. It can419 * optionally return a format (such as `'module'`) as a hint to the `load` hook. If420 * a format is specified, the `load` hook is ultimately responsible for providing421 * the final `format` value (and it is free to ignore the hint provided by422 * `resolve`); if `resolve` provides a `format`, a custom `load` hook is required423 * even if only to pass the value to the Node.js default `load` hook.424 */425 type ResolveHook = (426 specifier: string,427 context: ResolveHookContext,428 nextResolve: (429 specifier: string,430 context?: Partial<ResolveHookContext>,431 ) => ResolveFnOutput | Promise<ResolveFnOutput>,432 ) => ResolveFnOutput | Promise<ResolveFnOutput>;433 type ResolveHookSync = (434 specifier: string,435 context: ResolveHookContext,436 nextResolve: (437 specifier: string,438 context?: Partial<ResolveHookContext>,439 ) => ResolveFnOutput,440 ) => ResolveFnOutput;441 interface LoadHookContext {442 /**443 * Export conditions of the relevant `package.json`444 */445 conditions: string[];446 /**447 * The format optionally supplied by the `resolve` hook chain (can be an intermediary value).448 */449 format: string | null | undefined;450 /**451 * An object whose key-value pairs represent the assertions for the module to import452 */453 importAttributes: ImportAttributes;454 }455 interface LoadFnOutput {456 format: string | null | undefined;457 /**458 * A signal that this hook intends to terminate the chain of `resolve` hooks.459 * @default false460 */461 shortCircuit?: boolean | undefined;462 /**463 * The source for Node.js to evaluate464 */465 source?: ModuleSource | undefined;466 }467 /**468 * The `load` hook provides a way to define a custom method of determining how a469 * URL should be interpreted, retrieved, and parsed. It is also in charge of470 * validating the import attributes.471 */472 type LoadHook = (473 url: string,474 context: LoadHookContext,475 nextLoad: (476 url: string,477 context?: Partial<LoadHookContext>,478 ) => LoadFnOutput | Promise<LoadFnOutput>,479 ) => LoadFnOutput | Promise<LoadFnOutput>;480 type LoadHookSync = (481 url: string,482 context: LoadHookContext,483 nextLoad: (484 url: string,485 context?: Partial<LoadHookContext>,486 ) => LoadFnOutput,487 ) => LoadFnOutput;488 interface SourceMapsSupport {489 /**490 * If the source maps support is enabled491 */492 enabled: boolean;493 /**494 * If the support is enabled for files in `node_modules`.495 */496 nodeModules: boolean;497 /**498 * If the support is enabled for generated code from `eval` or `new Function`.499 */500 generatedCode: boolean;501 }502 /**503 * This method returns whether the [Source Map v3](https://tc39.es/ecma426/) support for stack504 * traces is enabled.505 * @since v23.7.0, v22.14.0506 */507 function getSourceMapsSupport(): SourceMapsSupport;508 /**509 * `path` is the resolved path for the file for which a corresponding source map510 * should be fetched.511 * @since v13.7.0, v12.17.0512 * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.513 */514 function findSourceMap(path: string): SourceMap | undefined;515 interface SetSourceMapsSupportOptions {516 /**517 * If enabling the support for files in `node_modules`.518 * @default false519 */520 nodeModules?: boolean | undefined;521 /**522 * If enabling the support for generated code from `eval` or `new Function`.523 * @default false524 */525 generatedCode?: boolean | undefined;526 }527 /**528 * This function enables or disables the [Source Map v3](https://tc39.es/ecma426/) support for529 * stack traces.530 *531 * It provides same features as launching Node.js process with commandline options532 * `--enable-source-maps`, with additional options to alter the support for files533 * in `node_modules` or generated codes.534 *535 * Only source maps in JavaScript files that are loaded after source maps has been536 * enabled will be parsed and loaded. Preferably, use the commandline options537 * `--enable-source-maps` to avoid losing track of source maps of modules loaded538 * before this API call.539 * @since v23.7.0, v22.14.0540 */541 function setSourceMapsSupport(enabled: boolean, options?: SetSourceMapsSupportOptions): void;542 interface SourceMapConstructorOptions {543 /**544 * @since v21.0.0, v20.5.0545 */546 lineLengths?: readonly number[] | undefined;547 }548 interface SourceMapPayload {549 file: string;550 version: number;551 sources: string[];552 sourcesContent: string[];553 names: string[];554 mappings: string;555 sourceRoot: string;556 }557 interface SourceMapping {558 generatedLine: number;559 generatedColumn: number;560 originalSource: string;561 originalLine: number;562 originalColumn: number;563 }564 interface SourceOrigin {565 /**566 * The name of the range in the source map, if one was provided567 */568 name: string | undefined;569 /**570 * The file name of the original source, as reported in the SourceMap571 */572 fileName: string;573 /**574 * The 1-indexed lineNumber of the corresponding call site in the original source575 */576 lineNumber: number;577 /**578 * The 1-indexed columnNumber of the corresponding call site in the original source579 */580 columnNumber: number;581 }582 /**583 * @since v13.7.0, v12.17.0584 */585 class SourceMap {586 constructor(payload: SourceMapPayload, options?: SourceMapConstructorOptions);587 /**588 * Getter for the payload used to construct the `SourceMap` instance.589 */590 readonly payload: SourceMapPayload;591 /**592 * Given a line offset and column offset in the generated source593 * file, returns an object representing the SourceMap range in the594 * original file if found, or an empty object if not.595 *596 * The object returned contains the following keys:597 *598 * The returned value represents the raw range as it appears in the599 * SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and600 * column numbers as they appear in Error messages and CallSite601 * objects.602 *603 * To get the corresponding 1-indexed line and column numbers from a604 * lineNumber and columnNumber as they are reported by Error stacks605 * and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)`606 * @param lineOffset The zero-indexed line number offset in the generated source607 * @param columnOffset The zero-indexed column number offset in the generated source608 */609 findEntry(lineOffset: number, columnOffset: number): SourceMapping | {};610 /**611 * Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source,612 * find the corresponding call site location in the original source.613 *614 * If the `lineNumber` and `columnNumber` provided are not found in any source map,615 * then an empty object is returned.616 * @param lineNumber The 1-indexed line number of the call site in the generated source617 * @param columnNumber The 1-indexed column number of the call site in the generated source618 */619 findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {};620 }621 function runMain(main?: string): void;622 function wrap(script: string): string;623 }624 global {625 interface ImportMeta {626 /**627 * The directory name of the current module.628 *629 * This is the same as the `path.dirname()` of the `import.meta.filename`.630 *631 * > **Caveat**: only present on `file:` modules.632 * @since v21.2.0, v20.11.0633 */634 dirname: string;635 /**636 * The full absolute path and filename of the current module, with637 * symlinks resolved.638 *639 * This is the same as the `url.fileURLToPath()` of the `import.meta.url`.640 *641 * > **Caveat** only local modules support this property. Modules not using the642 * > `file:` protocol will not provide it.643 * @since v21.2.0, v20.11.0644 */645 filename: string;646 /**647 * The absolute `file:` URL of the module.648 *649 * This is defined exactly the same as it is in browsers providing the URL of the650 * current module file.651 *652 * This enables useful patterns such as relative file loading:653 *654 * ```js655 * import { readFileSync } from 'node:fs';656 * const buffer = readFileSync(new URL('./data.proto', import.meta.url));657 * ```658 */659 url: string;660 /**661 * `import.meta.resolve` is a module-relative resolution function scoped to662 * each module, returning the URL string.663 *664 * ```js665 * const dependencyAsset = import.meta.resolve('component-lib/asset.css');666 * // file:///app/node_modules/component-lib/asset.css667 * import.meta.resolve('./dep.js');668 * // file:///app/dep.js669 * ```670 *671 * All features of the Node.js module resolution are supported. Dependency672 * resolutions are subject to the permitted exports resolutions within the package.673 *674 * **Caveats**:675 *676 * * This can result in synchronous file-system operations, which677 * can impact performance similarly to `require.resolve`.678 * * This feature is not available within custom loaders (it would679 * create a deadlock).680 * @since v13.9.0, v12.16.0681 * @param specifier The module specifier to resolve relative to the682 * current module.683 * @param parent An optional absolute parent module URL to resolve from.684 * **Default:** `import.meta.url`685 * @returns The absolute URL string that the specifier would resolve to.686 */687 resolve(specifier: string, parent?: string | URL): string;688 }689 namespace NodeJS {690 interface Module {691 /**692 * The module objects required for the first time by this one.693 * @since v0.1.16694 */695 children: Module[];696 /**697 * The `module.exports` object is created by the `Module` system. Sometimes this is698 * not acceptable; many want their module to be an instance of some class. To do699 * this, assign the desired export object to `module.exports`.700 * @since v0.1.16701 */702 exports: any;703 /**704 * The fully resolved filename of the module.705 * @since v0.1.16706 */707 filename: string;708 /**709 * The identifier for the module. Typically this is the fully resolved710 * filename.711 * @since v0.1.16712 */713 id: string;714 /**715 * `true` if the module is running during the Node.js preload716 * phase.717 * @since v15.4.0, v14.17.0718 */719 isPreloading: boolean;720 /**721 * Whether or not the module is done loading, or is in the process of722 * loading.723 * @since v0.1.16724 */725 loaded: boolean;726 /**727 * The module that first required this one, or `null` if the current module is the728 * entry point of the current process, or `undefined` if the module was loaded by729 * something that is not a CommonJS module (e.g. REPL or `import`).730 * @since v0.1.16731 * @deprecated Please use `require.main` and `module.children` instead.732 */733 parent: Module | null | undefined;734 /**735 * The directory name of the module. This is usually the same as the736 * `path.dirname()` of the `module.id`.737 * @since v11.14.0738 */739 path: string;740 /**741 * The search paths for the module.742 * @since v0.4.0743 */744 paths: string[];745 /**746 * The `module.require()` method provides a way to load a module as if747 * `require()` was called from the original module.748 * @since v0.5.1749 */750 require(id: string): any;751 }752 interface Require {753 /**754 * Used to import modules, `JSON`, and local files.755 * @since v0.1.13756 */757 (id: string): any;758 /**759 * Modules are cached in this object when they are required. By deleting a key760 * value from this object, the next `require` will reload the module.761 * This does not apply to762 * [native addons](https://nodejs.org/docs/latest-v24.x/api/addons.html),763 * for which reloading will result in an error.764 * @since v0.3.0765 */766 cache: Dict<Module>;767 /**768 * Instruct `require` on how to handle certain file extensions.769 * @since v0.3.0770 * @deprecated771 */772 extensions: RequireExtensions;773 /**774 * The `Module` object representing the entry script loaded when the Node.js775 * process launched, or `undefined` if the entry point of the program is not a776 * CommonJS module.777 * @since v0.1.17778 */779 main: Module | undefined;780 /**781 * @since v0.3.0782 */783 resolve: RequireResolve;784 }785 /** @deprecated */786 interface RequireExtensions extends Dict<(module: Module, filename: string) => any> {787 ".js": (module: Module, filename: string) => any;788 ".json": (module: Module, filename: string) => any;789 ".node": (module: Module, filename: string) => any;790 }791 interface RequireResolveOptions {792 /**793 * Paths to resolve module location from. If present, these794 * paths are used instead of the default resolution paths, with the exception795 * of796 * [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v24.x/api/modules.html#loading-from-the-global-folders)797 * like `$HOME/.node_modules`, which are798 * always included. Each of these paths is used as a starting point for799 * the module resolution algorithm, meaning that the `node_modules` hierarchy800 * is checked from this location.801 * @since v8.9.0802 */803 paths?: string[] | undefined;804 }805 interface RequireResolve {806 /**807 * Use the internal `require()` machinery to look up the location of a module,808 * but rather than loading the module, just return the resolved filename.809 *810 * If the module can not be found, a `MODULE_NOT_FOUND` error is thrown.811 * @since v0.3.0812 * @param request The module path to resolve.813 */814 (request: string, options?: RequireResolveOptions): string;815 /**816 * Returns an array containing the paths searched during resolution of `request` or817 * `null` if the `request` string references a core module, for example `http` or818 * `fs`.819 * @since v8.9.0820 * @param request The module path whose lookup paths are being retrieved.821 */822 paths(request: string): string[] | null;823 }824 }825 /**826 * The directory name of the current module. This is the same as the827 * `path.dirname()` of the `__filename`.828 * @since v0.1.27829 */830 var __dirname: string;831 /**832 * The file name of the current module. This is the current module file's absolute833 * path with symlinks resolved.834 *835 * For a main program this is not necessarily the same as the file name used in the836 * command line.837 * @since v0.0.1838 */839 var __filename: string;840 /**841 * The `exports` variable is available within a module's file-level scope, and is842 * assigned the value of `module.exports` before the module is evaluated.843 * @since v0.1.16844 */845 var exports: NodeJS.Module["exports"];846 /**847 * A reference to the current module.848 * @since v0.1.16849 */850 var module: NodeJS.Module;851 /**852 * @since v0.1.13853 */854 var require: NodeJS.Require;855 // Global-scope aliases for backwards compatibility with @types/node <13.0.x856 // TODO: consider removing in a future major version update857 /** @deprecated Use `NodeJS.Module` instead. */858 interface NodeModule extends NodeJS.Module {}859 /** @deprecated Use `NodeJS.Require` instead. */860 interface NodeRequire extends NodeJS.Require {}861 /** @deprecated Use `NodeJS.RequireResolve` instead. */862 interface RequireResolve extends NodeJS.RequireResolve {}863 }864 export = Module;865}866declare module "node:module" {867 import module = require("module");868 export = module;869}870 