aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCyril Sobierajewicz <cyril.sobierajewicz@fretlink.com>2019-03-04 17:48:28 +0100
committerCyril Sobierajewicz <cyril.sobierajewicz@fretlink.com>2019-03-04 18:15:33 +0100
commit9c781cacd60692af960d9734983346ecc9481a62 (patch)
tree416c2934f18a43b61c5694a1a6c175e0f121dc9b
parentcb94750aafc73f93a2b7056517cd94a30a5149d7 (diff)
downloadpurs-loader-9c781cacd60692af960d9734983346ecc9481a62.tar.gz
purs-loader-9c781cacd60692af960d9734983346ecc9481a62.tar.zst
purs-loader-9c781cacd60692af960d9734983346ecc9481a62.zip
Extract err locations from the format introduced in `purescript@0.12.2`
See https://github.com/purescript/purescript/pull/3473.
-rw-r--r--package.json3
-rw-r--r--src/index.js2
2 files changed, 4 insertions, 1 deletions
diff --git a/package.json b/package.json
index f2b95af..ae8d7eb 100644
--- a/package.json
+++ b/package.json
@@ -50,5 +50,8 @@
50 "devDependencies": { 50 "devDependencies": {
51 "babel-cli": "^6.8.0", 51 "babel-cli": "^6.8.0",
52 "babel-preset-es2015": "^6.6.0" 52 "babel-preset-es2015": "^6.6.0"
53 },
54 "peerDependencies": {
55 "purescript": ">=0.12.2"
53 } 56 }
54} 57}
diff --git a/src/index.js b/src/index.js
index 8a2e468..28246e3 100644
--- a/src/index.js
+++ b/src/index.js
@@ -195,7 +195,7 @@ module.exports = function purescriptLoader(source, map) {
195 const matchErrorsSeparator = /\n(?=Error)/; 195 const matchErrorsSeparator = /\n(?=Error)/;
196 const errors = pscMessage.split(matchErrorsSeparator); 196 const errors = pscMessage.split(matchErrorsSeparator);
197 for (const error of errors) { 197 for (const error of errors) {
198 const matchErrLocation = /at (.+\.purs) line (\d+), column (\d+) - line (\d+), column (\d+)/; 198 const matchErrLocation = /at (.+\.purs):(\d+):(\d+) - (\d+):(\d+) \(line \2, column \3 - line \4, column \5\)/;
199 const [, filename] = matchErrLocation.exec(error) || []; 199 const [, filename] = matchErrLocation.exec(error) || [];
200 if (!filename) continue; 200 if (!filename) continue;
201 201