()
| 1181 | if (!files?.length) return; |
| 1182 | let processed = 0; |
| 1183 | const next = () => { |
| 1184 | if (processed >= files.length) return; |
| 1185 | const file = files[processed]; |
| 1186 | processed += 1; |
| 1187 | const reader = new FileReader(); |
| 1188 | reader.onload = (event) => { |
| 1189 | const content = event.target?.result as string; |
| 1190 | const path = `modules/${file.name}`; |
| 1191 | try { |
| 1192 | const template = parseModuleYaml(content, path); |
| 1193 | setUploadedModules((prev) => { |
| 1194 | const without = prev.filter((m) => m.path !== path); |
| 1195 | return [...without, { path, content, template }]; |
| 1196 | }); |
| 1197 | } catch (err) { |
| 1198 | console.error('Failed to parse submodule:', file.name, err); |
| 1199 | } |
| 1200 | next(); |
| 1201 | }; |
| 1202 | reader.readAsText(file); |
| 1203 | }; |
| 1204 | next(); |
| 1205 | }; |
| 1206 | input.click(); |
no test coverage detected