Skip to content

Commit 09f406c

Browse files
authored
chore(deps): upgrade Yarn from 4.1.0 to 4.5.1 (#393)
1 parent c1e2786 commit 09f406c

17 files changed

+1128
-933
lines changed

.yarn/releases/yarn-4.1.0.cjs

-893
This file was deleted.

.yarn/releases/yarn-4.5.1.cjs

+934
Large diffs are not rendered by default.

.yarn/sdks/eslint/bin/eslint.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire} = require(`module`);
4+
const {createRequire, register} = require(`module`);
55
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
67

78
const relPnpApiPath = "../../../../.pnp.cjs";
89

910
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
1012
const absRequire = createRequire(absPnpApiPath);
1113

14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
1217
if (existsSync(absPnpApiPath)) {
1318
if (!process.versions.pnp) {
1419
// Setup the environment to be able to require eslint/bin/eslint.js
1520
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
1624
}
1725
}
1826

27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
1931
// Defer to the real eslint/bin/eslint.js your application uses
20-
module.exports = absRequire(`eslint/bin/eslint.js`);
32+
module.exports = wrapWithUserWrapper(absRequire(`eslint/bin/eslint.js`));

.yarn/sdks/eslint/lib/api.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire} = require(`module`);
4+
const {createRequire, register} = require(`module`);
55
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
67

78
const relPnpApiPath = "../../../../.pnp.cjs";
89

910
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
1012
const absRequire = createRequire(absPnpApiPath);
1113

14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
1217
if (existsSync(absPnpApiPath)) {
1318
if (!process.versions.pnp) {
1419
// Setup the environment to be able to require eslint
1520
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
1624
}
1725
}
1826

27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
1931
// Defer to the real eslint your application uses
20-
module.exports = absRequire(`eslint`);
32+
module.exports = wrapWithUserWrapper(absRequire(`eslint`));
+14-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire} = require(`module`);
4+
const {createRequire, register} = require(`module`);
55
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
67

78
const relPnpApiPath = "../../../../.pnp.cjs";
89

910
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
1012
const absRequire = createRequire(absPnpApiPath);
1113

14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
1217
if (existsSync(absPnpApiPath)) {
1318
if (!process.versions.pnp) {
1419
// Setup the environment to be able to require eslint/use-at-your-own-risk
1520
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
1624
}
1725
}
1826

27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
1931
// Defer to the real eslint/use-at-your-own-risk your application uses
20-
module.exports = absRequire(`eslint/use-at-your-own-risk`);
32+
module.exports = wrapWithUserWrapper(absRequire(`eslint/use-at-your-own-risk`));

.yarn/sdks/prettier/bin/prettier.cjs

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire} = require(`module`);
4+
const {createRequire, register} = require(`module`);
55
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
67

78
const relPnpApiPath = "../../../../.pnp.cjs";
89

910
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
1012
const absRequire = createRequire(absPnpApiPath);
1113

14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
1217
if (existsSync(absPnpApiPath)) {
1318
if (!process.versions.pnp) {
1419
// Setup the environment to be able to require prettier/bin/prettier.cjs
1520
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
1624
}
1725
}
1826

27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
1931
// Defer to the real prettier/bin/prettier.cjs your application uses
20-
module.exports = absRequire(`prettier/bin/prettier.cjs`);
32+
module.exports = wrapWithUserWrapper(absRequire(`prettier/bin/prettier.cjs`));

.yarn/sdks/prettier/index.cjs

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire} = require(`module`);
4+
const {createRequire, register} = require(`module`);
55
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
67

78
const relPnpApiPath = "../../../.pnp.cjs";
89

910
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
1012
const absRequire = createRequire(absPnpApiPath);
1113

14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
1217
if (existsSync(absPnpApiPath)) {
1318
if (!process.versions.pnp) {
1419
// Setup the environment to be able to require prettier
1520
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
1624
}
1725
}
1826

27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
1931
// Defer to the real prettier your application uses
20-
module.exports = absRequire(`prettier`);
32+
module.exports = wrapWithUserWrapper(absRequire(`prettier`));

.yarn/sdks/typescript/bin/tsc

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire} = require(`module`);
4+
const {createRequire, register} = require(`module`);
55
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
67

78
const relPnpApiPath = "../../../../.pnp.cjs";
89

910
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
1012
const absRequire = createRequire(absPnpApiPath);
1113

14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
1217
if (existsSync(absPnpApiPath)) {
1318
if (!process.versions.pnp) {
1419
// Setup the environment to be able to require typescript/bin/tsc
1520
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
1624
}
1725
}
1826

27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
1931
// Defer to the real typescript/bin/tsc your application uses
20-
module.exports = absRequire(`typescript/bin/tsc`);
32+
module.exports = wrapWithUserWrapper(absRequire(`typescript/bin/tsc`));

.yarn/sdks/typescript/bin/tsserver

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire} = require(`module`);
4+
const {createRequire, register} = require(`module`);
55
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
67

78
const relPnpApiPath = "../../../../.pnp.cjs";
89

910
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
1012
const absRequire = createRequire(absPnpApiPath);
1113

14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
1217
if (existsSync(absPnpApiPath)) {
1318
if (!process.versions.pnp) {
1419
// Setup the environment to be able to require typescript/bin/tsserver
1520
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
1624
}
1725
}
1826

27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
1931
// Defer to the real typescript/bin/tsserver your application uses
20-
module.exports = absRequire(`typescript/bin/tsserver`);
32+
module.exports = wrapWithUserWrapper(absRequire(`typescript/bin/tsserver`));

.yarn/sdks/typescript/lib/tsc.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire} = require(`module`);
4+
const {createRequire, register} = require(`module`);
55
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
67

78
const relPnpApiPath = "../../../../.pnp.cjs";
89

910
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
1012
const absRequire = createRequire(absPnpApiPath);
1113

14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
1217
if (existsSync(absPnpApiPath)) {
1318
if (!process.versions.pnp) {
1419
// Setup the environment to be able to require typescript/lib/tsc.js
1520
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
1624
}
1725
}
1826

27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
1931
// Defer to the real typescript/lib/tsc.js your application uses
20-
module.exports = absRequire(`typescript/lib/tsc.js`);
32+
module.exports = wrapWithUserWrapper(absRequire(`typescript/lib/tsc.js`));

.yarn/sdks/typescript/lib/tsserver.js

+30-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire} = require(`module`);
4+
const {createRequire, register} = require(`module`);
55
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
67

78
const relPnpApiPath = "../../../../.pnp.cjs";
89

910
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
1012
const absRequire = createRequire(absPnpApiPath);
1113

12-
const moduleWrapper = tsserver => {
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require typescript/lib/tsserver.js
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
31+
const moduleWrapper = exports => {
32+
return wrapWithUserWrapper(moduleWrapperFn(exports));
33+
};
34+
35+
const moduleWrapperFn = tsserver => {
1336
if (!process.versions.pnp) {
1437
return tsserver;
1538
}
@@ -214,11 +237,11 @@ const moduleWrapper = tsserver => {
214237
return tsserver;
215238
};
216239

217-
if (existsSync(absPnpApiPath)) {
218-
if (!process.versions.pnp) {
219-
// Setup the environment to be able to require typescript/lib/tsserver.js
220-
require(absPnpApiPath).setup();
221-
}
240+
const [major, minor] = absRequire(`typescript/package.json`).version.split(`.`, 2).map(value => parseInt(value, 10));
241+
// In TypeScript@>=5.5 the tsserver uses the public TypeScript API so that needs to be patched as well.
242+
// Ref https://github.com/microsoft/TypeScript/pull/55326
243+
if (major > 5 || (major === 5 && minor >= 5)) {
244+
moduleWrapper(absRequire(`typescript`));
222245
}
223246

224247
// Defer to the real typescript/lib/tsserver.js your application uses

.yarn/sdks/typescript/lib/tsserverlibrary.js

+30-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire} = require(`module`);
4+
const {createRequire, register} = require(`module`);
55
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
67

78
const relPnpApiPath = "../../../../.pnp.cjs";
89

910
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
1012
const absRequire = createRequire(absPnpApiPath);
1113

12-
const moduleWrapper = tsserver => {
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
31+
const moduleWrapper = exports => {
32+
return wrapWithUserWrapper(moduleWrapperFn(exports));
33+
};
34+
35+
const moduleWrapperFn = tsserver => {
1336
if (!process.versions.pnp) {
1437
return tsserver;
1538
}
@@ -214,11 +237,11 @@ const moduleWrapper = tsserver => {
214237
return tsserver;
215238
};
216239

217-
if (existsSync(absPnpApiPath)) {
218-
if (!process.versions.pnp) {
219-
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
220-
require(absPnpApiPath).setup();
221-
}
240+
const [major, minor] = absRequire(`typescript/package.json`).version.split(`.`, 2).map(value => parseInt(value, 10));
241+
// In TypeScript@>=5.5 the tsserver uses the public TypeScript API so that needs to be patched as well.
242+
// Ref https://github.com/microsoft/TypeScript/pull/55326
243+
if (major > 5 || (major === 5 && minor >= 5)) {
244+
moduleWrapper(absRequire(`typescript`));
222245
}
223246

224247
// Defer to the real typescript/lib/tsserverlibrary.js your application uses

0 commit comments

Comments
 (0)