function namespacesFor
namespacesFor(found: readonly string[]): Map<string, string>

What each preload goes into scope as, with two that want one name pulled apart rather than left to overwrite each other.

qunitx repl lib/task/* is the case: index.ts is named for the directory holding it and task.ts for itself, both want Task, and whoever was brought last silently took it. Now one keeps the plain name and the other is qualified by as much of its path as it takes to be unique — TaskTask — so nothing a preload exports is unreachable.

An index is the door into a directory, so it keeps the plain name. Naming a file yourself AFTER a wildcard beats that: qunitx repl 'lib/task/*' lib/task/task.ts. Quote the pattern — unquoted, your shell expands it before qunitx starts, both files arrive as ordinary paths with nothing to say which was a glob, and the index keeps it.

import { namespacesFor } from './session.ts';

const found = ['/p/task/index.ts', '/p/task/task.ts'];
namespacesFor(found).get('/p/task/index.ts'); // 'Task' — first in the group keeps it
namespacesFor(found).get('/p/task/task.ts'); // 'TaskTask'

Parameters

found: readonly string[]

Return Type

Map<string, string>

Usage

import { namespacesFor } from "lib/repl/session.ts";