@@ -15,3 +15,3 @@ const path = require('path') | ||
| { | ||
| loader: './bs-loader', | ||
| loader: 'bs-loader', | ||
| options: { | ||
@@ -18,0 +18,0 @@ module: 'es6' |
+19
-13
@@ -8,3 +8,3 @@ const path = require('path') | ||
| try { | ||
| bsb = require.resolve('bs-platform/bin/bsb') | ||
| bsb = require.resolve('bs-platform/bin/bsb.exe') | ||
| } catch (e) { | ||
@@ -15,7 +15,13 @@ bsb = 'bsb' | ||
| const outputDir = 'lib' | ||
| const CWD = process.cwd() | ||
| const fileNameRegex = /\.(ml|re)$/ | ||
| const es6ReplaceRegex = /(from\ "\.\.?\/.*)(\.js)("\;)/g | ||
| const commonJsReplaceRegex = /(require\("\.\.?\/.*)(\.js)("\);)/g | ||
| const getErrorRegex = /(File [\s\S]*?:\n|Fatal )[eE]rror: [\s\S]*?(?=ninja|\n\n|$)/g | ||
| const getJsFile = (moduleDir, resourcePath) => { | ||
| const mlFileName = resourcePath.replace(process.cwd(), '') | ||
| const jsFileName = mlFileName.replace(/\.(ml|re)$/, '.js') | ||
| return path.join(process.cwd(), outputDir, moduleDir, jsFileName) | ||
| const mlFileName = resourcePath.replace(CWD, '') | ||
| const jsFileName = mlFileName.replace(fileNameRegex, '.js') | ||
| return path.join(CWD, outputDir, moduleDir, jsFileName) | ||
| } | ||
@@ -25,4 +31,4 @@ | ||
| moduleDir === 'es6' | ||
| ? src.replace(/(from\ "\.\.?\/.*)(\.js)("\;)/g, '$1$3') | ||
| : src.replace(/(require\("\.\.?\/.*)(\.js)("\);)/g, '$1$3') | ||
| ? src.replace(es6ReplaceRegex, '$1$3') | ||
| : src.replace(commonJsReplaceRegex, '$1$3') | ||
@@ -37,7 +43,7 @@ const runBsb = (compilation, callback) => { | ||
| const runBsbSync = () => { | ||
| execFileSync(bsb, ['-make-world'], { stdio: 'pipe' }) | ||
| const cp = execFileSync(bsb, ['-make-world'], { stdio: 'pipe' }) | ||
| cp.stdin.end() | ||
| } | ||
| const getBsbErrorMessages = err => | ||
| err.match(/(File [\s\S]*?:\n|Fatal )[eE]rror: [\s\S]*?(?=ninja|\n\n|$)/g) | ||
| const getBsbErrorMessages = err => err.match(getErrorRegex) | ||
@@ -93,7 +99,7 @@ const getCompiledFile = (compilation, moduleDir, path, callback) => { | ||
| errorMessages | ||
| .slice(0, -1) | ||
| .forEach(msg => this.emitError(new Error(msg))) | ||
| for (let i = 0; i < errorMessages.length - 1; ++i) { | ||
| this.emitError(new Error(errorMessages[i])) | ||
| } | ||
| callback(new Error(errorMessages.slice(-1)), null) | ||
| callback(new Error(errorMessages[errorMessages.length - 1]), null) | ||
| } else { | ||
@@ -100,0 +106,0 @@ callback(null, res) |
+1
-1
| { | ||
| "name": "bs-loader", | ||
| "version": "1.5.5", | ||
| "version": "1.5.6", | ||
| "description": "Bucklescript integration in Webpack", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
218183
0.11%164
3.14%