Commit Graph

6341 Commits

Author SHA1 Message Date
Ben Newman
1df6668cc9 Test that importing the winston npm package works now.
This is a test that should have accompanied my previous commit
81a07ed84f.
2017-05-29 19:37:33 -04:00
James
6445a44001 Clarify meteor update message for indirect dependencies
* Adjust string style to be in line with meteor style guide 6.2

* Partially addresses #8721 #8488
2017-05-29 14:41:00 -04:00
Ben Newman
cd4fc028f8 Upgrade reify to version 0.11.20 to fix getNamespace bug.
Reported here:
https://github.com/meteor/meteor/pull/8327#issuecomment-304582864

Fixed by:
aeb46dcd61
2017-05-29 12:02:56 -04:00
Ben Newman
e2210ef01d Update Reify API usage for version 0.11.13. 2017-05-26 18:22:02 -04:00
Ben Newman
a445e50c11 Merge branch 'release-1.4.4.3' into release-1.5 2017-05-22 20:21:10 -04:00
Ben Newman
2a3fd57303 Style tweaks and a small bug fix.
These checks should still happen when body is an empty string, which (for
better or worse) is falsy in JavaScript.
2017-05-22 16:40:48 -04:00
David Glasser
5f18c6e24a tools: fix Galaxy discovery
1a036553 in 1.4.4.2 expanded on the HTTP error checking added by 30aec9f in
1.4.2. Neither of these changes were aware that discoverGalaxy invokes
httpHelpers.request with json:true, resulting in a `body` that is a parsed JSON
object rather than a string or Buffer.  Before 1.4.4.2, this had no consequences
because body.length is undefined and `undefined < 90` is false, but the change
to Buffer.byteLength actually made the condition true.

It's safe to not check length in the JSON case because a truncated JSON object
is not legal JSON (unless the truncation just drops trailing whitespace, in
white case that's OK).

I check for both string and Buffer because some calls to this function pass in
an encoding option.  Buffer.byteLength works with both types.
2017-05-22 16:40:42 -04:00
Ben Newman
47496e9dba Call requestGarbageCollection in Isopack#_writeTool.
This method appears to be causing large spikes in memory consumption on
Circle CI during the `meteor --get-ready` preparation step, which often
leads to the test process being killed.

Also added a call in IsopackCache#_loadLocalPackage for good measure.

We're now calling requestGarbageCollection pretty frequently when
we run Node with --expose-gc, but that currently only happens during
Circle CI tests, so I don't think we need to implement the improvements
suggested in tools/utils/gc.js, yet.

Previously: 35f488e140, f6df21ff1e
2017-05-22 16:40:32 -04:00
Ben Newman
35386e49dd Re-run individual tests to avoid re-running the whole suite.
To deal with individual flaky tests, we often just re-run the entire test
suite, which feels like an enormous waste of shared computing resources.

This change automatically re-runs individual failed tests as many as two
more times, and considers the test successful if any of those attempts
succeeds.

cc @abernix @hwillson et al.
2017-05-22 16:40:32 -04:00
Ben Newman
0fbb97432c Fix ENOTEMPTY and EPERM errors on Windows.
Windows began suffering from cryptic ENOTEMPTY and EPERM errors between
1.5-beta.20 and 1.5-rc.0. After a tricky `git bisect` adventure, I tracked
the problem down to my commit b6694b2f5d,
which caused dynamic modules to be written more than once by the bundler.
Though I don't understand exactly why Windows complained in this way, I'm
glad that it did, because otherwise this mistake would merely have been a
performance problem, and might not have been noticed before the release.
2017-05-18 11:48:40 -04:00
Ben Newman
16a8a3ae3c Tweaks to linker caching.
No longer using a RegExp when we know what the old file wildcard path
should be, and no longer using Fiber when we can just use a Promise
callback (since all Promise callbacks run in a Fiber).
2017-05-16 13:43:38 -04:00
Hugh Willson
b8a8833ac6 Moved LINKER_CACHE_SALT into cacheKeySuffix part of cache filename hash. 2017-05-16 13:41:40 -04:00
Hugh Willson
7dd14e723d Adjusted bundler-cache saved file approach to remove out of date cache files. 2017-05-16 13:41:39 -04:00
Ben Newman
2e057d7119 Call requestGarbageCollection in Isopack#_writeTool.
This method appears to be causing large spikes in memory consumption on
Circle CI during the `meteor --get-ready` preparation step, which often
leads to the test process being killed.

Also added a call in IsopackCache#_loadLocalPackage for good measure.

We're now calling requestGarbageCollection pretty frequently when
we run Node with --expose-gc, but that currently only happens during
Circle CI tests, so I don't think we need to implement the improvements
suggested in tools/utils/gc.js, yet.

Previously: 35f488e140, f6df21ff1e
2017-05-15 16:17:20 -04:00
Ben Newman
2032ba8b23 Re-run individual tests to avoid re-running the whole suite.
To deal with individual flaky tests, we often just re-run the entire test
suite, which feels like an enormous waste of shared computing resources.

This change automatically re-runs individual failed tests as many as two
more times, and considers the test successful if any of those attempts
succeeds.

cc @abernix @hwillson et al.
2017-05-15 13:56:57 -04:00
Ben Newman
e3bd1cfb9c Make dynamic import(...) caching more robust to IndexedDB failures.
Fixes #8697.
2017-05-15 12:11:30 -04:00
Ben Newman
9e32c00428 Give dynamic module manifest items a different type: "dynamic js".
Now that dynamic modules are part of the manifest that determines which
files are served over HTTP, I'm a bit paranoid about them somehow ending
up as <script> tags in the initial HTML of the application.

This commit adds another safety measure to prevent that, just in case the
boilerplate-generator package for some reason fails to skip items whose
.path starts with "dynamic/" (see my previous commit).
2017-05-10 12:30:19 -04:00
Ben Newman
b6694b2f5d Expose dynamic modules via HTTP, but do not load them eagerly.
This allows fetching the compiled code of dynamic modules via HTTP,
without generating <script> tags for those resources in the intial
boilerplate HTML of the application.

The URL for a dynamic module should be formed by taking its absolute
module identifier, prepending "/dynamic" and appending "?hash=<version>".
Appropriate version hashes can be obtained from the tree exported by the
meteor/dynamic-import/dynamic-versions.js module, though the hashes are
used only for cache busting, so they could be anything at all.

A good place to do this fetching would be the meteorInstall.fetch
callback, as defined (for example) in meteor/dynamic-import/client.js.
That implementation still uses a WebSocket rather than HTTP, but this
commit will allow us to experiment with HTTP in the future.

Because the code returned for these dynamic modules is wrapped as an
anonymous function expression, you'll need to fetch them using an
XMLHttpRequest, the HTTP fetch() function, or some similar utility, rather
than using a <script> tag, because executing the unmodified code as JS
will likely throw a syntax error.
2017-05-10 12:11:10 -04:00
Ben Newman
fba9e9dfe9 Restrict the dynamic-import package to Meteor 1.5+ apps. 2017-05-10 11:31:39 -04:00
Ben Newman
7a54259c94 Revert "Include the dynamic-import package in new apps and packages."
Partially reverts commit 8364f81344.

This commit was causing self-test failures like the following:

  While selecting package versions:
  error: unknown package in top-level dependencies: dynamic-import

I suspect these tests won't work until the dynamic-import package is
published with a non-prerelease version.
2017-05-09 21:25:28 -04:00
Ben Newman
42c41901c5 Call module.runSetters() after any meteor/tools modules load. 2017-05-09 21:23:41 -04:00
Ben Newman
75ada39092 Bump LINKER_CACHE_SALT and compiler.BUILT_BY for good measure.
Recent updates to meteor-babel and reify make it particularly important to
force recompilation of ECMAScript modules and package/app bundles.
2017-05-09 15:21:42 -04:00
Ben Newman
8364f81344 Include the dynamic-import package in new apps and packages.
It's tempting to make the ecmascript package api.imply("dynamic-import"),
but the dynamic-import package depends on the ddp package, which depends
heavily on the ecmascript package, and I'm not sure how best to break that
dependency cycle.
2017-05-09 14:53:34 -04:00
Ben Newman
b5b76a850e Include minifier package name and version in .stats.json file. 2017-05-09 13:17:01 -04:00
Ben Newman
1c8bc7353e Serve <hash>.stats.json for every <hash>.js bundle. 2017-05-09 13:17:00 -04:00
Ben Newman
084801237a Report per-bundle stats from minifier. 2017-05-09 13:16:59 -04:00
Ben Newman
95c4bcd6f2 Make meteor create --bare apps use static-html.
Perhaps most importantly, this means bare apps no longer depend on jquery.
2017-05-09 13:16:58 -04:00
Ben Newman
269e10caa6 Remove support for pkg.module in client bundles.
This partially reverts commit d7cae3c939.

This functionality was problematic without providing any clear benefits to
Meteor developers, as reported by @fermuch and @markoshust:
https://github.com/meteor/meteor/pull/8327#issuecomment-298723203
2017-05-04 16:09:45 -04:00
Ben Newman
9c7778da36 Let the install npm package implement Module.prototype.prefetch.
Now anyone can define meteorInstall.fetch however they see fit, and the
install.js implementation will handle everything else.

This separation of concerns leads to significantly less code, too.
2017-05-01 23:55:00 -04:00
Ben Newman
d7cae3c939 Support pkg.module in client bundles, even for node_modules.
As proposed here: https://github.com/rollup/rollup/wiki/pkg.module

By supporting ECMAScript module entry points for npm packages in Meteor
1.5, we will be well-positioned to do more effective import/export-based
tree shaking in future versions of Meteor.

We can't do the same thing on the server because we can't change how
native Node resolves package entry points based on the "main" field of the
package.json module.

On the other hand, all npm packages have to work in Node using the "main"
field, and client bundles stand to benefit the most from tree shaking, so
this client/server difference should not be problematic.

Note that the "jsnext:main" property is also supported as a legacy synonym
for "module".
2017-04-27 17:34:34 -04:00
Ben Newman
b023f5c67a Merge branch 'release-1.4.4.2' into release-1.5 2017-04-27 17:16:05 -04:00
Bartosz Wojtkowiak
5a4d5035c3 Implement CORDOVA_COMPATIBILITY_VERSION_IOS/ANDROID and EXCLUDE (#8581)
* Implement CORDOVA_COMPATIBILITY_VERSION_EXCLUDE and CORDOVA_COMPATIBILITY_VERSION_IOS/ANDROID

CORDOVA_COMPATIBILITY_VERSION_IOS or CORDOVA_COMPATIBILITY_VERSION_ANDROID allows to override compatibility version for a specified platform.

CORDOVA_COMPATIBILITY_VERSION_EXCLUDE provides a way of excluding a certain plugin from compatibility version calculation. You can pass several plugin names with ';'. For example: `CORDOVA_COMPATIBILITY_VERSION_EXCLUDE='cordova-plugin-crosswalk-webview;cordova-plugin-device'`

* Changes after review
2017-04-26 13:23:22 -07:00
Ben Newman
1a036553c1 Fix faulty content-length comparison in utils/http-helpers.js.
Since body is a string, body.length is not necessarily the number of bytes
in the response body.
2017-04-25 16:11:29 -07:00
Jesse Rosenberger
99fffd8670 Fix disappearance of debug banner when running meteor debug.
This was broken due to a change in Node.js which enabled support for
using `--debug` in combination with IPv6 addresses.
2017-04-25 15:49:52 -07:00
Jesse Rosenberger
94f8c9d7ce Remove experimental trailing comma to avoid problems with jsdoc.
The comma in question: a trailing comma a rest-parameter, within a
function argument's parameter de-structuring:

	function a({
	  a = false,
	  ...b,
	}) {
	  // ...
	}

Espree, the parser used by `jsdoc` (used in Meteor docs) previously
allowed this with `experimentalObjectRestSpread` enabled but now throws
an error with the addition of 652990a7bf.

It might have been argued at one point that the trailing-comma could
allow for the easy, future addition of another parameter, ala:

	function a({
	  a = false,
	  ...b,
	  c = true,
	}) {
	  // ...
	}

Having the rest-parameter in the last position is certainly more clear
(it is the "rest", after-all, and there can be only one) but I'm not
going to have that discussion at the cost of docs not deploying!
2017-04-25 15:36:10 -07:00
Ben Newman
d9264e3b4b Better API for module.prefetch(id). 2017-04-25 10:26:24 -04:00
Ben Newman
5477aeac3f Support module.prefetch(id) to fetch but not evaluate dynamic modules.
Generally, module.prefetch(id) will not throw even if the fetched module
is missing. If you need to know whether module.prefetch(id) succeeded,
simply await the result of the promise, which will be null on success, or
an Error object if the module could not be imported.
2017-04-24 16:40:58 -04:00
Ben Newman
f4fc2a904d Use final hashes of dynamic modules for browser caching.
Previously, the linker included a "version" hash in each stub entry
corresponding to a dynamic module in the meteorInstall bundle. These stub
entries also contain information about any module identifiers ("deps")
imported by the module, and various other metadata.

This hash was derived from the source code of the dynamic module, instead
of its fully-processed generated code, which created a small risk that the
source hash would remain the same when anything changed in the post-linker
processing logic.

This new implementation uses the same hashes found in program.json
manifest files, which more reliably reflect changes in the actual final
contents of the modules.

Because these hashes are not known at link time, they are now injected as
one blob into the meteor/dynamic-import/dynamic-versions.js module, rather
than appearing in the meteorInstall bundles for their containing packages.
2017-04-21 16:15:09 -04:00
Ben Newman
b057415048 Merge branch 'devel' into release-1.5 2017-04-20 16:46:03 -04:00
Ben Newman
4122e6e7f2 Minor cleanup to make import chain test more robust. 2017-04-20 16:12:08 -04:00
Ben Newman
1c041237d9 Fix faulty content-length comparison in utils/http-helpers.js.
Since body is a string, body.length is not necessarily the number of bytes
in the response body.
2017-04-20 16:12:08 -04:00
Ben Newman
6f75eae135 Remove automatic Buffer polyfill.
This polyfill is unnecessary in Node, and added a whopping 22KB to the
minified client bundle. If you really need the Buffer API on the client,
you can get it from require("buffer").Buffer.
2017-04-19 17:41:11 -04:00
Jesse Rosenberger
27b2a04f6f Remove experimental trailing comma to avoid problems with jsdoc.
The comma in question: a trailing comma a rest-parameter, within a
function argument's parameter de-structuring:

	function a({
	  a = false,
	  ...b,
	}) {
	  // ...
	}

Espree, the parser used by `jsdoc` (used in Meteor docs) previously
allowed this with `experimentalObjectRestSpread` enabled but now throws
an error with the addition of 652990a7bf.

It might have been argued at one point that the trailing-comma could
allow for the easy, future addition of another parameter, ala:

	function a({
	  a = false,
	  ...b,
	  c = true,
	}) {
	  // ...
	}

Having the rest-parameter in the last position is certainly more clear
(it is the "rest", after-all, and there can be only one) but I'm not
going to have that discussion at the cost of docs not deploying!
2017-04-12 09:59:09 -07:00
Ben Newman
1a120a6f4d Merge branch 'devel' into release-1.5 2017-04-08 11:36:56 -04:00
Ben Newman
6055b49f8d Wait on removal of garbage directories.
This would have been a nice optimization if it had worked, but (in
addition to leaving garbage directories lying around sometimes if the
process was killed), it appears to have some unintended consequences for
meteorNpm.rebuildIfNonPortable and related functions, since the garbage
directories are easily confused for npm package directories.

Example stack trace:

  Error: ENOENT: no such file or directory, open '/home/travis/build/meteor/galaxy-server/node_modules/heapdump-garbage-1c2jqib/package.json'
      at Error (native)
   => awaited here:
      at Promise.await (/home/travis/.meteor/packages/less/.2.7.9.9fh5c1++os+web.browser+web.cordova/plugin.compileLessBatch.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:39:12)
      at copyFileHelper (/tools/fs/files.js:633:6)
      at Object.files.cp_r (/tools/fs/files.js:532:7)
      at /tools/isobuild/meteor-npm.js:393:11
      at Array.forEach (native)
      at copyNpmPackageWithSymlinkedNodeModules (/tools/isobuild/meteor-npm.js:386:29)
      at /tools/isobuild/meteor-npm.js:325:5
      at Array.forEach (native)
      at Object.rebuildIfNonPortable (/tools/isobuild/meteor-npm.js:315:17)
      at NodeModulesDirectory.rebuildIfNonPortable (/tools/isobuild/bundler.js:273:22)
      at /tools/isobuild/compiler.js:650:13
2017-04-07 16:21:43 -04:00
Ben Newman
43d339d087 Merge branch 'devel' into release-1.5 2017-04-07 12:45:29 -04:00
Jesse Rosenberger
948ec2b05f Merge branch 'master' into devel 2017-04-07 18:50:17 +03:00
Jesse Rosenberger
ae35f13ed2 Use new rm_recursive_async to cleanup garbage directory w/o waiting. 2017-04-06 20:18:38 +03:00
Jesse Rosenberger
0cf0fb12c3 Remove catch-ing of EXDEV from Builder#complete.
This logic is now handled in `files.renameDirAlmostAtomically`.
2017-04-06 20:03:35 +03:00
Jesse Rosenberger
960e78c250 Sacrifice atomicity in the event that the file-system won't allow it.
/cc @benjamn
2017-04-06 19:56:17 +03:00