Accept absent map-level sourcesContent and preserve null source-name slots alongside known originals and aligned content. Represent unnamed local declarations explicitly, retain leaf-local and flattened indices, and preserve declared indexed-section order across consumers. Account for added indices before browser output allocation. Accept legacy retained rows without indices. Consolidate public CLI/MCP source-map fixtures and update the stale named-source-only assertion. BREAKING CHANGE: Browser source-map original and mapping rows expose null for unavailable source names instead of inventing an unknown-source string. New index fields are optional when reading older retained evidence. Refs #2023, #2024
13 lines
400 B
TypeScript
13 lines
400 B
TypeScript
/** Validate optional source-map content against its source inventory. */
|
|
export const hasValidSourceMapContents = (
|
|
sourceCount: number,
|
|
contents: unknown,
|
|
): boolean =>
|
|
contents === undefined ||
|
|
contents === null ||
|
|
(Array.isArray(contents) &&
|
|
contents.length === sourceCount &&
|
|
contents.every(
|
|
(content: unknown) => content === null || typeof content === "string",
|
|
));
|