mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-03 07:54:40 +08:00
Without @types/node, every program loaded scriptc-node-fallback.d.ts whole: the console and process globals and 47 Node modules, about 8,100 lines, parsed, bound and checked in every cold build whether or not the program imported them. - The fallback file keeps the globals and the modules they name (console, readline, readline/promises, perf_hooks, tty). Every other module, under both spellings, has its own file in ambient/node-fallback/, which references the files of the modules its declarations name. - A module's file joins the program when one of the program's files names the module in a string literal: imports, requires, import types and JSDoc types all name modules that way. The entry is read before the first program; the program-root discovery passes add modules that other files name. Files are read as tsgo reads them, and the TypeScript libraries and scriptc's own declarations are skipped. - The checks that recognized the fallback file by its path recognize every fallback file.
23 lines
912 B
TypeScript
23 lines
912 B
TypeScript
/// <reference path="./path.d.ts" />
|
|
|
|
declare module "path/win32" {
|
|
export function join(...paths: string[]): string;
|
|
export function resolve(...paths: string[]): string;
|
|
export function normalize(path: string): string;
|
|
export function dirname(path: string): string;
|
|
export function basename(path: string, suffix?: string): string;
|
|
export function extname(path: string): string;
|
|
export function isAbsolute(path: string): boolean;
|
|
export function relative(from: string, to: string): string;
|
|
export function toNamespacedPath(path: string): string;
|
|
export function matchesGlob(path: string, pattern: string): boolean;
|
|
export function parse(path: string): import("path").ParsedPath;
|
|
export function format(pathObject: import("path").FormatInputPathObject): string;
|
|
export const sep: "\\";
|
|
export const delimiter: ";";
|
|
}
|
|
|
|
declare module "node:path/win32" {
|
|
export * from "path/win32";
|
|
}
|