pipe2browser: Picking up breaking JS API changes from http://v.io/c/15404
Plus fixing some breaking changes from other dependencies.

MultiPart: 7/10
Change-Id: I59de66b60b61eb5e41b3205906c3bc97dd610052
diff --git a/Makefile b/Makefile
index 40d406e..9fc0a37 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,7 @@
 	cd $(V23_ROOT)/release/javascript/core && \
 	:;jspm link -y npm:vanadium@0.0.1
 	cd browser && \
-	:;jspm install -y -link npm:vanadium
+	:;jspm install -y -l npm:vanadium@0.0.1
 
 # Install JSPM and Bower packages as listed in browser/package.json from JSPM and browser/bower.json from bower
 browser/third-party: browser/third-party/npm/vanadium@0.0.1 browser/package.json browser/bower.json node_modules
diff --git a/browser/config.js b/browser/config.js
index 04f6a21..794622f 100644
--- a/browser/config.js
+++ b/browser/config.js
@@ -1,10 +1,13 @@
-// Copyright 2015 The Vanadium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
 System.config({
-  "paths": {
-    "*": "*.js",
+  defaultJSExtensions: true,
+  transpiler: "babel",
+  babelOptions: {
+    "optional": [
+      "runtime",
+      "optimisation.modules.system"
+    ]
+  },
+  paths: {
     "pipe-viewer": "pipe-viewers/pipe-viewer.js",
     "pipe-viewer-delegation": "pipe-viewers/pipe-viewer-delegation.js",
     "view": "libs/mvc/view.js",
@@ -13,14 +16,15 @@
     "web-component-loader": "libs/utils/web-component-loader.js",
     "formatting": "libs/utils/formatting.js",
     "app/*": "lib/*.js",
-    "github:*": "third-party/github/*.js",
-    "npm:*": "third-party/npm/*.js"
-  }
-});
+    "github:*": "third-party/github/*",
+    "npm:*": "third-party/npm/*"
+  },
 
-System.config({
-  "map": {
+  map: {
+    "babel": "npm:babel-core@5.8.24",
+    "babel-runtime": "npm:babel-runtime@5.8.20",
     "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+    "core-js": "npm:core-js@1.1.4",
     "npm:event-stream": "npm:event-stream@3.2.2",
     "npm:humanize": "npm:humanize@0.0.9",
     "stream": "github:jspm/nodelibs-stream@0.1.0",
@@ -45,10 +49,8 @@
     },
     "github:jspm/nodelibs-http@1.7.0": {
       "Base64": "npm:Base64@0.2.1",
-      "events": "github:jspm/nodelibs-events@0.1.0",
       "inherits": "npm:inherits@2.0.1",
       "stream": "github:jspm/nodelibs-stream@0.1.0",
-      "url": "github:jspm/nodelibs-url@0.1.0",
       "util": "github:jspm/nodelibs-util@0.1.0"
     },
     "github:jspm/nodelibs-https@0.1.0": {
@@ -117,7 +119,7 @@
     "npm:assert@1.3.0": {
       "util": "npm:util@0.10.3"
     },
-    "npm:bluebird@2.9.8": {
+    "npm:babel-runtime@5.8.20": {
       "process": "github:jspm/nodelibs-process@0.1.1"
     },
     "npm:browserify-aes@1.0.0": {
@@ -173,6 +175,11 @@
     "npm:constants-browserify@0.0.1": {
       "systemjs-json": "github:systemjs/plugin-json@0.1.0"
     },
+    "npm:core-js@1.1.4": {
+      "fs": "github:jspm/nodelibs-fs@0.1.1",
+      "process": "github:jspm/nodelibs-process@0.1.1",
+      "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+    },
     "npm:core-util-is@1.0.1": {
       "buffer": "github:jspm/nodelibs-buffer@0.1.0"
     },
@@ -348,10 +355,8 @@
       "inherits": "npm:inherits@2.0.1",
       "isarray": "npm:isarray@0.0.1",
       "process": "github:jspm/nodelibs-process@0.1.1",
-      "stream": "npm:stream-browserify@1.0.0",
       "stream-browserify": "npm:stream-browserify@1.0.0",
-      "string_decoder": "npm:string_decoder@0.10.31",
-      "util": "github:jspm/nodelibs-util@0.1.0"
+      "string_decoder": "npm:string_decoder@0.10.31"
     },
     "npm:ripemd160@1.0.0": {
       "buffer": "github:jspm/nodelibs-buffer@0.1.0",
@@ -465,4 +470,3 @@
     }
   }
 });
-
diff --git a/browser/package.json b/browser/package.json
index 24954fa..f64ef01 100644
--- a/browser/package.json
+++ b/browser/package.json
@@ -7,9 +7,14 @@
     "packages": "third-party"
   },
   "dependencies": {
-    "buffer": "^0.1.0",
+    "buffer": "github:jspm/nodelibs-buffer@^0.1.0",
     "npm:event-stream": "npm:event-stream@^3.1.5",
     "npm:humanize": "npm:humanize@^0.0.9",
-    "stream": "^0.1.0"
+    "stream": "github:jspm/nodelibs-stream@^0.1.0"
+  },
+  "devDependencies": {
+    "babel": "npm:babel-core@^5.8.22",
+    "babel-runtime": "npm:babel-runtime@^5.8.20",
+    "core-js": "npm:core-js@^1.1.0"
   }
 }
diff --git a/browser/pipe-viewers/builtin/git/status/filterer.js b/browser/pipe-viewers/builtin/git/status/filterer.js
index 89c8cff..a07a0e7 100644
--- a/browser/pipe-viewers/builtin/git/status/filterer.js
+++ b/browser/pipe-viewers/builtin/git/status/filterer.js
@@ -15,7 +15,7 @@
     return true;
   }
 
-  for (var key in filters) {
+  for (var key of filters) {
     var isMatch = applyFilter(item, key, filters[key]);
     // we AND all the filters, short-circuit for early termination
     if (!isMatch) {
diff --git a/browser/pipe-viewers/builtin/vlog/filterer.js b/browser/pipe-viewers/builtin/vlog/filterer.js
index 00f1c32..d2b2318 100644
--- a/browser/pipe-viewers/builtin/vlog/filterer.js
+++ b/browser/pipe-viewers/builtin/vlog/filterer.js
@@ -15,7 +15,7 @@
     return true;
   }
 
-  for (var key in filters) {
+  for (var key of filters) {
     var isMatch = applyFilter(item, key, filters[key]);
     // we AND all the filters, short-circuit for early termination
     if (!isMatch) {
diff --git a/browser/services/pipe-to-browser-client.js b/browser/services/pipe-to-browser-client.js
index d027943..c1a6883 100644
--- a/browser/services/pipe-to-browser-client.js
+++ b/browser/services/pipe-to-browser-client.js
@@ -20,7 +20,7 @@
  */
 export function pipe(name, stream) {
   return vanadium.init().then((runtime) => {
-    var client = runtime.newClient();
+    var client = runtime.getClient();
     var ctx = runtime.getContext().withTimeout(5000);
     ctx.waitUntilDone(function(){});
     return client.bindTo(ctx, name).then((remote) => {
diff --git a/browser/services/pipe-to-browser-namespace.js b/browser/services/pipe-to-browser-namespace.js
index 652915c..a72d3a4 100644
--- a/browser/services/pipe-to-browser-namespace.js
+++ b/browser/services/pipe-to-browser-namespace.js
@@ -19,7 +19,7 @@
  */
 export function getAll() {
   return vanadium.init().then((runtime) => {
-    var namespace = runtime.namespace();
+    var namespace = runtime.getNamespace();
     var ctx = runtime.getContext().withTimeout(5000);
     ctx.waitUntilDone(function(){});
 
diff --git a/browser/services/pipe-to-browser-server.js b/browser/services/pipe-to-browser-server.js
index 09cfaa9..365dc7a 100644
--- a/browser/services/pipe-to-browser-server.js
+++ b/browser/services/pipe-to-browser-server.js
@@ -138,15 +138,15 @@
   state.publishing = true;
 
   return vanadium.init().then((runtime) => {
-    server = runtime.newServer();
     // the blessing name for the account is dev.v.io.io/u/<email>/<something>.
     // the object name we want to publish under is users/<email>/<something>/p2b/<name>.
     // So, replace "dev.v.io/u/" with "users/".
     var nsPrefix = runtime.accountName.replace('dev.v.io/u/', 'users/');
     var serviceName = vanadium.naming.join(nsPrefix, 'p2b', name);
 
-    return server.serveDispatcher(serviceName, dispatcher).then(() => {
+    return runtime.newDispatchingServer(serviceName, dispatcher).then((s) => {
       log.debug('published!');
+      server = s;
 
       state.published = true;
       state.publishing = false;
diff --git a/package.json b/package.json
index 4689c18..e7c7159 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
   "version": "0.1.0",
   "description": "This Vanadium application makes it possible to pipe anything from any Unix-like console to the browser using the shell's regular pipe functionality. Data being piped to the browser then is displayed in a graphical and formatted way by a viewer",
   "devDependencies": {
-    "jspm": "0.13.4",
+    "jspm": "0.16.2",
     "vulcanize": "~0.7.9",
     "serve": "~1.4.0",
     "bower": "~1.3.12"