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
1 change: 1 addition & 0 deletions apps/api-extractor/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
# DO NOT MODIFY ABOVE THIS LINE! Add any project-specific overrides below.
# ---------------------------------------------------------------------------
!/extends/*.json
!UPGRADING.md
3 changes: 3 additions & 0 deletions apps/api-extractor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ For more details and support resources, please visit: https://api-extractor.com/
- [CHANGELOG.md](
https://github.com/microsoft/rushstack/blob/main/apps/api-extractor/CHANGELOG.md) - Find
out what's new in the latest version
- [UPGRADING.md](
https://github.com/microsoft/rushstack/blob/main/apps/api-extractor/UPGRADING.md) - Instructions
for migrating existing projects to a newer version of API Extractor
- [API Reference](https://api.rushstack.io/pages/api-extractor/)

API Extractor is part of the [Rush Stack](https://rushstack.io/) family of projects.
37 changes: 37 additions & 0 deletions apps/api-extractor/UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Upgrade notes for @microsoft/api-extractor

### Upgrading past the bundled TypeScript 6.0 compiler engine

API Extractor analyzes your project using its **own bundled** TypeScript compiler, not the
TypeScript version your project builds with. This release upgrades the bundled compiler to
TypeScript 6.0.

TypeScript 6.0 changes the default `moduleResolution` for `module: "commonjs"` projects from
`node10` to `bundler` ([microsoft/TypeScript#62338](https://github.com/microsoft/TypeScript/pull/62338)).
If your project builds with TypeScript 5.x and does not set `moduleResolution` explicitly, API
Extractor's analysis may now resolve modules differently than your build — most visibly as
`TS2307` errors for dependencies that expose their typings only via `typesVersions`, or that
require extensionful import specifiers under an `exports` map.

If you hit this, in order of preference:

1. **Update the import or dependency.** Use extensionful specifiers
(`import ... from 'some-package/subpath.js'`), or upgrade the dependency to a version whose
`exports` map includes a `types` condition. This is the forward-compatible fix and also keeps
your project resolving correctly under TypeScript 7.

2. **Pin `moduleResolution` for the analysis only.** Set it in `compiler.overrideTsconfig` in your
`api-extractor.json`, so it applies to API Extractor without affecting your build:

```json
"compiler": {
"overrideTsconfig": {
"extends": "./tsconfig.json",
"compilerOptions": { "moduleResolution": "node10" }
}
}
```

> **Note:** `node10` is deprecated in TypeScript 6.0 and removed in TypeScript 7.0
> ([microsoft/TypeScript#62200](https://github.com/microsoft/TypeScript/issues/62200)), so treat
> this as a transitional workaround rather than a long-term setting.
2 changes: 1 addition & 1 deletion apps/api-extractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"resolve": "~1.22.1",
"semver": "~7.7.4",
"source-map": "~0.6.1",
"typescript": "5.9.3"
"typescript": "6.0.3"
},
"devDependencies": {
"@rushstack/heft": "1.2.19",
Expand Down
24 changes: 10 additions & 14 deletions apps/api-extractor/src/analyzer/TypeScriptInternals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface IGlobalVariableAnalyzer {
export class TypeScriptInternals {
public static getImmediateAliasedSymbol(symbol: ts.Symbol, typeChecker: ts.TypeChecker): ts.Symbol {
// Compiler internal:
// https://github.com/microsoft/TypeScript/blob/v5.9.3/src/compiler/checker.ts
// https://github.com/microsoft/TypeScript/blob/v6.0.3/src/compiler/checker.ts#L33515
return (typeChecker as any).getImmediateAliasedSymbol(symbol);
}

Expand Down Expand Up @@ -61,7 +61,7 @@ export class TypeScriptInternals {
*/
public static getJSDocCommentRanges(node: ts.Node, text: string): ts.CommentRange[] | undefined {
// Compiler internal:
// https://github.com/microsoft/TypeScript/blob/v5.9.3/src/compiler/utilities.ts#L2710
// https://github.com/microsoft/TypeScript/blob/v6.0.3/src/compiler/utilities.ts#L2763

return (ts as any).getJSDocCommentRanges.apply(this, arguments);
}
Expand All @@ -73,7 +73,7 @@ export class TypeScriptInternals {
node: ts.Identifier | ts.StringLiteralLike | ts.NumericLiteral
): string {
// Compiler internal:
// https://github.com/microsoft/TypeScript/blob/v5.9.3/src/compiler/utilities.ts#L5368
// https://github.com/microsoft/TypeScript/blob/v6.0.3/src/compiler/utilities.ts#L5439

return (ts as any).getTextOfIdentifierOrLiteral(node);
}
Expand All @@ -89,7 +89,7 @@ export class TypeScriptInternals {
mode: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined
): ts.ResolvedModuleFull | undefined {
// Compiler internal:
// https://github.com/microsoft/TypeScript/blob/v5.9.3/src/compiler/types.ts#L5064
// https://github.com/microsoft/TypeScript/blob/v6.0.3/src/compiler/types.ts#L4732
const result: ts.ResolvedModuleWithFailedLookupLocations | undefined = (program as any).getResolvedModule(
sourceFile,
moduleNameText,
Expand All @@ -107,7 +107,7 @@ export class TypeScriptInternals {
compilerOptions: ts.CompilerOptions
): ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined {
// Compiler internal:
// https://github.com/microsoft/TypeScript/blob/v5.9.3/src/compiler/program.ts#L932
// https://github.com/microsoft/TypeScript/blob/v6.0.3/src/compiler/program.ts#L932

return ts.getModeForUsageLocation?.(file, usage, compilerOptions);
}
Expand All @@ -128,14 +128,10 @@ export class TypeScriptInternals {
}

public static getGlobalVariableAnalyzer(program: ts.Program): IGlobalVariableAnalyzer {
const anyProgram: any = program;
const typeCheckerInstance: any =
anyProgram.getDiagnosticsProducingTypeChecker ?? anyProgram.getTypeChecker;

if (!typeCheckerInstance) {
throw new InternalError('Missing Program.getDiagnosticsProducingTypeChecker or Program.getTypeChecker');
}
const typeChecker: any = typeCheckerInstance();
// Compiler internals: `getEmitResolver` and `hasGlobalName` are accessed via `any` and
// guarded below at runtime.
// https://github.com/microsoft/TypeScript/blob/v6.0.3/src/compiler/checker.ts#L51221
const typeChecker: any = program.getTypeChecker();
if (!typeChecker.getEmitResolver) {
throw new InternalError('Missing TypeChecker.getEmitResolver');
}
Expand All @@ -150,7 +146,7 @@ export class TypeScriptInternals {
* Returns whether a variable is declared with the const keyword
*/
public static isVarConst(node: ts.VariableDeclaration | ts.VariableDeclarationList): boolean {
// Compiler internal: https://github.com/microsoft/TypeScript/blob/71286e3d49c10e0e99faac360a6bbd40f12db7b6/src/compiler/utilities.ts#L925
// Compiler internal: https://github.com/microsoft/TypeScript/blob/v6.0.3/src/compiler/utilities.ts#L2677
return (ts as any).isVarConst(node);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import * as ts from 'typescript';

import { type IGlobalVariableAnalyzer, TypeScriptInternals } from '../TypeScriptInternals';

/**
* Builds a minimal in-memory `ts.Program` whose global scope is populated from the bundled
* compiler's real `lib.*.d.ts` files, without needing on-disk fixtures.
*/
function createInMemoryProgram(sourceText: string): ts.Program {
const rootFileName: string = 'index.ts';
const compilerOptions: ts.CompilerOptions = {
target: ts.ScriptTarget.ESNext,
// Load the standard globals: lib.es5 declares Array/Object, lib.es2015 adds Promise/Map. es5 is
// listed explicitly so the assertions don't depend on es2015's transitive reference to it.
lib: ['lib.es5.d.ts', 'lib.es2015.d.ts'],
noLib: false,
types: []
};

// Start from a real CompilerHost so that lib file resolution/reads use the bundled compiler,
// then override only the root source file to keep the program self-contained.
const host: ts.CompilerHost = ts.createCompilerHost(compilerOptions);
const rootSourceFile: ts.SourceFile = ts.createSourceFile(
rootFileName,
sourceText,
ts.ScriptTarget.ESNext,
/*setParentNodes*/ true
);

const defaultGetSourceFile: ts.CompilerHost['getSourceFile'] = host.getSourceFile.bind(host);
const defaultFileExists: ts.CompilerHost['fileExists'] = host.fileExists.bind(host);
const defaultReadFile: ts.CompilerHost['readFile'] = host.readFile.bind(host);

host.getSourceFile = (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) => {
if (fileName === rootFileName) {
return rootSourceFile;
}
return defaultGetSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile);
};
host.fileExists = (fileName) => fileName === rootFileName || defaultFileExists(fileName);
host.readFile = (fileName) => (fileName === rootFileName ? sourceText : defaultReadFile(fileName));

const program: ts.Program = ts.createProgram([rootFileName], compilerOptions, host);

// Self-validate the fixture: a clean program means the libs and root file resolved, so a future
// misconfiguration fails loudly here instead of silently emptying the global table.
expect(ts.getPreEmitDiagnostics(program)).toHaveLength(0);

return program;
}

describe(TypeScriptInternals.name, () => {
describe(TypeScriptInternals.getGlobalVariableAnalyzer.name, () => {
// Guards the getTypeChecker -> getEmitResolver -> hasGlobalName chain against *semantic* drift:
// the methods can survive a compiler bump but stop populating the global table (the InternalError
// guards in TypeScriptInternals only catch their outright removal).
it('reports ambient globals as global names', () => {
const program: ts.Program = createInMemoryProgram('export const value: number = 1;');
const analyzer: IGlobalVariableAnalyzer = TypeScriptInternals.getGlobalVariableAnalyzer(program);

expect(analyzer.hasGlobalName('Array')).toBe(true);
expect(analyzer.hasGlobalName('Object')).toBe(true);
expect(analyzer.hasGlobalName('Promise')).toBe(true);
});

it('does not report arbitrary identifiers as global names', () => {
const program: ts.Program = createInMemoryProgram('export const value: number = 1;');
const analyzer: IGlobalVariableAnalyzer = TypeScriptInternals.getGlobalVariableAnalyzer(program);

expect(analyzer.hasGlobalName('__this_is_definitely_not_a_global_name__')).toBe(false);
expect(analyzer.hasGlobalName('value')).toBe(false);
});
});
});
8 changes: 4 additions & 4 deletions apps/playwright-browser-tunnel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@
"@rushstack/ts-command-line": "workspace:*",
"string-argv": "~0.3.1",
"ws": "~8.21.0",
"playwright": "1.56.1"
"playwright": "1.58.2"
},
"devDependencies": {
"@rushstack/heft": "workspace:*",
"eslint": "~9.37.0",
"local-node-rig": "workspace:*",
"@types/semver": "7.7.1",
"@types/ws": "8.18.1",
"playwright-core": "~1.56.1",
"@playwright/test": "~1.56.1",
"playwright-core": "~1.58.2",
"@playwright/test": "~1.58.2",
"@types/node": "20.17.19"
},
"peerDependencies": {
"playwright-core": "~1.56.1"
"playwright-core": "~1.58.2"
},
"sideEffects": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import * as path from 'node:path';

import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';

import { FileSystem, Import, JsonFile, type JsonObject, JsonSchema } from '@rushstack/node-core-library';
import { Autoinstaller } from '@rushstack/rush-sdk/lib/logic/Autoinstaller';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See LICENSE in the project root for license information.

import * as zod from 'zod';
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';

import type { IRushMcpTool } from './IRushMcpTool';
import type { zodModule } from './zodTypes';
Expand Down
2 changes: 1 addition & 1 deletion apps/rush-mcp-server/src/pluginFramework/zodTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See LICENSE in the project root for license information.

import type * as zod from 'zod';
import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types';
import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';

export type { zod as zodModule };
export { CallToolResultSchema };
Expand Down
6 changes: 3 additions & 3 deletions apps/rush-mcp-server/src/tools/base.tool.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol';
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
import type {
CallToolResultSchema,
ServerNotification,
ServerRequest
} from '@modelcontextprotocol/sdk/types';
} from '@modelcontextprotocol/sdk/types.js';
import type { z, ZodRawShape, ZodTypeAny } from 'zod';

export type CallToolResult = z.infer<typeof CallToolResultSchema>;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@microsoft/api-extractor",
"comment": "Upgrade the bundled compiler engine to TypeScript 6.0.x. TypeScript 6.0 changes the default `moduleResolution` for CommonJS projects from `node10` to `bundler`, which can surface new module-resolution errors when API Extractor analyzes projects that relied on the previous default; see [UPGRADING.md](https://github.com/microsoft/rushstack/blob/main/apps/api-extractor/UPGRADING.md) for migration guidance.",
"type": "minor"
}
],
"packageName": "@microsoft/api-extractor",
"email": "hl662@users.noreply.github.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@rushstack/mcp-server",
"comment": "Fix resolution of `@modelcontextprotocol/sdk` subpath imports by using explicit \".js\" extensions, which the package's \"exports\" map requires under both Node's runtime module resolution and TypeScript's bundler resolution",
"type": "patch"
}
],
"packageName": "@rushstack/mcp-server",
"email": "50554904+hl662@users.noreply.github.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@rushstack/playwright-browser-tunnel",
"comment": "Upgrade the Playwright dependencies from 1.56.1 to 1.58.2",
"type": "patch"
}
],
"packageName": "@rushstack/playwright-browser-tunnel",
"email": "50554904+hl662@users.noreply.github.com"
}
18 changes: 9 additions & 9 deletions common/config/subspaces/build-tests-subspace/pnpm-lock.yaml

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
@@ -1,6 +1,6 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "68f19a15bc2ad51338ac42af387887d9e67a2e54",
"pnpmShrinkwrapHash": "1521c576e354bce267d0a24c3f5693b88fab5024",
"preferredVersionsHash": "550b4cee0bef4e97db6c6aad726df5149d20e7d9",
"packageJsonInjectedDependenciesHash": "53d4f8e2a003af60173d4a21283b23fc14eac530"
"packageJsonInjectedDependenciesHash": "43b10e6f4b615d20c7bc39ef8e1916692c3b445b"
}
Loading