Skip to content

Commit

Permalink
fix(compat): update patch for typescript@5.5.0-beta (#6248)
Browse files Browse the repository at this point in the history
**What's the problem this PR addresses?**

The PnP compatibility patch for TypeScript doesn't apply to
`typescript@5.5.0-beta`.

Ref microsoft/TypeScript#35206

**How did you fix it?**

Rebased it.

**Checklist**
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).
- [x] I have set the packages that need to be released for my changes to
be effective.
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.
  • Loading branch information
merceyz committed May 1, 2024
1 parent c8c59ff commit c7c0767
Show file tree
Hide file tree
Showing 20 changed files with 1,150 additions and 59 deletions.
32 changes: 16 additions & 16 deletions .pnp.cjs

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

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 8 additions & 6 deletions .yarn/sdks/typescript/lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsserver.js
require(absPnpApiPath).setup();
}
}

const moduleWrapper = tsserver => {
if (!process.versions.pnp) {
return tsserver;
Expand Down Expand Up @@ -214,12 +221,7 @@ const moduleWrapper = tsserver => {
return tsserver;
};

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsserver.js
require(absPnpApiPath).setup();
}
}
moduleWrapper(absRequire(`typescript`));

// Defer to the real typescript/lib/tsserver.js your application uses
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));
14 changes: 8 additions & 6 deletions .yarn/sdks/typescript/lib/tsserverlibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
require(absPnpApiPath).setup();
}
}

const moduleWrapper = tsserver => {
if (!process.versions.pnp) {
return tsserver;
Expand Down Expand Up @@ -214,12 +221,7 @@ const moduleWrapper = tsserver => {
return tsserver;
};

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
require(absPnpApiPath).setup();
}
}
moduleWrapper(absRequire(`typescript`));

// Defer to the real typescript/lib/tsserverlibrary.js your application uses
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`));
2 changes: 1 addition & 1 deletion .yarn/sdks/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript",
"version": "5.4.1-rc-sdk",
"version": "5.5.0-beta-sdk",
"main": "./lib/typescript.js",
"type": "commonjs",
"bin": {
Expand Down
24 changes: 24 additions & 0 deletions .yarn/versions/80caa95b.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/plugin-compat": patch
"@yarnpkg/sdks": patch

declined:
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"jest": "^29.2.1",
"pirates": "^4.0.5",
"tslib": "^2.4.0",
"typescript": "5.4.1-rc"
"typescript": "5.5.0-beta"
},
"resolutions": {
"ink": "patch:ink@npm%3A3.0.8#~/.yarn/patches/ink-npm-3.0.8-3a8005f59f.patch",
Expand Down Expand Up @@ -81,5 +81,6 @@
"chalk": "^3.0.0",
"micromatch": "^4.0.2",
"semver": "^7.1.2"
}
},
"packageManager": "yarn@4.1.1+sha256.f3cc0eda8e5560e529c7147565b30faa43b4e472d90e8634d7134a37c7f59781"
}
2 changes: 1 addition & 1 deletion packages/docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"fast-glob": "^3.2.2",
"mdast-util-mdx-jsx": "^3.0.0",
"typedoc": "^0.25.7",
"typescript": "5.4.1-rc",
"typescript": "5.5.0-beta",
"unified": "^11.0.4"
},
"browserslist": {
Expand Down
13 changes: 10 additions & 3 deletions packages/plugin-compat/extra/typescript/gen-typescript-patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,14 @@ const SLICES = [
from: `786e26825dad9dcc0eff79610bffd8bb121e7e8a`,
to: `786e26825dad9dcc0eff79610bffd8bb121e7e8a`,
onto: `db6b2a980280a9c87799b9c1edd6d71e92bb255b`,
range: `>=5.4.1-rc`,
range: `>=5.4.1-rc <5.5.0-beta`,
},
// https://github.com/yarnpkg/TypeScript/tree/merceyz/pnp-5.5-beta
{
from: `f90eb7508e66a3d5066b1d8a06606c6c23f3df43`,
to: `43d2cbd6ac423e35a5a095a509fc90c03f0c22ba`,
onto: `b574864abc989d0f8b15367baea1058819e126ba`,
range: `>=5.5.0-beta`,
},
];

Expand Down Expand Up @@ -531,10 +538,10 @@ async function main() {
const patch = await run(slice);
const versions = await fetchVersions(slice.range);

for (const version of versions) {
await Promise.all(versions.map(async version => {
console.log(`Validating ${version}...`);
await validate(version, patch);
}
}));

patches.push(patch);
}
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 49a42a27b..0625b052d 100644
semver exclusivity >=5.4.1-rc
semver exclusivity >=5.4.1-rc <5.5.0-beta
--- a/lib/tsc.js
+++ b/lib/tsc.js
@@ -5063,6 +5063,9 @@ var sys = (() => {
Expand Down Expand Up @@ -345,7 +345,7 @@ semver exclusivity >=5.4.1-rc
function reloadFileNamesFromConfigFile() {
diff --git a/lib/tsserver.js b/lib/tsserver.js
index 707a6387a..491cb8fa7 100644
semver exclusivity >=5.4.1-rc
semver exclusivity >=5.4.1-rc <5.5.0-beta
--- a/lib/tsserver.js
+++ b/lib/tsserver.js
@@ -8611,6 +8611,9 @@ var sys = (() => {
Expand Down Expand Up @@ -1002,7 +1002,7 @@ semver exclusivity >=5.4.1-rc
this.installer.on("message", (m) => this.handleMessage(m));
diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts
index a13173346..b0e8856e1 100644
semver exclusivity >=5.4.1-rc
semver exclusivity >=5.4.1-rc <5.5.0-beta
--- a/lib/typescript.d.ts
+++ b/lib/typescript.d.ts
@@ -9903,6 +9903,8 @@ declare namespace ts {
Expand All @@ -1016,7 +1016,7 @@ semver exclusivity >=5.4.1-rc
function resolveTripleslashReference(moduleName: string, containingFile: string): string;
diff --git a/lib/typescript.js b/lib/typescript.js
index a75d7ba4b..fd5189269 100644
semver exclusivity >=5.4.1-rc
semver exclusivity >=5.4.1-rc <5.5.0-beta
--- a/lib/typescript.js
+++ b/lib/typescript.js
@@ -6370,6 +6370,9 @@ ${lanes.join("\n")}
Expand Down Expand Up @@ -1719,7 +1719,7 @@ semver exclusivity >=5.4.1-rc
let result = (this.packageJsonFilesMap ?? (this.packageJsonFilesMap = /* @__PURE__ */ new Map())).get(path);
diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js
index 7d305c002..0162dd8ae 100644
semver exclusivity >=5.4.1-rc
semver exclusivity >=5.4.1-rc <5.5.0-beta
--- a/lib/typingsInstaller.js
+++ b/lib/typingsInstaller.js
@@ -4475,6 +4475,9 @@ var sys = (() => {
Expand Down

0 comments on commit c7c0767

Please sign in to comment.