Repository: rollup/rollup
File: src/utils/logs.ts (TypeScript)

Code before:
}

export function logUnknownOption(
	optionType: string,
	unknownOptions: string[],
	validOptions: string[]
): RollupLog {
	return {
		code: UNKNOWN_OPTION,
		message: `Unknown ${optionType}: ${unknownOptions.join(
			', '
		)}. Allowed options: ${validOptions.join(', ')}`
	};
}

export function logEntryCannotBeExternal(unresolvedId: string): RollupLog {
	return {
		code: UNRESOLVED_ENTRY,
		message: `Entry module "${relativeId(unresolvedId)}" cannot be external.`
	};
}

export function logExternalizedModulesCannotBeIncludedInManualChunks(source: string) {
	return {
		code: EXTERNALIZED_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS,
		message: `"${source}" cannot be included in manualChunks, because it is resolved as an external module by plugins`
	};
}

export function logUnresolvedEntry(unresolvedId: string): RollupLog {
	return {
		code: UNRESOLVED_ENTRY,
		message: `Could not resolve entry module "${relativeId(unresolvedId)}".`
	};
}

export function logUnresolvedImport(source: string, importer: string): RollupLog {
	return {
		code: UNRESOLVED_IMPORT,
		exporter: source,
		id: importer,
		message: `Could not resolve "${source}" from "${relativeId(importer)}"`
	};
}

export function logUnresolvedImportTreatedAsExternal(source: string, importer: string): RollupLog {
	return {
		code: UNRESOLVED_IMPORT,
		exporter: source,
		id: importer,
		message: `"${source}" is imported by "${relativeId(

Review comment (suggestion):
 Nice! Question: can this only happen when plugins make the module external, or could this also happen when a user uses the "external" option? Then maybe we should adjust the message:
 
 `"${source}" cannot be included in manualChunks, because it is resolved as an external module by the "external" option or plugins.`

Also note that error message usually end with a "." But this is just tiny details, nice work overall!

Code after:
		url: getRollupUrl(URL_OUTPUT_INTEROP)
	};
}

export function logUnknownOption(
	optionType: string,
	unknownOptions: string[],
	validOptions: string[]
): RollupLog {
	return {
		code: UNKNOWN_OPTION,
		message: `Unknown ${optionType}: ${unknownOptions.join(
			', '
		)}. Allowed options: ${validOptions.join(', ')}`
	};
}

export function logEntryCannotBeExternal(unresolvedId: string): RollupLog {
	return {
		code: UNRESOLVED_ENTRY,
		message: `Entry module "${relativeId(unresolvedId)}" cannot be external.`
	};
}

export function logExternalModulesCannotBeIncludedInManualChunks(source: string): RollupLog {
	return {
		code: EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS,
		message: `"${source}" cannot be included in manualChunks because it is resolved as an external module by the "external" option or plugins.`
	};
}

export function logExternalModulesCannotBeTransformedToModules(source: string): RollupLog {
	return {
		code: EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES,
		message: `${source} is resolved as a module now, but it was an external module before. Please check whether there are conflicts in your Rollup options "external" and "manualChunks", manualChunks cannot include external modules.`
	};
}

export function logUnresolvedEntry(unresolvedId: string): RollupLog {
	return {
		code: UNRESOLVED_ENTRY,
		message: `Could not resolve entry module "${relativeId(unresolvedId)}".`
	};
}

export function logUnresolvedImport(source: string, importer: string): RollupLog {
	return {
		code: UNRESOLVED_IMPORT,
		exporter: source,
		id: importer,
		message: `Could not resolve "${source}" from "${relativeId(importer)}"`