Skip to content

Commit

Permalink
fix(compat): update patch for typescript 4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Jan 14, 2022
1 parent 442f509 commit afd71c6
Show file tree
Hide file tree
Showing 5 changed files with 2,884 additions and 25 deletions.
11 changes: 9 additions & 2 deletions packages/plugin-compat/extra/typescript/gen-typescript-patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,16 @@ const SLICES = [
// https://github.com/merceyz/TypeScript/tree/merceyz/pnp-4.5
{
from: `79fe5d206f89e5f1585807bdcd7feeb567a69646`,
to: `fff89a12766fa485e35b1c65d8631d109c4e2c0e`,
to: `b7875244ca066f2674e81ba84ce9fbf00466ab84`,
onto: `7893f689fedcfe28a499d119d34844840bce9160`,
range: `>=4.5.2`,
range: `>=4.5.2 <4.6`,
},
// https://github.com/merceyz/TypeScript/tree/merceyz/pnp-4.6
{
from: `5a46ef5979c2b0a8e31180d099b6c6acd3fe18ac`,
to: `7874ae3accdaf5554dd9e1b9e6cf8d290a41d58c`,
onto: `ce18254c776782a938bd55046d93871e176d6172`,
range: `>=4.6.0-dev.20220113`,
},
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff --git a/lib/tsc.js b/lib/tsc.js
index b7520e834..a8b13999c 100644
semver exclusivity >=4.5.2
index b7520e834..796e8d126 100644
semver exclusivity >=4.5.2 <4.6
--- a/lib/tsc.js
+++ b/lib/tsc.js
@@ -4776,6 +4776,9 @@ var ts;
Expand Down Expand Up @@ -193,7 +193,7 @@ semver exclusivity >=4.5.2
+ var findPnpApi = require("module").findPnpApi;
+ var pnpApi = findPnpApi(path);
+ var locator = pnpApi === null || pnpApi === void 0 ? void 0 : pnpApi.findPackageLocator(path);
+ if (locator != null) {
+ if (locator !== null && locator !== undefined) {
+ var sourceLocator = pnpApi.findPackageLocator("".concat(sourceDirectory, "/"));
+ if (locator === sourceLocator) {
+ return undefined;
Expand Down Expand Up @@ -303,8 +303,8 @@ semver exclusivity >=4.5.2
ts.perfLogger.logStartUpdateProgram("SynchronizeProgram");
synchronizeProgram();
diff --git a/lib/tsserver.js b/lib/tsserver.js
index d0063b2e5..17d21c109 100644
semver exclusivity >=4.5.2
index d0063b2e5..a83296120 100644
semver exclusivity >=4.5.2 <4.6
--- a/lib/tsserver.js
+++ b/lib/tsserver.js
@@ -7515,6 +7515,11 @@ var ts;
Expand Down Expand Up @@ -520,7 +520,7 @@ semver exclusivity >=4.5.2
+ var pnpApi = findPnpApi(path);
+ var locator = pnpApi === null || pnpApi === void 0 ? void 0 : pnpApi.findPackageLocator(path);
+ // eslint-disable-next-line no-null/no-null
+ if (locator != null) {
+ if (locator !== null && locator !== undefined) {
+ var sourceLocator = pnpApi.findPackageLocator("".concat(sourceDirectory, "/"));
+ // Don't use the package name when the imported file is inside
+ // the source directory (prefer a relative path instead)
Expand Down Expand Up @@ -924,8 +924,8 @@ semver exclusivity >=4.5.2
this.installer.on("message", function (m) { return _this.handleMessage(m); });
// We have to schedule this event to the next tick
diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js
index 362c8ed2f..836fb22b4 100644
semver exclusivity >=4.5.2
index 362c8ed2f..b99bd161a 100644
semver exclusivity >=4.5.2 <4.6
--- a/lib/tsserverlibrary.js
+++ b/lib/tsserverlibrary.js
@@ -7709,6 +7709,11 @@ var ts;
Expand Down Expand Up @@ -1141,7 +1141,7 @@ semver exclusivity >=4.5.2
+ var pnpApi = findPnpApi(path);
+ var locator = pnpApi === null || pnpApi === void 0 ? void 0 : pnpApi.findPackageLocator(path);
+ // eslint-disable-next-line no-null/no-null
+ if (locator != null) {
+ if (locator !== null && locator !== undefined) {
+ var sourceLocator = pnpApi.findPackageLocator("".concat(sourceDirectory, "/"));
+ // Don't use the package name when the imported file is inside
+ // the source directory (prefer a relative path instead)
Expand Down Expand Up @@ -1521,8 +1521,8 @@ semver exclusivity >=4.5.2
var _this = this;
var watchers = this.packageJsonFilesMap || (this.packageJsonFilesMap = new ts.Map());
diff --git a/lib/typescript.js b/lib/typescript.js
index b08660b52..0cefe5195 100644
semver exclusivity >=4.5.2
index b08660b52..e37fe50a1 100644
semver exclusivity >=4.5.2 <4.6
--- a/lib/typescript.js
+++ b/lib/typescript.js
@@ -7709,6 +7709,11 @@ var ts;
Expand Down Expand Up @@ -1738,7 +1738,7 @@ semver exclusivity >=4.5.2
+ var pnpApi = findPnpApi(path);
+ var locator = pnpApi === null || pnpApi === void 0 ? void 0 : pnpApi.findPackageLocator(path);
+ // eslint-disable-next-line no-null/no-null
+ if (locator != null) {
+ if (locator !== null && locator !== undefined) {
+ var sourceLocator = pnpApi.findPackageLocator("".concat(sourceDirectory, "/"));
+ // Don't use the package name when the imported file is inside
+ // the source directory (prefer a relative path instead)
Expand Down Expand Up @@ -2014,8 +2014,8 @@ semver exclusivity >=4.5.2
return statement;
});
diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js
index bbe1b9b37..197e2c71c 100644
semver exclusivity >=4.5.2
index bbe1b9b37..e8f32af65 100644
semver exclusivity >=4.5.2 <4.6
--- a/lib/typescriptServices.js
+++ b/lib/typescriptServices.js
@@ -7709,6 +7709,11 @@ var ts;
Expand Down Expand Up @@ -2231,7 +2231,7 @@ semver exclusivity >=4.5.2
+ var pnpApi = findPnpApi(path);
+ var locator = pnpApi === null || pnpApi === void 0 ? void 0 : pnpApi.findPackageLocator(path);
+ // eslint-disable-next-line no-null/no-null
+ if (locator != null) {
+ if (locator !== null && locator !== undefined) {
+ var sourceLocator = pnpApi.findPackageLocator("".concat(sourceDirectory, "/"));
+ // Don't use the package name when the imported file is inside
+ // the source directory (prefer a relative path instead)
Expand Down Expand Up @@ -2507,8 +2507,8 @@ semver exclusivity >=4.5.2
return statement;
});
diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js
index 514f48a46..4d1aa5d8f 100644
semver exclusivity >=4.5.2
index 514f48a46..f73da2952 100644
semver exclusivity >=4.5.2 <4.6
--- a/lib/typingsInstaller.js
+++ b/lib/typingsInstaller.js
@@ -7504,6 +7504,11 @@ var ts;
Expand Down Expand Up @@ -2724,7 +2724,7 @@ semver exclusivity >=4.5.2
+ var pnpApi = findPnpApi(path);
+ var locator = pnpApi === null || pnpApi === void 0 ? void 0 : pnpApi.findPackageLocator(path);
+ // eslint-disable-next-line no-null/no-null
+ if (locator != null) {
+ if (locator !== null && locator !== undefined) {
+ var sourceLocator = pnpApi.findPackageLocator("".concat(sourceDirectory, "/"));
+ // Don't use the package name when the imported file is inside
+ // the source directory (prefer a relative path instead)
Expand Down
Loading

0 comments on commit afd71c6

Please sign in to comment.