Commit Graph

6565 Commits

Author SHA1 Message Date
Ben Newman
f9a9e9f2f9 Another small improvement to temp directory removal logic. 2017-10-31 14:00:46 -04:00
Ben Newman
c257183a55 Use files.rm_recursive_async to implement files.freeTempDir. 2017-10-31 14:00:33 -04:00
Ben Newman
afd556f931 Allow Builder#copyDirectory to re-create symlinks again.
Commit 86ec7eb5db broke tests because we
rely on symlinks even when the symlink option is false.
2017-10-31 14:00:12 -04:00
Ben Newman
fe5479400e Avoid calling files.stat(source) in symlinkWithOverwrite.
This was dangerous because source is often a path relative to the old
target file, whereas files.stat was interpreting source as a path relative
to process.cwd().

Fixes #9203.
2017-10-31 14:00:05 -04:00
Ben Newman
b7695d2e8b Avoid creating symlinks in Builder#copyDirectory when forbidden. 2017-10-31 13:59:59 -04:00
Ben Newman
b2db70a727 Allow files.rm_recursive to yield whenever possible.
A while back, for performance reasons, we disabled yielding for all
files.* operations unless METEOR_DISABLE_FS_FIBERS was set to false.

This was safe for almost all files.* operations, because most of them have
a synchronous fs.*Sync version available.

For a more complicated operation like files.rm_recursive, however, there
is no synchronous or asynchronous counterpart in the fs.* namespace, so
the safety of disabling fibers is not guaranteed.

Lately, files.rm_recursive has become a major source of uncaught ENOTEMPTY
errors on Windows, because rimraf.sync fails with that error, and we don't
give files.rm_recursive_async a chance to delete the directory in a more
persistent, forgiving manner.

The only reason we haven't been falling back to files.rm_recursive_async
is that YIELD_ALLOWED is false by default, so canYield() returns false.

This commit distinguishes between canYield() and mayYield(), and uses
canYield() in files.rm_recursive to determine whether it is technically
safe to yield, regardless of YIELD_ALLOWED.

Anyone who ever asked "Can I go to the bathroom?" in elementary school,
only to be mercilessly rebuked with "I don't know, CAN YOU?" should
understand the difference between these two functions.
2017-10-31 13:59:37 -04:00
Ben Newman
f73c7207e2 Use files.rm_recursive_async to implement meteor reset.
This should hopefully prevent ENOTEMPTY errors on Windows.
2017-10-31 13:59:10 -04:00
Ben Newman
b567fa0a39 Allow asynchronous meteor command implementations. 2017-10-31 13:59:03 -04:00
Ben Newman
ddc490c66d Use module.watch live bindings to solve #9176.
Further explanation / discussion:
https://github.com/meteor/meteor/issues/9176#issuecomment-335913296

Another (complementary) solution to the same problem: #9190
2017-10-31 13:58:31 -04:00
Ben Newman
699768f39d Stop using file.imported to mark fake files in the ImportScanner.
Using a Symbol ensures compiler plugins can't mark files fake accidentally
(or maliciously) when calling inputFile.addJavaScript(options).
2017-10-31 13:58:30 -04:00
Ben Newman
f2b800c927 Remove target directory in files.rename to avoid Windows EPERM errors.
These errors are especially harmful because they cause files.rename to
fall back to copying rather than atomically renaming, which is both much
slower and not even remotely atomic.
2017-10-31 13:58:30 -04:00
Ben Newman
55a6d1b50b Revert "Rename installPath property to absModuleId, and make absolute."
This reverts commit b9f0a54b39.

Though probably a good idea for the future, this change was not really
necessary for Meteor 1.6, and probably too risky for a release candidate.
2017-10-31 10:06:25 -07:00
Ben Newman
8dc1fc3512 Fix typo in ImportScanner#_scanFile.
Introduced by 3faee05eed.

cc @cpury @JanMP
2017-10-26 12:47:19 -07:00
Ben Newman
6323a34d6a Adjust npm update notifier opt-out environment variable.
https://github.com/zkat/npx/issues/98#issuecomment-316936135
https://www.npmjs.com/package/update-notifier#user-settings
2017-10-26 12:37:35 -07:00
Ben Newman
c03a46f70f Regression test for #9185 (fixed by #9187). 2017-10-26 12:37:23 -07:00
Ben Newman
3b7943f631 Add more comments to recently-modified ImportScanner logic. 2017-10-26 12:23:49 -07:00
Ben Newman
202e913faa Call _scanFile far fewer times in ImportScanner#scanMissingModules. 2017-10-26 12:23:49 -07:00
Ben Newman
1470bc841f Remember whether parent module of failed import was dynamic.
Fixes #9182.
2017-10-26 12:23:49 -07:00
Ben Newman
4e778b6e17 Rename installPath property to absModuleId, and make absolute.
The `installPath` property was always essentially an absolute module
identifier that was simply missing the leading '/' character, so this
commit acknowledges that role by renaming the property to `absModuleId`
and adding the leading slash.
2017-10-26 12:23:48 -07:00
Ben Newman
9ac6d60ba2 Track all failed imports separately.
Previously, if more than one module in a package tried and failed to
import the same identifier, we would record information about only the
last failed import.

This was good enough for later attempting to resolve the failed import in
other packges or the application's `node_modules` directory (a concept
known as "peer dependencies"), but it sometimes discarded information
about whether the failed imports were dynamic. In particular, if the last
recorded failed import was a dynamic import, it could accidentally render
the entire peer dependency tree dynamic.

Although it's a bit more complicated than what we did before, I believe
the simplest solution is for the ImportScanner to maintain a mapping from
failed identifiers to lists of import information objects, rather than a
single object, so that no information is lost.
2017-10-26 12:23:48 -07:00
Ben Newman
6cee042b54 Simplify checking/setting file.imported in ImportScanner#_scanFile.
By checking and setting this property earlier, we can avoid scanning files
more than once.
2017-10-26 12:23:33 -07:00
Ben Newman
462a29702d Make Npm.require import built-in modules first. 2017-09-28 17:21:17 +03:00
Hugh Willson
1ab30946d8 Update cordova-ios to 4.5.1, to add in iOS 11 / Xcode 9 support
Fixes #9098.
Fixes #9126.
2017-09-26 14:08:04 -04:00
Ben Newman
cf45eb0f8c Update the modules test app to Meteor 1.5.2.1. 2017-09-26 12:29:04 -04:00
Ben Newman
cc47ba4a6f Update dynamic-import test app to Meteor 1.5.2.1. 2017-09-25 20:24:49 -04:00
Ben Newman
750d11e853 Merge branch 'master' into release-1.5.2.1 2017-09-25 17:36:31 -04:00
Ben Newman
5947df645a Allow Npm.require to find packages in application node_modules.
This used to "work" (somewhat accidentally) before we got stricter about
which `node_modules` directories `Npm.require` can search:
971d2b1272

This commit should fix the problem with `juliancwirko:postcss` reported
here: https://github.com/meteor/meteor/issues/9094#issuecomment-331964596

Note that this only works for `Npm.require` when called during the build
process, not at application runtime. Use ordinary `require` for that.
2017-09-25 16:43:05 -04:00
Ben Newman
022f87c5b1 Avoid stopping fs.watchFile pollers when rewatching.
Calling unwatchFile may result in stopping the watcher before watchFile is
called, which then restarts it. This temporary stoppage appears to cause
change events to be missed sometimes. In particular, preventing this
stop/start with the acrobatics in this commit seems to fix recent
compiler-plugins.js test failures.
2017-09-22 15:00:17 -04:00
Ben Newman
7fd4fd559b Support .meteorignore files.
Closes https://github.com/meteor/meteor-feature-requests/issues/5.
2017-09-22 08:47:37 -04:00
Ben Newman
f4f4fd9994 Optimistically depend on parent directory when file does not exist.
With any luck, this will solve a host of problems related to undetected
changes when new files are created.
2017-09-22 08:47:36 -04:00
cyrille
a5f27fa723 Fix App.icons documentation typo 2017-09-22 13:09:42 +02:00
Ben Newman
069d3dffe7 Additional timeout for duplicate extension compiler plugins test. 2017-09-20 16:33:52 -04:00
Jesse Rosenberger
d50b83cc47 When starting mongod, yield until the heartbeat has pulsed after election. (#9119)
* When awaiting Mongo, wait until the heartbeat has pulsed after election.

> Prologue: A heartbeat is used amongst members of a MongoDB replica set
to poll the status of said members.

When we are initiating a new replicaset for the test Mongo server, the
replicaset is not fully prepared to accept writes until the voting
members have negotiated and propagated their decision about who is the
"primary" to all members involved.  This seems to be delayed by almost
_exactly_ the default heartbeat interval, which is 2000ms.

The heartbeat interval is marked as an "internal only" property in Mongo
so I was hesitant to lower it.  It's also a new property in Mongo 3.2
which might explain why this cropped up a while ago.

I believe this heartbeat delay is the only explanation for why the
`rs.status()` (i.e. `replSetGetStatus`) believes it is ready before the
`mongod` has actually printed "transition to primary complete" to the
log.

Fixes meteor/meteor#9026.

* Replace addl. variable occurrence with the new `firstMemberState` var.
2017-09-20 14:51:54 -04:00
Ben Newman
e59e0a582a Convert \s to /s in Npm.require'd module identifiers.
This is another way of addressing the problem I attempted to fix with
f34c5ec926 earlier today.

Apparently, older versions of compiler plugin-registering packages such as
standard-minifier-css and templating-compiler still depend on older
versions of the meteor package, which may still use path.join to import
fibers/future. This can be fixed by republishing those packages, as I did
in 917b01ac5f, but I'd prefer not to
republish every compiler plugin package.

Fortunately, we can also solve the problem by being more tolerant in the
implementation of Npm.require, which is what this commit does.
2017-09-18 16:54:23 -04:00
Ben Newman
565e6904d7 Avoid using meteor/tools/node_modules symlink (missing on Windows). 2017-09-18 14:22:41 -04:00
Ben Newman
7cbb2bb579 Tolerate : or _ in dynamic version identifiers, and add tests.
Follow-up to #9103.
2017-09-18 12:34:47 -04:00
Ben Newman
971d2b1272 Standardize Npm.require exceptions and limit lookup paths. (#9095)
Ever since Meteor 1.3 first introduced a module system based on something
other than `Npm.require`, we've continued throwing missing module
exceptions that refer to `Npm.depends` and/or `Npm.require`, even if the
developer called `require` or used an `import` declaration. This commit
fixes that, so that all missing module exceptions look like 'Cannot find
module "module/name"'.

I also noticed recently that `Npm.require` is capable of returning modules
installed in `node_modules` directories completely outside the app, which
is bad news for development/production reproducibility. Fixed that too.

CC @hwillson who has spoken of deprecating `Npm.require` entirely, and
just using `require` everywhere, instead.
2017-09-18 11:39:45 -04:00
Christian Klaussner
c5960a6509 Add shell-server package to scaffold app skeleton (#9085) 2017-09-13 11:50:48 -04:00
Ben Newman
e94349937e Update dynamic-import test app to Meteor 1.5.2. 2017-09-11 15:32:39 -04:00
Ben Newman
d6666c96f5 Update modules test app to Meteor 1.5.2. 2017-09-11 15:27:25 -04:00
Ben Newman
31fa502148 Enable transform-do-expressions in production for modules test app. 2017-09-11 15:24:47 -04:00
Ben Newman
0d7ce023e0 Merge pull request #8702 from vlasky/devel
Support for UNIX sockets (#7392)
2017-09-06 11:11:51 -04:00
Hugh Willson
050688d81b Merge branch 'devel' into devel 2017-08-23 11:03:10 -04:00
Ben Newman
754b0c5abc Merge branch 'devel' into release-1.5.2 2017-08-22 20:55:33 -04:00
Ben Newman
67b76abc78 Make node-gyp look for headers in dev_bundle/include/node.
Thanks to @abernix for identifying this solution to the duplication
between dev_bundle/include/node and dev_bundle/.node-gyp/*/node.
2017-08-22 16:41:01 -04:00
Hugh Willson
e027a46d71 Add missing CLI help for test/test-packages --driver-package (#9035) 2017-08-22 15:57:43 -04:00
Ben Newman
00ff851352 Avoid calling files.statOrNull(absPath) in readAndWatchFileWithHash.
This is performance-sensitive code, and I think this extra (uncached) call
to files.statOrNull could be contributing to test timeouts on Circle CI.

Follow-up to #9030.
2017-08-22 13:40:19 -04:00
Hugh Willson
b498c41401 Avoid creating a watcher when --settings is set to a directory (#9030)
As outlined in #3854, if `meteor --settings` points to a
directory instead of a file, an application gets caught up
in an infinite rebuild loop. Since it was assumed only a
file would be configured via `--settings`, a file watcher
is created for the specified directory, and that watcher
is then triggered ad infinitum.

These changes prevent a file watcher from being created
on a `--settings` directory.
2017-08-21 16:25:15 -04:00
Hugh Willson
cc5525f9a8 Use UNIX_SOCKET_PATH instead of PORT for socket files. 2017-08-18 08:44:34 -04:00
Ben Newman
d2213f0288 Merge branch 'devel' into release-1.5.2 2017-08-17 10:08:20 -04:00