Commit Graph

5976 Commits

Author SHA1 Message Date
Ben Newman
1d149a0ed7 Keep Resolver.getOrCreate cache results distinct by caller.
The options.statOrNull function is not included in the JSON.stringify key,
but it affects the results because the implementation provided by the
ImportScanner relies on scanner._getFile to return fakeFileStat for
make-believe files created by the ImportScanner.

This becomes a problem if PackageSourceBatch#getResolver accidentally uses
a Resolver created initially for the ImportScanner, or vice-versa.

In particular, when a compiler plugin calls addJavaScript with a path
different from the original file path, the ImportScanner generates two
different modules, one of which imports the other. Only one of the files
exists on disk, though, so a special implementation of statOrNull is
necessary to keep the Resolver from having to share implementation details
with the ImportScanner.

When this system fails, users of compiler plugins see errors like this:
https://github.com/meteor/meteor/pull/7668#issuecomment-251976739
2016-10-06 12:43:37 -04:00
Ben Newman
43aa2c777b Avoid calling files.realpath in IsopackCache#getSourceRoot.
It's difficult to keep track of all the factors that could affect the
output of files.realpath, so it doesn't seem feasible to replace this call
with an optimistic function.

Fortunately, it's fine if the paths returned by IsopackCache#getSourceRoot
contain symlinks, and possibly even preferable, since

  ~/.meteor/packages/<name>/<version>

is more consistent than

  ~/.meteor/packages/<name>/.<version>.<junk>++<more junk>

though the latter happens to be a symlink to the latter.
2016-10-06 12:34:04 -04:00
Ben Newman
c74a95c0b8 Clean up findAssignedGlobals caching.
Two mistakes: we were maintaining two redundant caches for
findAssignedGlobals, and callings tryToParse before checking globalsCache,
when often globalsCache already had a stored result.
2016-10-05 17:54:35 -04:00
Ben Newman
2ec570251a Stop generating identity source maps for files without actual source maps.
This speeds up both getPrelinkedOutput (because we don't spend any time
generating the identity source map) and toStringWithSourceMap (because we
don't have to combine those source maps).

We still generate line number comments for files without source maps, so
it's relatively easy to find the source line for a stack trace.
2016-10-05 17:54:34 -04:00
Martijn Walraven
e8b1126ad4 Add temporary workaround for cordova-ios bug 2016-10-05 16:11:34 -04:00
Martijn Walraven
458c5b40f0 Update Cordova pinned plugin versions and dependencies to latest versions 2016-10-05 16:11:33 -04:00
Martijn Walraven
6322a55985 Update cordova-ios and cordova-android to latest versions 2016-10-05 16:11:33 -04:00
Martijn Walraven
cc9882b12d Update cordova-lib in dev bundle to 6.3.1 2016-10-05 16:11:32 -04:00
Ben Newman
bcc5f7ff97 Avoid dropping package.json files when "main" names a directory.
An example of an npm package that triggers this bug is the `cli-color`
package, which has a package.json file with a "main" property whose value
is "lib", and a "lib" directory that contains an index.js file.
2016-10-05 14:58:09 -04:00
Ben Newman
339ccc9db3 Fix tests by not watching package.json files if hash is null. 2016-10-04 17:15:25 -04:00
Ben Newman
5c9d72450d Watch package.json files reported from Resolver#resolve.
This change should mitigate any regressions from my earlier commit
97ca5f1836.
2016-10-04 15:18:57 -04:00
Ben Newman
21b4c664f4 Cache Resolver objects by their constructor arguments.
This is critical because it means Resolver objects can now survive
development server restarts, which means the optimistic Resolver#resolve
method can remember results indefinitely. Thanks to this change, the
Resolver#resolve method has practically disappeared from rebuild
performance profiles.
2016-10-04 13:08:13 -04:00
Ben Newman
dd3d4363b7 Use optimistic wapper for Resolver#resolve instead of _resolveCache. 2016-10-04 12:59:16 -04:00
Ben Newman
d0f093413c Use optimisticStatOrNull in tools/fs/watch.js. 2016-10-03 22:19:13 -04:00
Ben Newman
3ef7a08297 Eliminate the onMissing callback from the Resolver API. 2016-10-03 22:06:50 -04:00
Ben Newman
5b238bb0c7 Eliminate the onPackageJson callback from the Resolver API. 2016-10-03 22:06:38 -04:00
Ben Newman
97ca5f1836 Don't pass watchSet when instantiating Resolver objects.
We used the watchSet only when reading package.json files, and I think we
can add package.json files to the watchSet in the ImportScanner instead.
2016-10-03 21:45:36 -04:00
Ben Newman
1a3ae4e117 Remove _statCache and _pkgJsonCache members from Resolver.
This caching is redundant now that we're using optimistic functions for
accessing the file system in Resolver methods.
2016-10-03 21:01:01 -04:00
Ben Newman
23d62408b2 Use my optimism npm package to implement optimistic functions. 2016-10-03 17:32:10 -04:00
Ben Newman
eb4c04da86 Cache result of findAssignedGlobals in memory to speed up rebuilds. 2016-09-29 21:14:55 -04:00
Ben Newman
bfa3eaa57d Use async rimraf as a fallback if rimraf.sync throws ENOTEMPTY.
This change preserves the performance benefits of my previous commit
5af59c58bc, since rimraf.sync is still
attempted first.
2016-09-29 19:25:32 -04:00
Ben Newman
e882a7ea52 Merge branch 'devel' into release-1.4.2 2016-09-29 16:57:44 -04:00
Ben Newman
dd3fe9a264 Add additional delay to "run: run" test. 2016-09-29 16:03:18 -04:00
Ben Newman
295d3d5678 Kill mongo when server process exits.
We try to kill any mongod processes before starting new ones, but this
change kills it when the development server shuts down, too.

Killing mongo on shutdown is particularly important for tests that run
meteor multiple times in a row, and for whatever reason fail to find and
kill running mongod processes on startup, e.g. because the --port has
changed (#7563).

This comment by @glasser seems to suggest this is a reasonable idea:
https://github.com/meteor/meteor/issues/2182#issuecomment-45685614

Fixes #2182 and possibly other related bugs.
2016-09-29 09:48:55 -04:00
Ben Newman
5b2e08a80c Automatically reconfigure Mongo replication set when --port differs.
Fixes #7563.
2016-09-29 09:48:55 -04:00
Ben Newman
20a6604126 Remove pointless and exception-swallowing assert.doesNotThrow wrappers. 2016-09-29 08:51:57 -04:00
Ben Newman
f8ba1226b1 Rename test entry point module so that it isn't ignored. 2016-09-29 08:51:56 -04:00
Ben Newman
697e7ae0f7 Protect against null return values from getDevBundleForRelease. (#7841)
Fixes #7838.
2016-09-28 19:54:10 -04:00
Mehdi Ahraoui
2bc5b4b3b6 Meteor should check if is running as root and prevent it on Unix (#7821)
* Prevent running sudo meteor run it on Unix

Prevent running sudo meteor run it on Unix

Fix for all commands

remove empty line

Revert "Prevent running sudo meteor run it on Unix"

This reverts commit d2867561bb6fb1b259a59556628b56a64c677a0b.

improve PR

improve PR

improve PR

fix PR

* improve PR

* fix PR

* fix PR

* fix PR
2016-09-28 09:34:53 -04:00
Seba Kerckhof
8cdab91bc4 Do not check connection with protected npm registries (#7637)
* Do not check connection with protected npm registries

* Remove need for registry http get check by tuning npm retry parameters
2016-09-28 09:29:35 -04:00
Jesse Rosenberger
465a7f724c Merge pull request #7819 from alphanso/iss7478
Use -s as short form of --settings flag
2016-09-28 03:46:37 +03:00
Jesse Rosenberger
d787654e60 Update help.txt with -s shorthand for --settings flags.
The -s flag is now shorthand for --settings

Related to meteor/meteor#7478
2016-09-28 02:52:11 +03:00
Ben Newman
9304f76b52 Fix tests by avoiding printing inotify warning when Console.isHeadless(). 2016-09-27 11:09:46 -04:00
Ben Newman
b976cfa552 Fix reference error for file variable in tools/isobuild/compiler.js. 2016-09-27 11:03:28 -04:00
Ben Newman
0d3466b882 Be more defensive when terminating watchers. 2016-09-27 10:41:40 -04:00
Ben Newman
ea92d83744 Don't cache exceptions in optimistic functions.
I originally added the exception-caching functionality in order to avoid
calling files.stat repeatedly for files known to be missing, but now that
we're using statOrNull, knowledge of missing files (as indicated by
statOrNull returning null) is being properly cached.

The reason it's dangerous to cache exceptions is that (for example) when
an ENOENT exception indicates the file is missing, there will be no more
change events for that file, effectively making the exception permanent,
even if the file comes to exist at a later time.
2016-09-27 10:13:19 -04:00
Jesse Rosenberger
1c42e0fe22 Await Promise when running npm install (#7805)
I believe this is the fix for the (recent) CI server timeouts.
2016-09-26 20:12:46 -04:00
Ben Newman
c6b2a2f95e Use optimistic functions in meteorNpm.getProdPackageNames. 2016-09-26 20:12:46 -04:00
Ben Newman
8e57ecb731 Use optimistic functions in Builder#copyDirectory. 2016-09-26 20:12:46 -04:00
Ben Newman
c7b8b72e77 Never yield in files.symlink. 2016-09-26 20:04:30 -04:00
Ben Newman
5af59c58bc Always use rimraf.sync in files.rm_recursive. 2016-09-26 20:04:30 -04:00
Ben Newman
50a1f11a10 Use optimistic functions in compileUnibuild. 2016-09-26 20:04:29 -04:00
Ben Newman
978df6e043 Use optimistic functions in meteorNpm.isPortable. 2016-09-26 20:04:29 -04:00
Ben Newman
d954415752 Add profiling to PathWatcher watch function. 2016-09-26 20:04:29 -04:00
Ben Newman
83e7b38779 Break circular dependency between {files,watch,optimistic}.js. 2016-09-26 20:04:28 -04:00
Ben Newman
033a935a89 Use optimistic functions to speed up IO-bound bottlenecks. 2016-09-26 20:04:28 -04:00
Ben Newman
6b320bd64b Avoid starting optimistic watchers for node_modules files.
I've also moved both try-catch blocks out of the optimistic wrapper
function in an effort to help V8 optimize the optimistic functions.
2016-09-26 20:04:28 -04:00
Ben Newman
ae7bd2e5af Ignore meaningless initial fs.watchFile callback.
As a reminder, we use fs.watchFile only as a fallback in environments
where pathwatcher.watch is not available, such as on network or virtual
file systems.
2016-09-26 19:59:40 -04:00
Ben Newman
37647c8657 Implement optimistic versions of heavily used files.* methods. 2016-09-26 18:29:08 -04:00
Ben Newman
26597c4fbb Simplify rehashing in safe-pathwatcher.js. 2016-09-26 15:58:13 -04:00