12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- "use strict";
- exports.getTrimmedIdsAndRange = (
- untrimmedIds,
- untrimmedRange,
- ranges,
- moduleGraph,
- dependency
- ) => {
- let trimmedIds = trimIdsToThoseImported(
- untrimmedIds,
- moduleGraph,
- dependency
- );
- let trimmedRange = untrimmedRange;
- if (trimmedIds.length !== untrimmedIds.length) {
-
-
-
-
- const idx =
- ranges === undefined
- ? -1
- : ranges.length + (trimmedIds.length - untrimmedIds.length);
- if (idx < 0 || idx >= (ranges).length) {
-
-
-
- trimmedIds = untrimmedIds;
-
-
- } else {
- trimmedRange = (ranges)[idx];
- }
- }
- return { trimmedIds, trimmedRange };
- };
- function trimIdsToThoseImported(ids, moduleGraph, dependency) {
-
- let trimmedIds = [];
- let currentExportsInfo = moduleGraph.getExportsInfo(
- (moduleGraph.getModule(dependency))
- );
- for (let i = 0; i < ids.length; i++) {
- if (i === 0 && ids[i] === "default") {
- continue;
- }
- const exportInfo = currentExportsInfo.getExportInfo(ids[i]);
- if (exportInfo.provided === false) {
-
- trimmedIds = ids.slice(0, i);
- break;
- }
- const nestedInfo = exportInfo.getNestedExportsInfo();
- if (!nestedInfo) {
-
- trimmedIds = ids.slice(0, i + 1);
- break;
- }
- currentExportsInfo = nestedInfo;
- }
-
- return trimmedIds.length ? trimmedIds : ids;
- }
|