diff options
author | Cyril Sobierajewicz <cyril.sobierajewicz@fretlink.com> | 2019-03-18 14:07:13 +0100 |
---|---|---|
committer | Cyril Sobierajewicz <cyril.sobierajewicz@fretlink.com> | 2019-03-18 14:07:13 +0100 |
commit | 1a321910d7afebddc65ea512f06b0b667b041ae0 (patch) | |
tree | c87e9f9912518e170d9360a0d2cc0172ba4cd729 | |
parent | 9dad774b4693ddda09b491ee7f7e0099f8fb1a61 (diff) | |
parent | d2dedd26a0ff0133904956198ce694c241214dfa (diff) | |
download | purs-loader-1a321910d7afebddc65ea512f06b0b667b041ae0.tar.gz purs-loader-1a321910d7afebddc65ea512f06b0b667b041ae0.tar.zst purs-loader-1a321910d7afebddc65ea512f06b0b667b041ae0.zip |
Merge remote-tracking branch 'fretlink/master' into latest
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/index.js | 13 | ||||
-rw-r--r-- | src/utils.js | 4 |
3 files changed, 18 insertions, 1 deletions
diff --git a/package.json b/package.json index e9b5035..1faef7b 100644 --- a/package.json +++ b/package.json | |||
@@ -1,6 +1,6 @@ | |||
1 | { | 1 | { |
2 | "name": "purs-loader", | 2 | "name": "purs-loader", |
3 | "version": "4.0.0", | 3 | "version": "4.1.0", |
4 | "description": "A webpack loader for PureScript.", | 4 | "description": "A webpack loader for PureScript.", |
5 | "main": "lib/index.js", | 5 | "main": "lib/index.js", |
6 | "files": [ | 6 | "files": [ |
diff --git a/src/index.js b/src/index.js index 28246e3..be809c6 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -202,6 +202,19 @@ module.exports = function purescriptLoader(source, map) { | |||
202 | const baseModulePath = path.join(this.rootContext, filename); | 202 | const baseModulePath = path.join(this.rootContext, filename); |
203 | this.addDependency(baseModulePath); | 203 | this.addDependency(baseModulePath); |
204 | 204 | ||
205 | const foreignModulesErrorCodes = [ | ||
206 | 'ErrorParsingFFIModule', | ||
207 | 'MissingFFIImplementations', | ||
208 | 'UnusedFFIImplementations', | ||
209 | 'MissingFFIModule' | ||
210 | ]; | ||
211 | for (const code of foreignModulesErrorCodes) { | ||
212 | if (error.includes(code)) { | ||
213 | const resolved = utils.resolveForeignModule(baseModulePath); | ||
214 | this.addDependency(resolved); | ||
215 | } | ||
216 | } | ||
217 | |||
205 | const matchErrModuleName = /in module ((?:\w+\.)*\w+)/; | 218 | const matchErrModuleName = /in module ((?:\w+\.)*\w+)/; |
206 | const [, baseModuleName] = matchErrModuleName.exec(error) || []; | 219 | const [, baseModuleName] = matchErrModuleName.exec(error) || []; |
207 | if (!baseModuleName) continue; | 220 | if (!baseModuleName) continue; |
diff --git a/src/utils.js b/src/utils.js index b6ccf81..829ba72 100644 --- a/src/utils.js +++ b/src/utils.js | |||
@@ -33,3 +33,7 @@ exports.resolvePursModule = ({ baseModulePath, baseModuleName, targetModuleName | |||
33 | `${path.join(...parts)}.purs`) | 33 | `${path.join(...parts)}.purs`) |
34 | : baseModulePath; | 34 | : baseModulePath; |
35 | }; | 35 | }; |
36 | |||
37 | exports.resolveForeignModule = pursModulePath => | ||
38 | path.join(path.dirname(pursModulePath), | ||
39 | path.basename(pursModulePath, path.extname(pursModulePath)) + '.js'); | ||