MCPcopy Index your code
hub / github.com/ptmt/react-native-macos / collect

Function collect

packager/src/ModuleGraph/Graph.js:106–130  ·  view source on GitHub ↗
(
    path = null,
    serialized = {entryModules: [], modules: []},
    seen = new Set(),
  )

Source from the content-addressed store, hash-verified

104 const modules = new Map([[null, createParentModule()]]);
105
106 function collect(
107 path = null,
108 serialized = {entryModules: [], modules: []},
109 seen = new Set(),
110 ) {
111 const module = modules.get(path);
112 if (module == null || seen.has(path)) {
113 return serialized;
114 }
115
116 const {dependencies} = module;
117 if (path === null) {
118 serialized.entryModules =
119 dependencies.map(dep => nullthrows(modules.get(dep.path)));
120 } else {
121 serialized.modules.push(module);
122 seen.add(path);
123 }
124
125 for (const dependency of dependencies) {
126 collect(dependency.path, serialized, seen);
127 }
128
129 return serialized;
130 }
131
132 function loadModule(id, parent, parentDepIndex) {
133 loadQueue.push(

Callers 2

GraphFunction · 0.85

Calls 4

hasMethod · 0.80
pushMethod · 0.80
getMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…