Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bs-loader

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bs-loader - npm Package Compare versions

Comparing version 1.8.1 to 1.8.2

36

index.js

@@ -18,2 +18,7 @@ // @flow

function isWSL() {
const release = os.release()
return release.substring(release.length - 'Microsoft'.length) === 'Microsoft'
}
const bsb =

@@ -23,4 +28,6 @@ os.platform() === 'darwin'

: os.platform() === 'linux'
? `script --return -qfc "${bsbCommand} -make-world -color" /dev/null`
: `${bsbCommand} -make-world`
? isWSL()
? `${bsbCommand} -make-world` // Windows WSL
: `script --return -qfc "${bsbCommand} -make-world -color" /dev/null` // Linux
: `${bsbCommand} -make-world` // Windows Native and others.

@@ -35,2 +42,3 @@ const outputDir = 'lib'

const getSuperErrorRegex = /We've found a bug for you![\s\S]*?(?=ninja: build stopped)/g
const getWarningRegex = /((File [\s\S]*?Warning.+? \d+:)|Warning number \d+)[\s\S]*?(?=\[\d+\/\d+\]|$)/g

@@ -61,6 +69,7 @@ function jsFilePath(buildDir, moduleDir, resourcePath, inSource) {

(err, stdout, stderr) => {
const output = `${stdout.toString()}\n${stderr.toString()}`
if (err) {
reject(`${stdout.toString()}\n${stderr.toString()}`)
reject(output)
} else {
resolve()
resolve(output)
}

@@ -91,3 +100,3 @@ }

function getCompiledFile(buildDir, compilation, moduleDir, path) {
return runBsb(buildDir, compilation).then(() => {
return runBsb(buildDir, compilation).then(output => {
return new Promise((resolve, reject) => {

@@ -99,3 +108,3 @@ readFile(path, (err, res) => {

const src = transformSrc(moduleDir, res.toString())
resolve(src)
resolve({ src, output })
}

@@ -148,2 +157,4 @@ })

const inSourceBuild = options.inSource || bsconfig.inSource || false
const showWarnings =
options.showWarnings !== undefined ? options.showWarnings : true

@@ -158,4 +169,13 @@ const compiledFilePath = jsFilePath(

getCompiledFile(buildDir, this._compilation, moduleDir, compiledFilePath)
.then(res => {
callback(null, res)
.then(({ src, output }) => {
if (output && showWarnings) {
const warningMessages = output.match(getWarningRegex)
if (warningMessages) {
warningMessages.forEach(message => {
this.emitWarning(new Error(message))
})
}
}
callback(null, src)
})

@@ -162,0 +182,0 @@ .catch(err => {

{
"name": "bs-loader",
"version": "1.8.1",
"version": "1.8.2",
"description": "Bucklescript integration in Webpack",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -171,1 +171,5 @@ # bs-loader [![Build Status](https://travis-ci.org/reasonml-community/bs-loader.svg?branch=master)](https://travis-ci.org/reasonml-community/bs-loader)

```
### `showWarnings`
Controls whether `bsb` compile warnings are shown. Defaults to `true`.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc