Commit Graph

6233 Commits

Author SHA1 Message Date
Ben Newman
ae59532f12 Delete MeteorDynamicImportCache database before running tests.
Also run the tests a third time without deleting the database, to exercise
the caching logic.
2017-03-04 19:56:10 -05:00
Ben Newman
f9de0a7b65 Use NODE_ENV (with --production) to run production import(...) tests. 2017-03-04 19:56:10 -05:00
Ben Newman
7c48703a13 Split dynamic import(...) tests into development/production runs.
Though running the tests twice in the same app mostly worked, the error
reporting was confusing because it did not indicate which run was which.
2017-03-04 19:51:15 -05:00
Ben Newman
7031ea1dd5 Bump LINKER_CACHE_SALT for good measure.
Recent changes to the way the linker works might not be reflected unless
we invalidate .meteor/local/bundler-cache.
2017-02-21 13:25:58 -05:00
Ben Newman
41e9ee857e Evaluate dynamic module code in package scope.
This should elegantly address the issues described in this comment:
https://github.com/meteor/meteor/pull/8327#issuecomment-280881830

I toyed with the possibility of turning package variables (both imports
from other packages and intercepted "global" variable assignments) into
properties on a shared namespace object, but that would have been a major
breaking change for existing package code, because it would have required
automatically rewriting variable references in package modules.
2017-02-21 11:47:31 -05:00
Ben Newman
2c172db31a Merge branch 'devel' into release-1.5 2017-02-21 11:33:00 -05:00
Ben Newman
15135a65df Test importing lazy packages and dynamic package modules. 2017-02-16 18:20:42 -05:00
tcastelli
907e1d9183 Update help text to clarify the use of external npm commands (#8355)
* Update help text to clarify the use of external npm commands

First attempt to improve the help text regarding the external npm commands that can be run directly with 'meteor'.
#8277
Further enhancements could include listing also the "current" available external commands by parsing a ls/dir command or 'meteor npm list -g -depth 0'. If they command is uninstalled between the call of 'meteor help' and 'meteor <external command>' we are not the ones to be blamed but the user instead :)

* Update 'external command' to 'npm command'

* Joining new suggestions and cleaning some redundancy

Included @abernix suggestions (with some variations) to include references to npm and node. Also clarified how to install a npm package and run it afterwards

* Typo

Changed to global context

* Reword description of "other" npm commands

These commands are similar to `node` and `npm`, but we didn't want
them to be confused with `npm command` commands.

* Avoid repetition of `meteor npm install --global`
2017-02-15 15:46:53 -05:00
Ben Newman
c2e4b77636 Protect against edge case when resolved is a string.
In particular, if the "main" field of the package.json file cannot be
resolved, then the `resolved` variable will be "missing", which is a
truthy value that silently rejects property assignments. Ugh!
2017-02-15 14:09:36 -05:00
Ben Newman
0b26890d97 Protect against edge case when resolved is a string.
In particular, if the "main" field of the package.json file cannot be
resolved, then the `resolved` variable will be "missing", which is a
truthy value that silently rejects property assignments. Ugh!
2017-02-15 14:07:27 -05:00
Ben Newman
6b89bed42d Merge branch 'devel' into release-1.5 2017-02-14 12:28:59 -05:00
Eric Dobbertin
005c521f54 Fix comment about unordered imports (#8362) 2017-02-14 09:03:25 -08:00
Ben Newman
e43a5d07f0 Update the modules test app to Meteor 1.4.3.1. 2017-02-14 09:55:38 -05:00
Ben Newman
434116aa84 Fix installing from shrinkwrap.
Although we thought the upgrade from `npm` 3.10.9 to 4.1.2 was worthwhile
and safe, this breaking change proved problematic:
https://github.com/npm/npm/blob/latest/CHANGELOG.md#no-more-partial-shrinkwraps-breaking

Specifically, if a Meteor package calls `Npm.depends` in a way that
disagrees with the contents of `.npm/package/npm-shrinkwrap.json` file,
Meteor will create a partial shrinkwrap file in order to install the
correct top-level npm dependencies, but transitive dependencies of the
package will no longer be installed.

This was fixed in Meteor 1.4.2.7 by reverting the upgrade of npm, but
Meteor 1.4.3.1 will keep npm@4.1.2 and fix the consequences.
2017-02-13 18:11:11 -05:00
Ben Newman
c8f77a57b9 Automatically add dynamic-import package when updating to Meteor 1.5. 2017-02-10 18:05:45 -05:00
Ben Newman
cda9ba1d41 Merge branch 'release-1.4.3' into release-1.5 2017-02-10 14:37:43 -05:00
Ben Newman
d9184808cb Avoid calling ImportScanner#_getRelativeImportId with bad parentPath.
Fixes #8336.
2017-02-10 14:33:20 -05:00
Jesse Rosenberger
f4d677fbc8 Add an upgrader which modifies accounts-* packages automatically.
The transformations to be made here are:
   * Existence of `accounts-<service>` **adds** `<service>-config-ui`
   * Existence of `<service>` **changes to** `<service>-oauth`
 https://github.com/meteor/meteor/issues/7715#issuecomment-276529351

 Relates to:

  * facebook: https://github.com/meteor/meteor/pull/7728
  * github: https://github.com/meteor/meteor/pull/8303
  * google: https://github.com/meteor/meteor/pull/8275
  * meetup: https://github.com/meteor/meteor/pull/8231
  * meteor-developer: https://github.com/meteor/meteor/pull/8305
  * twitter: https://github.com/meteor/meteor/pull/8283
  * weibo: https://github.com/meteor/meteor/pull/8302
2017-02-10 17:34:28 +02:00
Ben Newman
844e2c34ad Consider npm packages with {,pre,post}install scripts non-portable.
Inspired by analysis from @danstiner:
https://github.com/meteor/meteor/issues/8225#issuecomment-275044900

Fixes #8225, as well as the tests I added in 672c4f338a.

I changed the name of the .meteor-portable file to .meteor-portable-1.json
in order to invalidate previous .meteor-portable files. This naming scheme
will be more sustainable, because we can keep incrementing the version
number whenever we change this logic.
2017-02-09 16:06:55 -05:00
Ben Newman
bcffe53d14 Consider npm packages with {,pre,post}install scripts non-portable.
Inspired by analysis from @danstiner:
https://github.com/meteor/meteor/issues/8225#issuecomment-275044900

Fixes #8225, as well as the tests I added in 672c4f338a.

I changed the name of the .meteor-portable file to .meteor-portable-1.json
in order to invalidate previous .meteor-portable files. This naming scheme
will be more sustainable, because we can keep incrementing the version
number whenever we change this logic.
2017-02-09 16:04:23 -05:00
Ben Newman
d0aa53cef9 Basic test harness for dynamic imports. 2017-02-09 13:25:59 -05:00
Ben Newman
672c4f338a Add the modules test app to the self-test suite.
I've been running these tests manually ever since Meteor 1.3, but they
really should run every time.
2017-02-09 12:09:48 -05:00
Ben Newman
fabad4cc8d Overwrite implicit modules only if they are package.json files.
Implicit empty stub CSS modules added in addStylesheet in
compiler-plugin.js were being overwritten with actual CSS module code,
thanks to logic intended to support replacing package.json stubs with
their actual contents.

The meaning of "implicit" is somewhat overloaded: for package.json
modules, it means the module is a minimal stub (just the "name",
"version", and "main"/"browser" fields) that should be replaced if ever
explicitly imported. For empty stub CSS modules, it means the module
should yield to any actual modules added via addJavaScript.
2017-02-09 12:09:34 -05:00
Ben Newman
cf71259080 Overwrite implicit modules only if they are package.json files.
Implicit empty stub CSS modules added in addStylesheet in
compiler-plugin.js were being overwritten with actual CSS module code,
thanks to logic intended to support replacing package.json stubs with
their actual contents.

The meaning of "implicit" is somewhat overloaded: for package.json
modules, it means the module is a minimal stub (just the "name",
"version", and "main"/"browser" fields) that should be replaced if ever
explicitly imported. For empty stub CSS modules, it means the module
should yield to any actual modules added via addJavaScript.
2017-02-09 12:02:34 -05:00
Ben Newman
696b8d4b3c Fix Buffer conversion logic in writeFile. 2017-02-09 10:21:21 -05:00
Ben Newman
f5ae115c10 Don't forget to write dynamic files without source maps. 2017-02-09 10:19:49 -05:00
Ben Newman
e469eeec05 Fix tests by adding //# sourceMappingURL= only to dynamic files.
Also, the regular expression for removing existing source map comments now
matches only if the comment starts at the beginning of a line, following
previous behavior more closely.

To get this exactly right, we would need to tokenize the source to avoid
matching comments in string literals, for example, but that's hard because
this logic needs to work for multiple file types, not just JavaScript.
2017-02-08 19:40:38 -05:00
Ben Newman
365ceb6386 Tolerate ENOENT exceptions from files.realpath in isWithinProdPackage. 2017-02-08 17:18:30 -05:00
Ben Newman
fa23107642 Merge branch 'release-1.4.3' into release-1.5 2017-02-08 16:10:52 -05:00
Ben Newman
2010e9d11a Merge branch 'devel' into release-1.4.3 2017-02-08 14:47:03 -05:00
Ben Newman
858dc64db4 Merge branch 'master' into devel 2017-02-08 14:43:26 -05:00
Ben Newman
cafe4cc084 Fix bad npm package stripping logic introduced to fix #8136.
When `start + maxPartCount > parts.length`, this code was comparing
array holes to strings, leading to unpredictable results.

Blame: 2613582311
2017-02-08 11:04:20 -05:00
Ben Newman
4baa5a44dc Allow file.data to be a Buffer in Target#minifyJs. 2017-02-07 20:06:10 -05:00
Ben Newman
5ff0f4f987 Fix test failures by re-anonymizing module wrapper functions. 2017-02-07 19:22:47 -05:00
Ben Newman
8e344a324a Bump LINKER_CACHE_SALT and compiler.BUILT_BY for good measure. 2017-02-07 16:18:40 -05:00
Ben Newman
158adc48e8 Expose manifest of dynamic modules to the dynamic-import package. 2017-02-07 16:17:44 -05:00
Ben Newman
22d1b3ddfe Make special arguments in boot.js more configurable.
Currently this functionality is only used for exposing npmRequire and
Profile to the packages/modules-runtime.js bundle, but I'm planning to use
it for packages/dynamic-import.js soon.
2017-02-07 16:17:43 -05:00
Ben Newman
9845c2f484 Unify sourceMappingURL logic in tools/isobuild/bundler.js. 2017-02-07 16:17:43 -05:00
Ben Newman
ebff32f626 Write dynamic files separately in builder output directories. 2017-02-07 16:17:42 -05:00
Ben Newman
a2e950dfd3 Include dynamic stubs in linked meteorInstall bundles. 2017-02-07 16:17:42 -05:00
Ben Newman
4bff3220e8 Include .jsonData on files returned by ImportScanner#getOutputFiles. 2017-02-07 16:17:41 -05:00
Ben Newman
0e210ef53c Allow ImportScanner#getOutputFiles to return dynamic files. 2017-02-07 16:17:41 -05:00
Ben Newman
38c1e5b88a Teach findImportedModuleIdentifiers to find dynamic imports. 2017-02-07 16:17:41 -05:00
Ben Newman
868a52829f Register package@version constraints for current release.
Package version unpinning (#7084) removed all exact package@=version
constraints derived from the current release.

As we discovered with Meteor 1.4.2.4 (#8306), this meant releases no
longer had any power to enforce package upgrades, which is why the
follow-up Meteor 1.4.2.5 release (#8311) was necessary.

This commit has the same effect as putting package@version in your
.meteor/packages file for every local/core package that your app uses.
2017-02-07 14:52:49 -05:00
Ben Newman
59124681bc Preserve true "main" and "browser" fields of package.json modules.
This reverts commit 32140c8707, restoring
commit 6c643a4763.
2017-02-07 10:43:20 -05:00
Ben Newman
29b88d29d4 Merge branch 'devel' into release-1.4.3 2017-02-07 10:37:54 -05:00
Ben Newman
3801349437 Merge branch 'master' into devel 2017-02-07 10:36:49 -05:00
Jesse Rosenberger
32140c8707 Revert "Preserve true "main" and "browser" fields of package.json modules."
This reverts commit 6c643a4763.
2017-02-02 20:26:54 -08:00
Ben Newman
a00b19d1fb Merge branch 'devel' into release-1.4.3 2017-02-02 16:07:50 -05:00
Hugh Willson
f57d4d157d Added extra colon-converter calls to the bundler and linker. (#8293)
* Added extra colon-converter calls to the bundler and linker.
* Rewording of convert to convertColons for clarity.
2017-02-02 15:54:59 -05:00