Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api-extractor] Update API Extractor to support TypeScript 5.3.3 #4408

Merged
merged 9 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/api-extractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"resolve": "~1.22.1",
"semver": "~7.5.4",
"source-map": "~0.6.1",
"typescript": "~5.0.4"
"typescript": "5.3.0-beta"
octogonz marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"local-eslint-config": "workspace:*",
Expand Down
2 changes: 2 additions & 0 deletions apps/api-extractor/src/analyzer/ExportAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export class ExportAnalyzer {
: undefined;

const resolvedModule: ts.ResolvedModuleFull | undefined = TypeScriptInternals.getResolvedModule(
this._program,
importOrExportDeclaration.getSourceFile(),
moduleSpecifier,
mode
Expand Down Expand Up @@ -882,6 +883,7 @@ export class ExportAnalyzer {
)
: undefined;
const resolvedModule: ts.ResolvedModuleFull | undefined = TypeScriptInternals.getResolvedModule(
this._program,
importOrExportDeclaration.getSourceFile(),
moduleSpecifier,
mode
Expand Down
11 changes: 8 additions & 3 deletions apps/api-extractor/src/analyzer/TypeScriptInternals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,19 @@ export class TypeScriptInternals {
* The compiler populates this cache as part of analyzing the source file.
*/
public static getResolvedModule(
program: ts.Program,
sourceFile: ts.SourceFile,
moduleNameText: string,
mode: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined
): ts.ResolvedModuleFull | undefined {
// Compiler internal:
// https://github.com/microsoft/TypeScript/blob/v4.7.2/src/compiler/utilities.ts#L161

return (ts as any).getResolvedModule(sourceFile, moduleNameText, mode);
// https://github.com/microsoft/TypeScript/blob/v5.3-beta/src/compiler/types.ts#L4678
octogonz marked this conversation as resolved.
Show resolved Hide resolved
octogonz marked this conversation as resolved.
Show resolved Hide resolved
const result: ts.ResolvedModuleWithFailedLookupLocations | undefined = (program as any).getResolvedModule(
sourceFile,
moduleNameText,
mode
);
return result?.resolvedModule;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/api-extractor",
"comment": "Update API Extractor to support TypeScript 5.3.0-beta",
octogonz marked this conversation as resolved.
Show resolved Hide resolved
"type": "minor"
}
],
"packageName": "@microsoft/api-extractor"
}
4 changes: 3 additions & 1 deletion common/config/rush/common-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
// For testing Heft with TS V3
"~3.9.10",
// For testing Heft with TS V4
"~4.9.5"
"~4.9.5",

"5.3.0-beta"
octogonz marked this conversation as resolved.
Show resolved Hide resolved
],
"source-map": [
"~0.6.1" // API Extractor is using an older version of source-map because newer versions are async
Expand Down
16 changes: 11 additions & 5 deletions common/config/rush/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion common/config/rush/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "a292292be45a1f217c2433bb27a80cb6abfeedb0",
"pnpmShrinkwrapHash": "37bd534b31a3f5e73e3c44db26a1387c565f4b40",
"preferredVersionsHash": "1926a5b12ac8f4ab41e76503a0d1d0dccc9c0e06"
}