From 38d2b8ddff8539b54616c3fa5b74da52c46971a7 Mon Sep 17 00:00:00 2001 From: jpellizzari Date: Fri, 3 Mar 2017 10:09:52 -0800 Subject: [PATCH] Added more granular JS API exports --- client/.babelrc | 5 ++++- client/app/scripts/actions.js | 1 + client/app/scripts/component.js | 1 + client/app/scripts/index.js | 1 - client/app/scripts/reducer.js | 1 + client/app/scripts/utils/router-utils.js | 2 +- client/app/scripts/utils/web-api-utils.js | 3 +++ client/package.json | 4 +++- 8 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 client/app/scripts/actions.js create mode 100644 client/app/scripts/component.js create mode 100644 client/app/scripts/reducer.js diff --git a/client/.babelrc b/client/.babelrc index 431d458d2..5a6095063 100644 --- a/client/.babelrc +++ b/client/.babelrc @@ -1,4 +1,7 @@ { - "plugins": ["lodash"], + "plugins": [ + "lodash", + ["transform-object-rest-spread", { "useBuiltIns": true }] + ], "presets": ["es2015", "react"] } diff --git a/client/app/scripts/actions.js b/client/app/scripts/actions.js new file mode 100644 index 000000000..ffcdfb3dd --- /dev/null +++ b/client/app/scripts/actions.js @@ -0,0 +1 @@ +module.exports = require('./actions/app-actions'); diff --git a/client/app/scripts/component.js b/client/app/scripts/component.js new file mode 100644 index 000000000..55f61da4c --- /dev/null +++ b/client/app/scripts/component.js @@ -0,0 +1 @@ +module.exports = require('./components/app').default; diff --git a/client/app/scripts/index.js b/client/app/scripts/index.js index f4ae21fc8..7f5362bfe 100644 --- a/client/app/scripts/index.js +++ b/client/app/scripts/index.js @@ -1,4 +1,3 @@ exports.reducer = require('./reducers/root').default; exports.Scope = require('./components/app').default; exports.actions = require('./actions/app-actions'); -exports.ContrastStyleCompiler = require('./contrast-compiler'); diff --git a/client/app/scripts/reducer.js b/client/app/scripts/reducer.js new file mode 100644 index 000000000..825220487 --- /dev/null +++ b/client/app/scripts/reducer.js @@ -0,0 +1 @@ +module.exports = require('./reducers/root').default; diff --git a/client/app/scripts/utils/router-utils.js b/client/app/scripts/utils/router-utils.js index 35dbae03b..66ba02077 100644 --- a/client/app/scripts/utils/router-utils.js +++ b/client/app/scripts/utils/router-utils.js @@ -98,7 +98,7 @@ export function getRouter(dispatch, initialState) { if (storageState) { window.location.hash = `!/state/${storageState}`; const parsedState = JSON.parse(decodeURL(storageState)); - mergedState = Object.assign(initialState, parsedState); + mergedState = { ...initialState, ...parsedState }; } page('/', () => { diff --git a/client/app/scripts/utils/web-api-utils.js b/client/app/scripts/utils/web-api-utils.js index f7ab99c5b..90423118c 100644 --- a/client/app/scripts/utils/web-api-utils.js +++ b/client/app/scripts/utils/web-api-utils.js @@ -363,7 +363,10 @@ export function teardownWebsockets() { if (socket) { socket.onerror = null; socket.onclose = null; + socket.onmessage = null; + socket.onopen = null; socket.close(); + socket = null; currentOptions = null; } } diff --git a/client/package.json b/client/package.json index 95b4f5eb3..d07113fa3 100644 --- a/client/package.json +++ b/client/package.json @@ -52,6 +52,7 @@ "babel-eslint": "7.1.1", "babel-jest": "17.0.2", "babel-loader": "6.2.8", + "babel-plugin-transform-object-rest-spread": "^6.23.0", "babel-preset-es2015": "6.18.0", "babel-preset-react": "6.16.0", "clean-webpack-plugin": "0.1.14", @@ -93,7 +94,8 @@ "scripts": { "build": "webpack --config webpack.production.config.js", "build-external": "EXTERNAL=true webpack --config webpack.production.config.js", - "build-pkg": "mkdir -p build-pkg && node node_modules/.bin/babel app/scripts --ignore __tests__ --out-dir build-pkg && cp package.json build-pkg/ && cp -R app/styles build-pkg/", + "copy-pkg-files": "cp package.json build-pkg/ && cp -R app/styles build-pkg/", + "build-pkg": "mkdir -p build-pkg && node node_modules/.bin/babel app/scripts --ignore __tests__ --out-dir build-pkg && npm run copy-pkg-files", "bundle": "npm run build-pkg && npm pack ./build-pkg && mv weave-scope-$npm_package_version.tgz ./tmp/weave-scope.tgz", "start": "node server.js", "start-production": "NODE_ENV=production node server.js",