8000 Fix an issue with the 'fileUrlPath' on Windows. · syengineering/rushstack@8cc7a04 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8cc7a04

Browse files
committed
Fix an issue with the 'fileUrlPath' on Windows.
1 parent 8052122 commit 8cc7a04

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

apps/api-extractor/src/generators/ApiModelGenerator.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
IApiTypeParameterOptions,
3535
EnumMemberOrder
3636
} from '@microsoft/api-extractor-model';
37+
import { Path } from '@rushstack/node-core-library';
3738

3839
import { Collector } from '../collector/Collector';
3940
import { ISourceLocation } from '../collector/SourceMapper';
@@ -1138,6 +1139,11 @@ export class ApiModelGenerator {
11381139
pos: declaration.pos
11391140
});
11401141

1141-
return path.posix.relative(this._collector.extractorConfig.projectFolder, sourceLocation.sourceFilePath);
1142+
let result: string = path.relative(
1143+
this._collector.extractorConfig.projectFolder,
1144+
sourceLocation.sourceFilePath
1145+
);
1146+
result = Path.convertToSlashes(result);
1147+
return result;
11421148
}
11431149
}

build-tests/api-extractor-scenarios/etc/referenceTokens/api-extractor-scenarios.api.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,7 @@
907907
"text": "unique symbol"
908908
}
909909
],
910+
"fileUrlPath": "src/referenceTokens/index.ts",
910911
"isReadonly": true,
911912
"releaseTag": "Public",
912913
"name": "SomeSymbol1",
@@ -929,6 +930,7 @@
929930
"text": "\"ThisIsSomeVar1\""
930931
}
931932
],
933+
"fileUrlPath": "src/referenceTokens/index.ts",
932934
"initializerTokenRange": {
933935
"startIndex": 1,
934936
"endIndex": 2
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/api-extractor",
5+
"comment": "Fix a regression where the \"fileUrlPath\" property would contain a malformed path when API Extractor is run on Windows.",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@microsoft/api-extractor"
10+
}

0 commit comments

Comments
 (0)
0