diff --git a/admin/generate-dev-bundle.sh b/admin/generate-dev-bundle.sh index e3a1e2ad14..33e797711c 100755 --- a/admin/generate-dev-bundle.sh +++ b/admin/generate-dev-bundle.sh @@ -3,7 +3,7 @@ set -e set -u -BUNDLE_VERSION=0.2.12 +BUNDLE_VERSION=0.2.14 UNAME=$(uname) ARCH=$(uname -m) @@ -88,7 +88,6 @@ npm install mime@1.2.7 npm install semver@1.1.0 npm install handlebars@1.0.7 npm install mongodb@1.1.11 -npm install uglify-js@1.3.4 npm install clean-css@0.8.3 npm install useragent@1.1.0 npm install request@2.12.0 @@ -98,7 +97,13 @@ npm install keypress@0.1.0 npm install sockjs@0.3.4 npm install http-proxy@0.8.5 npm install underscore@1.4.2 +npm install fstream@0.1.21 npm install tar@0.1.14 +npm install websocket@1.0.8 + +# uglify-js has a bug which drops 'undefined' in arrays: +# https://github.com/mishoo/UglifyJS2/pull/97 +npm install https://github.com/meteor/UglifyJS2/tarball/9a4d0d86ed # progress 0.1.0 has a regression where it opens stdin and thus does not # allow the node process to exit cleanly. See @@ -109,16 +114,10 @@ npm install progress@0.0.5 # which make the dev bundle much bigger. We need a better solution. npm install mailcomposer@0.1.15 -# Use our version of fstream with a bug fixed. Also have tar use it. -# See https://github.com/isaacs/fstream/pull/11 . -npm install https://github.com/meteor/fstream/tarball/91c56e7 -cd tar/node_modules -npm install https://github.com/meteor/fstream/tarball/91c56e7 -cd ../.. - # If you update the version of fibers in the dev bundle, also update the "npm -# install" command in docs/client/concepts.html. -npm install fibers@0.6.9 +# install" command in docs/client/concepts.html and in the README in +# app/lib/bundler.js. +npm install fibers@1.0.0 # Fibers ships with compiled versions of its C code for a dozen platforms. This # bloats our dev bundle, and confuses dpkg-buildpackage and rpmbuild into # thinking that the packages need to depend on both 32- and 64-bit versions of diff --git a/app/lib/bundler.js b/app/lib/bundler.js index 045077f004..a5ee2d0315 100644 --- a/app/lib/bundler.js +++ b/app/lib/bundler.js @@ -378,36 +378,23 @@ _.extend(Bundle.prototype, { var self = this; /// Javascript - var code_parts = []; + var codeParts = []; _.each(self.js.client, function (js_path) { - var code = self.files.client[js_path].toString('utf8'); + codeParts.push(self.files.client[js_path].toString('utf8')); - // Uglify has a bug -- it will incorrectly minifiy files that - // contain the 'debugger' statement. - // https://github.com/mishoo/UglifyJS/issues/243 - // For now, just skip minification of such files. - // XXX fix uglify, and once that happens, go back to - // concatenating before minifying, rather than vice versa - // https://app.asana.com/0/159908330244/522242142181 - if (!(code.match(/debugger/))) { - var ast = uglify.parser.parse(code); - ast = uglify.uglify.ast_mangle(ast); - ast = uglify.uglify.ast_squeeze(ast); - code = uglify.uglify.gen_code(ast); - } - - code_parts.push(code); delete self.files.client[js_path]; }); - var final_code = code_parts.join('\n;\n'); + var combinedCode = codeParts.join('\n;\n'); + var finalCode = uglify.minify( + combinedCode, {fromString: true, compress: {drop_debugger: false}}).code; var hash = crypto.createHash('sha1'); - hash.update(final_code); + hash.update(finalCode); var digest = hash.digest('hex'); var name = path.sep + digest + ".js"; - self.files.client_cacheable[name] = new Buffer(final_code); + self.files.client_cacheable[name] = new Buffer(finalCode); self.js.client = [name]; /// CSS @@ -574,7 +561,7 @@ _.extend(Bundle.prototype, { "This is a Meteor application bundle. It has only one dependency,\n" + "node.js (with the 'fibers' package). To run the application:\n" + "\n" + -" $ npm install fibers\n" + +" $ npm install fibers@1.0.0\n" + " $ export MONGO_URL='mongodb://user:password@host:port/databasename'\n" + " $ export ROOT_URL='http://example.com'\n" + " $ export MAIL_URL='smtp://user:password@mailhost:port/'\n" + diff --git a/app/server/server.js b/app/server/server.js index 78121555c5..f536bb6a6a 100644 --- a/app/server/server.js +++ b/app/server/server.js @@ -1,6 +1,6 @@ ////////// Requires ////////// -require("fibers"); +var Fiber = require("fibers"); var fs = require("fs"); var path = require("path"); diff --git a/docs/client/concepts.html b/docs/client/concepts.html index 5c314eea7e..050ba4c23a 100644 --- a/docs/client/concepts.html +++ b/docs/client/concepts.html @@ -641,7 +641,7 @@ have `npm` available, and run the following: $ cd bundle/server/node_modules $ rm -r fibers - $ npm install fibers@0.6.9 + $ npm install fibers@1.0.0 {{/warning}} {{/better_markdown}} diff --git a/examples/other/quiescence/quiescence.js b/examples/other/quiescence/quiescence.js index 5058999618..c0e7e779fc 100644 --- a/examples/other/quiescence/quiescence.js +++ b/examples/other/quiescence/quiescence.js @@ -31,6 +31,8 @@ if (Meteor.isServer) { } }); + var Fiber = __meteor_bootstrap__.require('fibers'); + var sleep = function (ms) { var fiber = Fiber.current; setTimeout(function() { diff --git a/meteor b/meteor index 6ff0939e5d..3955ed5447 100755 --- a/meteor +++ b/meteor @@ -1,6 +1,6 @@ #!/bin/bash -BUNDLE_VERSION=0.2.12 +BUNDLE_VERSION=0.2.14 # OS Check. Put here because here is where we download the precompiled # bundles that are arch specific. diff --git a/packages/accounts-oauth-helper/oauth_server.js b/packages/accounts-oauth-helper/oauth_server.js index 24824b7b91..7feea25e99 100644 --- a/packages/accounts-oauth-helper/oauth_server.js +++ b/packages/accounts-oauth-helper/oauth_server.js @@ -69,6 +69,7 @@ return result; }); + var Fiber = __meteor_bootstrap__.require('fibers'); // Listen to incoming OAuth http requests __meteor_bootstrap__.app .use(connect.query()) diff --git a/packages/livedata/livedata_server.js b/packages/livedata/livedata_server.js index f95a7b9628..e625b29ff6 100644 --- a/packages/livedata/livedata_server.js +++ b/packages/livedata/livedata_server.js @@ -1,3 +1,5 @@ +var Fiber = __meteor_bootstrap__.require('fibers'); + /******************************************************************************/ /* LivedataSession */ /******************************************************************************/ diff --git a/packages/meteor/dynamics_nodejs.js b/packages/meteor/dynamics_nodejs.js index 01ff545175..97bb1dadef 100644 --- a/packages/meteor/dynamics_nodejs.js +++ b/packages/meteor/dynamics_nodejs.js @@ -2,6 +2,8 @@ (function () { + var Fiber = __meteor_bootstrap__.require('fibers'); + var nextSlot = 0; Meteor.EnvironmentVariable = function () { diff --git a/packages/meteor/fiber_helpers_test.js b/packages/meteor/fiber_helpers_test.js index 5a09d2160e..509d16c965 100644 --- a/packages/meteor/fiber_helpers_test.js +++ b/packages/meteor/fiber_helpers_test.js @@ -1,3 +1,5 @@ +var Fiber = __meteor_bootstrap__.require('fibers'); + Tinytest.add("fibers - synchronous queue", function (test) { var q = new Meteor._SynchronousQueue; var output = []; diff --git a/packages/mongo-livedata/mongo_driver.js b/packages/mongo-livedata/mongo_driver.js index bda3fc6432..f44efb4b73 100644 --- a/packages/mongo-livedata/mongo_driver.js +++ b/packages/mongo-livedata/mongo_driver.js @@ -10,6 +10,7 @@ var path = __meteor_bootstrap__.require('path'); var MongoDB = __meteor_bootstrap__.require('mongodb'); +var Fiber = __meteor_bootstrap__.require('fibers'); var Future = __meteor_bootstrap__.require(path.join('fibers', 'future')); _Mongo = function (url) { diff --git a/packages/mongo-livedata/mongo_livedata_tests.js b/packages/mongo-livedata/mongo_livedata_tests.js index 9e728f5da6..ab4e22bb2a 100644 --- a/packages/mongo-livedata/mongo_livedata_tests.js +++ b/packages/mongo-livedata/mongo_livedata_tests.js @@ -108,6 +108,7 @@ Tinytest.addAsync("mongo-livedata - basics", function (test, onComplete) { // sleep function from fibers docs. var sleep = function(ms) { + var Fiber = __meteor_bootstrap__.require('fibers'); var fiber = Fiber.current; setTimeout(function() { fiber.run(); diff --git a/packages/tinytest/tinytest_server.js b/packages/tinytest/tinytest_server.js index b7d274448f..29225507dd 100644 --- a/packages/tinytest/tinytest_server.js +++ b/packages/tinytest/tinytest_server.js @@ -1,4 +1,5 @@ (function () { + var Fiber = __meteor_bootstrap__.require('fibers'); var handlesForRun = {}; var reportsForRun = {};