Commit Graph

7060 Commits

Author SHA1 Message Date
Ben Newman
41b2f76ef3 Let plugin packages import from the plugin's npmDependencies.
This should make the @babel/runtime dependency that I added to the
compile-coffeescript plugin in a52a2c28f1
actually work as intended.

Specifically, the babel-runtime package that's bundled into the
compile-coffeescript plugin will now be able to import @babel/runtime and
receive the plugin's private version of @babel/runtime, rather than the
one in dev_bundle/lib/node_modules or the application's node_modules.

cc @hwillson @abernix
2018-08-20 15:25:39 -04:00
Ben Newman
1cc5661f15 Ignore bad POST requests in dynamic-import request handler.
Should help mitigate #10147.
2018-08-16 10:10:00 -04:00
Ben Newman
9872a3a71d Tests for @x.y.z! package version constraint override syntax.
Following up on this promise:
https://github.com/meteor/meteor/pull/9942#commitcomment-30080110
2018-08-15 14:05:12 -04:00
Ben Newman
4a70b12edd Allow package-name@x.y.z! override syntax in .meteor/packages.
With this commit, if a top-level package version constraint in
.meteor/packages ends with a '!' character, any other (non-!) constraints
on that package elsewhere in the application will be weakened to accept
any version of the package that is not less than the constraint,
regardless of whether the major/minor versions actually match.

This functionality is extremely useful in cases where an unmaintained
package was last published with api.versionsFrom(<some ancient version>),
thus constraining the major version of any Meteor core package it depended
on, but you really want to upgrade that core package anyway. Just put a
'!' after the core package's version constraint in your .meteor/packages
file, and you will almost certainly get your way. The fact that minimum
versions are still enforced is good/fine because the constraints you want
to override are typically ancient, so they easily match any recent version
of the package.

Your only recourse before this @x.y.z! syntax was to find a replacement
for the unmaintained package, or fork and modify it locally, or somehow
persuade the package author to publish a new version with a more
reasonable api.versionsFrom. None of these options were easy.

Many thanks to @GeoffreyBooth, long-time maintainer of the `coffeescript`
package, for originally suggesting a ! syntax similar to this one:
https://github.com/meteor/meteor-feature-requests/issues/208#issuecomment-400154209

The limitation of this syntax to .meteor/packages is deliberate, since
overriding package version constraints is a power-tool that should be used
sparingly by application developers, and never abused by package authors.
Also, limiting the scope of this syntax reduces the risk of an arms race
between overrides, a la the infamous CSS !important modifier.
2018-08-14 20:27:23 -04:00
Ben Newman
b29ed0d133 Update meteor-babel to version 7.0.0-rc.1. 2018-08-09 16:35:10 -04:00
Christian Klaussner
340c7d9ab5 Update mongo test to match MongoDB 4.0 output (#10058)
The `mongo` shell is run with the `--quiet` option (7f7a987251), so there's no more output to match.
2018-08-09 16:09:35 -04:00
Christian Klaussner
7f7a987251 Use --quiet option when running mongo shell 2018-08-08 18:23:33 -04:00
Christian Klaussner
b6574915fc Use protocol version 1 when initiating replica set
Protocol version 0 (used by default) is deprecated in MongoDB 4.0 (https://docs.mongodb.com/manual/release-notes/4.0/#remove-pv0-for-replica-sets).
2018-08-08 18:23:33 -04:00
Christian Klaussner
48075f4fd3 Update regular expression to match MongoDB 4.0 output 2018-08-08 18:23:32 -04:00
Ben Newman
29ce8f2142 Adjust @babel/runtime version constraints in test app package.json files.
According to the plan described in #10134, whereas we had to pin these
versions to exactly 7.0.0-beta.55 for Meteor 1.7.0.4, we must now require
at least 7.0.0-beta.56 for Meteor 1.7.1, since other @babel/... packages
used by babel-compiler and meteor-babel are currently at beta.56.
2018-08-07 13:49:32 -04:00
Ben Newman
defbf6d6eb Merge branch 'devel' into release-1.7.1 2018-08-07 13:30:16 -04:00
Ben Newman
aba03743ad Update dynamic-import test app to Meteor 1.7.0.4.
Unit tests will still run the app from a checkout of the devel branch, but
it's worth noting that Meteor 1.7.0.4 also works for this app.
2018-08-07 12:33:15 -04:00
Ben Newman
228688cb8c Update vulnerable moment dependency of modules test app. 2018-08-07 12:28:44 -04:00
Ben Newman
619a8b6924 Merge branch 'master' into devel 2018-08-07 11:49:34 -04:00
Chris Hearn
a8af2ba590 Fix typo in ImportScanner#_readFile (#10132) 2018-08-07 08:57:38 -04:00
Ben Newman
ec6716ce7e Pin another @babel/runtime dependency in an old test app. 2018-08-06 18:42:13 -04:00
Ben Newman
7593c74a7b Pin test app @babel/... dependencies to version 7.0.0-beta.55.
Also updated the dynamic-import test app to Meteor 1.7.0.3.
2018-08-06 12:35:23 -04:00
Ben Newman
c2af98263d Pin @babel/runtime version for new apps to 7.0.0-beta.55. 2018-08-06 11:52:46 -04:00
Ben Newman
2603f7c06a Add akryum:vue-component to modules test app to verify #10129 fix. 2018-08-06 11:15:29 -04:00
Ben Newman
818022dd02 Update moment dependency of modules test app to appease npm audit. 2018-08-06 11:15:28 -04:00
Ben Newman
d2942614ae Update modules test app to Meteor 1.7.1-beta.28. 2018-08-06 11:10:34 -04:00
Ben Newman
bcaeed676e Move puppeteer back to dependencies for test applications.
This should fix test failures, because apparently it's important that
puppeteer not be installed in devDependencies.
2018-08-04 14:49:55 -04:00
Ben Newman
96c72791ed Increment LINKER_CACHE_SALT to force relinking after Babel updates. 2018-08-04 14:27:39 -04:00
Ben Newman
b23b1213f4 Update @babel/... dependencies of modules test app to 7.0.0-beta.56.
Also moving puppeteer to devDependencies.
2018-08-04 14:27:38 -04:00
Ben Newman
ce68c4b91c Update dynamic-import test app dependencies. 2018-08-04 14:12:23 -04:00
Ben Newman
97bd20449f Update meteor-babel to version 7.0.0-beta.56.
Fixes https://github.com/meteor/babel/issues/22.
2018-08-04 12:59:04 -04:00
Ben Newman
7dc77cdaf1 Fix importing local .json modules within Meteor packages.
The ImportScanner was mistakenly generating module.useNode() stub modules
for local .json files within Meteor packages, just because their absolute
module identifiers include "node_modules", which happens because we put
package modules under the /node_modules/meteor/<package name/ namespace.

Fix: make logic for determining when to generate module.useNode() stubs
match Module.prototype.useNode logic in modules-runtime/server.js.

Closes #10122.
2018-08-03 11:07:51 -04:00
Ben Newman
09950c403b Update reify npm package to version 0.17.2. 2018-07-31 20:48:25 -04:00
Ben Newman
0636cffaf1 Use module.link to bridge modules in ImportScanner. 2018-07-31 17:02:59 -04:00
Ben Newman
3a0778fc85 Update meteor-babel and reify npm packages to latest versions.
Probably the most notable change in this update is that the Reify compiler
now generates

  module.link("./child", { ...setters... });

instead of

  module.watch(require("./child"), { ...setters... });

for import and export-from declarations.
2018-07-31 17:02:58 -04:00
Ben Newman
44cdfeb686 Prepare for module.link(id, setters) replacing module.watch.
Thanks to these commits in the Reify project, there's a new runtime module
system method: module.link(id, setters), which replaces the previous (more
cumbersome) module.watch(require(id), setters).

This is more than a cosmetic change, since it will allow creating module
Entry objects before evaluating modules, which will help improve spec
compliance around import cycles and hoisted function declarations.

It's also shorter than the module.watch style, which is always nice.

However, since require(id) no longer appears in the generated code, we
can't just rely on findImportedModuleIdentifiers looking for require
function calls, so the scanner now needs to look for module.link(id, ...)
calls as well.
2018-07-31 17:02:58 -04:00
Ben Newman
c0b9af522d Ignore another harmless error from {pause,refresh}Client. 2018-07-30 15:03:43 -04:00
Ben Newman
691053175b Ignore some {pause,refresh}Client errors if child process exited. 2018-07-26 20:18:15 -04:00
Ben Newman
f8c76b90dc Force .meteor/local/build to be rebuilt in-place on Windows.
Because in-place rebuilds are disabled by default on Windows, we were
losing .meteor/local/build/programs/web.browser.legacy every time we
rebuilt .meteor/local/build as part of writeSiteArchive, as reported by
@lmachens in this comment: https://github.com/meteor/meteor/pull/9942#issuecomment-406656741

In-place rewriting of .meteor/local/build seems essential for the new
strategy of writing different targets at different times, though I have
attempted to limit the risk of overwriting open files on Windows by
continuing to build the individual target directories from scratch (that
is, by writing a fresh temporary directory and then renaming it over the
existing directory).

Though I don't have any specific ideas in this direction, it may be worth
noting: if we could find a way to make in-place builds safer on Windows
(as they are on Linux and Mac), Windows rebuilds would be significantly
faster than they are with the current strategy of rewriting everything
from scratch every time.
2018-07-20 19:10:18 -04:00
Ben Newman
a4657f34d5 Merge branch 'devel' into release-1.7.1 2018-07-19 17:53:10 -04:00
Ben Newman
e91b3776e5 Make sure file.jsonData is defined for imported package.json modules.
The defaultExtensionHandlers[".json"] function in import-scanner.js sets
file.jsonData as a side effect, which is important because that's what the
linker uses to construct a stub module.exports object for dynamically
imported package.json modules.

When I introduced ImportScanner#_readPackageJson as an alternative to
ImportScanner#_readModule in a recent commit, I intentionally did not call
defaultExtensionHandlers[".json"], but in so doing I neglected to preserve
the behavior of setting file.jsonData.

Without a proper package.json stub with at least a "main" property, the
dynamic import() system can't resolve dynamically imported packages until
the full package.json module has been fetched from the server, which leads
to missing module errors in the initial dynamic import().
2018-07-19 17:43:53 -04:00
Ben Newman
35473f29e4 Move package.json private field stripping tests into modules test app.
Follow-up to #9903.
2018-07-19 15:31:17 -04:00
Ben Newman
8a7db9b094 Move logic for stripping private package.json fields into ImportScanner.
Follow-up to #9903.
2018-07-19 15:31:05 -04:00
Bartosz Wojtkowiak
c6b136d3ca Remove non deterministic fields from included package.json files. (#9903) 2018-07-19 12:30:17 -07:00
Ben Newman
2cc172bbed Fix meteor scripts in tools/tests/apps/modules/package.json. 2018-07-18 12:48:35 -04:00
Ben Newman
a756af487b Merge branch 'devel' into release-1.7.1 2018-07-18 12:42:01 -04:00
Ben Newman
50b6751728 Merge pull request #9814 from toinevk/devel
Switch Meteor's headless browser tests from PhantomJS to Headless Chrome
2018-07-18 07:54:44 -07:00
Ben Newman
50b44f6465 Update meteor-babel to version 7.0.0-beta.54. 2018-07-17 20:35:37 -04:00
Ben Newman
f4946306c0 Make IPC system more testable, and implement some basic tests. 2018-07-17 16:44:58 -04:00
Ben Newman
2450ffe84d Remove unreliable modification of Autoupdate versions from self-test. 2018-07-16 18:59:51 -04:00
Ben Newman
77ed148614 Use listener API for communication between build/server processes.
Fixes #10073, per
https://github.com/meteor/meteor/issues/10073#issuecomment-405290391

While thinking about this bug, I realized that sending IPC messages to
specific packages in the server process was much less flexible than
sending messages based on an arbitrary topic string, since the topic
string approach allows both `autoupdate` and `dynamic-import` to listen
for the same message.

The topic string approach calls for a listener interface like
`onMessage(topic, callback)`, which elegantly replaces the previous
approach of requiring packages to export a single `onMessage` function.

However, because the `meteor` package does not have access to the module
system, implementing the `onMessage` listener interface in the `meteor`
package would have required exposing an API like `Meteor.onMessage(topic,
callback)`, which has an unpleasant global smell to it. Instead, the
`onMessage` function should be explicitly imported (using the module
system) from a less-generically-named package.

Since I knew I was going to have to move the message dispatch logic out of
the `meteor` package, I decided to create a new package called
`inter-process-messaging` to implement the parent/child components of the
IPC system.
2018-07-16 18:59:50 -04:00
Toine van Kampen
92b72bc46b Fix Failing Tests
Ensure Hot Code Push and Package Tests account for possible multiple runs.
2018-07-15 10:17:01 +10:00
Ben Newman
34bbbcb0f9 Calculate autoupdate versions correctly in cordova/builder.js.
Follow-up to the recent rewrite of autoupdate:
fe9e4035f9

Should fix #10067.
2018-07-12 11:57:09 -04:00
Ben Newman
244fd2a677 Replace Package._on(name, callback) with Package._promise(name).
https://github.com/meteor/meteor/pull/10055#discussion_r201855997

As I explained in this comment, Package._on(packageName, callback) was a
bad API because it never called the callback if the package was not
installed, which caused any app not using the autoupdate package to get
stuck trying to communicate with the autoupdate package.
2018-07-11 19:37:44 -04:00
Ben Newman
05e7aebef7 Merge branch 'devel' into release-1.7.1 2018-07-11 15:52:05 -04:00