Skip to content

Commit

Permalink
deps: upd
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD committed May 12, 2024
1 parent fea0146 commit 8529591
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 146 deletions.
17 changes: 12 additions & 5 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,11 +221,11 @@ 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();
}
const [major, minor] = absRequire(`typescript/package.json`).version.split(`.`, 2).map(value => parseInt(value, 10));
// In TypeScript@>=5.5 the tsserver uses the public TypeScript API so that needs to be patched as well.
// Ref https:/microsoft/TypeScript/pull/55326
if (major > 5 || (major === 5 && minor >= 5)) {
moduleWrapper(absRequire(`typescript`));
}

// Defer to the real typescript/lib/tsserver.js your application uses
Expand Down
17 changes: 12 additions & 5 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,11 +221,11 @@ 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();
}
const [major, minor] = absRequire(`typescript/package.json`).version.split(`.`, 2).map(value => parseInt(value, 10));
// In TypeScript@>=5.5 the tsserver uses the public TypeScript API so that needs to be patched as well.
// Ref https:/microsoft/TypeScript/pull/55326
if (major > 5 || (major === 5 && minor >= 5)) {
moduleWrapper(absRequire(`typescript`));
}

// Defer to the real typescript/lib/tsserverlibrary.js your application uses
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@
"prettier": "^3.2.5",
"typescript": "^5.4.5"
},
"packageManager": "yarn@4.1.1"
"packageManager": "yarn@4.2.2"
}
Loading

0 comments on commit 8529591

Please sign in to comment.