You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[api-extractor] Source map segment without a source crashes SourceMapper with "Target is a folder, not a file" #6156
API Extractor crashes when a .d.ts.map contains a mapping segment that has only a generated column and no source. The source map spec allows these segments, and rolldown 1.2.14 now emits them in declaration maps (rolldown/rolldown#11170). We hit this upgrading rolldown in sanity-io/sdk#1445.
mkdir etc && npx @microsoft/api-extractor@7.59.4 run --local
Expected result: The run completes and reports ae-missing-release-tag for foo. It does when the mappings are AAAA,qBAAqB.
Actual result:
ERROR: Target is a folder, not a file: undefined
Target is a folder, not a file: undefined
EISDIR: illegal operation on a directory, read
at Object.readFileSync (node:fs)
at FileSystem.readFile (@rushstack/node-core-library/src/FileSystem.ts:1066:12)
at SourceMapper.#getMappedSourceLocation (@microsoft/api-extractor/src/collector/SourceMapper.ts:130:56)
Details
SourceMapper.#getMappedSourceLocation takes the nearest mapping item and runs path.resolve(path.dirname(sourceFilePath), nearestMappingItem.source). For a source-less segment source is empty, so the path resolves to the .d.ts file's folder. FileSystem.exists returns true for it, and the read fails.
Treating a mapping item with no source as "no mapping" would fix it, so the original .d.ts location is used.
Activity