function sizeWarningPlugin({ threshold = DEFAULT_THRESHOLD, factor = 3 } = {}) {
	return {
		name: 'size-warning-plugin',
		transform(contents, filename) {
			const approxSize = contents.length / factor;
			if (approxSize > threshold) {
				// eslint-disable-next-line no-console
				console.log(`Warning: large file ${filename} (${Math.round(contents.length / 1000)}kb)`);
			}
		}
	};
}
Warn when huge files are getting piped into node_modules.
@returns {import("./registry").Plugin}