Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix: revert breaking change to cache and fetchers
  • Loading branch information
merceyz committed Oct 21, 2021
commit 8a7ed9d524a23dde2efbb9bce3eeca12610eb702
33 changes: 33 additions & 0 deletions .yarn/versions/1f6e9219.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/core": patch
"@yarnpkg/doctor": patch
"@yarnpkg/plugin-essentials": patch
"@yarnpkg/plugin-exec": patch
"@yarnpkg/plugin-file": patch
"@yarnpkg/plugin-git": patch
"@yarnpkg/plugin-github": patch
"@yarnpkg/plugin-http": patch
"@yarnpkg/plugin-npm": patch
"@yarnpkg/plugin-patch": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-link"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/nm"
- "@yarnpkg/pnpify"
- "@yarnpkg/sdks"
2 changes: 1 addition & 1 deletion packages/plugin-essentials/sources/commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export default class InfoCommand extends BaseCommand {
const infoTree: treeUtils.TreeNode = {children: infoTreeChildren};

const fetcher = configuration.makeFetcher();
const fetcherOptions: FetchOptions = {project, fetcher, cache, checksums: project.storedChecksums, report: new ThrowReport(), skipIntegrityCheck: true};
const fetcherOptions: FetchOptions = {project, fetcher, cache, checksums: project.storedChecksums, report: new ThrowReport(), cacheOptions: {skipIntegrityCheck: true}, skipIntegrityCheck: true};

const builtinInfoBuilders: Array<Exclude<Hooks['fetchPackageInfo'], undefined>> = [
// Manifest fields
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-essentials/sources/dedupeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ export async function dedupe(project: Project, {strategy, patterns, cache, repor
project,
report: throwReport,
skipIntegrityCheck: true,
cacheOptions: {
skipIntegrityCheck: true,
},
};
const resolveOptions: ResolveOptions = {
project,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-essentials/sources/suggestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ export async function fetchDescriptorFrom(ident: Ident, range: string, {project,
const fetcher = project.configuration.makeFetcher();
const resolver = project.configuration.makeResolver();

const fetchOptions: FetchOptions = {project, fetcher, cache, checksums: project.storedChecksums, report, skipIntegrityCheck: true};
const fetchOptions: FetchOptions = {project, fetcher, cache, checksums: project.storedChecksums, report, cacheOptions: {skipIntegrityCheck: true}, skipIntegrityCheck: true};
const resolveOptions: ResolveOptions = {...fetchOptions, resolver, fetchOptions};

// The descriptor has to be bound for the resolvers that need a parent locator. (e.g. FileResolver)
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-exec/sources/ExecFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export class ExecFetcher implements Fetcher {
onHit: () => opts.report.reportCacheHit(locator),
onMiss: () => opts.report.reportCacheMiss(locator),
loader: () => this.fetchFromDisk(locator, opts),
}, opts.cacheOptions);
skipIntegrityCheck: opts.skipIntegrityCheck,
...opts.cacheOptions,
});

return {
packageFs,
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-file/sources/FileFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class FileFetcher implements Fetcher {
onHit: () => opts.report.reportCacheHit(locator),
onMiss: () => opts.report.reportCacheMiss(locator, `${structUtils.prettyLocator(opts.project.configuration, locator)} can't be found in the cache and will be fetched from the disk`),
loader: () => this.fetchFromDisk(locator, opts),
}, opts.cacheOptions);
skipIntegrityCheck: opts.skipIntegrityCheck,
...opts.cacheOptions,
});

return {
packageFs,
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-file/sources/TarballFileFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export class TarballFileFetcher implements Fetcher {
onHit: () => opts.report.reportCacheHit(locator),
onMiss: () => opts.report.reportCacheMiss(locator, `${structUtils.prettyLocator(opts.project.configuration, locator)} can't be found in the cache and will be fetched from the disk`),
loader: () => this.fetchFromDisk(locator, opts),
}, opts.cacheOptions);
skipIntegrityCheck: opts.skipIntegrityCheck,
...opts.cacheOptions,
});

return {
packageFs,
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-git/sources/GitFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export class GitFetcher implements Fetcher {
onHit: () => opts.report.reportCacheHit(locator),
onMiss: () => opts.report.reportCacheMiss(locator, `${structUtils.prettyLocator(opts.project.configuration, locator)} can't be found in the cache and will be fetched from the remote repository`),
loader: () => this.cloneFromRemote(normalizedLocator, nextOpts),
}, opts.cacheOptions);
skipIntegrityCheck: opts.skipIntegrityCheck,
...opts.cacheOptions,
});

return {
packageFs,
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-github/sources/GithubFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export class GithubFetcher implements Fetcher {
onHit: () => opts.report.reportCacheHit(locator),
onMiss: () => opts.report.reportCacheMiss(locator, `${structUtils.prettyLocator(opts.project.configuration, locator)} can't be found in the cache and will be fetched from GitHub`),
loader: () => this.fetchFromNetwork(locator, opts),
}, opts.cacheOptions);
skipIntegrityCheck: opts.skipIntegrityCheck,
...opts.cacheOptions,
});

return {
packageFs,
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-http/sources/TarballHttpFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export class TarballHttpFetcher implements Fetcher {
onHit: () => opts.report.reportCacheHit(locator),
onMiss: () => opts.report.reportCacheMiss(locator, `${structUtils.prettyLocator(opts.project.configuration, locator)} can't be found in the cache and will be fetched from the remote server`),
loader: () => this.fetchFromNetwork(locator, opts),
}, opts.cacheOptions);
skipIntegrityCheck: opts.skipIntegrityCheck,
...opts.cacheOptions,
});

return {
packageFs,
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-npm/sources/NpmHttpFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export class NpmHttpFetcher implements Fetcher {
onHit: () => opts.report.reportCacheHit(locator),
onMiss: () => opts.report.reportCacheMiss(locator, `${structUtils.prettyLocator(opts.project.configuration, locator)} can't be found in the cache and will be fetched from the remote server`),
loader: () => this.fetchFromNetwork(locator, opts),
}, opts.cacheOptions);
skipIntegrityCheck: opts.skipIntegrityCheck,
...opts.cacheOptions,
});

return {
packageFs,
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-npm/sources/NpmSemverFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export class NpmSemverFetcher implements Fetcher {
onHit: () => opts.report.reportCacheHit(locator),
onMiss: () => opts.report.reportCacheMiss(locator, `${structUtils.prettyLocator(opts.project.configuration, locator)} can't be found in the cache and will be fetched from the remote registry`),
loader: () => this.fetchFromNetwork(locator, opts),
}, opts.cacheOptions);
skipIntegrityCheck: opts.skipIntegrityCheck,
...opts.cacheOptions,
});

return {
packageFs,
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-patch/sources/PatchFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export class PatchFetcher implements Fetcher {
onHit: () => opts.report.reportCacheHit(locator),
onMiss: () => opts.report.reportCacheMiss(locator, `${structUtils.prettyLocator(opts.project.configuration, locator)} can't be found in the cache and will be fetched from the disk`),
loader: () => this.patchPackage(locator, opts),
}, opts.cacheOptions);
skipIntegrityCheck: opts.skipIntegrityCheck,
...opts.cacheOptions,
});

return {
packageFs,
Expand Down
2 changes: 1 addition & 1 deletion packages/yarnpkg-core/sources/Cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class Cache {
}
}

async fetchPackageFromCache(locator: Locator, expectedChecksum: string | null, {onHit, onMiss, loader}: {onHit?: () => void, onMiss?: () => void, loader?: () => Promise<ZipFS>}, opts: CacheOptions = {}): Promise<[FakeFS<PortablePath>, () => void, string | null]> {
async fetchPackageFromCache(locator: Locator, expectedChecksum: string | null, {onHit, onMiss, loader, ...opts}: {onHit?: () => void, onMiss?: () => void, loader?: () => Promise<ZipFS> } & CacheOptions): Promise<[FakeFS<PortablePath>, () => void, string | null]> {
const mirrorPath = this.getLocatorMirrorPath(locator);

const baseFs = new NodeFS();
Expand Down
3 changes: 3 additions & 0 deletions packages/yarnpkg-core/sources/Fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export type FetchOptions = MinimalFetchOptions & {
cacheOptions?: CacheOptions,
checksums: Map<LocatorHash, string | null>,
report: Report,
/**
* @deprecated Use cacheOptions.skipIntegrityCheck instead
*/
skipIntegrityCheck?: boolean
};

Expand Down
12 changes: 6 additions & 6 deletions packages/yarnpkg-core/sources/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import {promisify} from 'ut
import v8 from 'v8';
import zlib from 'zlib';

import {Cache} from './Cache';
import {Cache, CacheOptions} from './Cache';
import {Configuration, FormatType} from './Configuration';
import {Fetcher} from './Fetcher';
import {Fetcher, FetchOptions} from './Fetcher';
import {Installer, BuildDirective, BuildType, InstallStatus} from './Installer';
import {LegacyMigrationResolver} from './LegacyMigrationResolver';
import {Linker} from './Linker';
import {Linker, LinkOptions} from './Linker';
import {LockfileResolver} from './LockfileResolver';
import {DependencyMeta, Manifest} from './Manifest';
import {MessageName} from './MessageName';
Expand Down Expand Up @@ -969,17 +969,17 @@ export class Project {
}

async linkEverything({cache, report, fetcher: optFetcher, mode}: InstallOptions) {
const cacheOptions = {
const cacheOptions: CacheOptions = {
mockedPackages: this.disabledLocators,
unstablePackages: this.conditionalLocators,
skipIntegrityCheck: true,
};

const fetcher = optFetcher || this.configuration.makeFetcher();
const fetcherOptions = {checksums: this.storedChecksums, project: this, cache, fetcher, report, cacheOptions};
const fetcherOptions: FetchOptions = {checksums: this.storedChecksums, project: this, cache, fetcher, report, skipIntegrityCheck: true, cacheOptions};

const linkers = this.configuration.getLinkers();
const linkerOptions = {project: this, report};
const linkerOptions: LinkOptions = {project: this, report};

const installers = new Map(linkers.map(linker => {
const installer = linker.makeInstaller(linkerOptions);
Expand Down
2 changes: 1 addition & 1 deletion packages/yarnpkg-doctor/sources/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ async function makeResolveFn(project: Project) {
const checksums = project.storedChecksums;
const yarnReport = new ThrowReport();

const fetchOptions: FetchOptions = {project, fetcher, cache, checksums, report: yarnReport, skipIntegrityCheck: true};
const fetchOptions: FetchOptions = {project, fetcher, cache, checksums, report: yarnReport, cacheOptions: {skipIntegrityCheck: true}, skipIntegrityCheck: true};
const resolveOptions: ResolveOptions = {...fetchOptions, resolver, fetchOptions};

return async (descriptor: Descriptor) => {
Expand Down