Commit Graph

22356 Commits

Author SHA1 Message Date
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
Jesse Rosenberger
7117d30e0f Stop pre-installing phantomjs-prebuilt and browserstack-webdriver.
While this was necessary in previous versions of Meteor, as of 1.6 the
`self-test` tooling will automatically install the dependencies it needs
at runtime.

Not only does this allow the installation to be avoided when tests using
those facilities aren't invoked, it also allows us to reliably install
the same version of these npms, rather than falling back to the
`latest` npm tag on each CI run.
2017-11-14 16:52:34 +02:00
Ben Newman
9eeeb46dbb Revert "Stop implying underscore from the meteor-base package."
This reverts commit b513abff23.

Per @abernix's comment here:
https://github.com/meteor/meteor/pull/9362#pullrequestreview-76428132
2017-11-14 09:31:45 -05:00
Ben Newman
b513abff23 Stop implying underscore from the meteor-base package. 2017-11-14 09:31:34 -05:00
Ben Newman
a713f613b5 Remove underscore from the autoupdate package. 2017-11-14 09:31:34 -05:00
Ben Newman
e84ae21a1e Convert IdMap to class and remove underscore dependency. 2017-11-14 09:31:34 -05:00
Ben Newman
14dbfb4c2b Remove underscore and deprecated functions from reload package. 2017-11-14 09:31:34 -05:00
Ben Newman
babe85f268 Remove underscore from callback-hook package. 2017-11-14 09:31:34 -05:00
Ben Newman
b9d562d29d Remove underscore from retry package. 2017-11-14 09:31:34 -05:00
Ben Newman
28613103d0 Remove underscore from ordered-dict package. 2017-11-14 09:31:34 -05:00
Ben Newman
fe73c913b5 Remove underscore and deprecated Meteor.uuid from random package. 2017-11-14 09:31:33 -05:00
Ben Newman
b0780d67dc Remove underscore from diff-sequence package. 2017-11-14 09:31:33 -05:00
Ben Newman
879a8410ea Merge pull request #9361 from meteor/remove-underscore-from-check
Remove underscore from check package.
2017-11-14 09:02:31 -05:00
Jesse Rosenberger
d5ff826596 Decompose self-test logic into separate files.
The single file which represented the bulk of the `meteor self-test`
functionality had got a bit heavy and it stood to benefit from some
dissemination.

I embarked on this change originally when looking into replacing
PhantomJS with Chrome Headless (and a new `ChromeClient` class) within
self-test.  Unfortunately, I didn't have time to take this the last
step of actually implementing Chrome, but this should hopefully
facilitate that change in the future by providing what I believe to be
better compartmentalization of this logic.

I apologize for the (likely) difficulty of reviewing this commit.  Due
to heavy intertwining of existing code it was hard to arrange these
changes in an easy-to-review manner.  I believe a reviewer will
find that it's mainly copy and pasting into different files and
careful adjusting of those files (new) module dependencies.
2017-11-14 15:55:11 +02:00
Jesse Rosenberger
8a122b7cc2 Finish check ES class conversion by swapping self with this.
The original PR from @stubailo started the conversion to native
ECMAScript `class`es with 970f1fa7dd.

I might be projecting, but had there been time to finish that PR, I believe a
subsequent commit would have expunged the no-longer-necessary `self=this`
assignments, however I think that effort was lost in the hand-off.
2017-11-14 11:22:31 +02:00
Ben Newman
a30f42c4ac Use ECMAScript exports instead of CommonJS in check package. 2017-11-13 22:36:43 -05:00
Ben Newman
dd33655375 Address my own review feedback. 2017-11-13 22:32:49 -05:00
Sashko Stubailo
f40dac844d Replace _.isObject 2017-11-13 22:32:49 -05:00
Sashko Stubailo
2f10c82a50 Replace each with forEach 2017-11-13 22:32:49 -05:00
Sashko Stubailo
c18ff138c9 Replace _.has 2017-11-13 22:32:49 -05:00
Sashko Stubailo
a8f4916992 Remove _.isEmpty 2017-11-13 22:32:49 -05:00
Sashko Stubailo
a9cd3a491e Replace _.isArguments 2017-11-13 22:32:49 -05:00
Sashko Stubailo
970f1fa7dd Some of the most obvious underscore removals 2017-11-13 22:32:49 -05:00
Ben Newman
68053b34fa Fix typo in ddp-client SockJS detection. 2017-11-13 19:01:52 -05:00
Ben Newman
f501bbb577 Merge pull request #9359 from meteor/remove-underscore-from-client-mongo-modules
Convert Mongo.Collection to class and remove underscore on client.
2017-11-13 17:46:03 -05:00
Ben Newman
c73e907eee Shallow-clone inserted documents more reliably.
In a previous commit, I changed

  doc = _.extend({}, doc);

to avoid using underscore, thus:

  doc = { ...doc };

While this may seem harmless, it broke a few Mongo.Collection tests
because _.extend copies *all* properties, both own and inherited, whereas
object ...spread only copies own properties.

However, the correct way to fix this problem is *not* to revert to the old
behavior, since flattening the inherited properties of a document was
never actually what we wanted. The old behavior was subtly broken, too.

Instead, we need to create a new object with the same prototoype as the
provided document, then shallow-copy the own properties. Any properties or
methods inherited from the original prototype will then be available on
the new object, even though they didn't get copied over.

I've intentionally left some trivial formatting changes in this commit to
remind myself which broken tests were fixed by this change.
2017-11-13 16:04:30 -05:00
Ben Newman
6fcf190bb4 Convert Mongo.Collection to class and remove underscore on client. 2017-11-13 16:04:30 -05:00
Ben Newman
ef76652a89 Merge pull request #9353 from meteor/sockjs-polyfill
Avoid loading SockJS in browsers known not to need it.
2017-11-13 15:54:42 -05:00
Ben Newman
8810976b7f Run all PhantomJS test-packages tests with and without SockJS. 2017-11-13 12:39:27 -05:00
Ben Newman
d4f1ebf321 Fix tests and address review feedback from @stubailo. 2017-11-13 09:25:10 -05:00
Ben Newman
edb33611e1 Avoid loading SockJS in browsers known not to need it.
Supersedes #9316, in which @stubailo demonstrated that SockJS can be
straightforwardly eliminated if native WebSocket support is assumed.

Native WebSocket support is close to universal now (94% of all clients
according to https://caniuse.com/#feat=websockets), which means we can
remove ~30KB of legacy code from the client bundle that we send to most
web browsers.

To achieve this flexibility, the sockjs-0.3.4.js script is injected as a
standalone <script> tag in the <head> of the document, but only if the
user agent string of the HTTP request fails to convince the sockjs-shim
package that the browser has native WebSocket support. When Meteor is
running in production, a minified version of that script is used instead.

Not only is this loading strategy a bit faster for older browsers, because
the SockJS script begins loading earlier, and is independent from the
normal JS bundle, it also removes the cost of loading SockJS completely
for more recent browsers.

Though it's tempting to keep hacking the SockJS script to make it smaller,
we should avoid spending too much time on that, since it only benefits a
small portion of users whose devices are likely to have poor performance
for lots of other reasons. In other words, I think we should keep
[Amdahl's Law](https://en.wikipedia.org/wiki/Amdahl%27s_law) in mind.
2017-11-13 09:15:52 -05:00
Ben Newman
a0267780f5 Merge branch 'ddp-client-refactor-2' into devel 2017-11-12 11:52:30 -05:00
Christian Klaussner
813a67ebef Fix typo in "Documentation" section (#9352) 2017-11-12 11:37:51 -05:00
George Ehrhorn
b481194788 Fix broken link (#9351)
The contribution guidelines have a broken link to the documentation section. This fix uses the standard convention for the other links in this section.
2017-11-12 10:55:10 -05:00
Ben Newman
664b42b82a Remove underscore from (and add ecmascript to) ddp-common. 2017-11-11 17:52:51 -05:00
Ben Newman
411599ce93 Finish removing underscore from ddp-client. 2017-11-11 17:27:48 -05:00
Ben Newman
193910fdd2 Use object ...spread instead of Object.assign. 2017-11-11 17:26:21 -05:00
Ben Newman
76fb8a7897 Use truly empty Object.create(null) instead of {} in ddp-client. 2017-11-11 16:20:27 -05:00
Ben Newman
f2d42067b9 Use Object.keys instead of Object.entries.
It turns out we do not polyfill Object.entries, because that would require
requiring 'core-js/es7/object' in ecmascript-runtime-client/runtime.js.
Something to consider, but not strictly necessary right now.

https://github.com/meteor/meteor/pull/9338#discussion_r150306273
2017-11-11 16:07:08 -05:00
Ben Newman
24e07095d7 Use String#endsWith as well as #startsWith. 2017-11-11 16:01:42 -05:00
Sashko Stubailo
d16b928efb Apply is confusing, we don't actually use this 2017-11-10 14:18:39 -08:00
Sashko Stubailo
83c774c486 Replace Array.prototype.slice.call with Array.from 2017-11-10 14:15:46 -08:00
Sashko Stubailo
8e4f4fb650 Use assign to avoid an extra object copy 2017-11-10 14:08:02 -08:00
Sashko Stubailo
470df87cef Replace startsWith 2017-11-10 14:07:10 -08:00