isModulePath(name: string): boolean
Reports whether a name ends in an extension the runtime will load.
Shared by classification here and by the directory listing in ./target.ts,
so "what counts as a module" is answered in one place: a directory refusal
that offered names the classifier would then reject would be teaching a form
the tool does not accept.
Every extension the runtime loads counts, and nothing else
Every extension the runtime loads counts, and nothing else
import { assertEquals } from "@std/assert"; import { isModulePath } from "./specifier.ts"; assertEquals(isModulePath("mod.ts"), true); assertEquals(isModulePath("./pkg/mod.mts"), true); assertEquals(isModulePath("deno.json"), false); assertEquals(isModulePath("README.md"), false);