/** * Standard-library and builtin module recognition (change: add-phantom-reference-findings). * * A reference check that reported every `import os` as an undeclared dependency would be useless, * so each ecosystem gets a CLOSED rule for "this name is the language's own, not a package": * * - **npm** — the Node runtime's own `module.builtinModules`, plus the `node:` scheme. Taken from * the runtime rather than hand-listed, so it cannot drift from reality. * - **Go** — the canonical language rule, not a list: a module path's first element must contain a * dot (`github.com/x/y`), so an import path whose first element has none (`fmt`, `net/http`) is * standard library. This is exactly how the go tool tells them apart. * - **Rust** — the crate roots the compiler provides (`std`, `core`, `alloc`, …) and the path * keywords that stay inside the current crate. * - **Python** — a list, because the language offers no rule. Top-level module names of the CPython * standard library (3.8 through 3.13, including the ones removed in 3.13, so a repository on an * older runtime is not mis-reported). * * A language whose ecosystem is not listed here is not assessed for undeclared dependencies at all: * calling an unknown import "undeclared" would be a guess, and this file is the allow list that * makes the claim safe (`AddedReferencesResolveOrAreReported`). */ import type { PackageEcosystem } from './external-packages.js'; /** * The ecosystems whose manifests and standard libraries are recognized. Same vocabulary as the * manifest reader's {@link PackageEcosystem}, so one name means one thing throughout. */ export type Ecosystem = PackageEcosystem; /** Node's own builtin module names, as the running runtime reports them. */ export declare const NODE_BUILTINS: ReadonlySet; /** Crate roots the Rust compiler provides, and the path keywords that stay in the current crate. */ export declare const RUST_BUILTIN_CRATES: ReadonlySet; /** * Top-level module names of the CPython standard library. Kept deliberately wide across versions: * a name that was standard library in any supported version must never read as a package. */ export declare const PYTHON_STDLIB: ReadonlySet; /** * The package (or module) name a specifier belongs to, as a manifest would declare it; null when the * specifier names no package — it is standard library, a builtin, or relative. * * `@scope/pkg/sub` → `@scope/pkg`, `lodash/fp` → `lodash`, `github.com/x/y/z` → the module path * prefix cannot be known from the specifier alone, so the whole path is returned and matched by * prefix against the declared modules. */ export declare function packageNameOf(ecosystem: Ecosystem, specifier: string): string | null; /** Whether a specifier is a path relative to the importing file (never a package). */ export declare function isRelativeSpecifier(specifier: string): boolean; /** Whether a specifier names the language's own standard library or a runtime builtin. */ export declare function isStdlibSpecifier(ecosystem: Ecosystem, specifier: string): boolean; /** The ecosystem a source file's language belongs to; null when none is recognized. */ export declare function ecosystemOfLanguage(language: string): Ecosystem | null; //# sourceMappingURL=stdlib-modules.d.ts.map