Commit Graph

20295 Commits

Author SHA1 Message Date
Ben Newman
d690906f7f Bump package versions for 1.6.1-beta.8 release. release/METEOR@1.6.1-beta.8 2017-11-17 14:47:17 -05:00
Ben Newman
5bdf684525 Merge branch 'devel' into release-1.6.1 2017-11-17 14:34:11 -05:00
Ben Newman
c4bcf91519 Bump ecmascript version to 0.10.0 instead of 0.9.1.
Since the new version of ecmascript depends directly on dynamic-import,
it's important that it's a version of dynamic-import that does not depend
indirectly on ecmascript, and I'm not sure if the constraint solver can
figure that out easily without a little help.
2017-11-17 14:31:33 -05:00
Ben Newman
ac085d96fb Merge pull request #9382 from meteor/abernix/fix-cordova-add
Ensure that Cordova is installed for `meteor [add | remove] cordova:*`.
2017-11-17 14:11:51 -05:00
Ben Newman
981fb3c88d Merge pull request #9384 from meteor/dynamic-import-via-http-post
Support fetching dynamic modules via HTTP POST requests.
2017-11-17 14:11:19 -05:00
Ben Newman
1c2d6c6382 Improve readability of dynamic-import helper function.
Per feedback from @abernix:
https://github.com/meteor/meteor/pull/9384#discussion_r151743041
2017-11-17 13:29:49 -05:00
Jesse Rosenberger
2fee9e4d7f Change let to const for some nearby use cases. 2017-11-17 20:27:54 +02:00
Jesse Rosenberger
1ed7796956 Change nested imports to share related, top-level imports.
I believe at one point some of this nesting was important to avoid
cycles in the dependency graph, but that no longer seems to be the
case.
2017-11-17 20:26:33 +02:00
Ben Newman
b81872b01a Remove weak dependency on browser-policy-common from dynamic-import.
Even a weak dependency affects the load order of packages by forcing the
depended-on package to load before the dependent package. Waiting until
Meteor.startup to check for Package["browser-policy-common"] dynamically
does not have this problem.
2017-11-17 13:20:30 -05:00
Jesse Rosenberger
5e4ee8dc36 Only import necessary functions from cordova, not *.
The rest of the module is not necessary.
2017-11-17 20:17:21 +02:00
Ben Newman
d0566bbb18 Make bundle-visualizer use HTTP instead of Meteor.call.
If you're trying to visualize the bundle of an application that does not
use ddp-client, it's annoying if bundle-visualizer pulls in all those
dependencies just to support itself.

cc @abernix
2017-11-17 13:11:20 -05:00
Ben Newman
a80af7e064 Move dynamic-import dependency from meteor-base to ecmascript.
Now that dynamic-import no longer depends indirectly on ecmascript, the
ecmascript package can finally guarantee support for dynamic `import()`,
as it rightfully should.
2017-11-17 12:04:25 -05:00
Ben Newman
2f3bbcde70 Bump dynamic-import package version to 0.3.0. 2017-11-16 20:11:28 -05:00
Ben Newman
bdab67274b Talk about dynamic imports over HTTP in History.md. 2017-11-16 20:11:28 -05:00
Ben Newman
305abbefb8 Upgrade install to allow batching of dynamic import() requests.
Now that we're using HTTP POST requests to fetch dynamic modules, it's
more important to make fewer requests when possible, given the higher
latency of HTTP requests compared to WebSocket messages.

The trick is to wait until the next tick of the event loop before actually
sending the request, so that multiple dynamic import() calls in quick
succession are treated as a single request, and all the modules they
require can be returned in a single response object.

For example, we want code like this

  const [
    React,
    ReactDOM
  ] = await Promise.all([
    import("react"),
    import("react-dom")
  ]);

to result in one HTTP POST request for both `react` and `react-dom`, as
well as all their dependencies, rather than two separate requests.
Indeed, that is what happens, since both import() calls take place in the
same tick of the event loop.
2017-11-16 19:49:06 -05:00
Ben Newman
088432410c Remove webapp and random dependencies from dynamic-import.
Letting dynamic-import depend on packages that depend on ecmascript means
ecmascript and its dependencies can't depend on dynamic-import. This
commit gives us back that flexibility.
2017-11-16 19:49:06 -05:00
Ben Newman
a7a63cd743 Allow only server-side code to fetch dynamic server modules.
Each time the server starts, the dynamic-import/server.js module creates a
secret key for accessing dynamic server modules, then exposes that key to
the server-side dynamic-import/client.js module, and no one else.

If client.setSecretKey has been called, that key will be included as a
query parameter in each /__dynamicImport POST request. If it matches the
actual secret key, access is granted to the corresponding dynamic modules;
otherwise, only web.browser dynamic modules are made available.
2017-11-16 19:49:06 -05:00
Ben Newman
d073990a3a Prune dynamic imports result tree rather than failing on error. 2017-11-16 19:49:06 -05:00
Ben Newman
e24eec2084 Support fetching dynamic modules via HTTP POST requests.
Ever since Meteor 1.5 first shipped, dynamic modules have been fetched
over a WebSocket, which is appealing because sockets have very little
latency and metadata overhead per round-trip.

However, using a WebSocket requires first establishing a socket connection
to the server, which takes time and may require a WebSocket polyfill.

An even more subtle problem is that we cannot use dynamic imports in any
of the code that implements the ddp-client package, as long as the
dynamic-import package depends on ddp-client.

By switching from WebSockets to HTTP POST requests, this commit radically
reduces the dependencies of the dynamic-import package, while preserving
(or even exceeding) the benefits of socket-based dynamic module fetching:

1. The client makes a single HTTP POST request for the exact set of
   dynamic modules that it needs, which is much cheaper/faster than making
   several/many HTTP requests in parallel, with or without HTTP/2.

2. Because the client uses a permanent cache (IndexedDB) to avoid
   requesting any modules it has ever previously received, the lack of
   HTTP caching for POST requests is not a problem.

3. Because the HTTP response contains all the requested dynamic modules in
   a single JSON payload, gzip compression works across modules, which
   produces a smaller total response size than if each individual module
   was compressed by itself.

4. Although HTTP requests have more latency than WebSocket messages, the
   ability to make HTTP requests begins much sooner than a WebSocket
   connection can be established, which more than makes up for the latency
   disadvantage.

5. HTTP requests are a little easier to inspect and debug in the dev tools
   than WebSocket frames.

6. The new /__dynamicImport HTTP endpoint is a raw Connect/Express-style
   endpoint, so it bypasses the Meteor method-calling system altogether,
   which eliminates some additional overhead.

7. Fetching dynamic modules no longer competes with other WebSocket
   traffic such as DDP and Livedata.

8. Although the implementation of the /__dynamicImport endpoint is a bit
   too complicated to allow serving dynamic modules from a CDN, that
   remains a possibility for future experimentation. In other words, how
   modules are fetched is still just an implementation detail of the
   `meteorInstall.fetch` callback.

9. As with the WebSocket implementation, the module server is totally
   stateless, so it should be easy to scale up if necessary.

I wish I had appreciated the advantages of an HTTP-based implementation
sooner, but I think the transition will be pretty seamless, since the new
implementation is completely backwards compatible with the old.
2017-11-16 19:49:06 -05:00
Ben Newman
80e564e9c3 Remove underscore from url package, and use modules. 2017-11-16 19:49:06 -05:00
Ben Newman
21275011bd Remove underscore from http package, and use modules.
I replaced the ecmascript package with just the modules package so that
ecmascript and its dependencies can depend on http without creating
package dependency cycles.

I also took this opportunity to upgrade the `request` npm dependency to
its latest version (2.83.0), and removed the `deprecated.js` file, which
used to define `Meteor.http`.
2017-11-16 19:49:05 -05:00
Jesse Rosenberger
ecec5a1ad0 Ensure that Cordova is installed for meteor [add |remove] cordova:*.
In the same spirit as the changes made in
https://github.com/meteor/meteor/pull/8976.

Fixes: https://github.com/meteor/meteor/issues/9257.
2017-11-17 02:15:04 +02:00
Ben Newman
80e8b26506 Allow Meteor.startup to work in isopackets and build plugins.
Since global.__meteor_bootstrap__ is not defined in plugins, the callback
will simply be called immediately.
2017-11-16 19:05:26 -05:00
Hugh Willson
27ed9bc2e8 Allow scoped Cordova packages to be installed
Fixes an issue preventing the installation of scoped Cordova
packages. For example,
`meteor add cordova:@somescope/some-cordova-plugin@1.0.0`
will now work properly.

Fixes https://github.com/meteor/meteor/issues/7336.
2017-11-17 01:58:54 +02:00
Jack Kavanagh
dd5ea2b950 can resolve private npm package when adding cordova plugin 2017-11-17 01:57:48 +02:00
Jesse Rosenberger
6f42d36279 Update ISSUE_TEMPLATE.md
Clarify that it's not necessary to include the word Meteor in the title, and that the title doesn't have to be _too_ descriptive.
2017-11-16 17:09:59 +02:00
Ben Newman
3da9cf8fd6 Merge pull request #9371 from meteor/extract-socket-stream-client
Extract ClientStream into its own package.
2017-11-15 17:34:30 -05:00
Ben Newman
fe05aa7b4c Make ClientStream ConnectionError type configurable.
I'm intentionally leaving forcedReconnectError as a non-configurable
singleton Error object.
2017-11-15 13:22:11 -05:00
Ben Newman
3ba8af8519 Remove no-longer-necessary ClientStream-related imports from ddp-client. 2017-11-15 13:21:50 -05:00
Ben Newman
2dd4043478 Extract ClientStream into its own package. 2017-11-15 13:21:50 -05:00
Hugh Willson
3e28d5d49c Adjust observeChanges skip/limit ordered observe error message (#9373)
* Adjust observeChanges skip/limit ordered observe error message

The `Cursor.observeChanges` function throws an error when there
is an attempt to use an unordered observe with skip/limit.
This error can also be thrown when attempting the same thing
with `Cursor.observe`. This is because `Cursor.observe` ends
up calling back to `Cursor.observeChanges`. When using
`Cursor.observe` however, the shared error message
is a bit misleading, as `addedAt` should be used instead of
`addedBefore`. This commit adjusts the shared error message to
cover both `observeChanges` and `observe` scenarios.

Fixes #4996.

* Bump minimongo patch version
2017-11-15 12:59:30 -05:00
Jesse Rosenberger
e8c58677f2 Merge branch 'master' into devel 2017-11-15 19:50:45 +02:00
Jesse Rosenberger
9cae673e1d Merge pull request #9370 from skirunman/patch-2
Fix history file
2017-11-15 19:49:51 +02:00
skirunman
2439082fbb Update History.md for PR #9198 (#9227)
Removed this change from https://github.com/meteor/meteor/pull/9213 as it goes with https://github.com/meteor/meteor/pull/9198
2017-11-15 19:12:40 +02:00
Jesse Rosenberger
8bef5bf20c Merge pull request #9368 from hwillson/issue-9138
Update minifier-js uglify-es dependency to latest version
2017-11-15 19:01:12 +02:00
Jesse Rosenberger
55ccc0f203 Merge pull request #9366 from meteor/abernix/stop-installing-self-test-npms
Stop pre-installing phantomjs-prebuilt and browserstack-webdriver.
2017-11-14 22:51:46 +02:00
Ben Newman
4911b1e7f6 Bump package versions for 1.6.1-beta.7 release. release/METEOR@1.6.1-beta.7 2017-11-14 14:24:18 -05:00
Ben Newman
62690c07ec Merge branch 'devel' into release-1.6.1 2017-11-14 14:22:16 -05:00
Ben Newman
a1ed6b48e8 Two more minor version bumps, due to removal of es5-shim weak deps. 2017-11-14 14:21:11 -05:00
Ben Newman
e74d31d6e6 Bump reload package to 1.2.0.
In my previous version-bumping commit, I accidentally went from 1.1.11
back to 1.1.0.
2017-11-14 14:10:05 -05:00
Ben Newman
944b8a1ab2 Bump package versions for 1.6.1-beta.6 release. release/METEOR@1.6.1-beta.6 2017-11-14 13:45:58 -05:00
Hugh Willson
3f09a0e0ee Update minifier-js uglify-es dependency to latest version 2017-11-14 13:42:18 -05:00
Ben Newman
eaf96699ad Merge branch 'devel' into release-1.6.1 2017-11-14 13:35:03 -05:00
Ben Newman
bac168b4ca Bulk-bump minor versions of recently changed packages. 2017-11-14 13:31:10 -05:00
Ben Newman
de75fb6b18 Merge pull request #9362 from meteor/remove-underscore-from-various-packages
Remove underscore from various remaining packages.
2017-11-14 11:32:42 -05:00
Ben Newman
f38ee8f480 Merge pull request #9360 from meteor/server-render-es5-shim
Selectively server-render es5-shim <script> tag, as with sockjs-shim.
2017-11-14 11:31:24 -05:00
Ben Newman
d230ad51cd Imply es5-shim from meteor-base.
Now that es5-shim has no impact on modern browsers (thanks to selectively
server-side rendering a <script> tag for older browsers), there's very
little reason not to use it.

If you really don't want to use it, you can always remove meteor-base and
install your preferred set of base packages.
2017-11-14 10:10:50 -05:00
Ben Newman
b234cab480 Factor out common logic from sockjs-shim and es5-shim.
Thanks to @hwillson for this suggestion.
2017-11-14 10:10:49 -05:00
Ben Newman
2a4caf9846 Avoid symlinks into es5-shim npm package, for Windows' sake. 2017-11-14 10:10:49 -05:00
Ben Newman
f33457a0ad Server-render es5-shim <script> tags like sockjs-shim.
Just as we were able to remove the SockJS polyfill library entirely from
the client JS bundle for modern browsers (#9353), we can do the same with
the `es5-shim` package.

The removes 28KB from the size of the minified JS bundle (before gzip).

It is no longer necessary for other packages to register weak dependencies
on `es5-shim`, because `es5-shim` will be reliably loaded in the `<head>`
if installed, which guarantees it will be evaluated before any bundled JS
in packages or the application.

In addition to loading `es5-shim` and `es5-sham` using `<script>` tags on
the client, we no longer evaluate either script on the server, since Node
8 has solid support for everything that previously needed shimming.
2017-11-14 10:10:49 -05:00