Commit Graph

7114 Commits

Author SHA1 Message Date
Ben Newman
991ff6d620 Merge branch 'devel' into release-1.8.1 2019-01-10 11:32:02 -05:00
Ben Newman
dea96ecac6 Fix #10409 by ignoring self-referential browser aliases in package.json. 2019-01-10 11:31:49 -05:00
Ben Newman
e25415927f Merge branch 'devel' into release-1.8.1 2019-01-06 19:10:45 -05:00
Ben Newman
fb2146cb3b Stop excluding test modules when meteor.testModule found in package.json. (#10402)
New Meteor apps have the following meteor.testModule in their package.json
files by default

  "meteor": {
    "testModule": "tests/main.js"
  }

When meteor.testModule is defined, it determines the test entry point when
running the `meteor test` command, ignoring legacy file naming conventions
like *.tests.js or *.app-tests.js.

The package-source.js code changed by this commit was incorrect because it
ignored those specially-named test files even when running tests, which
was a problem if the meteor.testModule tried to import them explicitly,
because they would not be properly compiled.

If you're using meteor.testModule, the distinction between `meteor test`
and `meteor test --full-app` matters a bit less, since the test entry
point will be the same for both modes, though you can still check
Meteor.isTest and Meteor.isAppTest at runtime to control test behavior.
2019-01-06 15:02:48 -05:00
Ben Newman
5d88d9a1a4 Improve stack traces for self-test failures. 2019-01-05 16:54:38 -05:00
Ben Newman
aaeb2a7c2c Pass --enableFreeMonitoring off to Mongo 4 shell, except on Linux. 2019-01-05 16:27:20 -05:00
Ben Newman
c7441e68c6 Ensure consistent LANG-related environment variables in findMongoPids.
For some reason, without all three of these environment variables set
(LANG, LC_ALL, and LANGUAGE), the STDOUT returned from the child process
in findMongoPids contained ?? in place of non-ASCII unicode characters,
which was causing the self-test of Mongo shell in a unicode application
directory to fail.

This implementation defaults all three environment variables to
process.env.LANG if it was defined, or "en_US.UTF-8" otherwise.
2019-01-05 15:05:34 -05:00
Ben Newman
bcf6bf2cfc Wait until test app is running before starting Mongo shell. 2019-01-05 15:04:30 -05:00
Ben Newman
61b2ac3878 Revert "Use --enableFreeMonitoring off instead of --quiet for Mongo shell."
This reverts commit 7055780697.

While this flag works as expected on MacOS, it appears not to be supported
on Linux, even using MongoDB 4.0.5 (the latest version):
https://jira.mongodb.org/browse/SERVER-38862
2019-01-05 13:17:33 -05:00
Ben Newman
7055780697 Use --enableFreeMonitoring off instead of --quiet for Mongo shell.
Previously: 7f7a987251

cc @klaussner @mitar
2019-01-05 12:45:24 -05:00
Ben Newman
6c87f68116 Fix mongo tests by adding a package.json to standard-app. 2019-01-05 12:45:22 -05:00
Ben Newman
4859f426dd Adjust timeouts to help Mongo self-tests pass reliably. 2019-01-04 14:13:25 -05:00
Ben Newman
905941fc2d Merge branch 'devel' into release-1.8.1 2018-11-23 12:48:04 -05:00
Ben Newman
0f5bed4707 Avoid passing lots of ...args to watch.sha1. 2018-11-20 17:47:49 -05:00
Ben Newman
346d512b13 Propagate input hashes all the way through bundling.
Hashes have a number of overlapping but not entirely redundant or
equivalent purposes within the build system.

Hashes of source code are important because they can be computed before
compilation and processing, and thus are useful as keys for caching that
expensive work. Source hashes remain useful even after compilation, as a
way of reflecting the contributions of source-code-sensitive assets like
source maps.

However, source hashes do not tell the whole story, and using them as
cache keys can be risky if the work that's being cached depends on
generated code rather than source code, as we recently discovered with the
findImportedModuleIdentifiers function. The preliminary fix for that
problem (#10330) was to cache findImportedModuleIdentifiers using a hash
of the generated code rather than the source hash.

PR #10330 swung a bit too far in the direction of ignoring source hashes
and considering only hashes of generated code. For example, the URLs of
source maps share the hash of the corresponding resource, but source maps
can change (because of superficial changes in the source code) without
changing the generated code of the resource. Ignoring the source hash when
computing source map URLs resulted in stale source maps with incorrect
line numbers.

A better solution seems to be to propagate the source hash (along with any
hashes of intermediate generated artifacts) all the way through bundling,
so that the final hash of any static resource reflects all information
that could/should change the behavior of that static resource, including
its source map, which embeds the exact source code of all contributing
files in the sourcesContent property. At every step of the way, we merge
all the input hashes into a single hash, so we don't have to keep juggling
multiple hashes, thankfully.

Sub-Resource Integrity (SRI) hashes still need to be computed from just
the final contents of a given asset, so that the browser can verify those
contents without knowing anything about the Meteor build system, but
that's handled separately.
2018-11-20 11:19:42 -05:00
Ben Newman
7ce3ca29fd Avoid computing servePath from undefined targetPath.
https://github.com/meteor/meteor/issues/10337#issuecomment-439674497
2018-11-19 12:40:33 -05:00
Ben Newman
b55806f931 Relax precondition in ResourceSlot#addJavaScript.
https://github.com/meteor/meteor/issues/10337#issuecomment-439638590
2018-11-17 15:26:05 -05:00
Ben Newman
c67d40f7f1 Merge branch 'devel' into release-1.8.1 2018-11-15 15:56:54 -05:00
Ben Newman
5e7e809cd1 Implement ResourceSlot#_addDirectlyToJsOutputResources to fix #10337. (#10338) 2018-11-15 13:50:48 -05:00
Ben Newman
014dfab1ac Implement ResourceSlot#_addDirectlyToJsOutputResources to fix #10337. (#10338) 2018-11-15 11:10:47 -06:00
Ben Newman
d19ac6a5dd Merge branch 'devel' into release-1.8.1 2018-11-12 20:52:26 -05:00
Ben Newman
4294414506 Update meteor-babel to version 7.1.5. 2018-11-12 19:35:47 -05:00
Ben Newman
44e713f046 Ensure file.hash is always computed from sha1(file.data).
With the introduction of lazy compilation in Meteor 1.8, calling

  inputFile.addJavaScript({
    ...
    hash: inputFile.getSourceHash(),
    ...
  }, function () {
    return compiler.processFilesForTarget(inputFile);
  });

becomes problematic, since inputFile.getSourceHash() is usually different
from compiler.processFilesForTarget(inputFile).hash, because the latter is
computed from the compiled code, whereas the former is computed from the
source code.

For example, when we use file.hash to cache imported module identifiers in
ImportScanner#_findImportedModuleIdentifiers, we really need to be using
the hash of the compiled code, since a single source module can be
compiled in different ways. If we cache based on the source hash, there's
a risk of reusing the scanned imports from the web.browser version for the
web.browser.legacy version, which can lead to all sorts of problems that
are only apparent in legacy browsers.

The quick fix is easy enough: BabelCompiler can simply stop including a
hash in the eager options to inputFile.addJavaScript. This fix can be
published as a minor update to the babel-compiler and ecmascript packages.

The remaining changes in this commit add another layer of defense against
this problem, by ignoring any hash options provided by compiler plugins,
in favor of simply computing the hash from the compiled data buffer.
These additional changes will become available in the next release of
Meteor (likely 1.8.1).
2018-11-12 18:57:06 -05:00
Ben Newman
3a18f67ac2 Rely on native Node.js Promise implementation.
There's no reason to use a Promise polyfill in Node.js at this point.
2018-11-03 13:58:48 -04:00
Christian Klaussner
0e9660097d Update self-tests for mongo-free autoupdate 2018-11-03 13:32:01 -04:00
Ben Newman
c96278700d Fix compiler plugins self-tests by waiting for lazy compilation to finish. 2018-10-31 10:41:31 -04:00
Ben Newman
18762f97a2 Update modules test app to Meteor 1.8. 2018-10-13 19:32:10 -04:00
Ben Newman
94771d233e Update dynamic-import test app to Meteor 1.8. 2018-10-13 19:27:48 -04:00
Ben Newman
ed41dcd4a6 Flatten buildmessage.{enterJob,capture} stacks by not using withValue. (#10266)
Whenever you're looking at a stack trace generated by the command-line
tool, you see tons and tons of useless stack frames for withValue,
enterJob, and/or capture.

Each of these function calls has its own try-finally block, which is
probably the real reason this pattern is slow, though the excess of
unnecessary stack frames is subjectively gross as well.

Initial build times for the `meteor create --full` app on my machine are
about 4.4 seconds with Meteor 1.8, and just 2.8 seconds after this change,
which is a nice 36% improvement. Rebuild times are not noticeably
different, however.

Looking to the future, flattening this function call pyramid should make
it easier to introduce non-Fiber-based async/await into the buildmessage
system, so that we can start properly propagating promises up the stack.
2018-10-11 09:47:17 -04:00
Ben Newman
c5f6c270b7 Avoid modifying source files explicitly added by compiler plugins.
Should resolve #10233, reported by @klaussner.

Previously, if a compiler plugin called inputFile.addJavaScript multiple
times with different { path } strings, Meteor would allow importing all of
those modules at once by importing the original source module identifier,
by synthesizing a new source module containing a series of re-exports for
each of the generated modules.

Preserving this behavior is important for backwards compatibility, since
some compiler plugins still generate files like "module.ext.js" given an
input file named "module.ext", so Meteor tries to make those modules
interchangeable/synonymous.

However, if the compiler plugin explicitly calls inputFile.addJavaScript
with the original source path, then it would be a mistake to modify the
contents of that module, so Meteor will now leave the contents of that
explicit source module unmodified, rather than using it as a catch-all way
to import other generated modules.
2018-10-03 15:13:08 -04:00
Ben Newman
dd00c6b0c1 Warn about duplicate api.mainModule paths, like api.addFiles does.
This would have helped catch the underlying problem in #10234.
2018-10-03 15:13:08 -04:00
Ben Newman
8f8e2a01f6 Be more tolerant of missing err.stack in parse-stack.js.
Should help with #10083.
2018-10-03 15:13:08 -04:00
Lisa Huang
0e899c4091 Fix LGTM testing errors (issue #10240, PR #10241)
* fix issue 10240: add variable declaration

* fix issue 10240: add semicolons to avoid automated semicolon insertion

* fix issue 10240: add semicolons to avoid automated semicolon insertion

* fix issue 10240: variable declaration in for...in statement, add semicolons

* fix issue 10240: variable declaration

* fix issue 10240: variable declaration
2018-10-02 10:53:50 -04:00
Ben Newman
a6e52c87b9 Await lingering self.runPromise in AppProcess#_runOnce.
Should fix #10220.
2018-09-18 10:28:37 -04:00
Ben Newman
46396a1156 Instrument build/bundle/deploy commands for METEOR_PROFILE.
https://github.com/meteor/meteor-feature-requests/issues/239
2018-09-18 09:59:14 -04:00
Ben Newman
deffd8ac2c Undo accidental reformatting of meteor create help text.
This broke a test that depends on the precise wording of this help
message: https://circleci.com/gh/meteor/meteor/27381
2018-09-13 12:38:02 -04:00
Ben Newman
9a0ab62850 Update package.json dependencies of --react skeleton app. 2018-09-13 11:53:23 -04:00
Ben Newman
914c18c181 Fully add --react to meteor create (with help text). 2018-09-13 11:53:23 -04:00
Ben Newman
465f6ad02d Style and application layout tweaks for React starter app. 2018-09-13 11:53:22 -04:00
David Mihal
56553f0c3b Create React-based apps with meteor create --react (#10149) 2018-09-13 11:46:41 -04:00
Ben Newman
ac5410e75a Merge branch 'devel' into release-1.7.1 2018-09-12 12:38:37 -04:00
mrauhu
5574f22df5 Fix: file Meteor_:-@2x.png breaks development on Windows (#10110)
* Rename file that breaks development on Windows

* Fix: failing test bundle - verify sanitized asset names
2018-09-12 18:55:38 +03:00
Ben Newman
08027c9fbc Nullify CSS source map when replaced with stub comment.
Should fix #10165.
2018-09-11 14:01:57 -04:00
Ben Newman
881390c553 Avoid trying resolve.extensions unless parent directory exists.
This change dramatically reduces the number of attempted files.stat calls
during module resolution, especially for apps that use a large number of
compiler plugins, and thus have many different file extensions to try.
2018-09-10 16:43:35 -04:00
Ben Newman
1a472a4161 Simplify external symlink handling in Builder#copyDirectory.
Follow-up to af51b816, which fixed #8005 by copying symlinks to external
directories as directories rather than trying to preserve the symlinks.

Issue #10177 revealed a flaw in this strategy: the filter function that we
use to strip development npm packages always rejects external paths, even
if the original symlink was found in a valid production npm package, and
thus its contents should be included in the production bundle.

In the process of fixing this problem, I realized that the only important
part of af51b816 was this code:

  // Update fileStatus to match the actual file rather than the
  // symbolic link, thus forcing the file to be copied below.
  fileStatus = optimisticLStatOrNull(externalPath);

and the code for manipulating thisAbsFrom and _currentRealRootDirectory
could be removed.
2018-09-05 21:30:27 -04:00
Ben Newman
05dd6095a0 Merge pull request #10193 from wojtkowiak/cordova_consistency_fix
Cordova plugin handling algorithm consistency improvements
2018-09-05 21:59:04 +00:00
Ben Newman
4a688d7ca9 Show web.browser.legacy rebuild time only when METEOR_PROFILE enabled.
In theory, these delayed rebuilds should not even be noticed, so it
doesn't make sense to draw attention to them.
2018-09-05 17:56:57 -04:00
Ben Newman
dc8f4ffb13 Update meteor-babel to version 7.0.0. 🎉 2018-09-05 12:08:17 -04:00
Bartosz Wojtkowiak
1f8ffbf56a Improvements to cordova plugin set change detection algorithm
Fixes several cases causing cordova plugins reinstall on every build:
- proper handling of scoped npm cordova plugins
- proper detection of plugin removal (previously a cordova plugin containing a dependency would make the algorithm think a package was removed from cordova-plugins)
- proper handling of plugins which have plugin.xml id different than the npm package name
Additionally rechecks the build integrity verifying if packages were really installed and perform a retry if needed.
Allows to override a meteor package cordova dependency with scoped package i.e. @scope/cordova-dummy-plugin will now override a cordova-dummy-plugin dependency.
2018-09-04 12:58:21 +02:00
zhadzlik
5558e50b88 Validating Cordova plugins installation (#9548) 2018-09-04 11:10:18 +02:00