mirror of https://github.com/webpack/webpack.git
parent
27796db6eb
commit
b6bc2730b9
|
|
@ -116,6 +116,7 @@ exports.inferDependencyUsage = state => {
|
|||
}
|
||||
|
||||
const { innerGraph, usageCallbackMap } = innerGraphState;
|
||||
const processed = new Map();
|
||||
// flatten graph to terminal nodes (string, undefined or true)
|
||||
const nonTerminal = new Set(innerGraph.keys());
|
||||
while (nonTerminal.size > 0) {
|
||||
|
|
@ -124,7 +125,15 @@ exports.inferDependencyUsage = state => {
|
|||
let newSet = new Set();
|
||||
let isTerminal = true;
|
||||
const value = innerGraph.get(key);
|
||||
let alreadyProcessed = processed.get(key);
|
||||
if (alreadyProcessed === undefined) {
|
||||
alreadyProcessed = new Set();
|
||||
processed.set(key, alreadyProcessed);
|
||||
}
|
||||
if (value !== true && value !== undefined) {
|
||||
for (const item of value) {
|
||||
alreadyProcessed.add(item);
|
||||
}
|
||||
for (const item of value) {
|
||||
if (typeof item === "string") {
|
||||
newSet.add(item);
|
||||
|
|
@ -137,7 +146,7 @@ exports.inferDependencyUsage = state => {
|
|||
if (itemValue !== undefined) {
|
||||
for (const i of itemValue) {
|
||||
if (i === key) continue;
|
||||
if (value.has(i)) continue;
|
||||
if (alreadyProcessed.has(i)) continue;
|
||||
newSet.add(i);
|
||||
if (typeof i !== "string") {
|
||||
isTerminal = false;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,71 @@
|
|||
const createTestCases = require("../_helpers/createTestCases");
|
||||
module.exports = createTestCases({
|
||||
nothing: {
|
||||
usedExports: [],
|
||||
expect: {
|
||||
"resize-observer": ["ResizeObserver"],
|
||||
"Source_Data/employee": [],
|
||||
"Source_Data/services": [],
|
||||
"Source_Framework/splitview/page": [],
|
||||
"Source_Framework/splitview/menu": [],
|
||||
"Source_Framework/splitview/text": [],
|
||||
"Source_Framework/uilistpicker/UiListPicker": [],
|
||||
"Source_ODS/cookiestorage": [],
|
||||
"Source_Framework/uirichtextedit": [],
|
||||
"Source_Framework/uielement": [],
|
||||
"Source_ODS/UiButton/icon": [],
|
||||
"Source_ODS/UiButton/text": [],
|
||||
"Source_Framework/pagelinks": [],
|
||||
"Source_ODS/ods": [],
|
||||
"Source_ODS/UiButton": [],
|
||||
"Source_Framework/defaultButtons": [],
|
||||
"Source_Framework/uiform": [],
|
||||
"Source_Framework/breadcrumb": [],
|
||||
"Source_ODS/lodash": [],
|
||||
"Source_ODS/DomElement": [],
|
||||
"Source_ODS/url": [],
|
||||
"Source_ODS/tooltip": [],
|
||||
"Source_ODS/ui": [],
|
||||
"Source_ODS/types": [],
|
||||
"Source_ODS/UiDialog": [],
|
||||
"Source_Framework/common/moduleDispatcher": [],
|
||||
"Source_Framework/common/employeeassignment": [],
|
||||
"Source_Framework/common/pdf_preview": [],
|
||||
"Source_Framework/common/taskprogress": [],
|
||||
"Source_Framework/uitable": [],
|
||||
"Source_Framework/backend/universalData": [],
|
||||
"Source_Framework/common/columnsDialog": [],
|
||||
"Source_Framework/backend/jsonData": [],
|
||||
"Source_Framework/common/statuschange": [],
|
||||
"Source_Framework/common/las_mod_jobselection": [],
|
||||
"./text": [],
|
||||
"./bec": [],
|
||||
"./positionTypes": [],
|
||||
"./settings": ["SETTINGS"],
|
||||
"./preferences": [],
|
||||
"./privileges": [],
|
||||
"./buttons": [],
|
||||
"./form": [],
|
||||
"./formHelper": [],
|
||||
"./table": [],
|
||||
"./techText": [],
|
||||
"./addPositionToSi": [],
|
||||
"./ciPosFromJob": [],
|
||||
"./shiftPosition": [],
|
||||
"./autoSums": [],
|
||||
"./defineLayout": [],
|
||||
"./insertFromTemplate": [],
|
||||
"./movePosition": [],
|
||||
"./copy": [],
|
||||
"./save": [],
|
||||
"./createOrder": [],
|
||||
"./orderPosFromJobPos": [],
|
||||
"./nchInfoDialog": [],
|
||||
"Source_Modules/las_mod_siheader/url": [],
|
||||
"Source_Modules/las_mod_siheader/bec": [],
|
||||
"Source_Modules/las_mod_ceheader/bec": [],
|
||||
"Source_Modules/las_mod_order/bec": [],
|
||||
"Source_Modules/las_mod_ciheader/bec": []
|
||||
}
|
||||
}
|
||||
});
|
||||
Loading…
Reference in New Issue