Commit Graph

6020 Commits

Author SHA1 Message Date
Ben Newman
91058b53a7 Allow (junction) symlinking node_modules on Windows.
Hopefully fixes #7830 by ensuring that server node_modules are physically
present in the programs/server/npm directory.
2016-10-14 16:29:35 -04:00
Ben Newman
c572b12f26 Allow Builder#copyDirectory to make junction links on Windows. 2016-10-14 16:25:07 -04:00
Ben Newman
9039f98b30 Make findMongoPort return null if net.connect throws. 2016-10-14 16:24:27 -04:00
Ben Newman
56c041c858 Filter out node_modules/babel-runtime/* when Meteor provides babel-runtime.
Should fix #7872 and others (e.g. #7833).
2016-10-13 19:24:34 -04:00
Ben Newman
5de9070c9c Implement ImportScanner#isWeb convenience method. 2016-10-13 19:24:33 -04:00
Ben Newman
7ea95063b0 Ignore non-top-level identifiers early in Resolver#_resolveNodeModule. 2016-10-13 19:24:33 -04:00
Ben Newman
ec34a4ecc6 Fix tests by making sure to close optimistic file watchers.
If a test process does not explicitly call process.exit, pathwatcher
watchers may keep it alive indefinitely (either that, or there's a bug
with the persistent:false option to fs.watchFile).

This accidental immortality can be prevented by explicitly closing all
watchers when we no longer have any interest in file change notifications.
2016-10-13 14:09:16 -04:00
Ben Newman
56de90e440 Switch back some optimistic functions in tools/fs/watch.js.
In particular, optimisticReaddir was getting called before relevant dirty
callbacks were firing, and thus failing to notice actual changes on the
file system.

In general, the tools/fs/watch.js code is the one place where we really
need an up-to-date view of the file system. Put another way, if optimistic
functions worked perfectly, we wouldn't need to rely so much on WatchSet
logic, but for now it's a balance of equally important strategies, and we
shouldn't be compromising one by intermingling it with the other.
2016-10-12 18:12:16 -04:00
Ben Newman
4300d261f3 Support meteor <command> for any dev_bundle/bin/<command> executable.
This will make it easier to use tools like https://yarnpkg.com/ with the
right version of Node, etc.

With this commit, here's all you have to do:

  meteor npm install -g yarnpkg

Then test that it works:

  meteor yarn info

Note that any commands registered by Meteor itself will not be honored.
2016-10-12 13:22:26 -04:00
Ben Newman
ebecfeeb3e Prevent exceptional optimisticReadFile from invalidating Resolver caching. 2016-10-12 11:41:34 -04:00
Ben Newman
1d375ffb70 Hold off on using optimistic functions in watch.readAndWatchFileWithHash.
This partially reverts commit 96c95629eb.

When running `meteor update`, we call writeReleaseFileAndDevBundleLink
immediately before reading .meteor/release, so there's no time for a file
change notification to invalidate the cached contents of that file.

In the future, we could perhaps call optimisticReadFile.dirty(path) as a
consequence of files.writeFile(path, ...), but that may be tricky.
2016-10-11 11:25:36 -04:00
Ben Newman
b594b460a4 Go back to using pathwatcher.watch, with new rewatching logic.
Judging from the variety and extent of test failures, switching to
chokidar.watch was too drastic a change for this late-beta stage of the
release cycle.

The problem with pathwatcher.watch was that watches don't survive the
deletion of the watched file, because (like fs.watch) it watches files
based on inodes, not paths. This problem can be solved in a relatively
narrow way, by attempting to rewatch the file after any "delete" or
"rename" events.
2016-10-11 10:02:06 -04:00
Ben Newman
b814311266 Catch async chokidar.watch errors and suggest raising watch limit. 2016-10-10 17:39:17 -04:00
Ben Newman
0311e76673 Bring back fs.watchFile fallback when chokidar.watch fails.
Especially on Linux, chokidar.watch tends to throw ENOSPC errors when too
many files are being watched.

I removed this logic earlier because I thought chokidar could handle such
failures by itself, but that was wishful thinking.
2016-10-10 17:12:53 -04:00
Ben Newman
96c95629eb Use optimistic functions throughout tools/fs/watch.js. 2016-10-10 15:22:53 -04:00
Ben Newman
6a66368e09 Cache optimistic stat objects in InputFile#findControlFile. 2016-10-10 15:22:53 -04:00
Ben Newman
117b1a8525 Use chokidar for file watching instead of pathwatcher.
Healthy competition among fs.watch wrappers appears to have produced a
clear winner: https://www.npmjs.com/package/chokidar

This wrapper is better for Meteor than pathwatcher was, because it can
watch directory trees recursively, and it has no trouble watching
nonexistent file paths, whereas pathwatcher would throw an exception.
2016-10-10 14:12:51 -04:00
Ben Newman
1e5b414e48 Prepare for breaking API change affecting optimistic subscribe functions.
As of optimism@0.3.0, the value of `this` within subscribe functions is no
longer the optimistic wrapper function object (instead: null or global, as
if called with no receiver object), so we need to retain a reference to
the optimistic function so that the watcher can call .dirty(...args).
2016-10-10 11:47:19 -04:00
Ben Newman
817876f7b3 Use optimistic functions in PackageSource#initFromPackageDir. 2016-10-07 19:31:17 -04:00
Ben Newman
a1cfbc7ab2 Add profiling and use optimistic functions in LocalCatalog. 2016-10-07 19:31:07 -04:00
Ben Newman
2553958c38 Merge branch 'devel' into release-1.4.2 2016-10-07 19:30:30 -04:00
Ben Newman
dfd477568f Fix test failure by tolerating different line/column numbers. 2016-10-07 18:56:13 -04:00
Ben Newman
d3d60fc475 Merge pull request #7886 from abernix/feature/add-cordova-dependency-test
Add Cordova Platform Dependency Tests
2016-10-07 11:21:58 -04:00
Ben Newman
c969cde1af Merge pull request #7814 from engelgabriel/patch-1
Add --headless option to the build command.
2016-10-07 10:03:38 -04:00
Ben Newman
a24448e7a7 Merge pull request #7885 from abernix/feature/fix-console-success
`Console.success` should provide an indicator when pretty is disabled
2016-10-07 09:58:36 -04:00
Ben Newman
16e9e0c0f9 Merge pull request #7884 from abernix/feature/fix-console-fail
Fix for `Console.failInfo` and `Console.failWarn` when `pretty` is false.
2016-10-07 09:56:25 -04:00
Jesse Rosenberger
8c948d2ebc Test: Ensure message when platform already added
If the platform is already added, it should provide the appropriate message.
2016-10-07 14:17:11 +03:00
Jesse Rosenberger
3359d2397c Add test which verifies the Cordova dependency messages are working
Previously, the Cordova message was failing in CI.  It wasn't caught on CircleCI since they have Cordova installed by default so this path was never tested.  I found this when I ran this through Semaphore CI who does not have Cordova available by default.

This test fails without meteor/meteor#7884 and passes with it.
2016-10-07 14:16:48 +03:00
Jesse Rosenberger
932750f77d Fix redeclared var & change to let 2016-10-07 14:07:54 +03:00
Jesse Rosenberger
58a6d743c8 Console.success should provide an indicator when pretty is disabled
`Console.success` is currently called in only one place but it relies on the fact that `pretty` console mode is enabled for it to make any sense.  This adds the ability to pass an "ugly" (less pretty?) message to `Console.success` (default: "success") and changes the Cordova dependency checker to use "installed" when showing a met-dependency.

Fixes meteor/meteor#7883
2016-10-07 13:41:39 +03:00
Jesse Rosenberger
1d3d6c2bda Fix for Console.failInfo and Console.failWarn when pretty is false
These functions were both using the `Console._fail` function which is passed a severity of failure as a string (e.g. "warn", "error", etc.) which corresponds to the appropriate `Console` function.  Previously, the string was just being called as if it was a function.

Fixes meteor/meteor#7882
2016-10-07 13:36:59 +03:00
Ben Newman
2d18c25f7e Be more defensive when terminating watchers. 2016-10-06 18:09:22 -04:00
Ben Newman
14ee8775c3 Decompose PackageNamespace, PackageNpm, and PackageCordova classes.
Similar to the treatment given to PackageAPI in my commit
af50b4cc5b.

This clear separation of concerns will be helpful for optimizing
PackageSource#initFromPackageDir.
2016-10-06 17:39:23 -04:00
Ben Newman
9608506ce5 Merge pull request #7835 from sebakerckhof/optimize-ignorefiles
Optimize ignoreFiles patterns.
2016-10-06 15:07:29 -04:00
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