async function buildExtraConfigForDependencies(options, config) {
	// extra handling for svelte dependencies in the project
	const packagesWithoutSvelteExportsCondition = new Set();
	const depsConfig = await crawlFrameworkPkgs({
		root: options.root,
		isBuild: options.isBuild,
		viteUserConfig: config,
		isFrameworkPkgByJson(pkgJson) {
			let hasSvelteCondition = false;
			if (typeof pkgJson.exports === 'object') {
				// use replacer as a simple way to iterate over nested keys
				JSON.stringify(pkgJson.exports, (key, value) => {
					if (SVELTE_EXPORT_CONDITIONS.includes(key)) {
						hasSvelteCondition = true;
					}
					return value;
				});
			}
			const hasSvelteField = !!pkgJson.svelte;
			if (hasSvelteField && !hasSvelteCondition) {
				packagesWithoutSvelteExportsCondition.add(`${pkgJson.name}@${pkgJson.version}`);
			}
			return hasSvelteCondition || hasSvelteField;
		},
		isSemiFrameworkPkgByJson(pkgJson) {
			return !!pkgJson.dependencies?.svelte || !!pkgJson.peerDependencies?.svelte;
		},
		isFrameworkPkgByName(pkgName) {
			const isNotSveltePackage = isCommonDepWithoutSvelteField(pkgName);
			if (isNotSveltePackage) {
				return false;
			} else {
				return undefined;
			}
		}
	});
	if (
		!options.experimental?.disableSvelteResolveWarnings &&
		packagesWithoutSvelteExportsCondition?.size > 0
	) {
		log.warn(
			`WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte.\n\n${[
				...packagesWithoutSvelteExportsCondition
			].join('\n')}\n\nPlease see ${FAQ_LINK_MISSING_EXPORTS_CONDITION} for details.`
		);
	}
	log.debug('extra config for dependencies generated by vitefu', depsConfig, 'config');

	if (options.prebundleSvelteLibraries) {
		// prebundling enabled, so we don't need extra dependency excludes
		depsConfig.optimizeDeps.exclude = [];
		// but keep dependency reinclusions of explicit user excludes
		const userExclude = config.optimizeDeps?.exclude;
		depsConfig.optimizeDeps.include = !userExclude
			? []
			: depsConfig.optimizeDeps.include.filter((dep) => {
					// reincludes look like this: foo > bar > baz
					// in case foo or bar are excluded, we have to retain the reinclude even with prebundling
					return (
						dep.includes('>') &&
						dep
							.split('>')
							.slice(0, -1)
							.some((d) => isDepExcluded(d.trim(), userExclude))
					);
				});
	}
	if (options.disableDependencyReinclusion === true) {
		depsConfig.optimizeDeps.include = depsConfig.optimizeDeps.include.filter(
			(dep) => !dep.includes('>')
		);
	} else if (Array.isArray(options.disableDependencyReinclusion)) {
		const disabledDeps = options.disableDependencyReinclusion;
		depsConfig.optimizeDeps.include = depsConfig.optimizeDeps.include.filter((dep) => {
			if (!dep.includes('>')) return true;
			const trimDep = dep.replace(/\s+/g, '');
			return disabledDeps.some((disabled) => trimDep.includes(`${disabled}>`));
		});
	}

	log.debug('post-processed extra config for dependencies', depsConfig, 'config');

	return depsConfig;
}
@param {import('../types/options.d.ts').PreResolvedOptions} options
@param {import('vite').UserConfig} config
@returns {Promise<import('vitefu').CrawlFrameworkPkgsResult>}