MCPcopy Index your code
hub / github.com/Moddable-OpenSource/moddable / run

Method run

tools/mcbundle.js:141–309  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139 return this.resolveSlash(value);
140 }
141 run() {
142 const path = this.manifestPath;
143 const manifest = this.parseManifest(path);
144 this.parseBuild(manifest);
145 const store = manifest.bundle ?? manifest.store;
146 if (!store) {
147 throw new Error("no store!");;
148 }
149
150 const id = store.id;
151 if (!id)
152 throw new Error("no id!");;
153 const parts = id.split(".");
154 if (parts.length != 3)
155 throw new Error("invalid id!");;
156 const signature = parts.reverse().join(".");
157
158 const names = store.devices;
159 if (!names)
160 throw new Error(`no devices!`);
161 const results = [];
162 for (let name of names) {
163 let gotDevice = false;
164 let star = name.lastIndexOf("*");
165 if (star >= 0) {
166 star = name.slice(0, star)
167 for (let device of devices) {
168 if (device.id.indexOf(star) == 0) {
169 gotDevice = true;
170 if (results.indexOf(device) < 0)
171 results.push(device);
172 }
173 else if (device.platform.indexOf(star) == 0) {
174 gotDevice = true;
175 if (results.indexOf(device) < 0)
176 results.push(device);
177 }
178 }
179 }
180 else {
181 for (let device of devices) {
182 if (device.id == name) {
183 gotDevice = true;
184 if (results.indexOf(device) < 0)
185 results.push(device);
186 break;
187 }
188 if (device.platform == name) {
189 gotDevice = true;
190 if (results.indexOf(device) < 0)
191 results.push(device);
192 break;
193 }
194 }
195 }
196 if (!gotDevice)
197 throw new Error(`device not found: ${name}!`);
198 }

Callers

nothing calls this directly

Calls 9

reverseMethod · 0.80
resolveFilePathMethod · 0.80
sliceMethod · 0.65
closeMethod · 0.65
parseManifestMethod · 0.45
parseBuildMethod · 0.45
pushMethod · 0.45
lineMethod · 0.45
resolveSlashMethod · 0.45

Tested by

no test coverage detected