X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Findex.js;h=be809c685ac5959cc011388259cea1026578102c;hb=c69d78d9010e224f1a31b1acfa24db346d535cb6;hp=8a2e468229d95b405bd740189044bc04fc16c1d9;hpb=d8239dd526facd516600acfdbc808f415919117d;p=github%2Ffretlink%2Fpurs-loader.git diff --git a/src/index.js b/src/index.js index 8a2e468..be809c6 100644 --- a/src/index.js +++ b/src/index.js @@ -195,13 +195,26 @@ module.exports = function purescriptLoader(source, map) { const matchErrorsSeparator = /\n(?=Error)/; const errors = pscMessage.split(matchErrorsSeparator); for (const error of errors) { - const matchErrLocation = /at (.+\.purs) line (\d+), column (\d+) - line (\d+), column (\d+)/; + const matchErrLocation = /at (.+\.purs):(\d+):(\d+) - (\d+):(\d+) \(line \2, column \3 - line \4, column \5\)/; const [, filename] = matchErrLocation.exec(error) || []; if (!filename) continue; const baseModulePath = path.join(this.rootContext, filename); this.addDependency(baseModulePath); + const foreignModulesErrorCodes = [ + 'ErrorParsingFFIModule', + 'MissingFFIImplementations', + 'UnusedFFIImplementations', + 'MissingFFIModule' + ]; + for (const code of foreignModulesErrorCodes) { + if (error.includes(code)) { + const resolved = utils.resolveForeignModule(baseModulePath); + this.addDependency(resolved); + } + } + const matchErrModuleName = /in module ((?:\w+\.)*\w+)/; const [, baseModuleName] = matchErrModuleName.exec(error) || []; if (!baseModuleName) continue;