The reader of the structure of a TypeScript or JavaScript source (commons 0036-distributionFR-022, FR-025): which of its characters are code, which are comments and which are the text of strings, so that what a packer reads of a source (the specifiers it imports, whether it does something when it is loaded) is read from code and never from the text of a comment, a string or a template literal that only looks like it.
It is a scanner and not a parser: it tracks comments, the quotes, template literals with their expressions and regular expressions, which is all that the readers below need.
import { importSpecifiers } from"./scan.ts";
importSpecifiers('import a from "./a.ts"; const s = "import b from \\"./b.ts\\"";'); // ["./a.ts"]
What a source is made of, for the readers below: its code with the comments and the insides of strings, templates and regular expressions blanked (each character a space, the quotes and the lines kept), and where the strings and the comments are.
The strings of a source that are specifiers: those that follow from, import or import(, with where each is. A name in a string that is no specifier (a list of packages, a field of a manifest, the text of generated code) is not one.