Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/api-extractor/src/collector/SourceMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ export class SourceMapper {
column: sourceFileColumn
});

if (!nearestMappingItem) return;
// A segment with only a generated column marks code that has no original source. The "source-map"
// package reports it with a null originalLine, despite the MappingItem typings.
if (!nearestMappingItem || nearestMappingItem.originalLine === null) return;

const mappedFilePath: string = path.resolve(path.dirname(sourceFilePath), nearestMappingItem.source);

Expand Down
2 changes: 1 addition & 1 deletion build-tests/api-extractor-scenarios/config/heft.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{
"sourcePath": "src",
"destinationFolders": ["lib-dts"],
"fileExtensions": [".d.ts"]
"fileExtensions": [".d.ts", ".d.ts.map"]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
{
"metadata": {
"toolPackage": "@microsoft/api-extractor",
"toolVersion": "[test mode]",
"schemaVersion": 1011,
"oldestForwardsCompatibleVersion": 1001,
"tsdocConfig": {
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
"noStandardTags": true,
"tagDefinitions": [
{
"tagName": "@alpha",
"syntaxKind": "modifier"
},
{
"tagName": "@beta",
"syntaxKind": "modifier"
},
{
"tagName": "@defaultValue",
"syntaxKind": "block"
},
{
"tagName": "@decorator",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@deprecated",
"syntaxKind": "block"
},
{
"tagName": "@eventProperty",
"syntaxKind": "modifier"
},
{
"tagName": "@example",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@experimental",
"syntaxKind": "modifier"
},
{
"tagName": "@inheritDoc",
"syntaxKind": "inline"
},
{
"tagName": "@internal",
"syntaxKind": "modifier"
},
{
"tagName": "@label",
"syntaxKind": "inline"
},
{
"tagName": "@link",
"syntaxKind": "inline",
"allowMultiple": true
},
{
"tagName": "@override",
"syntaxKind": "modifier"
},
{
"tagName": "@packageDocumentation",
"syntaxKind": "modifier"
},
{
"tagName": "@param",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@privateRemarks",
"syntaxKind": "block"
},
{
"tagName": "@public",
"syntaxKind": "modifier"
},
{
"tagName": "@readonly",
"syntaxKind": "modifier"
},
{
"tagName": "@remarks",
"syntaxKind": "block"
},
{
"tagName": "@returns",
"syntaxKind": "block"
},
{
"tagName": "@sealed",
"syntaxKind": "modifier"
},
{
"tagName": "@see",
"syntaxKind": "block"
},
{
"tagName": "@throws",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@typeParam",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@virtual",
"syntaxKind": "modifier"
},
{
"tagName": "@jsx",
"syntaxKind": "block"
},
{
"tagName": "@jsxRuntime",
"syntaxKind": "block"
},
{
"tagName": "@jsxFrag",
"syntaxKind": "block"
},
{
"tagName": "@jsxImportSource",
"syntaxKind": "block"
},
{
"tagName": "@betaDocumentation",
"syntaxKind": "modifier"
},
{
"tagName": "@internalRemarks",
"syntaxKind": "block"
},
{
"tagName": "@preapproved",
"syntaxKind": "modifier"
}
],
"supportForTags": {
"@alpha": true,
"@beta": true,
"@defaultValue": true,
"@decorator": true,
"@deprecated": true,
"@eventProperty": true,
"@example": true,
"@experimental": true,
"@inheritDoc": true,
"@internal": true,
"@label": true,
"@link": true,
"@override": true,
"@packageDocumentation": true,
"@param": true,
"@privateRemarks": true,
"@public": true,
"@readonly": true,
"@remarks": true,
"@returns": true,
"@sealed": true,
"@see": true,
"@throws": true,
"@typeParam": true,
"@virtual": true,
"@betaDocumentation": true,
"@internalRemarks": true,
"@preapproved": true
},
"reportUnsupportedHtmlElements": false
}
},
"kind": "Package",
"canonicalReference": "api-extractor-scenarios!",
"docComment": "",
"name": "api-extractor-scenarios",
"preserveMemberOrder": false,
"members": [
{
"kind": "EntryPoint",
"canonicalReference": "api-extractor-scenarios!",
"name": "",
"preserveMemberOrder": false,
"members": [
{
"kind": "Variable",
"canonicalReference": "api-extractor-scenarios!foo:var",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "foo: "
},
{
"kind": "Content",
"text": "string"
}
],
"fileUrlPath": "lib-dts/sourceMapWithoutSource/index.d.ts",
"isReadonly": true,
"releaseTag": "Public",
"name": "foo",
"variableTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## API Report File for "api-extractor-scenarios"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

// @public (undocumented)
export const foo: string;

// (No @packageDocumentation comment for this package)

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @public */
export declare const foo: string;

export { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** @public */
export declare const foo: string;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"comment": "Fix a crash (\"Target is a folder, not a file\") when a .d.ts.map contains a mapping segment with no source, such as those emitted by rolldown.",
"type": "patch",
"packageName": "@microsoft/api-extractor"
}
],
"packageName": "@microsoft/api-extractor"
}
Loading