Commit Graph

6906 Commits

Author SHA1 Message Date
Ben Newman
105bdd8fd7 Start marking some optimistic functions as disposable. 2018-04-18 16:32:01 -04:00
Ben Newman
c5302bb2ba Stop scanning node_modules directories in PackageSource#_findSources. (#9825)
This functionality was originally intended to allow importing
compiled-to-JS modules from `node_modules`, by precompiling any modules
found in top-level npm packages, as long as a Meteor compiler plugin was
registered for the module's file extension.

As discussed in #9800, this extra compilation burden can be non-trivial,
especially if you happen to install an npm package such as `less`, which
contains hundreds of `.less` files in the `node_modules/less/test/`
directory.

More generally, this functionality was an early attempt to enable
selective compilation of `node_modules` directories, but it was not a good
solution to that problem, because in almost all cases the extra
compilation was unwanted.

Meteor 1.7 (formerly known as 1.6.2) will give full control over selective
compilation of `node_modules` back to the application developer (#9771),
which should afford a much better solution to this problem. If you've
installed some `.less` or `.scss` or `.ts` files from npm into your
`node_modules` directory, just create a symlink to the package directory
within your application, and those modules will be compiled and become
importable by other JS modules, as if they were part of the application.
2018-04-18 16:19:55 -04:00
Ben Newman
483661a9f4 Merge branch 'devel' into release-1.6.2 2018-04-06 11:09:04 -04:00
Ben Newman
bd26ce3d1e Make sure ImportScanner#_realPath always returns a string. 2018-04-06 10:59:18 -04:00
Ben Newman
3d025520c1 Provide more detailed profiling of _buildLocalPackages. (#9802)
https://github.com/meteor/meteor-feature-requests/issues/283

The ProjectContext#_buildLocalPackages method calls
IsopackCache#buildLocalPackages which calls _ensurePackageLoaded for each
local package, so this commit exposes how long each of those
_ensurePackageLoaded calls takes (when METEOR_PROFILE is enabled).
2018-04-06 10:51:58 -04:00
Christian Klaussner
c0bce716fc Update MongoDB driver to 3.0.5 (#9790)
* Update MongoDB driver to 3.0.5

* Use `MongoClient` instead of `Db` in Meteor Tool

* Update `mongo-livedata` test for new MongoDB driver version

* Consider `BulkWriteError` when checking MongoDB errors
2018-04-06 10:28:25 -04:00
Ben Newman
5fbb99ce5b Merge branch 'devel' into release-1.6.2 2018-04-05 20:29:02 -04:00
Ben Newman
5241d67ded Apply .meteorignore files to node_modules in PackageSource#_findSources. (#9800)
Although there was a comment in this code about not applying .meteorignore
files to the contents of node_modules directories, I'm pretty sure that
was the wrong decision, because .meteorignore merely limits what Meteor
tries to compile as application code, and does not actually modify or hide
node_modules files from other parts of Meteor (or Node).

In other words, there's no harm in letting .meteorignore apply to
node_modules, and there may be a LOT of benefit, because it allows the
developer to fight back when compilation descends unexpectedly into an npm
package that contains non-.js[on] files for which a compiler plugin has
been registered, an obscure but not uncommon behavior originally intended
to allow importing CSS assets from npm packages:

* https://github.com/meteor/meteor/issues/6037
* 43659ff561
* a073280e3f
* https://github.com/meteor/meteor/issues/5242
* https://github.com/meteor/meteor/issues/6846
* https://github.com/meteor/meteor/issues/7406

However, we now have a much more powerful tool for selectively compiling
specific npm packages: #9771. In light of this new approach, we should
probably remove the promiscuous node_modules compilation behavior
altogether, as it might speed up rebuild times for many applications whose
developers don't know or care that this behavior exists. For example,
abandoning this behavior would prevent the problem reported here:
https://github.com/meteor/meteor/issues/6950

In the meantime, this commit makes .meteorignore work for node_modules.
2018-04-05 19:55:43 -04:00
Aaron Curtis
90d5c1efc4 Correctly append branch locations (#9760)
Before this change,

  meteor create --list

would produce output containing the following line:

  todos-react: https://github.com/meteor/todos#react

but "meteor create --example todos-react" would create the blaze version of the todos example.

This was because for some reason the code is using a # to append the name of the branch, instead of /tree/.
2018-04-04 11:42:02 -04:00
Ben Newman
5938e88a83 Scan packages/non-core in self-test, e.g. to find jquery. 2018-04-03 12:50:42 -04:00
Lucas Hansen
8d320497d6 Cache linker cache files in memory (#9794) 2018-04-02 19:37:08 -04:00
Ben Newman
52a2354955 Merge branch 'devel' into release-1.6.2 2018-04-02 14:02:07 -04:00
Ben Newman
e6a0e9089d Merge branch 'master' into devel 2018-04-02 13:08:43 -04:00
Ben Newman
6b3cc2e94f Avoid displaying package stats errors in headless mode.
Console.isInteractive() will be false during our Circle CI test runs,
since we set the METEOR_HEADLESS environment variable, so this change
should help prevent spurious test failures like these:
https://circleci.com/gh/meteor/meteor/15305.
2018-04-02 12:32:50 -04:00
Ben Newman
4c0e583249 Update meteor-babel to version 7.0.0-beta.42.
https://github.com/babel/babel/releases/tag/v7.0.0-beta.41
https://github.com/babel/babel/releases/tag/v7.0.0-beta.42

Also updated various @babel/... plugin versions in package.json files.
2018-03-31 13:10:12 -04:00
Ben Newman
efdc66d614 Merge branch 'devel' into release-1.6.2 2018-03-27 12:15:11 -04:00
Ben Newman
9401f0d572 Add tests of selective node_modules compilation using symlinks. 2018-03-26 14:51:51 -04:00
Ben Newman
d35987d929 Enable selective compilation of node_modules via symlinking.
If a package in node_modules needs to be compiled for older browsers,
simply symlink the package directory into your application somewhere, and
then import the package as you normally would.

Because of the symlink, code within the package will be compiled as if it
was part of your application, and any imports that refer to modules in the
package will automatically use the compiled code rather than the raw code
from node_modules.

Note that you can also symlink individual files to make them be compiled
like application modules, rather than linking an entire package directory.

Creating symlinks could be considered a form of configuration, but
otherwise this is a zero-configuration solution to selectively compiling
packages within node_modules, which has been something of a holy grail in
the JavaScript community lately.

https://github.com/meteor/meteor-feature-requests/issues/6
2018-03-26 14:47:38 -04:00
Ben Newman
970d58409f Move realpathOrNull into tools/fs/files.js. 2018-03-26 12:04:13 -04:00
Ben Newman
ebd84317d8 Decompose _readDepFile helper from ImportScanner#_scanFile. 2018-03-26 12:04:13 -04:00
Ben Newman
0fca4c56aa Fix handling of old files in ImportScanner#_addFile. 2018-03-26 12:04:13 -04:00
Ben Newman
1757a69d8b Generate stubs that call module.useNode() for server node_modules.
Once this logic is established, the install.js library will no longer need
to know anything about module.useNode():
6412f4aabb/install.js (L322-L325)
2018-03-26 12:04:12 -04:00
Ben Newman
c6c92255e5 Relax options.from precondition in Builder#copyNodeModulesDirectory. 2018-03-26 12:04:12 -04:00
Ben Newman
e7ad5d2a42 Call files.cp_r with { preserveSymlinks: true } in more places.
Now that symlinks can be used to enable selective compilation of
node_modules, it's important to preserve them.
2018-03-26 12:04:12 -04:00
Ben Newman
e50da2f367 Merge branch 'devel' into release-1.6.2 2018-03-23 21:17:53 -04:00
Ben Newman
22e3f99565 Fix copying/symlinking of node_modules directories during build.
The bulk of this commit implements `builder.copyNodeModulesDirectory` to
allow more than one `node_modules` directory to be copied to the same
destination with as much safe symlinking as possible.

However, the crux of the fix for #9738 is the removal of the call to
`builder.generateFilename`, which deserves additional explanation.

If multiple directories are copied to the same output path by the builder,
in some cases it makes sense to ensure distinct directory names by adding
numeric suffixes to some of the directories.

In general, `builder.generateFilename` can get away with this renaming
only if the exact names of the directories are an implementation detail.

However, the code changed by this commit was altering the names of
`node_modules` directories whenever a package had both an `Npm.depends`
and a local `node_modules` directory.

Not only is it totally invalid to change the name of a `node_modules`
directory, but there is also no harm in copying the contents of multiple
`node_modules` directories into one final directory called `node_modules`.

Should fix #9738.
2018-03-23 18:59:32 -04:00
Ben Newman
339f128bd4 Merge branch 'devel' into release-1.6.2 2018-03-21 15:23:01 -04:00
Jesse Rosenberger
39030204a9 Merge branch 'hwillson-mongo-3.6-upgrade-with-test-fix' into devel 2018-03-21 20:24:37 +02:00
Hugh Willson
542ad06b75 Revert the revert of "Upgrade to Mongo 3.6 (#9533)"
This reverts commit 85d74f8d2b.
2018-03-21 19:27:03 +02:00
Ben Newman
41b0b309c6 Bump @babel/runtime to latest version in various package[-lock].json files. 2018-03-20 21:13:52 -04:00
Ben Newman
4b2d6c22bc Update meteor-babel to version 7.0.0-beta.42.
https://github.com/babel/babel/releases/tag/v7.0.0-beta.41
https://github.com/babel/babel/releases/tag/v7.0.0-beta.42
2018-03-20 19:57:00 -04:00
Cyrille Colin
db31fbc606 Open Xcode project folder instead of project file (#9724) 2018-03-15 19:49:22 -04:00
Ben Newman
cc77e963c5 Merge branch 'devel' into release-1.6.2 2018-03-07 12:31:43 -05:00
Ben Newman
74b8c595b7 Merge pull request #9715 from meteor/revamp-starter-app
Use meteor.{mainModule,testModule} for `meteor create` starter apps.
2018-03-07 11:58:00 -05:00
James Burgess
4ebf089d88 Remove underscore from meteor-base (#9596)
This should shave down bundle sizes by 14.4 kb for many non-blaze projects.

The other core meteor packages have not depended on `underscore` since #9362. However, we are only able to remove this last dependency now due to the previous commit, which eliminated usages of `underscore` from apps that did not have the package listed in their `packages` files. This was causing CI test failures that now should be corrected.

Any meteor apps currently using `_` without `underscore` listed in their `packages` file will need to add the package explicitly.

Version number of `meteor-base` bumped from 1.3.0 to 1.4.0.

There are only a few uses of `underscore` in these apps, and two of them actually used `underscore` without having it explicitly listed in their `packages` file.

This is a problem, because the apps were relying on the dependency from `meteor-base`, which we want to remove to cut down bundle sizes.

For the `modules` test app, I've added `underscore` to the `packages` file, because it is using `_` in an assertion about the module system. For the other app and all other uses of `_`, rather than add `underscore` to the `packages` files, I took the modernization route and replaced the functions with their ES6 equivalents, and then removed `underscore` from all `packages` files.
2018-03-07 11:23:52 -05:00
Ben Newman
88ac202349 Simplify test/main.js for newly meteor created apps. 2018-03-03 12:56:45 -05:00
Ben Newman
2f1956c497 Use meteortesting:mocha for testing newly meteor created apps. 2018-03-03 12:56:25 -05:00
Ben Newman
d55707894b Use meteor.{mainModule,testModule} for meteor create starter apps.
In order for Meteor to maintain its commitment to being a
zero-configuration tool, any configuration options that we add must come
pre-configured in the best way possible for newly created apps.

In particular, the default new Meteor app must contain a reasonable
testing story, or else we are signalling to the community that testing is
an afterthought.

With that said, this PR is still a work in progress. I welcome your
feedback on how best to configure the default `meteor create` starter app.

Builds on #9690 and #9714.
2018-03-01 18:12:22 -05:00
Ben Newman
f14d50538e Merge branch 'devel' into release-1.6.2 2018-03-01 18:02:08 -05:00
Ben Newman
e7b0a70a98 Use meteor.testModule in package.json of modules test app. 2018-03-01 14:27:31 -05:00
Ben Newman
36c7ee8efa Remove unnecessary 'meteor.' prefix from {main,test}Module self-tests. 2018-03-01 14:27:31 -05:00
Ben Newman
601f0d6f9f Update 'meteor test' help text to explain meteor.testModule. 2018-03-01 14:27:31 -05:00
Ben Newman
60731a88bc Test meteor.testModule with just meteor test (not --full-app). 2018-03-01 14:27:31 -05:00
Ben Newman
a212d9f515 Also support meteor.testModule to configure test entry points.
Setting meteor.testModule is a great way to specify test entry points
explicitly, rather than relying on Meteor's isTestFilePath heuristics:
https://github.com/meteor/meteor/blob/devel/tools/isobuild/test-files.js

The syntax is identical to meteor.mainModule, so you can set an explicit
meteor.testModule.{client,server,...} for each platform. If a testModule
is not specified for a platform, then Meteor's existing rules about test
file paths apply for that platform, as before.

If a testModule is specified, that module will always be loaded eagerly
when running `meteor test`, in addition to any other modules that load
eagerly because of meteor.mainModule or other rules regarding module
loading. If you run `meteor test` without the `--full-app` option, then no
application JS modules other than the testModule (and any modules imported
by it) will be loaded eagerly.
2018-03-01 14:27:30 -05:00
Ben Newman
b0e5400ff5 Improve meteor.mainModule arch discovery in tests.
If config.mainModule.client === false, then mainId should === false.
2018-03-01 14:27:30 -05:00
Ben Newman
8dd2402f76 Allow meteor.mainModule.{client,server} === false for no entry point.
If meteor.mainModule.{client,server,...} === false, no modules will be
loaded eagerly for that architecture. This is useful if you have an app
with no special app/{client,server} directory structure and you want to
specify an entry point for just the client (or just the server), without
accidentally loading everything on the other architecture.
2018-03-01 14:27:30 -05:00
Ben Newman
66508c483a Remove test driver packages from tests/apps/app-config/.meteor/versions. 2018-03-01 14:27:30 -05:00
Ben Newman
c2e3c52dd3 Simplify ResourceSlot#_isLazy for package resources. 2018-03-01 14:27:30 -05:00
Ben Newman
95efca2223 Stop using _inferFileOptions for package files.
Determining if Meteor package files should be loaded lazily or eagerly is
a lot easier than doing so for application files, so we should just do
that separately, to avoid any risk of application directory layout logic
interfering with package behavior.
2018-03-01 14:27:30 -05:00
Ben Newman
c28d813745 Merge branch 'devel' into release-1.6.2 2018-02-23 18:39:06 -05:00