function trimIdsToThoseImported(ids, moduleGraph, dependency) {
	/** @type {string[]} */
	let trimmedIds = [];
	let currentExportsInfo = moduleGraph.getExportsInfo(
		/** @type {Module} */ (moduleGraph.getModule(dependency))
	);
	for (let i = 0; i < ids.length; i++) {
		if (i === 0 && ids[i] === "default") {
			continue; // ExportInfo for the next level under default is still at the root ExportsInfo, so don't advance currentExportsInfo
		}
		const exportInfo = currentExportsInfo.getExportInfo(ids[i]);
		if (exportInfo.provided === false) {
			// json imports have nested ExportInfo for elements that things that are not actually exported, so check .provided
			trimmedIds = ids.slice(0, i);
			break;
		}
		const nestedInfo = exportInfo.getNestedExportsInfo();
		if (!nestedInfo) {
			// once all nested exports are traversed, the next item is the actual import so stop there
			trimmedIds = ids.slice(0, i + 1);
			break;
		}
		currentExportsInfo = nestedInfo;
	}
	// Never trim to nothing.  This can happen for invalid imports (e.g. import { notThere } from "./module", or import { anything } from "./missingModule")
	return trimmedIds.length ? trimmedIds : ids;
}
@summary Determine which IDs in the id chain are actually referring to namespaces or imports,
and which are deeper member accessors on the imported object.
@param {string[]} ids untrimmed ids
@param {ModuleGraph} moduleGraph moduleGraph
@param {Dependency} dependency dependency
@returns {string[]} trimmed ids