Commit Graph

6224 Commits

Author SHA1 Message Date
Ben Newman
15135a65df Test importing lazy packages and dynamic package modules. 2017-02-16 18:20:42 -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
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
Ben Newman
a3e8cf6763 Update modules test app to Meteor 1.4.2.4. 2017-02-02 15:46:59 -05:00
Ben Newman
cc8734ddca Merge branch 'master' into devel 2017-02-02 15:18:48 -05:00
Ben Newman
1f60258821 Merge pull request #8142 from abernix/feature/fix-7849-stale-cordova-build
Cordova project preparation must occur before copying to the build
2017-02-01 12:40:06 -05:00
Ben Newman
bf9338b367 Support ./meteor publish-release --skip-tree-hashing ... flag. 2017-02-01 12:24:06 -05:00
Ben Newman
c683a79595 Unify file.emptyStub and file.imported === "implicit" as file.implicit.
Note that there was a typo in ResourceSlot#addStylesheet, so
file.emptyStub was never === true before.
2017-02-01 10:35:31 -05:00
Ben Newman
6c643a4763 Preserve true "main" and "browser" fields of package.json modules.
Previously, when building a JavaScript bundle for the client, if a
package.json file had a string-valued "browser" field, we would replace
the value of the "main" field of the bundled package.json module with the
value of the "browser" field. This trick was important because it allowed
an npm package to have a different entry point on the client than it had
on the server.

However, that approach became inconsistent if the package.json file was
also explicitly imported as a module, because the package.json stub used
for module resolution prevented the real contents of package.json from
getting bundled, and disagreed with the original package.json module about
the value of the "main" field.

To resolve that inconsistency, it seems better to avoid modifying the
"main" field of package.json modules, and instead rely on the runtime
module system to make sense of the "browser" field, regardless of whether
the package.json module is a stub used only for module resolution or
contains the full contents of the original package.json file.

The ability to understand "browser" fields of package.json modules was
introduced in install@0.8.3:
377d1a3b51

This is potentially a backwards-incompatible change for developers using
this version of `ImportScanner` and `Resolver` who have not yet upgraded
their `modules-runtime` package to at least version 0.7.8. The solution is
to upgrade `modules-runtime`, though it would be nice to enforce that
better somehow.
2017-02-01 10:34:52 -05:00
Ben Newman
2613582311 Always copy node_modules/.bin into bundle/programs/server/npm.
Fixes #8136.
2017-02-01 09:58:10 -05:00
Jesse Rosenberger
3b8c886f6f Merge branch 'devel' into release-1.4.3 2017-01-26 15:39:21 -08:00
Ben Newman
355cde306a Merge pull request #8239 from wojtkowiak/cordova-6.4.0
Update to Cordova 6.4.0
2017-01-25 16:39:13 -05:00