Auto-merge for PR #517 via VersionBot

Use a custom webpack loader to avoid uncaught exceptions from JSONStream
This commit is contained in:
resin-io-versionbot[bot] 2017-10-31 22:06:50 +00:00 committed by GitHub
commit 4c5fd68aea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 10 deletions

View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## v6.3.10 - 2017-10-31
* Use a custom webpack loader to avoid uncaught exceptions from JSONStream #517 [Pablo Carranza Velez]
## v6.3.9 - 2017-10-30 ## v6.3.9 - 2017-10-30
* Avoid fetching an image when it might be available or when starting an app because it might not be necessary #507 [Pablo Carranza Velez] * Avoid fetching an image when it might be available or when starting an app because it might not be necessary #507 [Pablo Carranza Velez]

View File

@ -143,7 +143,7 @@ COPY package.json /usr/src/app/
RUN JOBS=MAX npm install --production --no-optional --unsafe-perm \ RUN JOBS=MAX npm install --production --no-optional --unsafe-perm \
&& npm dedupe && npm dedupe
COPY webpack.config.js remove-hashbang-loader.js /usr/src/app/ COPY webpack.config.js fix-jsonstream.js /usr/src/app/
COPY src /usr/src/app/src COPY src /usr/src/app/src
# Install devDependencies, build the coffeescript and then prune the deps # Install devDependencies, build the coffeescript and then prune the deps

9
fix-jsonstream.js Normal file
View File

@ -0,0 +1,9 @@
// JSONStream is a hybrid executable-library
// and has a #! /usr/bin/env node at the beginning of the file.
// This webpack loader removes it so that we have valid javascript for webpack to load.
// Also, JSONStream starts a pipe between stdin and stdout if module.parent is undefined.
// This pipe can fail throwing an uncaught exception, so we fake a module.parent to prevent this.
// See https://github.com/dominictarr/JSONStream/issues/129
module.exports = function (source) {
return "module.parent = {};\n" + source.toString().replace(/^#! .*\n/, '')
}

View File

@ -1,7 +1,7 @@
{ {
"name": "resin-supervisor", "name": "resin-supervisor",
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.", "description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
"version": "6.3.9", "version": "6.3.10",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1,6 +0,0 @@
// Some of the dependencies (e.g. JSONStream) are hybrid executable-library
// and have a #! /usr/bin/env node at the beginning of the file.
// This webpack loader removes it so that we have valid javascript for webpack to load.
module.exports = function (source) {
return source.toString().replace(/^#! .*\n/, '')
}

View File

@ -62,8 +62,8 @@ module.exports = {
module: { module: {
rules: [ rules: [
{ {
test: /\.js$/, test: /JSONStream\/index\.js$/,
use: require.resolve('./remove-hashbang-loader') use: require.resolve('./fix-jsonstream')
}, },
{ {
test: /\.coffee$/, test: /\.coffee$/,