From 6c1b0976fddfda6a31911d2fd7b20f28b64f8849 Mon Sep 17 00:00:00 2001 From: Devin Bayer Date: Fri, 28 Oct 2016 15:04:52 +0200 Subject: [PATCH 01/30] add onMessage hook --- packages/ddp-server/livedata_server.js | 22 +++++++++++++++++++ packages/ddp-server/livedata_server_tests.js | 23 +++++++++++++++++++- packages/ddp-server/server_convenience.js | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/packages/ddp-server/livedata_server.js b/packages/ddp-server/livedata_server.js index 2ac3aebea1..f714e6e0de 100644 --- a/packages/ddp-server/livedata_server.js +++ b/packages/ddp-server/livedata_server.js @@ -547,6 +547,11 @@ _.extend(Session.prototype, { processNext(); }; + self.server.onMessageHook.each(function (callback) { + callback(msg, self); + return true; + }); + if (_.has(self.protocol_handlers, msg.msg)) self.protocol_handlers[msg.msg].call(self, msg, unblock); else @@ -1320,6 +1325,11 @@ Server = function (options) { debugPrintExceptions: "onConnection callback" }); + // Map of callbacks to call when a new message comes in. + self.onMessageHook = new Hook({ + debugPrintExceptions: "onMessage callback" + }); + self.publish_handlers = {}; self.universal_publish_handlers = []; @@ -1403,6 +1413,18 @@ _.extend(Server.prototype, { return self.onConnectionHook.register(fn); }, + /** + * @summary Register a callback to be called when a new DDP message is received. + * @locus Server + * @param {function} callback The function to call when a new DDP message is received. + * @memberOf Meteor + * @importFromPackage meteor + */ + onMessage: function (fn) { + var self = this; + return self.onMessageHook.register(fn); + }, + _handleConnect: function (socket, msg) { var self = this; diff --git a/packages/ddp-server/livedata_server_tests.js b/packages/ddp-server/livedata_server_tests.js index 10203f319b..d24cfb0d06 100644 --- a/packages/ddp-server/livedata_server_tests.js +++ b/packages/ddp-server/livedata_server_tests.js @@ -82,7 +82,6 @@ testAsyncMulti( }] ); - Meteor.methods({ livedata_server_test_inner: function () { return this.connection.id; @@ -94,6 +93,28 @@ Meteor.methods({ }); +Tinytest.addAsync( + "livedata server - onMessage hook", + function (test, onComplete) { + + var cb = Meteor.onMessage(function (msg, session) { + test.equal(msg.method, 'livedata_server_test_inner'); + cb.stop(); + onComplete(); + }); + + makeTestConnection( + test, + function (clientConn, serverConn) { + clientConn.call('livedata_server_test_inner'); + clientConn.disconnect(); + }, + onComplete + ); + } +); + + Tinytest.addAsync( "livedata server - connection in method invocation", function (test, onComplete) { diff --git a/packages/ddp-server/server_convenience.js b/packages/ddp-server/server_convenience.js index 62384353fa..28fca40b2b 100755 --- a/packages/ddp-server/server_convenience.js +++ b/packages/ddp-server/server_convenience.js @@ -11,7 +11,7 @@ Meteor.refresh = function (notification) { // Proxy the public methods of Meteor.server so they can // be called directly on Meteor. -_.each(['publish', 'methods', 'call', 'apply', 'onConnection'], +_.each(['publish', 'methods', 'call', 'apply', 'onConnection', 'onMessage'], function (name) { Meteor[name] = _.bind(Meteor.server[name], Meteor.server); }); From a74b0c268ee0211e650e9b8b78cfb5923fff6b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20P=C3=A1l=20Koszta?= Date: Mon, 21 Nov 2016 10:35:35 +0100 Subject: [PATCH 02/30] Fix oauth ROOT_URL_PATH_PREFIX --- packages/oauth/end_of_popup_response.html | 2 +- packages/oauth/end_of_redirect_response.html | 2 +- packages/oauth/oauth_server.js | 5 +- packages/oauth/oauth_tests.js | 48 ++++++++++++++++++++ 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/packages/oauth/end_of_popup_response.html b/packages/oauth/end_of_popup_response.html index 9812af83da..11cf6c5692 100644 --- a/packages/oauth/end_of_popup_response.html +++ b/packages/oauth/end_of_popup_response.html @@ -6,6 +6,6 @@

- + diff --git a/packages/oauth/end_of_redirect_response.html b/packages/oauth/end_of_redirect_response.html index af0e9885e5..bf53b766a5 100644 --- a/packages/oauth/end_of_redirect_response.html +++ b/packages/oauth/end_of_redirect_response.html @@ -1,6 +1,6 @@ - + diff --git a/packages/oauth/oauth_server.js b/packages/oauth/oauth_server.js index f5cc5d592e..cca82cb2bd 100644 --- a/packages/oauth/oauth_server.js +++ b/packages/oauth/oauth_server.js @@ -342,7 +342,10 @@ var renderEndOfLoginResponse = function (options) { throw new Error('invalid loginStyle: ' + options.loginStyle); } - var result = template.replace(/##CONFIG##/, JSON.stringify(config)); + var result = template.replace(/##CONFIG##/, JSON.stringify(config)) + .replace( + /##ROOT_URL_PATH_PREFIX##/, __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + ); return "\n" + result; }; diff --git a/packages/oauth/oauth_tests.js b/packages/oauth/oauth_tests.js index dcca94ea18..a9e17aa3ef 100644 --- a/packages/oauth/oauth_tests.js +++ b/packages/oauth/oauth_tests.js @@ -59,3 +59,51 @@ Tinytest.add( test.equal(OAuth._retrievePendingCredential(key, secret), cred); } ); + +Tinytest.add("oauth - _endOfLoginResponse with popup loginStyle supports ROOT_URL_PATH_PREFIX", + function (test) { + var rootUrlPathPrefix = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX; + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX = '/test-root-url-prefix'; + var res = { + writeHead: function () {}, + end: function (content) { + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX = rootUrlPathPrefix; + test.matches( + content, + /\/test-root-url-prefix\/packages\/oauth\/end_of_popup_response\.js/ + ); + } + }; + var details = { + credentials: {}, + loginStyle: 'popup' + }; + OAuth._endOfLoginResponse(res, details); + } +); + +Tinytest.add("oauth - _endOfLoginResponse with redirect loginStyle supports ROOT_URL_PATH_PREFIX", + function (test) { + var rootUrlPathPrefix = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX; + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX = '/test-root-url-prefix'; + var res = { + writeHead: function () {}, + end: function (content) { + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX = rootUrlPathPrefix; + test.matches( + content, + /\/test-root-url-prefix\/packages\/oauth\/end_of_redirect_response\.js/ + ); + } + }; + var details = { + credentials: {}, + loginStyle: 'redirect', + query: { + // {"redirectUrl": "http://localhost:3000/"} + state: 'eyJyZWRpcmVjdFVybCI6ICJodHRwOi8vbG9jYWxob3N0OjMwMDAvIn0=' + } + }; + OAuth._endOfLoginResponse(res, details); + } +); From dd226b8c50a21cae06abac2e6115ce5776f896c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20P=C3=A1l=20Koszta?= Date: Mon, 21 Nov 2016 15:29:27 +0100 Subject: [PATCH 03/30] Add tests for oauth when ROOT_URL_PATH_PREFIX is not specified --- packages/oauth/oauth_tests.js | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/packages/oauth/oauth_tests.js b/packages/oauth/oauth_tests.js index a9e17aa3ef..8036bb20ce 100644 --- a/packages/oauth/oauth_tests.js +++ b/packages/oauth/oauth_tests.js @@ -60,6 +60,25 @@ Tinytest.add( } ); +Tinytest.add("oauth - _endOfLoginResponse with popup loginStyle supports unspecified ROOT_URL_PATH_PREFIX", + function (test) { + var res = { + writeHead: function () {}, + end: function (content) { + test.matches( + content, + /\/packages\/oauth\/end_of_popup_response\.js/ + ); + } + }; + var details = { + credentials: {}, + loginStyle: 'popup' + }; + OAuth._endOfLoginResponse(res, details); + } +); + Tinytest.add("oauth - _endOfLoginResponse with popup loginStyle supports ROOT_URL_PATH_PREFIX", function (test) { var rootUrlPathPrefix = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX; @@ -82,6 +101,30 @@ Tinytest.add("oauth - _endOfLoginResponse with popup loginStyle supports ROOT_UR } ); +Tinytest.add("oauth - _endOfLoginResponse with redirect loginStyle supports unspecified ROOT_URL_PATH_PREFIX", + function (test) { + var res = { + writeHead: function () {}, + end: function (content) { + test.matches( + content, + /\/packages\/oauth\/end_of_redirect_response\.js/ + ); + } + }; + var details = { + credentials: {}, + loginStyle: 'redirect', + query: { + // {"redirectUrl": "http://localhost:3000/"} + state: 'eyJyZWRpcmVjdFVybCI6ICJodHRwOi8vbG9jYWxob3N0OjMwMDAvIn0=' + } + }; + OAuth._endOfLoginResponse(res, details); + } +); + + Tinytest.add("oauth - _endOfLoginResponse with redirect loginStyle supports ROOT_URL_PATH_PREFIX", function (test) { var rootUrlPathPrefix = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX; From 4fb3c819365083c9d793009637b470d7bed0b04d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20P=C3=A1l=20Koszta?= Date: Mon, 21 Nov 2016 18:52:40 +0100 Subject: [PATCH 04/30] Use redirectUrl generated from ROOT_URL in oauth tests --- packages/oauth/oauth_tests.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/oauth/oauth_tests.js b/packages/oauth/oauth_tests.js index 8036bb20ce..bbca33dfeb 100644 --- a/packages/oauth/oauth_tests.js +++ b/packages/oauth/oauth_tests.js @@ -116,8 +116,9 @@ Tinytest.add("oauth - _endOfLoginResponse with redirect loginStyle supports unsp credentials: {}, loginStyle: 'redirect', query: { - // {"redirectUrl": "http://localhost:3000/"} - state: 'eyJyZWRpcmVjdFVybCI6ICJodHRwOi8vbG9jYWxob3N0OjMwMDAvIn0=' + state: new Buffer(JSON.stringify({ + redirectUrl: __meteor_runtime_config__.ROOT_URL + }), 'binary').toString('base64') } }; OAuth._endOfLoginResponse(res, details); @@ -143,8 +144,9 @@ Tinytest.add("oauth - _endOfLoginResponse with redirect loginStyle supports ROOT credentials: {}, loginStyle: 'redirect', query: { - // {"redirectUrl": "http://localhost:3000/"} - state: 'eyJyZWRpcmVjdFVybCI6ICJodHRwOi8vbG9jYWxob3N0OjMwMDAvIn0=' + state: new Buffer(JSON.stringify({ + redirectUrl: __meteor_runtime_config__.ROOT_URL + }), 'binary').toString('base64') } }; OAuth._endOfLoginResponse(res, details); From 23c52ff0026110d278413a5e8e9e2655fe175856 Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Thu, 6 Oct 2016 19:24:57 +0300 Subject: [PATCH 05/30] `meteor shell` should pass its TTY width to the server on connect Previously, the width (or "columns") for the readline shell was being obtained on the server. This causes problems for clients which are connecting to the server which are sized differently. The client will still have problems if they resize AFTER they are connected to the REPL, but at least they have the option of being a different size. A more complete solution would be to have the client listen on process.stdout "resize" and pass that to the server when it occurs, but I'm not sure of an easy way to do that with the current communication (perhaps pause-reconfigure-unpause?). Fixes meteor/meteor#5346 --- packages/shell-server/shell-server.js | 27 ++++++--------------------- tools/shell-client.js | 1 + 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/packages/shell-server/shell-server.js b/packages/shell-server/shell-server.js index eff77e0468..419fdaa4c7 100644 --- a/packages/shell-server/shell-server.js +++ b/packages/shell-server/shell-server.js @@ -3,7 +3,6 @@ var path = require("path"); var stream = require("stream"); var fs = require("fs"); var net = require("net"); -var tty = require("tty"); var vm = require("vm"); var _ = require("underscore"); var INFO_FILE_MODE = parseInt("600", 8); // Only the owner can read or write. @@ -119,6 +118,12 @@ class Server { } delete options.key; + // Set the columns to what is being requested by the client. + if (options.columns && socket) { + socket.columns = options.columns; + } + delete options.columns; + if (options.evaluateAndExit) { evalCommand.call( Object.create(null), // Dummy repl object without ._RecoverableError. @@ -166,13 +171,6 @@ class Server { startREPL(options) { var self = this; - if (! options.output.columns) { - // The REPL's tab completion logic assumes process.stdout is a TTY, - // and while that isn't technically true here, we can get tab - // completion to behave correctly if we fake the .columns property. - options.output.columns = getTerminalWidth(); - } - // Make sure this function doesn't try to write anything to the output // stream after it has been closed. options.output.on("close", function() { @@ -384,19 +382,6 @@ function getHistoryFile(shellDir) { return path.join(shellDir, "history"); } -function getTerminalWidth() { - try { - // Inspired by https://github.com/TooTallNate/ttys/blob/master/index.js - var fd = fs.openSync("/dev/tty", "r"); - assert.ok(tty.isatty(fd)); - var ws = new tty.WriteStream(fd); - ws.end(); - return ws.columns; - } catch (fancyApproachWasTooFancy) { - return 80; - } -} - // Shell commands need to be executed in a Fiber in case they call into // code that yields. Using a Promise is an even better idea, since it runs // its callbacks in Fibers drawn from a pool, so the Fibers are recycled. diff --git a/tools/shell-client.js b/tools/shell-client.js index 4f6bc936ee..f1543dbd68 100644 --- a/tools/shell-client.js +++ b/tools/shell-client.js @@ -137,6 +137,7 @@ Cp.setUpSocket = function setUpSocket(sock, key) { // Sending a JSON-stringified options object (even just an empty // object) over the socket is required to start the REPL session. sock.write(JSON.stringify({ + columns: process.stdout.columns, terminal: ! process.env.EMACS, key: key }) + "\n"); From 1fda39b3a0abe13ef9cf7565fb21a4371ea24783 Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Mon, 12 Dec 2016 15:05:57 +0200 Subject: [PATCH 06/30] Cordova project preparation must occur before copying to the build This fixes a regression caused by 88d43a0f16a484a5716050cb7de8066b126c7b28 which is demonstrated in meteor/meteor#7849. Essentially, with the current implementation some Cordova build elements are "stale" when the build is copied. For example, if you execute a `meteor run ios` and then `meteor build . --server=http://example.com/` (note: `example.com`) the `config.xml` (``), the boilerplate HTML (`__meteor_runtime_config__`) and other elements of the bundle (`Info.plist` on iOS) will still contain the previously used `http://:3000` address instead of `http://example.com` as they should. Additionally, it would appear that it's impossible to actually checkout a project and immediately run `meteor build` without running `meteor run (android|ios)` first. Various work-arounds for this seem to exist, such as running `meteor build` twice, or running `meteor run --server=http://production.com` first. Ultimately, this is occurring because the bundle is being copied before the Cordova `prepareForPlatform` occurs which I believe was not intended. There is already a test in place which fails without this fix, but marked as `slow` and therefore not executed on CircleCI. Specifically, `cordova builds with server options` would have caught this. Forcibly running this test locally now passes with this change. Fixes meteor/meteor#7849 Fixes meteor/meteor#7291 Fixes meteor/meteor#6756 --- tools/cli/commands.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/cli/commands.js b/tools/cli/commands.js index 3632698a2e..82ff99149e 100644 --- a/tools/cli/commands.js +++ b/tools/cli/commands.js @@ -1016,12 +1016,22 @@ ${cordova.displayNameForPlatform(platform)}` }, () => { 'platforms', platform); const platformOutputPath = files.pathJoin(outputPath, platform); + // Prepare the project once again to ensure that it is up to date + // with current build options. For example, --server=example.com + // is utilized in the Cordova builder to write boilerplate HTML and + // various config.xml settings (e.g. access policies) + if (platform === 'ios') { + cordovaProject.prepareForPlatform(platform, buildOptions); + } else if (platform === 'android') { + cordovaProject.buildForPlatform(platform, buildOptions); + } + + // Once prepared, copy the bundle to the final location. files.cp_r(buildPath, files.pathJoin(platformOutputPath, 'project')); + // Make some platform-specific adjustments to the resulting build. if (platform === 'ios') { - cordovaProject.prepareForPlatform(platform, buildOptions); - files.writeFile( files.pathJoin(platformOutputPath, 'README'), `This is an auto-generated XCode project for your iOS application. @@ -1030,8 +1040,6 @@ Instructions for publishing your iOS app to App Store can be found at: https://github.com/meteor/meteor/wiki/How-to-submit-your-iOS-app-to-App-Store `, "utf8"); } else if (platform === 'android') { - cordovaProject.buildForPlatform(platform, buildOptions); - const apkPath = files.pathJoin(buildPath, 'build/outputs/apk', options.debug ? 'android-debug.apk' : 'android-release-unsigned.apk') From 4a16e649ccc69ea35916cc974e3e9f98c1af6aaa Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Tue, 13 Dec 2016 15:54:10 +0200 Subject: [PATCH 07/30] Fix console glitch when using some admin package functions Tiny fix for an old issue where the console output would get corrupted when running `meteor admin set-unmigrated` or `meteor admin change-homepage` due to missing newline on `rawInfo` command. Fixes meteor/meteor#4054 --- tools/cli/commands-packages.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cli/commands-packages.js b/tools/cli/commands-packages.js index baf35ca5a4..a075ffacea 100644 --- a/tools/cli/commands-packages.js +++ b/tools/cli/commands-packages.js @@ -2617,7 +2617,7 @@ main.registerCommand({ try { Console.rawInfo( "Changing homepage on " - + name + " to " + url + "..."); + + name + " to " + url + "...\n"); packageClient.callPackageServer(conn, '_changePackageHomepage', name, url); Console.info(" done"); @@ -2670,7 +2670,7 @@ main.registerCommand({ _.each(versions, function (version) { Console.rawInfo( "Setting " + name + "@" + version + " as " + - status + " migrated ... "); + status + " migrated ...\n"); packageClient.callPackageServer( conn, '_changeVersionMigrationStatus', From cf744f800b51d8954e71c04abb1f916eb0b1ed44 Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Tue, 13 Dec 2016 14:31:08 -0800 Subject: [PATCH 08/30] Update roadmap for december 2016 (#8153) --- Roadmap.md | 89 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 16 deletions(-) diff --git a/Roadmap.md b/Roadmap.md index 892fd7c6e3..24b2ba37a6 100644 --- a/Roadmap.md +++ b/Roadmap.md @@ -1,42 +1,99 @@ -Meteor Roadmap -============== -This document describes the high level features the project has decided to prioritize in the near to medium term future. A large fraction of the MDG core engineering team's time will be dedicated to working on the features described here. -Contributors are encouraged to focus their efforts on work that aligns with the roadmap as maintainers will prioritize their time around these contributions. This however does not mean that PR's against other features and bugs will be automatically rejected. +# **Meteor Roadmap** -For the meantime, MDG won't be accepting PR's for changes to the roadmap. We hope to change this in the future as we figure out strategies to decentralize Meteor development. +**Last updated December 13, 2016** -## MongoDB updates +This document describes the high level features the Meteor project maintainers have decided to prioritize in the near- to medium-term future. A large fraction of the maintainers’ time will be dedicated to working on the features described here. As with any roadmap, this is a living document that will evolve as priorities and dependencies shift; we aim to update the roadmap with any changes or status updates on a monthly basis. -The mongo driver that currently ships with Meteor is old and doesn’t reliably work with connecting to MongoDB 3.2 databases (e.g [#6258](https://github.com/meteor/meteor/issues/6258)). We want to update to the latest driver [#5763](https://github.com/meteor/meteor/issues/5763). +Contributors are encouraged to focus their efforts on work that aligns with the roadmap as maintainers will prioritize their time spent reviewing PRs and issues around these contributions. This however does not mean that PRs against other features and bugs will automatically be rejected. -In addition, we'd like to update the dev bundle to ship with the latest stable version of MongoDB (3.2) [#5809](https://github.com/meteor/meteor/issues/5809) as MongoDB 2.6 will be officially sunsetted at the end of October, 2016. +Items can be added to this roadmap by first getting design approval for a solution to an open issue, as outlined by our [contributing guidelines](https://github.com/meteor/meteor/blob/devel/Contributing.md). Then, when a contributor has committed to solving the issue in the short to medium term, they can submit a PR to add that work to the roadmap. All other PRs to the roadmap will be rejected. -## Support for Node 4 and beyond -We want to be able to update the version of Node that ships with Meteor to 4 and eventually 6 [#5124](https://github.com/meteor/meteor/issues/5124). [#6537](https://github.com/meteor/meteor/issues/6537) lays the groundwork to overcome the main blocker for updating to Node 4, that is, needing to rebuild all existing Meteor packages that contain binary dependencies. +## Upgrade to Node 6 + +Tracking pull request: https://github.com/meteor/meteor/pull/6923 + + +## Page load performance improvements + +*Status: In progress* + +Fast initial page load times are somewhat less important for single-page reactive web apps than for other kinds of websites, but large Meteor apps with lots of packages tend to load quite a bit of JavaScript, and the cost of all that network traffic, parsing, and evaluation definitely adds up. + +Speeding up page load times will require a combination of new tools for asynchronous JavaScript delivery (code splitting), dead code elimination, deferred evaluation of JavaScript modules, and performance profiling (so that developers can identify expensive packages). + + +## Build system improvements + +*Status: In progress* + +Meteor 1.4.2 addressed a number of critical performance problems with the Meteor build system, but there are still more areas left for improvement. For example, Meteor could take better advantage of native support for new ECMAScript features in Node 4 (and eventually Node 6) on the server. + ## Full transition to npm +*Status: We encourage publishing Meteor-related packages to npm where possible. We are investigating ways to make it possible to move some parts of Meteor core onto npm without making the installation process more complex.* + The community has rallied around npm as the de-facto standard package manager for JavaScript. We believe committing fully to npm will strengthen the entire JavaScript ecosystem by removing fragmentation, will benefit existing Meteor developers by making it seamless to use any JavaScript package and increase Meteor adoption by aligning it with JavaScript best practices. 1.3 introduced `npm install` support along with ES2015 modules. In the future, we would like to transition the Meteor package ecosystem over entirely from Atmosphere to npm. We are still in the early conceptual design phase and expect to update the roadmap once we have a design in place that will underpin further development. -## Testing updates +## GraphQL Data: SQL, REST, performance -Meteor 1.3 shipped with two new testing modes and many developers are writing test suites and building test drivers as part of migrating to 1.3. We’re looking at improving the feature in upcoming releases, especially our support for continuous integration mode (see [#6755](https://github.com/meteor/meteor/issues/6755)). +*Status: In progress at [http://dev.apollodata.com/](http://dev.apollodata.com/)* -## Project Governance/Community Contribution +We're building a next generation GraphQL-focused data stack for modern applications called Apollo. We believe that this spiritual successor to the data part of the Meteor stack is impactful enough to deserve it's own fully fledged project that is compatible with other languages and frameworks. Apollo is born from the Meteor project and works perfectly with Meteor today. -Currently, it’s difficult for external developers to make meaningful contributions to Meteor as there is no clear guidance on what to work on, how best to do that work and signals around what will/won’t get merged. We plan on fixing this by creating tight documentation around how the project is developed (e.g the [Swift contribution guidelines](https://swift.org/contributing/)) and giving contributors a path towards earning increased privileges that culminate in full commit access. We’re also aiming to move more sub-projects into their own repositories that can be released on their own release schedule and more easily maintained by the community. +Apollo is our approach to giving Meteor developers SQL and other database support, the ability to choose between realtime and static data, and improved performance analysis. We are working on providing better tools and documentation for Meteor developers to integrate Apollo into their apps, and welcome contributions in this area. The next priority for Apollo and Meteor is enabling Meteor developers to choose to replace MongoDB entirely with GraphQL on top of other storage engines. -## Data (SQL, REST, Performance) +Even though Apollo could eventually be a complete replacement for Meteor’s included Mongo/DDP data stack, you should feel good about Meteor’s existing data system. We are currently open to ideas around performance and stability improvements. -We're building the next generation data stack for modern applications called [Apollo](https://github.com/apollostack/apollo). We believe the data part of the Meteor stack is impactful enough to deserve it's own fully fledged sub-project that will be compatible with other languages and frameworks. Apollo is born from the Meteor project and is naturally designed to work perfectly with Meteor. It is GraphQL based and will work with multiple data sources starting with REST. Apollo is our answer to bringing SQL and improved performance analysis to Meteor. + + +# **Recently completed** + + + +## Rebuild performance improvements + +*Status: Shipped in 1.4.2* + +Rebuild performance refers to the length of time between changing a file in development and being able to reload your app in a browser. After extensive profiling to identify performance hot-spots, and with careful caching of previously completed work, Meteor 1.4.2 takes substantially less time to rebuild most apps, especially larger apps. + + +## MongoDB updates + +*Status: Shipped in 1.4* + +The mongo driver that currently ships with Meteor is old and doesn’t reliably work with connecting to MongoDB 3.2 databases (e.g [#6258](https://github.com/meteor/meteor/issues/6258)). We want to update to the latest driver [#5763](https://github.com/meteor/meteor/issues/5763). +In addition, we'd like to update the dev bundle to ship with the latest stable version of MongoDB (3.2) [#5809](https://github.com/meteor/meteor/issues/5809) as MongoDB 2.6 will be officially sunsetted at the end of October, 2016. + + +## Support for Node 4 and beyond + +*Status: Shipped in 1.4* + +We want to be able to update the version of Node that ships with Meteor to 4 and eventually 6 [#5124](https://github.com/meteor/meteor/issues/5124). [#6537](https://github.com/meteor/meteor/issues/6537) lays the groundwork to overcome the main blocker for updating to Node 4, that is, needing to rebuild all existing Meteor packages that contain binary dependencies. ## View Layer +*Status: Blaze split into new repository and can be published independently as of 1.4.2* + Our plans around the view layer are to maintain strong integrations (along with guidance) with React, Angular and Blaze. We'll make essential fixes to Blaze but most likely won't be adding new features ourselves. We encourage you to help build the features you need at the [meteor/blaze](https://github.com/meteor/blaze) repository. + + +## Project Governance/Community Contribution + +*Status: Since this topic was added to the roadmap, we have introduced *[*completely new contribution guidelines*](https://github.com/meteor/meteor/blob/devel/Contributing.md)* that outline exactly how to contribute to Meteor in several ways, including triaging issues, improving documentation, submitting designs for new features, and submitting PRs for bug fixes and improvements. We encourage proposals about how to make the process better via new GitHub issues.* + +Currently, it’s difficult for external developers to make meaningful contributions to Meteor as there is no clear guidance on what to work on, how best to do that work and signals around what will/won’t get merged. We plan on fixing this by creating tight documentation around how the project is developed (e.g the [Swift contribution guidelines](https://swift.org/contributing/)) and giving contributors a path towards earning increased privileges that culminate in full commit access. We’re also aiming to move more sub-projects into their own repositories that can be released on their own release schedule and more easily maintained by the community. + + +## **Other** + +For more completed items, refer to the project history here: https://github.com/meteor/meteor/blob/devel/History.md + From 23994623f958c30bfec38c8f7d436c6ba61ce6d9 Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Tue, 13 Dec 2016 19:25:16 -0800 Subject: [PATCH 09/30] Update README formatting --- Roadmap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Roadmap.md b/Roadmap.md index 24b2ba37a6..9e12d9f6fe 100644 --- a/Roadmap.md +++ b/Roadmap.md @@ -88,7 +88,7 @@ Our plans around the view layer are to maintain strong integrations (along with ## Project Governance/Community Contribution -*Status: Since this topic was added to the roadmap, we have introduced *[*completely new contribution guidelines*](https://github.com/meteor/meteor/blob/devel/Contributing.md)* that outline exactly how to contribute to Meteor in several ways, including triaging issues, improving documentation, submitting designs for new features, and submitting PRs for bug fixes and improvements. We encourage proposals about how to make the process better via new GitHub issues.* +*Status: Since this topic was added to the roadmap, we have introduced *[completely new contribution guidelines](https://github.com/meteor/meteor/blob/devel/Contributing.md)* that outline exactly how to contribute to Meteor in several ways, including triaging issues, improving documentation, submitting designs for new features, and submitting PRs for bug fixes and improvements. We encourage proposals about how to make the process better via new GitHub issues.* Currently, it’s difficult for external developers to make meaningful contributions to Meteor as there is no clear guidance on what to work on, how best to do that work and signals around what will/won’t get merged. We plan on fixing this by creating tight documentation around how the project is developed (e.g the [Swift contribution guidelines](https://swift.org/contributing/)) and giving contributors a path towards earning increased privileges that culminate in full commit access. We’re also aiming to move more sub-projects into their own repositories that can be released on their own release schedule and more easily maintained by the community. From 8e32da57a128a70fdc09823b5d506758ce6a9b82 Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Tue, 13 Dec 2016 19:25:45 -0800 Subject: [PATCH 10/30] Update formatting again --- Roadmap.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Roadmap.md b/Roadmap.md index 9e12d9f6fe..94f3978295 100644 --- a/Roadmap.md +++ b/Roadmap.md @@ -88,12 +88,12 @@ Our plans around the view layer are to maintain strong integrations (along with ## Project Governance/Community Contribution -*Status: Since this topic was added to the roadmap, we have introduced *[completely new contribution guidelines](https://github.com/meteor/meteor/blob/devel/Contributing.md)* that outline exactly how to contribute to Meteor in several ways, including triaging issues, improving documentation, submitting designs for new features, and submitting PRs for bug fixes and improvements. We encourage proposals about how to make the process better via new GitHub issues.* +*Status: Since this topic was added to the roadmap, we have introduced [completely new contribution guidelines](https://github.com/meteor/meteor/blob/devel/Contributing.md) that outline exactly how to contribute to Meteor in several ways, including triaging issues, improving documentation, submitting designs for new features, and submitting PRs for bug fixes and improvements. We encourage proposals about how to make the process better via new GitHub issues.* Currently, it’s difficult for external developers to make meaningful contributions to Meteor as there is no clear guidance on what to work on, how best to do that work and signals around what will/won’t get merged. We plan on fixing this by creating tight documentation around how the project is developed (e.g the [Swift contribution guidelines](https://swift.org/contributing/)) and giving contributors a path towards earning increased privileges that culminate in full commit access. We’re also aiming to move more sub-projects into their own repositories that can be released on their own release schedule and more easily maintained by the community. -## **Other** +## Other For more completed items, refer to the project history here: https://github.com/meteor/meteor/blob/devel/History.md From ffd0a50f9487a0a9ffd7b6b415991c2022bf86fe Mon Sep 17 00:00:00 2001 From: brucejo Date: Sat, 17 Dec 2016 08:33:55 -0800 Subject: [PATCH 11/30] Check for is Array via _.isArray, instanceOf does not work cross window --- packages/observe-sequence/observe_sequence.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/observe-sequence/observe_sequence.js b/packages/observe-sequence/observe_sequence.js index 1a823ab019..68ec026591 100644 --- a/packages/observe-sequence/observe_sequence.js +++ b/packages/observe-sequence/observe_sequence.js @@ -94,7 +94,7 @@ ObserveSequence = { if (!seq) { seqArray = seqChangedToEmpty(lastSeqArray, callbacks); - } else if (seq instanceof Array) { + } else if (_.isArray(seq)) { seqArray = seqChangedToArray(lastSeqArray, seq, callbacks); } else if (isStoreCursor(seq)) { var result /* [seqArray, activeObserveHandle] */ = @@ -126,7 +126,7 @@ ObserveSequence = { fetch: function (seq) { if (!seq) { return []; - } else if (seq instanceof Array) { + } else if (_.isArray(seq)) { return seq; } else if (isStoreCursor(seq)) { return seq.fetch(); From 955c1c03b3ed4a7224fecfa6ab8afa41a87194f0 Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Mon, 19 Dec 2016 10:06:37 -0500 Subject: [PATCH 12/30] Adjusted minimongo to prohibit inserts with field names that contain dots, to address issue #3786. --- packages/minimongo/minimongo.js | 11 +++++++- packages/minimongo/minimongo_tests.js | 39 ++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/packages/minimongo/minimongo.js b/packages/minimongo/minimongo.js index 94db3fafdb..29e580ecfd 100644 --- a/packages/minimongo/minimongo.js +++ b/packages/minimongo/minimongo.js @@ -544,6 +544,16 @@ LocalCollection.prototype.insert = function (doc, callback) { var self = this; doc = EJSON.clone(doc); + // Make sure field names do not contain dots to line up with Mongo's + // field name restrictions: + // https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names + if (doc) { + const invalidFieldMatches = JSON.stringify(doc).match(/"([^"]*\.[^"]*)":/); + if (invalidFieldMatches && invalidFieldMatches.length === 2) { + throw MinimongoError(`Field ${invalidFieldMatches[1]} must not contain '.'`); + } + } + if (!_.has(doc, '_id')) { // if you really want to use ObjectIDs, set this global. // Mongo.Collection specifies its own ids and does not use this code. @@ -1110,4 +1120,3 @@ LocalCollection.prototype.resumeObservers = function () { } self._observeQueue.drain(); }; - diff --git a/packages/minimongo/minimongo_tests.js b/packages/minimongo/minimongo_tests.js index 2898156114..3919795125 100644 --- a/packages/minimongo/minimongo_tests.js +++ b/packages/minimongo/minimongo_tests.js @@ -2109,21 +2109,21 @@ Tinytest.add("minimongo - modify", function (test) { var upsert = function (query, mod, expected) { var coll = new LocalCollection; - + var result = coll.upsert(query, mod); - + var actual = coll.findOne(); - + if (expected._id) { test.equal(result.insertedId, expected._id); } else { delete actual._id; } - + test.equal(actual, expected); }; - + // document replacement modify({}, {}, {}); modify({a: 12}, {}, {}); // tested against mongodb @@ -2496,9 +2496,9 @@ Tinytest.add("minimongo - modify", function (test) { modify({a: 0}, {$setOnInsert: {a: 12}}, {a: 0}); upsert({a: 12}, {$setOnInsert: {b: 12}}, {a: 12, b: 12}); upsert({a: 12}, {$setOnInsert: {_id: 'test'}}, {_id: 'test', a: 12}); - + exception({}, {$set: {_id: 'bad'}}); - + // $bit // unimplemented @@ -3207,3 +3207,28 @@ Tinytest.add("minimongo - reactive skip/limit count while updating", function(te c.stop(); }); + +// Makes sure inserts cannot be performed using field names that have +// dots in them, to meet Mongo's field name restrictions. See: +// https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names +Tinytest.add("minimongo - cannot insert using invalid field names", function (test) { + const collection = new LocalCollection(); + + // Quick test to make sure non-dot field inserts are working + collection.insert({ a: 'b' }); + + // Quick test to make sure field values with dots are allowed + collection.insert({ a: 'b.c' }); + + // Verify top level dot-field inserts are prohibited + ['a.b', '.b', 'a.', 'a.b.c'].forEach((field) => { + test.throws(function () { + collection.insert({ [field]: 'c' }); + }, `Field ${field} must not contain '.'`); + }); + + // Verify nested dot-field inserts are prohibited + test.throws(function () { + collection.insert({ a: { b: { 'c.d': 'e' } } }); + }, "Field c.d must not contain '.'"); +}); From 5a3aa8394acc89b633ce0043a6e5a7de71e6ce07 Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Mon, 19 Dec 2016 11:47:00 -0500 Subject: [PATCH 13/30] Added ecmascript dependency; Replaced dot finding regex with JSON.stringify replacer function. --- packages/minimongo/minimongo.js | 10 ++++++---- packages/minimongo/package.js | 26 ++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/packages/minimongo/minimongo.js b/packages/minimongo/minimongo.js index 29e580ecfd..a54100e6c7 100644 --- a/packages/minimongo/minimongo.js +++ b/packages/minimongo/minimongo.js @@ -548,10 +548,12 @@ LocalCollection.prototype.insert = function (doc, callback) { // field name restrictions: // https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names if (doc) { - const invalidFieldMatches = JSON.stringify(doc).match(/"([^"]*\.[^"]*)":/); - if (invalidFieldMatches && invalidFieldMatches.length === 2) { - throw MinimongoError(`Field ${invalidFieldMatches[1]} must not contain '.'`); - } + JSON.stringify(doc, (key, value) => { + if (key.indexOf('.') > -1) { + throw MinimongoError(`Field ${key} must not contain '.'`); + } + return value; + }); } if (!_.has(doc, '_id')) { diff --git a/packages/minimongo/package.js b/packages/minimongo/package.js index acdeaf194b..7c65c1da14 100644 --- a/packages/minimongo/package.js +++ b/packages/minimongo/package.js @@ -7,8 +7,17 @@ Package.onUse(function (api) { api.export('LocalCollection'); api.export('Minimongo'); api.export('MinimongoTest', { testOnly: true }); - api.use(['underscore', 'ejson', 'id-map', 'ordered-dict', 'tracker', - 'mongo-id', 'random', 'diff-sequence']); + api.use([ + 'underscore', + 'ejson', + 'id-map', + 'ordered-dict', + 'tracker', + 'mongo-id', + 'random', + 'diff-sequence', + 'ecmascript' + ]); // This package is used for geo-location queries such as $near api.use('geojson-utils'); // This package is used to get diff results on arrays and objects @@ -39,8 +48,17 @@ Package.onUse(function (api) { Package.onTest(function (api) { api.use('minimongo', ['client', 'server']); api.use('test-helpers', 'client'); - api.use(['tinytest', 'underscore', 'ejson', 'ordered-dict', - 'random', 'tracker', 'reactive-var', 'mongo-id']); + api.use([ + 'tinytest', + 'underscore', + 'ejson', + 'ordered-dict', + 'random', + 'tracker', + 'reactive-var', + 'mongo-id', + 'ecmascript' + ]); api.addFiles('minimongo_tests.js', 'client'); api.addFiles('wrap_transform_tests.js'); api.addFiles('minimongo_server_tests.js', 'server'); From 36b76441c757e21757acbc2f2e0ceb10340b7aef Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Mon, 19 Dec 2016 12:47:27 -0500 Subject: [PATCH 14/30] Adjustment to make sure we're only checking string fields for dots. --- packages/minimongo/minimongo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/minimongo/minimongo.js b/packages/minimongo/minimongo.js index a54100e6c7..0f26f44cd0 100644 --- a/packages/minimongo/minimongo.js +++ b/packages/minimongo/minimongo.js @@ -549,7 +549,7 @@ LocalCollection.prototype.insert = function (doc, callback) { // https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names if (doc) { JSON.stringify(doc, (key, value) => { - if (key.indexOf('.') > -1) { + if (_.isString(key) && key.indexOf('.') > -1) { throw MinimongoError(`Field ${key} must not contain '.'`); } return value; From 8a81e7156e07ca9e1a6c2b2b89870eb4abe72a2d Mon Sep 17 00:00:00 2001 From: David Glasser Date: Mon, 19 Dec 2016 11:43:14 -0800 Subject: [PATCH 15/30] Fix missing var in mongo package. --- packages/mongo/mongo_driver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mongo/mongo_driver.js b/packages/mongo/mongo_driver.js index 77eabdc3b6..d16b6a540f 100644 --- a/packages/mongo/mongo_driver.js +++ b/packages/mongo/mongo_driver.js @@ -608,7 +608,7 @@ var isModificationMod = function (mod) { var transformResult = function (driverResult) { var meteorResult = { numberAffected: 0 }; if (driverResult) { - mongoResult = driverResult.result; + var mongoResult = driverResult.result; // On updates with upsert:true, the inserted values come as a list of // upserted values -- even with options.multi, when the upsert does insert, From e000e5351cd6d7da101b9a70a96b86670c9dbf79 Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Mon, 19 Dec 2016 15:38:28 -0500 Subject: [PATCH 16/30] Updated all webapp project URLs (issue #7843). --- packages/appcache/README.md | 2 +- packages/autoupdate/README.md | 2 +- packages/browser-policy/README.md | 2 +- packages/force-ssl/README.md | 2 +- packages/reload/README.md | 2 +- packages/routepolicy/README.md | 2 +- packages/spiderable/README.md | 2 +- packages/webapp/README.md | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/appcache/README.md b/packages/appcache/README.md index e74d791bff..ab07ead1ee 100644 --- a/packages/appcache/README.md +++ b/packages/appcache/README.md @@ -3,7 +3,7 @@ *** The `appcache` package, part of -[Webapp](https://www.meteor.com/webapp), stores the static parts of a +[Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp), stores the static parts of a Meteor application (the client side Javascript, HTML, CSS, and images) in the browser's [application cache](https://en.wikipedia.org/wiki/AppCache). diff --git a/packages/autoupdate/README.md b/packages/autoupdate/README.md index 26b7c0c2a4..810b8255bf 100644 --- a/packages/autoupdate/README.md +++ b/packages/autoupdate/README.md @@ -9,5 +9,5 @@ build of the app's client. When it sees that a new version is available, it uses the [reload](https://atmospherejs.com/meteor/reload) package (if included in the app) to gracefully save the app's state and reload it in place. -`autoupdate` is part of the [Webapp](https://www.meteor.com/webapp) +`autoupdate` is part of the [Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp) project. diff --git a/packages/browser-policy/README.md b/packages/browser-policy/README.md index 53cb941e32..38b388d123 100644 --- a/packages/browser-policy/README.md +++ b/packages/browser-policy/README.md @@ -3,7 +3,7 @@ *** The `browser-policy` family of packages, part of -[Webapp](https://www.meteor.com/webapp), lets you set security-related +[Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp), lets you set security-related policies that will be enforced by newer browsers. These policies help you prevent and mitigate common attacks like cross-site scripting and clickjacking. diff --git a/packages/force-ssl/README.md b/packages/force-ssl/README.md index ddfe0bb9ea..d32bdfe62d 100644 --- a/packages/force-ssl/README.md +++ b/packages/force-ssl/README.md @@ -2,7 +2,7 @@ [Source code of released version](https://github.com/meteor/meteor/tree/master/packages/force-ssl) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/force-ssl) *** -This package, part of [Webapp](https://www.meteor.com/webapp), causes +This package, part of [Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp), causes Meteor to redirect insecure connections (HTTP) to a secure URL (HTTPS). Use this package to ensure that communication to the server is always encrypted to protect users from active spoofing attacks. diff --git a/packages/reload/README.md b/packages/reload/README.md index ca025fbae0..9b4cb700c2 100644 --- a/packages/reload/README.md +++ b/packages/reload/README.md @@ -13,4 +13,4 @@ with `reload`. They can make the migration process wait until they are ready and include whatever state they may possess in the serialization and deserialization process. -`reload` is part of the [Webapp](https://www.meteor.com/webapp) project. +`reload` is part of the [Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp) project. diff --git a/packages/routepolicy/README.md b/packages/routepolicy/README.md index c825fda7f8..779aabc8b8 100644 --- a/packages/routepolicy/README.md +++ b/packages/routepolicy/README.md @@ -2,7 +2,7 @@ [Source code of released version](https://github.com/meteor/meteor/tree/master/packages/routepolicy) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/routepolicy) *** -RoutePolicy, part of [Webapp](https://www.meteor.com/webapp), is a +RoutePolicy, part of [Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp), is a low-level API for declaring the offline access semantics that apply to portions of the app's URL space. This is information is necessary when generating HTML5 Appcache manifests. diff --git a/packages/spiderable/README.md b/packages/spiderable/README.md index 9f9b65c32d..aa3ec74f47 100644 --- a/packages/spiderable/README.md +++ b/packages/spiderable/README.md @@ -2,7 +2,7 @@ [Source code of released version](https://github.com/meteor/meteor/tree/master/packages/spiderable) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/spiderable) *** -`spiderable` is part of [Webapp](https://www.meteor.com/webapp). It's one possible way to allow web search engines to index a Meteor application. It uses the [AJAX Crawling specification](https://developers.google.com/webmasters/ajax-crawling/) published by Google to serve HTML to compatible spiders (Google, Bing, Yandex, and more). +`spiderable` is part of [Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp). It's one possible way to allow web search engines to index a Meteor application. It uses the [AJAX Crawling specification](https://developers.google.com/webmasters/ajax-crawling/) published by Google to serve HTML to compatible spiders (Google, Bing, Yandex, and more). When a spider requests an HTML snapshot of a page the Meteor server runs the client half of the application inside [phantomjs](http://phantomjs.org/), a headless browser, and returns the full HTML generated by the client code. diff --git a/packages/webapp/README.md b/packages/webapp/README.md index f0af8c30a1..3a9c482f47 100644 --- a/packages/webapp/README.md +++ b/packages/webapp/README.md @@ -7,7 +7,7 @@ Meteor project into a web application. It is a "value added HTTP server" that includes not just a web server, but also advanced app serving functionality like over-the-air mobile app updates and HTML5 Appcache support. For more information, see the [Webapp project -page](https://www.meteor.com/webapp). +page](https://github.com/meteor/meteor/tree/devel/packages/webapp). ## Direct access to connect mongodb API From 7a4d6f66a0bb727ff20938479347415b1fa756a3 Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Mon, 19 Dec 2016 16:48:04 -0500 Subject: [PATCH 17/30] Adjusted DDP error docs to reflect proper error object properties (issue #7240). --- packages/ddp/DDP.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ddp/DDP.md b/packages/ddp/DDP.md index ca29b4b032..d9ce63731f 100644 --- a/packages/ddp/DDP.md +++ b/packages/ddp/DDP.md @@ -240,7 +240,8 @@ error is an Object with the following fields: * `error`: string (previously a number. See appendix 3) * `reason`: optional string - * `details`: optional string + * `message`: optional string + * `errorType`: pre-defined string with a value of `Meteor.Error` Such an Error is used to represent errors raised by the method or subscription, as well as an attempt to subscribe to an unknown subscription or call an unknown From 50d9de26f8b9af2eed386a4c8a26c0a53b2238b9 Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Tue, 20 Dec 2016 10:11:53 -0500 Subject: [PATCH 18/30] Updated the invalid field character check to include $ and null bytes. --- packages/minimongo/minimongo.js | 14 ++++++++++---- packages/minimongo/minimongo_tests.js | 28 ++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/packages/minimongo/minimongo.js b/packages/minimongo/minimongo.js index 0f26f44cd0..f79f2d4bc1 100644 --- a/packages/minimongo/minimongo.js +++ b/packages/minimongo/minimongo.js @@ -544,13 +544,19 @@ LocalCollection.prototype.insert = function (doc, callback) { var self = this; doc = EJSON.clone(doc); - // Make sure field names do not contain dots to line up with Mongo's - // field name restrictions: + // Make sure field names do not contain Mongo restricted + // characters ('.', '$', '\0'). // https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names if (doc) { + const invalidCharMsg = { + '.': "contain '.'", + '$': "start with '$'", + '\0': "contain null bytes", + }; JSON.stringify(doc, (key, value) => { - if (_.isString(key) && key.indexOf('.') > -1) { - throw MinimongoError(`Field ${key} must not contain '.'`); + let match; + if (_.isString(key) && (match = key.match(/^\$|\.|\0/))) { + throw MinimongoError(`Key ${key} must not ${invalidCharMsg[match[0]]}`); } return value; }); diff --git a/packages/minimongo/minimongo_tests.js b/packages/minimongo/minimongo_tests.js index 3919795125..1ddabaef90 100644 --- a/packages/minimongo/minimongo_tests.js +++ b/packages/minimongo/minimongo_tests.js @@ -3209,7 +3209,7 @@ Tinytest.add("minimongo - reactive skip/limit count while updating", function(te }); // Makes sure inserts cannot be performed using field names that have -// dots in them, to meet Mongo's field name restrictions. See: +// Mongo restricted characters in them ('.', '$', '\0'): // https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names Tinytest.add("minimongo - cannot insert using invalid field names", function (test) { const collection = new LocalCollection(); @@ -3224,11 +3224,33 @@ Tinytest.add("minimongo - cannot insert using invalid field names", function (te ['a.b', '.b', 'a.', 'a.b.c'].forEach((field) => { test.throws(function () { collection.insert({ [field]: 'c' }); - }, `Field ${field} must not contain '.'`); + }, `Key ${field} must not contain '.'`); }); // Verify nested dot-field inserts are prohibited test.throws(function () { collection.insert({ a: { b: { 'c.d': 'e' } } }); - }, "Field c.d must not contain '.'"); + }, "Key c.d must not contain '.'"); + + // Verify field names starting with $ are prohibited + test.throws(function () { + collection.insert({ '$a': 'b' }); + }, "Key $a must not start with '$'"); + + // Verify nested field names starting with $ are prohibited + test.throws(function () { + collection.insert({ a: { b: { '$c': 'd' } } }); + }, "Key $c must not start with '$'"); + + // Verify top level fields with null characters are prohibited + ['\0a', 'a\0', 'a\0b', '\u0000a', 'a\u0000', 'a\u0000b'].forEach((field) => { + test.throws(function () { + collection.insert({ [field]: 'c' }); + }, `Key ${field} must not contain null bytes`); + }); + + // Verify nested field names with null characters are prohibited + test.throws(function () { + collection.insert({ a: { b: { '\0c': 'd' } } }); + }, 'Key \0c must not contain null bytes'); }); From 91867c90db269739f8a171cea19bdf503b57ccef Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Wed, 21 Dec 2016 13:17:03 -0500 Subject: [PATCH 19/30] Updated webapp links to point to master instead of devel. --- packages/appcache/README.md | 2 +- packages/autoupdate/README.md | 2 +- packages/browser-policy/README.md | 2 +- packages/force-ssl/README.md | 2 +- packages/reload/README.md | 2 +- packages/routepolicy/README.md | 2 +- packages/spiderable/README.md | 2 +- packages/webapp/README.md | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/appcache/README.md b/packages/appcache/README.md index ab07ead1ee..d0d10221ca 100644 --- a/packages/appcache/README.md +++ b/packages/appcache/README.md @@ -3,7 +3,7 @@ *** The `appcache` package, part of -[Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp), stores the static parts of a +[Webapp](https://github.com/meteor/meteor/tree/master/packages/webapp), stores the static parts of a Meteor application (the client side Javascript, HTML, CSS, and images) in the browser's [application cache](https://en.wikipedia.org/wiki/AppCache). diff --git a/packages/autoupdate/README.md b/packages/autoupdate/README.md index 810b8255bf..f76824b62a 100644 --- a/packages/autoupdate/README.md +++ b/packages/autoupdate/README.md @@ -9,5 +9,5 @@ build of the app's client. When it sees that a new version is available, it uses the [reload](https://atmospherejs.com/meteor/reload) package (if included in the app) to gracefully save the app's state and reload it in place. -`autoupdate` is part of the [Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp) +`autoupdate` is part of the [Webapp](https://github.com/meteor/meteor/tree/master/packages/webapp) project. diff --git a/packages/browser-policy/README.md b/packages/browser-policy/README.md index 38b388d123..767931d2b2 100644 --- a/packages/browser-policy/README.md +++ b/packages/browser-policy/README.md @@ -3,7 +3,7 @@ *** The `browser-policy` family of packages, part of -[Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp), lets you set security-related +[Webapp](https://github.com/meteor/meteor/tree/master/packages/webapp), lets you set security-related policies that will be enforced by newer browsers. These policies help you prevent and mitigate common attacks like cross-site scripting and clickjacking. diff --git a/packages/force-ssl/README.md b/packages/force-ssl/README.md index d32bdfe62d..076fb3fe7e 100644 --- a/packages/force-ssl/README.md +++ b/packages/force-ssl/README.md @@ -2,7 +2,7 @@ [Source code of released version](https://github.com/meteor/meteor/tree/master/packages/force-ssl) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/force-ssl) *** -This package, part of [Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp), causes +This package, part of [Webapp](https://github.com/meteor/meteor/tree/master/packages/webapp), causes Meteor to redirect insecure connections (HTTP) to a secure URL (HTTPS). Use this package to ensure that communication to the server is always encrypted to protect users from active spoofing attacks. diff --git a/packages/reload/README.md b/packages/reload/README.md index 9b4cb700c2..0eb283305f 100644 --- a/packages/reload/README.md +++ b/packages/reload/README.md @@ -13,4 +13,4 @@ with `reload`. They can make the migration process wait until they are ready and include whatever state they may possess in the serialization and deserialization process. -`reload` is part of the [Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp) project. +`reload` is part of the [Webapp](https://github.com/meteor/meteor/tree/master/packages/webapp) project. diff --git a/packages/routepolicy/README.md b/packages/routepolicy/README.md index 779aabc8b8..7ccbb8e288 100644 --- a/packages/routepolicy/README.md +++ b/packages/routepolicy/README.md @@ -2,7 +2,7 @@ [Source code of released version](https://github.com/meteor/meteor/tree/master/packages/routepolicy) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/routepolicy) *** -RoutePolicy, part of [Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp), is a +RoutePolicy, part of [Webapp](https://github.com/meteor/meteor/tree/master/packages/webapp), is a low-level API for declaring the offline access semantics that apply to portions of the app's URL space. This is information is necessary when generating HTML5 Appcache manifests. diff --git a/packages/spiderable/README.md b/packages/spiderable/README.md index aa3ec74f47..22978f7c5a 100644 --- a/packages/spiderable/README.md +++ b/packages/spiderable/README.md @@ -2,7 +2,7 @@ [Source code of released version](https://github.com/meteor/meteor/tree/master/packages/spiderable) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/spiderable) *** -`spiderable` is part of [Webapp](https://github.com/meteor/meteor/tree/devel/packages/webapp). It's one possible way to allow web search engines to index a Meteor application. It uses the [AJAX Crawling specification](https://developers.google.com/webmasters/ajax-crawling/) published by Google to serve HTML to compatible spiders (Google, Bing, Yandex, and more). +`spiderable` is part of [Webapp](https://github.com/meteor/meteor/tree/master/packages/webapp). It's one possible way to allow web search engines to index a Meteor application. It uses the [AJAX Crawling specification](https://developers.google.com/webmasters/ajax-crawling/) published by Google to serve HTML to compatible spiders (Google, Bing, Yandex, and more). When a spider requests an HTML snapshot of a page the Meteor server runs the client half of the application inside [phantomjs](http://phantomjs.org/), a headless browser, and returns the full HTML generated by the client code. diff --git a/packages/webapp/README.md b/packages/webapp/README.md index 3a9c482f47..3a2810ccb3 100644 --- a/packages/webapp/README.md +++ b/packages/webapp/README.md @@ -7,7 +7,7 @@ Meteor project into a web application. It is a "value added HTTP server" that includes not just a web server, but also advanced app serving functionality like over-the-air mobile app updates and HTML5 Appcache support. For more information, see the [Webapp project -page](https://github.com/meteor/meteor/tree/devel/packages/webapp). +page](https://github.com/meteor/meteor/tree/master/packages/webapp). ## Direct access to connect mongodb API From 0a87fa5df6934bebff6819cfcae1f7bb23da806c Mon Sep 17 00:00:00 2001 From: Joshua Ohlman Date: Thu, 22 Dec 2016 07:52:11 -0600 Subject: [PATCH 20/30] Remove autopublish and insecure from the bare skeleton app Fixes #8145 --- tools/static-assets/skel-bare/.meteor/packages | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/static-assets/skel-bare/.meteor/packages b/tools/static-assets/skel-bare/.meteor/packages index 1615051104..7c56527178 100644 --- a/tools/static-assets/skel-bare/.meteor/packages +++ b/tools/static-assets/skel-bare/.meteor/packages @@ -17,6 +17,3 @@ standard-minifier-js # JS minifier run for production mode es5-shim # ECMAScript 5 compatibility for older browsers. ecmascript # Enable ECMAScript2015+ syntax in app code shell-server # Server-side component of the `meteor shell` command - -autopublish # Publish all data to the clients (for prototyping) -insecure # Allow all DB writes from clients (for prototyping) From fc54cdfa405204ec13ba75518b7697231ec42039 Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Thu, 22 Dec 2016 10:20:50 -0500 Subject: [PATCH 21/30] Made sure $set an $rename don't allow null bytes. --- packages/minimongo/minimongo_tests.js | 32 +++++++++++++++++++++++++++ packages/minimongo/modify.js | 10 +++++++++ 2 files changed, 42 insertions(+) diff --git a/packages/minimongo/minimongo_tests.js b/packages/minimongo/minimongo_tests.js index 1ddabaef90..eb66953178 100644 --- a/packages/minimongo/minimongo_tests.js +++ b/packages/minimongo/minimongo_tests.js @@ -3254,3 +3254,35 @@ Tinytest.add("minimongo - cannot insert using invalid field names", function (te collection.insert({ a: { b: { '\0c': 'd' } } }); }, 'Key \0c must not contain null bytes'); }); + +// Makes sure $set's cannot be performed using null bytes +// https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names +Tinytest.add("minimongo - cannot $set with null bytes", function (test) { + const collection = new LocalCollection(); + + // Quick test to make sure non-null byte $set's are working + const id = collection.insert({ a: 'b', 'c': 'd' }); + collection.update({ _id: id }, { $set: { e: 'f' } }); + + // Verify $set's with null bytes throw an exception + test.throws(() => { + collection.update({ _id: id }, { $set: { '\0a': 'b' } }); + }, 'Key \0a must not contain null bytes'); +}); + +// Makes sure $rename's cannot be performed using null bytes +// https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names +Tinytest.add("minimongo - cannot $rename with null bytes", function (test) { + const collection = new LocalCollection(); + + // Quick test to make sure non-null byte $rename's are working + let id = collection.insert({ a: 'b', c: 'd' }); + collection.update({ _id: id }, { $rename: { a: 'a1', c: 'c1' } }); + + // Verify $rename's with null bytes throw an exception + collection.remove({}); + id = collection.insert({ a: 'b', c: 'd' }); + test.throws(() => { + collection.update({ _id: id }, { $rename: { a: '\0a', c: 'c\0' } }); + }, "The 'to' field for $rename cannot contain an embedded null byte"); +}); diff --git a/packages/minimongo/modify.js b/packages/minimongo/modify.js index bb140d23e9..e5a81ba8f6 100644 --- a/packages/minimongo/modify.js +++ b/packages/minimongo/modify.js @@ -244,6 +244,11 @@ var MODIFIERS = { e.setPropertyError = true; throw e; } + if (_.isString(field) && field.indexOf('\0') > -1) { + // Null bytes are not allowed in Mongo field names + // https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names + throw MinimongoError(`Key ${field} must not contain null bytes`); + } target[field] = arg; }, $setOnInsert: function (target, field, arg) { @@ -457,6 +462,11 @@ var MODIFIERS = { throw MinimongoError("$rename source field invalid"); if (typeof arg !== "string") throw MinimongoError("$rename target must be a string"); + if (arg.indexOf('\0') > -1) { + // Null bytes are not allowed in Mongo field names + // https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names + throw MinimongoError("The 'to' field for $rename cannot contain an embedded null byte"); + } if (target === undefined) return; var v = target[field]; From b98d2711c6af5913b1f78db33c330bede752c6ca Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Thu, 22 Dec 2016 11:05:28 -0500 Subject: [PATCH 22/30] Small content change to point to the Meteor Tool README for "self test" info. --- Contributing.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Contributing.md b/Contributing.md index 38fa0880ad..97671ca415 100644 --- a/Contributing.md +++ b/Contributing.md @@ -276,3 +276,7 @@ example that you just want to run the Spacebars test suite. Just simple do `./me ./packages/spacebars-tests` and it will just run the test files from that one package. You can examine the `package.js` file for the `onTest` block, it outlines all the test files that should be run. + +### Running Meteor Tool tests + +While TinyTest and the `test-packages` command can be used to test internal Meteor packages, they cannot be used to test the Meteor Tool itself. The Meteor Tool is a node app that uses a home-grown "self test" system. For details on how to run Meteor Tool "self tests", please refer to the [Testing section of the Meteor Tool README](https://github.com/meteor/meteor/blob/master/tools/README.md#testing). From 433fd3bf2be660dd61817dba7bd73669f2529a7d Mon Sep 17 00:00:00 2001 From: Scott Brenner Date: Wed, 28 Dec 2016 11:55:33 -0800 Subject: [PATCH 23/30] Fixed twitter_configure.html URL In reference to https://github.com/meteor/meteor/issues/8190 --- packages/twitter/twitter_configure.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/twitter/twitter_configure.html b/packages/twitter/twitter_configure.html index 0a98c7b3fb..eed56c1959 100644 --- a/packages/twitter/twitter_configure.html +++ b/packages/twitter/twitter_configure.html @@ -4,7 +4,7 @@

  1. - Visit https://dev.twitter.com/apps/new + Visit https://apps.twitter.com/app/new
  2. Set Website to: {{siteUrl}} From 3d3c81830a0c85ffb520b7119998993973159456 Mon Sep 17 00:00:00 2001 From: Oleksandr Chekhovskyi Date: Wed, 21 Dec 2016 15:29:05 +0100 Subject: [PATCH 24/30] Update node-mongodb driver to 2.2.16 This fixes an issue where the driver fails to recover from unresponsive primary in a replica set. --- .../npm-mongo/.npm/package/npm-shrinkwrap.json | 18 +++++++++--------- packages/npm-mongo/package.js | 4 ++-- tools/runners/run-mongo.js | 6 +++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/npm-mongo/.npm/package/npm-shrinkwrap.json b/packages/npm-mongo/.npm/package/npm-shrinkwrap.json index 4493b91832..99567900d0 100644 --- a/packages/npm-mongo/.npm/package/npm-shrinkwrap.json +++ b/packages/npm-mongo/.npm/package/npm-shrinkwrap.json @@ -1,9 +1,9 @@ { "dependencies": { "bson": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/bson/-/bson-0.5.6.tgz", - "from": "bson@>=0.5.6 <0.6.0" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.1.tgz", + "from": "bson@>=1.0.1 <1.1.0" }, "buffer-shims": { "version": "1.0.0", @@ -31,14 +31,14 @@ "from": "isarray@>=1.0.0 <1.1.0" }, "mongodb": { - "version": "2.2.11", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.11.tgz", - "from": "mongodb@2.2.11" + "version": "2.2.16", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.16.tgz", + "from": "mongodb@2.2.16" }, "mongodb-core": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-2.0.13.tgz", - "from": "mongodb-core@2.0.13" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-2.1.2.tgz", + "from": "mongodb-core@2.1.2" }, "process-nextick-args": { "version": "1.0.7", diff --git a/packages/npm-mongo/package.js b/packages/npm-mongo/package.js index 8a21cb4846..c5bc711eaf 100644 --- a/packages/npm-mongo/package.js +++ b/packages/npm-mongo/package.js @@ -3,12 +3,12 @@ Package.describe({ summary: "Wrapper around the mongo npm package", - version: '2.2.11_2', + version: '2.2.16_1', documentation: null }); Npm.depends({ - mongodb: "2.2.11" + mongodb: "2.2.16" }); Package.onUse(function (api) { diff --git a/tools/runners/run-mongo.js b/tools/runners/run-mongo.js index a8a2dab23f..e3cf6b3a53 100644 --- a/tools/runners/run-mongo.js +++ b/tools/runners/run-mongo.js @@ -591,8 +591,12 @@ var launchMongo = function (options) { // Connect to the intended primary and start a replset. var db = new mongoNpmModule.Db( 'meteor', - new mongoNpmModule.Server('127.0.0.1', options.port, {poolSize: 1}), + new mongoNpmModule.Server('127.0.0.1', options.port, { + poolSize: 1, + socketOptions: {connectTimeoutMS: 30000}, + }), {safe: true}); + yieldingMethod(db, 'open'); if (stopped) { return; From dfbd5520441869a66d4adc0e77ad766ed5fab4c4 Mon Sep 17 00:00:00 2001 From: Mitar Date: Fri, 30 Dec 2016 09:52:23 +0100 Subject: [PATCH 25/30] Updated submodule to new Blaze history. --- packages/non-core/blaze | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/non-core/blaze b/packages/non-core/blaze index dd65753c32..637dac5914 160000 --- a/packages/non-core/blaze +++ b/packages/non-core/blaze @@ -1 +1 @@ -Subproject commit dd65753c32b5535e33772ceb7ca16e998aaf6f24 +Subproject commit 637dac59146e74e2d384e8ea15b4cb7a8cb67896 From f0a2c8cfe4a252cb928b27bc607767d3952eb00e Mon Sep 17 00:00:00 2001 From: Eliezer Date: Fri, 30 Dec 2016 02:39:56 -1000 Subject: [PATCH 26/30] Fastclick will break selects on Chrome mobile See here: https://github.com/ftlabs/fastclick/issues/497 And here: https://productforums.google.com/forum/#!topic/chrome/Q4Rt6d0C4Qo I just spent hours trying to figure out why selects haven't been working on my site, and finally found out it was fastclick. --- packages/fastclick/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/fastclick/README.md b/packages/fastclick/README.md index 5d1f8e4ffa..267a2b5bed 100644 --- a/packages/fastclick/README.md +++ b/packages/fastclick/README.md @@ -2,6 +2,10 @@ [Source code of released version](https://github.com/meteor/meteor/tree/master/packages/fastclick) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/fastclick) *** +``` +As of late 2015 most mobile browsers - notably Chrome and Safari - no longer have a 300ms touch delay, so fastclick offers no benefit on newer browsers, and risks introducing [bugs](https://github.com/ftlabs/fastclick/issues) into your application. Consider carefully whether you really need to use it. +``` + FastClick is a simple, easy-to-use library for eliminating the 300ms delay between a physical tap and the firing of a `click` event on mobile browsers. The aim is to make your application feel less laggy and more responsive while From 229b7e7c78b236b89dcb0c54f236ad8554daabc8 Mon Sep 17 00:00:00 2001 From: Eliezer Date: Fri, 30 Dec 2016 04:04:05 -1000 Subject: [PATCH 27/30] Update README.md --- packages/fastclick/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/fastclick/README.md b/packages/fastclick/README.md index 267a2b5bed..e5a1cf6bca 100644 --- a/packages/fastclick/README.md +++ b/packages/fastclick/README.md @@ -2,9 +2,7 @@ [Source code of released version](https://github.com/meteor/meteor/tree/master/packages/fastclick) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/fastclick) *** -``` -As of late 2015 most mobile browsers - notably Chrome and Safari - no longer have a 300ms touch delay, so fastclick offers no benefit on newer browsers, and risks introducing [bugs](https://github.com/ftlabs/fastclick/issues) into your application. Consider carefully whether you really need to use it. -``` +> **Warning:** As of late 2015 most mobile browsers - notably Chrome and Safari - no longer have a 300ms touch delay, so fastclick offers no benefit on newer browsers, and risks introducing [bugs](https://github.com/ftlabs/fastclick/issues) into your application. Consider carefully whether you really need to use it. FastClick is a simple, easy-to-use library for eliminating the 300ms delay between a physical tap and the firing of a `click` event on mobile browsers. The From d15e1f91725e04a831152b003247eeda5cf746ee Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Thu, 29 Dec 2016 20:32:58 +0200 Subject: [PATCH 28/30] Ensure `babel-runtime` is included in skelton variations & bump versions Also updated the `meteor-node-stubs` to the latest published release. Closes meteor/meteor#8202 --- tools/static-assets/skel-bare/package.json | 3 ++- tools/static-assets/skel-full/package.json | 4 ++-- tools/static-assets/skel/package.json | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/static-assets/skel-bare/package.json b/tools/static-assets/skel-bare/package.json index 509ac7e54f..0700d68455 100644 --- a/tools/static-assets/skel-bare/package.json +++ b/tools/static-assets/skel-bare/package.json @@ -5,6 +5,7 @@ "start": "meteor run" }, "dependencies": { - "meteor-node-stubs": "~0.2.0" + "babel-runtime": "^6.20.0", + "meteor-node-stubs": "~0.2.4" } } diff --git a/tools/static-assets/skel-full/package.json b/tools/static-assets/skel-full/package.json index 8c667e0354..0700d68455 100644 --- a/tools/static-assets/skel-full/package.json +++ b/tools/static-assets/skel-full/package.json @@ -5,7 +5,7 @@ "start": "meteor run" }, "dependencies": { - "babel-runtime": "^6.18.0", - "meteor-node-stubs": "~0.2.3" + "babel-runtime": "^6.20.0", + "meteor-node-stubs": "~0.2.4" } } diff --git a/tools/static-assets/skel/package.json b/tools/static-assets/skel/package.json index c56bdcbd4d..0700d68455 100644 --- a/tools/static-assets/skel/package.json +++ b/tools/static-assets/skel/package.json @@ -5,7 +5,7 @@ "start": "meteor run" }, "dependencies": { - "meteor-node-stubs": "~0.2.0", - "babel-runtime": "6.18.0" + "babel-runtime": "^6.20.0", + "meteor-node-stubs": "~0.2.4" } } From 2eab0b2bf4d635c0a7d8b3f2b1569e03b73a4325 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Tue, 3 Jan 2017 12:43:00 -0500 Subject: [PATCH 29/30] Preserve true "main" and "browser" fields of package.json modules. Previously, when building a JavaScript bundle for the client, if a package.json file had a string-valued "browser" field, we would replace the value of the "main" field of the bundled package.json module with the value of the "browser" field. This trick was important because it allowed an npm package to have a different entry point on the client than it had on the server. However, that approach became inconsistent if the package.json file was also explicitly imported as a module, because the package.json stub used for module resolution prevented the real contents of package.json from getting bundled, and disagreed with the original package.json module about the value of the "main" field. To resolve that inconsistency, it seems better to avoid modifying the "main" field of package.json modules, and instead rely on the runtime module system to make sense of the "browser" field, regardless of whether the package.json module is a stub used only for module resolution or contains the full contents of the original package.json file. The ability to understand "browser" fields of package.json modules was introduced in install@0.8.3: https://github.com/benjamn/install/commit/377d1a3b5138904d63f4594fd4c12f756454d277 This is potentially a backwards-incompatible change for developers using this version of `ImportScanner` and `Resolver` who have not yet upgraded their `modules-runtime` package to at least version 0.7.8. The solution is to upgrade `modules-runtime`, though it would be nice to enforce that better somehow. --- History.md | 11 +++++++- .../.npm/package/npm-shrinkwrap.json | 6 ++-- packages/modules-runtime/modules-runtime.js | 4 +++ packages/modules-runtime/package.js | 4 +-- tools/isobuild/import-scanner.js | 18 +++++++++++- tools/isobuild/resolver.js | 28 +++++++++++-------- 6 files changed, 52 insertions(+), 19 deletions(-) diff --git a/History.md b/History.md index b3a36ad74a..d73befad20 100644 --- a/History.md +++ b/History.md @@ -22,7 +22,16 @@ * Added support for frame-ancestors CSP option in browser-policy. [#7970](https://github.com/meteor/meteor/pull/7970) -* You can now use autoprefixer with stylus files added via packages [#7727](https://github.com/meteor/meteor/pull/7727) +* You can now use autoprefixer with stylus files added via packages. + [#7727](https://github.com/meteor/meteor/pull/7727) + +* The `"main"` field of `package.json` modules will no longer be + overwritten with the value of the optional `"browser"` field, now that + the `install` npm package can make sense of the `"browser"` field at + runtime. If you experience module resolution failures on the client + after updating Meteor, make sure you've updated the `modules-runtime` + Meteor package to at least version 0.7.8. + [#8213](https://github.com/meteor/meteor/pull/8213) ## v1.4.2.3 diff --git a/packages/modules-runtime/.npm/package/npm-shrinkwrap.json b/packages/modules-runtime/.npm/package/npm-shrinkwrap.json index ceac639e6f..6d78385bdf 100644 --- a/packages/modules-runtime/.npm/package/npm-shrinkwrap.json +++ b/packages/modules-runtime/.npm/package/npm-shrinkwrap.json @@ -1,9 +1,9 @@ { "dependencies": { "install": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/install/-/install-0.8.2.tgz", - "from": "install@0.8.2" + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/install/-/install-0.8.4.tgz", + "from": "install@0.8.4" } } } diff --git a/packages/modules-runtime/modules-runtime.js b/packages/modules-runtime/modules-runtime.js index 30403e3fbc..da38e75648 100644 --- a/packages/modules-runtime/modules-runtime.js +++ b/packages/modules-runtime/modules-runtime.js @@ -13,6 +13,10 @@ if (typeof Profile === "function" && }; } +// On the client, make package resolution prefer the "browser" field of +// package.json files to the "main" field. +options.browser = Meteor.isClient; + // This function will be called whenever a module identifier that hasn't // been installed is required. For backwards compatibility, and so that we // can require binary dependencies on the server, we implement the diff --git a/packages/modules-runtime/package.js b/packages/modules-runtime/package.js index 2cf3791782..224d83dc0c 100644 --- a/packages/modules-runtime/package.js +++ b/packages/modules-runtime/package.js @@ -1,13 +1,13 @@ Package.describe({ name: "modules-runtime", - version: "0.7.7", + version: "0.7.8", summary: "CommonJS module system", git: "https://github.com/benjamn/install", documentation: "README.md" }); Npm.depends({ - install: "0.8.2" + install: "0.8.4" }); Package.onUse(function(api) { diff --git a/tools/isobuild/import-scanner.js b/tools/isobuild/import-scanner.js index 23c8127930..f95fa14556 100644 --- a/tools/isobuild/import-scanner.js +++ b/tools/isobuild/import-scanner.js @@ -505,6 +505,16 @@ export default class ImportScanner { let depFile = this._getFile(absImportedPath); if (depFile) { + // If the module was imported implicitly before, update to the + // explicit version now. + if (depFile.imported === "implicit") { + const file = this._readModule(absImportedPath); + if (file) { + Object.assign(depFile, file); + depFile.imported = true; + } + } + // Avoid scanning files that we've scanned before, but mark them // as imported so we know to include them in the bundle if they // are lazy. Eager files and files that we have imported before do @@ -827,7 +837,13 @@ export default class ImportScanner { servePath: relPkgJsonPath, hash: sha1(data), lazy: true, - imported: true, + // Since _addPkgJsonToOutput is only ever called for package.json + // files that are involved in resolving package directories, and + // pkg is only a subset of the information in the actual + // package.json module, we mark it as being imported implicitly, + // so that the subset can be overridden by the actual module if + // this package.json file is imported explicitly elsewhere. + imported: "implicit", }; this._addFile(pkgJsonPath, pkgFile); diff --git a/tools/isobuild/resolver.js b/tools/isobuild/resolver.js index ac00eb2ce0..70e5f7703c 100644 --- a/tools/isobuild/resolver.js +++ b/tools/isobuild/resolver.js @@ -285,26 +285,30 @@ export default class Resolver { return null; } - let main = pkg.main; + // Output a JS module that exports just the "name", "version", "main", + // and "browser" properties (if defined) from the package.json file. + const pkgSubset = {}; - if (archMatches(this.targetArch, "web") && - isString(pkg.browser)) { - main = pkg.browser; + if (has(pkg, "name")) { + pkgSubset.name = pkg.name; } - // Output a JS module that exports just the "name", "version", and - // "main" properties defined in the package.json file. - const pkgSubset = { - name: pkg.name, - }; - if (has(pkg, "version")) { pkgSubset.version = pkg.version; } - if (isString(main)) { - pkgSubset.main = main; + let main = pkg.main; + if (has(pkg, "main")) { + pkgSubset.main = pkg.main; + } + if (archMatches(this.targetArch, "web") && + isString(pkg.browser)) { + main = pkg.browser; + pkgSubset.browser = pkg.browser; + } + + if (isString(main)) { // The "main" field of package.json does not have to begin with ./ // to be considered relative, so first we try simply appending it to // the directory path before falling back to a full resolve, which From c29a1e9b0be6f7cb0472eaa96213b99b5530bff0 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Tue, 3 Jan 2017 13:32:08 -0500 Subject: [PATCH 30/30] Remove packages/ui (superseded by packages/non-core/blaze/packages/ui). https://github.com/meteor/meteor/pull/8212#issuecomment-270330469 --- packages/ui/.gitignore | 1 - packages/ui/README.md | 5 ----- packages/ui/package.js | 16 ---------------- 3 files changed, 22 deletions(-) delete mode 100644 packages/ui/.gitignore delete mode 100644 packages/ui/README.md delete mode 100644 packages/ui/package.js diff --git a/packages/ui/.gitignore b/packages/ui/.gitignore deleted file mode 100644 index 677a6fc263..0000000000 --- a/packages/ui/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.build* diff --git a/packages/ui/README.md b/packages/ui/README.md deleted file mode 100644 index 33120c7c56..0000000000 --- a/packages/ui/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# ui -[Source code of released version](https://github.com/meteor/meteor/tree/master/packages/ui) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/ui) -*** - -This is an internal Meteor package. \ No newline at end of file diff --git a/packages/ui/package.js b/packages/ui/package.js deleted file mode 100644 index 680a4a272b..0000000000 --- a/packages/ui/package.js +++ /dev/null @@ -1,16 +0,0 @@ -Package.describe({ - summary: "Deprecated: Use the 'blaze' package", - version: '1.0.11' -}); - -Package.onUse(function (api) { - api.use('blaze'); - api.imply('blaze'); - - // XXX COMPAT WITH PACKAGES BUILT FOR 0.9.0. - // - // (in particular, packages that have a weak dependency on this - // package, since then exported symbols live on the - // `Package.ui` object) - api.export(['Blaze', 'UI', 'Handlebars']); -});