()
| 44 | } |
| 45 | |
| 46 | public loadFromFiles(): boolean { |
| 47 | this.init(); |
| 48 | const webSourceMetaFile = fileManager.getWebSourceMetaFile(); |
| 49 | const webSourceDir = fileManager.getWebSourceDir(); |
| 50 | if (!fs.existsSync(webSourceMetaFile) || !fs.existsSync(webSourceDir)) { |
| 51 | return false; |
| 52 | } |
| 53 | try { |
| 54 | const metaContent = fs.readFileSync(webSourceMetaFile, { |
| 55 | encoding: 'utf8', |
| 56 | }); |
| 57 | this.scriptInfos = JSON.parse(metaContent); |
| 58 | for (const scriptInfo of this.scriptInfos) { |
| 59 | this.urlToScriptMap.set(scriptInfo.url, scriptInfo); |
| 60 | } |
| 61 | } catch { |
| 62 | return false; |
| 63 | } |
| 64 | return true; |
| 65 | } |
| 66 | |
| 67 | public loadCodeForUrl(url: string): Nullable<string> { |
| 68 | if (!this.urlToScriptMap.has(url)) { |
no test coverage detected