Skip to content

Improves boot time #4261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 26, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 4 additions & 44 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.
Binary file not shown.
Binary file not shown.
37 changes: 37 additions & 0 deletions .yarn/versions/78804c3b.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
releases:
"@yarnpkg/cli": major
"@yarnpkg/core": major
"@yarnpkg/libzip": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-exec"
- "@yarnpkg/plugin-file"
- "@yarnpkg/plugin-git"
- "@yarnpkg/plugin-github"
- "@yarnpkg/plugin-http"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-link"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm"
- "@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"
- vscode-zipfs
- "@yarnpkg/builder"
- "@yarnpkg/doctor"
- "@yarnpkg/fslib"
- "@yarnpkg/nm"
- "@yarnpkg/pnp"
- "@yarnpkg/pnpify"
- "@yarnpkg/sdks"
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ describe(`Commands`, () => {
const content = await xfs.readFilePromise(`${path}/yarn.lock` as PortablePath, `utf8`);
const lock = parseSyml(content);

await expect(lock).toMatchObject({
expect(lock).toMatchObject({
[`inject-node-gyp@npm:^1.0.0`]: {
dependencies: {
[`node-gyp`]: `latest`,
Expand Down
3 changes: 0 additions & 3 deletions packages/yarnpkg-cli/sources/tools/getDynamicLibs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as shell from '@yarnpkg/shell';
import * as clipanion from 'clipanion';
import * as semver from 'semver';
import * as typanion from 'typanion';
import * as yup from 'yup';

export const getDynamicLibs = () => new Map<string, any>([
[`@yarnpkg/cli`, cli],
Expand All @@ -21,6 +20,4 @@ export const getDynamicLibs = () => new Map<string, any>([
[`clipanion`, clipanion],
[`semver`, semver],
[`typanion`, typanion],
// TODO: remove in next major
[`yup`, yup],
]);
2 changes: 1 addition & 1 deletion packages/yarnpkg-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"semver": "^7.1.2",
"strip-ansi": "^6.0.0",
"tar": "^6.0.5",
"tinylogic": "^1.0.3",
"tinylogic": "^2.0.0",
"treeify": "^1.1.0",
"tslib": "^1.13.0",
"tunnel": "^0.0.6"
Expand Down
36 changes: 18 additions & 18 deletions packages/yarnpkg-core/sources/httpUtils.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import {PortablePath, xfs} from '@yarnpkg/fslib';
import {ExtendOptions, RequestError, Response, TimeoutError} from 'got';
import {Agent as HttpsAgent} from 'https';
import {Agent as HttpAgent} from 'http';
import micromatch from 'micromatch';
import tunnel, {ProxyOptions} from 'tunnel';
import {URL} from 'url';

import {ConfigurationValueMap, Configuration} from './Configuration';
import {MessageName} from './MessageName';
import {ReportError} from './Report';
import * as formatUtils from './formatUtils';
import {MapValue, MapValueToObjectValue} from './miscUtils';
import * as miscUtils from './miscUtils';

export {RequestError} from 'got';
import {PortablePath, xfs} from '@yarnpkg/fslib';
import type {ExtendOptions, RequestError, Response} from 'got';
import {Agent as HttpsAgent} from 'https';
import {Agent as HttpAgent} from 'http';
import micromatch from 'micromatch';
import tunnel, {ProxyOptions} from 'tunnel';
import {URL} from 'url';

import {ConfigurationValueMap, Configuration} from './Configuration';
import {MessageName} from './MessageName';
import {ReportError} from './Report';
import * as formatUtils from './formatUtils';
import {MapValue, MapValueToObjectValue} from './miscUtils';
import * as miscUtils from './miscUtils';

export type {RequestError} from 'got';

const cache = new Map<string, Promise<Buffer> | Buffer>();
const fileCache = new Map<PortablePath, Promise<Buffer> | Buffer>();
Expand Down Expand Up @@ -64,8 +64,8 @@ async function prettyNetworkError(response: Promise<Response<any>>, {configurati
}
}

if (err instanceof TimeoutError && err.event === `socket`)
message += ` (can be increased via ${formatUtils.pretty(configuration, `httpTimeout`, formatUtils.Type.SETTING)})`;
if (err.code === `ETIMEDOUT` && err.event === `socket`)
message += `(can be increased via ${formatUtils.pretty(configuration, `httpTimeout`, formatUtils.Type.SETTING)})`;

const networkError = new ReportError(MessageName.NETWORK_ERROR, message, report => {
if (err.response) {
Expand Down
9 changes: 6 additions & 3 deletions packages/yarnpkg-libzip/sources/async.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import createModule from './libzipAsync';
import {Libzip, makeInterface} from './makeInterface';

let promise: Promise<Libzip> | null = null;
Expand All @@ -8,8 +7,12 @@ export function getLibzipSync() {
}

export async function getLibzipPromise() {
if (promise === null)
promise = createModule().then(libzip => makeInterface(libzip));
if (promise === null) {
promise = import(`./libzipAsync`).then(async ({default: createModule}) => {
const libzip = await createModule();
return makeInterface(libzip);
});
}

return promise;
}
Expand Down
44 changes: 5 additions & 39 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1777,20 +1777,6 @@ __metadata:
languageName: node
linkType: hard

"@chevrotain/types@npm:^9.1.0":
version: 9.1.0
resolution: "@chevrotain/types@npm:9.1.0"
checksum: 95621f85dde7afbc3298440407814a04857f45fa0deefed0006441d1bdd1e09ae2243e141753ca2d1b08845f3c391dd03532f219e12be8c5e1d12b0b12ad342a
languageName: node
linkType: hard

"@chevrotain/utils@npm:^9.1.0":
version: 9.1.0
resolution: "@chevrotain/utils@npm:9.1.0"
checksum: 3bf20cd22e2f5d64f9cfd968c6355e440abb833b8283a37ff67d1ba56a219f2c9f93a194f2c51befb9932475c6d1fa98376f2ace248c2e391639931e0305a783
languageName: node
linkType: hard

"@cnakazawa/watch@npm:^1.0.3":
version: 1.0.3
resolution: "@cnakazawa/watch@npm:1.0.3"
Expand Down Expand Up @@ -5486,7 +5472,7 @@ __metadata:
semver: ^7.1.2
strip-ansi: ^6.0.0
tar: ^6.0.5
tinylogic: ^1.0.3
tinylogic: ^2.0.0
treeify: ^1.1.0
tslib: ^1.13.0
tunnel: ^0.0.6
Expand Down Expand Up @@ -8373,17 +8359,6 @@ __metadata:
languageName: node
linkType: hard

"chevrotain@npm:^9.1.0":
version: 9.1.0
resolution: "chevrotain@npm:9.1.0"
dependencies:
"@chevrotain/types": ^9.1.0
"@chevrotain/utils": ^9.1.0
regexp-to-ast: 0.5.0
checksum: d8e5cd89c0baa0b227ed39eb425cc8a1ffe533fe9993850f130bd7771963f30bb6095624e58c2acd0dc933b622834f17df0e5100f63d1008d64967a135f6e229
languageName: node
linkType: hard

"chokidar@npm:^2.1.8":
version: 2.1.8
resolution: "chokidar@npm:2.1.8"
Expand Down Expand Up @@ -22084,13 +22059,6 @@ __metadata:
languageName: node
linkType: hard

"regexp-to-ast@npm:0.5.0":
version: 0.5.0
resolution: "regexp-to-ast@npm:0.5.0"
checksum: 7f03ab05187a8e2bece21ef75ea844cf280202fc011e91408d109ea02f324d1662757f5a746ab68716606bb582e9490af4bf9ebece5f3200737fb99ac3132efc
languageName: node
linkType: hard

"regexp.prototype.flags@npm:^1.3.1":
version: 1.3.1
resolution: "regexp.prototype.flags@npm:1.3.1"
Expand Down Expand Up @@ -24917,12 +24885,10 @@ resolve@^2.0.0-next.3:
languageName: node
linkType: hard

"tinylogic@npm:^1.0.3":
version: 1.0.3
resolution: "tinylogic@npm:1.0.3"
dependencies:
chevrotain: ^9.1.0
checksum: c2df54738430317f7900bb50502ee74ea57ccd31ce49bd42b51f05be7ef4460240ac18304a014ac51dd2457a873200114b424ee371a89f5bd017db47854fb936
"tinylogic@npm:^2.0.0":
version: 2.0.0
resolution: "tinylogic@npm:2.0.0"
checksum: 8c97825b2916ace0cee7dbd9f39762c063ca7cf27f5f0c3f0c16bab2de8580b07a8bb123ebcd52767ff5923919eb70f241ccc4f7d1889ad0c07aa77d88dcb409
languageName: node
linkType: hard

Expand Down