Skip to content

Commit b6c40b4

Browse files
feat: allow [email protected] as devDependency (#7821)
* feat: allow [email protected] as devDependency * fix: no-restricted-imports.ts satisfies and assertions/attributes * Use patch-package for api-extractor * Review feedback on typos * Update patch with optional chaining * I, ah, forgot we're on Yarn 3+ * Fix lint, and update snapshots * [email protected], and aliased interfaces * add yarn.lock update as well * Went back to 5.3.0-beta
1 parent c4709c2 commit b6c40b4

File tree

145 files changed

+605
-262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+605
-262
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
diff --git a/lib/analyzer/ExportAnalyzer.js b/lib/analyzer/ExportAnalyzer.js
2+
index 51f31b4f2f253d82adc9594faa58d8dc031957e0..1fddac54b08665f5a5a717fef740613ae921cb7a 100644
3+
--- a/lib/analyzer/ExportAnalyzer.js
4+
+++ b/lib/analyzer/ExportAnalyzer.js
5+
@@ -193,7 +193,7 @@ class ExportAnalyzer {
6+
const mode = specifier && ts.isStringLiteralLike(specifier)
7+
? TypeScriptInternals_1.TypeScriptInternals.getModeForUsageLocation(importOrExportDeclaration.getSourceFile(), specifier)
8+
: undefined;
9+
- const resolvedModule = TypeScriptInternals_1.TypeScriptInternals.getResolvedModule(importOrExportDeclaration.getSourceFile(), moduleSpecifier, mode);
10+
+ const resolvedModule = TypeScriptInternals_1.TypeScriptInternals.getResolvedModule(this._program, importOrExportDeclaration.getSourceFile(), moduleSpecifier, mode);
11+
if (resolvedModule === undefined) {
12+
// The TS compiler API `getResolvedModule` cannot resolve ambient modules. Thus, to match API Extractor's
13+
// previous behavior, simply treat all ambient modules as external. This bug is tracked by
14+
@@ -666,7 +666,7 @@ class ExportAnalyzer {
15+
ts.isStringLiteralLike(importOrExportDeclaration.moduleSpecifier)
16+
? TypeScriptInternals_1.TypeScriptInternals.getModeForUsageLocation(importOrExportDeclaration.getSourceFile(), importOrExportDeclaration.moduleSpecifier)
17+
: undefined;
18+
- const resolvedModule = TypeScriptInternals_1.TypeScriptInternals.getResolvedModule(importOrExportDeclaration.getSourceFile(), moduleSpecifier, mode);
19+
+ const resolvedModule = TypeScriptInternals_1.TypeScriptInternals.getResolvedModule(this._program, importOrExportDeclaration.getSourceFile(), moduleSpecifier, mode);
20+
if (resolvedModule === undefined) {
21+
// Encountered in https://github.com/microsoft/rushstack/issues/1914.
22+
//
23+
diff --git a/lib/analyzer/TypeScriptInternals.js b/lib/analyzer/TypeScriptInternals.js
24+
index ff13db7709ccf502fe202337869d4024431636c9..217c36b0303c3bf9871edabcd48fbf6e09f18561 100644
25+
--- a/lib/analyzer/TypeScriptInternals.js
26+
+++ b/lib/analyzer/TypeScriptInternals.js
27+
@@ -84,10 +84,16 @@ class TypeScriptInternals {
28+
* Retrieves the (cached) module resolution information for a module name that was exported from a SourceFile.
29+
* The compiler populates this cache as part of analyzing the source file.
30+
*/
31+
- static getResolvedModule(sourceFile, moduleNameText, mode) {
32+
+ static getResolvedModule(program, sourceFile, moduleNameText, mode) {
33+
// Compiler internal:
34+
- // https://github.com/microsoft/TypeScript/blob/v4.7.2/src/compiler/utilities.ts#L161
35+
- return ts.getResolvedModule(sourceFile, moduleNameText, mode);
36+
+ // https://github.com/microsoft/TypeScript/blob/v5.3-beta/src/compiler/types.ts#L4678
37+
+ const result = program.getResolvedModule(
38+
+ sourceFile,
39+
+ moduleNameText,
40+
+ mode
41+
+ );
42+
+ return result?.resolvedModule;
43+
+
44+
}
45+
/**
46+
* Gets the mode required for module resolution required with the addition of Node16/nodenext

.yarn/patches/typescript-npm-5.2.2-01717e9f84.patch .yarn/patches/typescript-npm-5.3.0-beta-33b1e90865.patch

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts
2-
index ead6d07d8fb2af6aa74b790c9fd947f1062f6df4..f8dad7f06e74d7cfccfcd8fc9c5c7038a7fe4164 100644
2+
index d785077fd9e4eb5959c0badb857358fad09d4d3f..54f71344b098e8d46acd8dd77638c60d505bb996 100644
33
--- a/lib/typescript.d.ts
44
+++ b/lib/typescript.d.ts
5-
@@ -371,8 +371,8 @@ declare namespace ts {
5+
@@ -4491,8 +4491,8 @@ declare namespace ts {
66
JSDocFunctionType = 324,
77
JSDocVariadicType = 325,
88
JSDocNamepathType = 326,
@@ -12,7 +12,7 @@ index ead6d07d8fb2af6aa74b790c9fd947f1062f6df4..f8dad7f06e74d7cfccfcd8fc9c5c7038
1212
JSDocComment = 327,
1313
JSDocText = 328,
1414
JSDocTypeLiteral = 329,
15-
@@ -738,6 +738,8 @@ declare namespace ts {
15+
@@ -5066,6 +5066,8 @@ declare namespace ts {
1616
readonly name: PropertyName;
1717
readonly questionToken?: QuestionToken;
1818
readonly type?: TypeNode;
@@ -21,7 +21,7 @@ index ead6d07d8fb2af6aa74b790c9fd947f1062f6df4..f8dad7f06e74d7cfccfcd8fc9c5c7038
2121
}
2222
interface PropertyDeclaration extends ClassElement, JSDocContainer {
2323
readonly kind: SyntaxKind.PropertyDeclaration;
24-
@@ -763,6 +765,10 @@ declare namespace ts {
24+
@@ -5091,6 +5093,10 @@ declare namespace ts {
2525
readonly parent: ObjectLiteralExpression;
2626
readonly name: PropertyName;
2727
readonly initializer: Expression;
@@ -32,7 +32,7 @@ index ead6d07d8fb2af6aa74b790c9fd947f1062f6df4..f8dad7f06e74d7cfccfcd8fc9c5c7038
3232
}
3333
interface ShorthandPropertyAssignment extends ObjectLiteralElement, JSDocContainer {
3434
readonly kind: SyntaxKind.ShorthandPropertyAssignment;
35-
@@ -770,6 +776,12 @@ declare namespace ts {
35+
@@ -5098,6 +5104,12 @@ declare namespace ts {
3636
readonly name: Identifier;
3737
readonly equalsToken?: EqualsToken;
3838
readonly objectAssignmentInitializer?: Expression;
@@ -45,7 +45,7 @@ index ead6d07d8fb2af6aa74b790c9fd947f1062f6df4..f8dad7f06e74d7cfccfcd8fc9c5c7038
4545
}
4646
interface SpreadAssignment extends ObjectLiteralElement, JSDocContainer {
4747
readonly kind: SyntaxKind.SpreadAssignment;
48-
@@ -892,6 +904,8 @@ declare namespace ts {
48+
@@ -5222,6 +5234,8 @@ declare namespace ts {
4949
}
5050
interface FunctionTypeNode extends FunctionOrConstructorTypeNodeBase, LocalsContainer {
5151
readonly kind: SyntaxKind.FunctionType;
@@ -54,7 +54,7 @@ index ead6d07d8fb2af6aa74b790c9fd947f1062f6df4..f8dad7f06e74d7cfccfcd8fc9c5c7038
5454
}
5555
interface ConstructorTypeNode extends FunctionOrConstructorTypeNodeBase, LocalsContainer {
5656
readonly kind: SyntaxKind.ConstructorType;
57-
@@ -4584,7 +4598,13 @@ declare namespace ts {
57+
@@ -8978,7 +8992,13 @@ declare namespace ts {
5858
function symbolName(symbol: Symbol): string;
5959
function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | PrivateIdentifier | undefined;
6060
function getNameOfDeclaration(declaration: Declaration | Expression | undefined): DeclarationName | undefined;
@@ -68,7 +68,7 @@ index ead6d07d8fb2af6aa74b790c9fd947f1062f6df4..f8dad7f06e74d7cfccfcd8fc9c5c7038
6868
function getModifiers(node: HasModifiers): readonly Modifier[] | undefined;
6969
/**
7070
* Gets the JSDoc parameter tags for the node if present.
71-
@@ -5110,7 +5130,13 @@ declare namespace ts {
71+
@@ -9508,7 +9528,13 @@ declare namespace ts {
7272
function isModuleName(node: Node): node is ModuleName;
7373
function isBinaryOperatorToken(node: Node): node is BinaryOperatorToken;
7474
function setTextRange<T extends TextRange>(range: T, location: TextRange | undefined): T;

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@
114114
"ts-node": "10.7.0",
115115
"tslint": "^6.1.3",
116116
"tsx": "^3.12.7",
117-
"typescript": ">=4.3.5 <5.3.0"
117+
"typescript": ">=4.3.5 <5.4.0"
118118
},
119119
"resolutions": {
120120
"@jest/create-cache-key-function": "^29",
121121
"@jest/reporters": "^29",
122122
"@jest/test-result": "^29",
123+
"@microsoft/api-extractor@^7.38.0": "patch:@microsoft/api-extractor@npm%3A7.38.0#./.yarn/patches/@microsoft-api-extractor-npm-7.38.0-955f1e0725.patch",
123124
"@swc/core-android-arm-eabi": "link:./tools/dummypkg",
124125
"@swc/core-android-arm64": "link:./tools/dummypkg",
125126
"@swc/core-freebsd-x64": "link:./tools/dummypkg",
@@ -140,7 +141,7 @@
140141
"pretty-format": "^29",
141142
"react-split-pane@^0.1.92": "patch:react-split-pane@npm%3A0.1.92#./.yarn/patches/react-split-pane-npm-0.1.92-93dbf51dff.patch",
142143
"tsx": "^3.12.7",
143-
"typescript": "patch:typescript@npm%3A5.2.2#./.yarn/patches/typescript-npm-5.2.2-01717e9f84.patch"
144+
"typescript": "patch:typescript@npm%3A5.3.0-beta#./.yarn/patches/typescript-npm-5.3.0-beta-33b1e90865.patch"
144145
},
145146
"packageManager": "[email protected]"
146147
}

packages/ast-spec/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@babel/core": "*",
4848
"@babel/eslint-parser": "*",
4949
"@babel/parser": "*",
50-
"@microsoft/api-extractor": "^7.36.1",
50+
"@microsoft/api-extractor": "^7.38.0",
5151
"glob": "*",
5252
"jest": "29.7.0",
5353
"jest-diff": "^29.6.2",

packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/kind-type/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/kind-type/snapshots/5-AST-Alignment-AST.shot

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/type-kind/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/type-kind/snapshots/5-AST-Alignment-AST.shot

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/5-AST-Alignment-AST.shot

+39-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts

+8
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@ export interface ExportAllDeclaration extends BaseNode {
1212
* ```
1313
* export * from 'mod' assert { type: 'json' };
1414
* ```
15+
* @deprecated -- Replaced with {@link `attributes`}.
1516
*/
1617
assertions: ImportAttribute[];
18+
/**
19+
* The attributes declared for the export.
20+
* ```
21+
* export * from 'mod' assert { type: 'json' };
22+
* ```
23+
*/
24+
attributes: ImportAttribute[];
1725
/**
1826
* The name for the exported items. `null` if no name is assigned.
1927
*/

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)