Commit Graph

22356 Commits

Author SHA1 Message Date
Ben Newman
7de2d35747 Move global types into tools/index.d.ts. 2019-07-04 10:20:57 -04:00
Ben Newman
1955ec08fa Bump package versions for 1.8.2-beta.12 release. release/METEOR@1.8.2-beta.12 2019-07-03 12:40:48 -04:00
Ben Newman
e195440442 Fall back to package.json "main" field if "module" cannot be resolved.
The meteor/tools/isobuild/resolver.js changes are the static half of the
puzzle. The runtime half was implemented in install@0.13.0 with this
commit: 233aa75ce3
2019-07-03 12:25:05 -04:00
Ben Newman
fec14ba8b7 Bump $BUNDLE_VERSION to 8.16.0.16 before rebuilding dev bundle. 2019-07-03 11:20:52 -04:00
Ben Newman
ad92fe8647 Merge branch 'devel' into release-1.8.2 2019-07-03 11:19:56 -04:00
Ben Newman
e0caf13103 Stop using Mongo Timestamp as cacheKey in DocFetcher.
See my comment in issue #10512 for motivation:
https://github.com/meteor/meteor/issues/10512#issuecomment-504797861

I think the changes in b0cb1ceda3 are still
worthwhile because they ensure ops within a transaction have distinct
Timestamps, with the caveat that we should avoid assuming those Timestamps
are necessarily unique.
2019-07-03 11:07:34 -04:00
Ben Newman
59284a90b5 Give different Timestamps to operations within a transaction.
Follow-up to #10420, per this comment by @conorstrejcek:
https://github.com/meteor/meteor/issues/10420#issuecomment-476833232

Should help with #10512.
2019-07-03 11:06:43 -04:00
Ben Newman
2add249b7c Update reify to version 0.20.11. 2019-07-03 10:59:14 -04:00
David Sichau
fd47bb3a23 Ignore oplog entries from other dbs instead of throwing an error. (#10604) 2019-07-03 10:38:44 -04:00
Ben Newman
eda3057233 Bump $BUNDLE_VERSION to 8.16.0.15 before rebuilding dev bundle. 2019-07-03 10:20:42 -04:00
Ben Newman
9b01729c79 Use reify/lib/parsers/babel rather than acorn.
Acorn seems to have trouble parsing code that @babel/parser parses
successfully, such as the dist/esm.js file in markdown-to-jsx@6.10.2.
2019-07-03 10:03:28 -04:00
Ben Newman
e10a7e1523 Remove hasModuleEntryPoint logic from PackageSource#_findSources.
Now that we have the meteor.nodeModules.recompile configuration (#10603),
we don't need to guess which packages might need to be recompiled.
2019-07-03 09:07:39 -04:00
Ben Newman
2973e8a787 Merge pull request #10603 from meteor/meteor.nodeModules.recompile-package.json-config
Support meteor.nodeModules.recompile package.json configuration option.
release/METEOR@1.8.2-beta.11
2019-07-02 17:17:31 -04:00
Ben Newman
86f0208f41 Update reify to version 0.20.10.
We don't need to build a whole new dev bundle just for this upgrade, since
we've already worked around the bug that it fixes, but it will get picked
up the next time we build the dev bundle for Meteor 1.8.2.
2019-07-02 16:06:34 -04:00
Ben Newman
f7f36bb758 Use default parser for Reify Module.prototype._compile hook.
This saves us from having to install @babel/parser in the server bundle.

There is currently a bug in Reify that prevents it from loading this
parser by default, but we can work around that on the Meteor side for now.
2019-07-02 15:31:16 -04:00
Ben Newman
e9060d01df Bump package versions for 1.8.2-beta.11 release. 2019-07-02 15:09:51 -04:00
Ben Newman
d9d3c3d64e Bump $BUNDLE_VERSION to 8.16.0.14 before rebuilding dev bundle. 2019-07-02 14:31:22 -04:00
Ben Newman
b3c1e83ef3 Update meteor-babel to version 7.4.18.
This allows us to take advantage of the features.compileForShell option
when compiling code in the `meteor shell` REPL.
2019-07-02 14:30:57 -04:00
Ben Newman
37026e965b Update History.md to explain latest recompilation improvements. 2019-07-02 13:16:06 -04:00
Ben Newman
8ef0326380 Keep using module.useNode() instead of bundling server node_modules.
This partially reverts commit 4dfc74197a.

Some server packages, especially those that rely on __dirname or
__filename (e.g. puppeteer), simply cannot be included in the server
bundle, and must be evaluated natively by Node.

As long as we have a Module.prototype._compile hook to process natively
evaluated modules with Reify, module.useNode() can still benefit from ESM
import/export syntax.
2019-07-02 13:15:46 -04:00
Ben Newman
0c5cb13136 Ensure all code evaluated by Node is compiled with Reify. 2019-07-02 13:15:46 -04:00
Ben Newman
2fa761bbfc Test that ESM modules can be imported from npm packages.
With appropriate meteor.nodeModules.recompile configuration, that is.
2019-07-02 11:50:51 -04:00
Ben Newman
108144c3d5 Update @babel/* dependencies of modules test app. 2019-07-02 11:41:39 -04:00
Ben Newman
4dfc74197a Avoid delegating to module.useNode() for .js and .mjs modules.
This partially reverts f0d39b86e6 by simply
including .js and .mjs modules in the server bundle, rather than
delegating to pure Node evaluation. In practice, whether or not the
package has a "module" entry point (or "type":"module") in its
package.json was not a perfect indicator of whether it should be compiled
with Reify and bundled, or left untouched and handled by Node.

Truly native modules (such as those with a .node file extension) should
always be handled by Node, so module.useNode() definitely still has a role
to play in the server bundle.
2019-07-02 11:41:39 -04:00
Ben Newman
a342532108 Bump $BUNDLE_VERSION to 8.16.0.13 before rebuilding dev bundle. 2019-07-01 12:45:34 -04:00
Ben Newman
4384fdb917 Update meteor-babel and reify to latest versions.
This ensures we wrap modules with a function to rename the `module`
identifier to something more reliable when the ImportScanner compiles
unanticipated modules imported from node_modules.
2019-07-01 12:43:00 -04:00
Ben Newman
9c120b7a06 Compile unanticipated node_modules code with Reify only, again.
In PR #10585, I tried enabling full compiler plugin processing for any
modules imported from `node_modules` that were not otherwise handled by
compiler plugins, but doing that for all packages was just too slow, not
to mention potentially dangerous for modules whose code cannot be safely
recompiled by Babel.

The primary reasons for wanting to recompile node_modules are

  1. to enable "native" ECMAScript `import`/`export` syntax (given that
     Node.js still does not fully support ESM syntax yet), and

  2. to compile standard syntax like `const`, `let`, classes, and arrow
     functions for legacy browsers.

The first goal can be achieved by compiling unanticipated `node_modules`
code with Reify, which is much faster than Babel, in part because Reify
can avoid doing any parsing when the source contains no `import` or
`export` identifiers. This compilation is also cached on disk, so its
impact should only be felt during cold builds after a `meteor reset`.

The second goal can be accomplished using the new `package.json`
configuration option `meteor.nodeModules.recompile`, which causes the
recompiled packages to be handled by the normal compiler plugins system,
so that the `ImportScanner`'s fallback compilation is not necessary.
Before this option was introduced, this recompilation behavior could be
achieved by symlinking application directories into `node_modules`, but
that always felt like an esoteric hack.
2019-07-01 09:20:06 -04:00
Ben Newman
f61ba60326 Support meteor.nodeModules.recompile package.json configuration option.
Example:

  "meteor": {
    "mainModule": ...,
    "testModule": ...,
    "nodeModules": {
      "recompile": {
        "very-modern-package": ["client", "server"],
        "alternate-notation-for-client-and-server": true,
        "somewhat-modern-package": "legacy",
        "another-package": ["legacy", "server"]
      }
    }
  }

The keys of the meteor.nodeModules.recompile configuration object are npm
package names, and the values specify for which bundles those packages
should be recompiled using the Meteor compiler plugins system, as if the
packages were part of the Meteor application.

For example, if an npm package uses const/let syntax or arrow functions,
that's fine for modern and server code, but you would probably want to
recompile the package when building the legacy bundle. To accomplish this,
specify "legacy" or ["legacy"] as the value of the package's property,
similar to somewhat-modern-package above. These strings and arrays of
strings have the same meaning as the second argument to
api.addFiles(files, where) in a package.js file.

This configuration serves pretty much the same purpose as symlinking an
application directory into node_modules, but without any symlinking:
https://forums.meteor.com/t/litelement-import-litelement-html/45042/8?u=benjamn

The meteor.nodeModules.recompile configuration currently applies to the
application node_modules directory only (not to Npm.depends dependencies
in Meteor packages). Recompiled packages must be direct dependencies of
the application.
2019-07-01 09:15:28 -04:00
Ben Newman
c664acc457 Bump $BUNDLE_VERSION to 8.16.0.12 before rebuilding dev bundle. 2019-06-28 23:17:46 -04:00
Ben Newman
a245003f15 Update optimism to version 0.10.2. 2019-06-28 22:55:10 -04:00
Ben Newman
414dc316d3 Bump $BUNDLE_VERSION to 8.16.0.11 before rebuilding dev bundle. 2019-06-28 15:20:04 -04:00
Ben Newman
00387ccce3 Update npm to version 6.9.2. 2019-06-28 15:18:25 -04:00
Ben Newman
0aa35032e8 Update pathwatcher to version 8.1.0. 2019-06-28 15:16:02 -04:00
Ben Newman
b5c49408e4 Update optimism to version 0.10.0. 2019-06-28 15:14:55 -04:00
Ben Newman
9c3b55a74e Mention .mjs support in History.md. 2019-06-25 14:32:42 -04:00
Ben Newman
48276c3d36 Bump package versions for 1.8.2-beta.10 release. release/METEOR@1.8.2-beta.10 2019-06-25 14:28:38 -04:00
Ben Newman
2dae9be561 Regression test that the graphql package can be imported. 2019-06-25 14:25:23 -04:00
Ben Newman
e89d68f636 Support .mjs modules (as well as .js and .jsx) in ecmascript plugin.
https://github.com/meteor/meteor/pull/10522#issuecomment-505553025
2019-06-25 14:11:17 -04:00
Ben Newman
0a353c03ca Bump package versions for 1.8.2-beta.9 release. release/METEOR@1.8.2-beta.9 2019-06-25 13:15:41 -04:00
Ben Newman
a69ba4904d Move meteorBabelHelpers to modules package, and restrict to legacy bundle. (#10596)
Should fix #10595.

Code from the application `node_modules` directory becomes part of the
`modules` package, so that it can be imported by any other package that
uses the module system, regardless of package load order.

Now that we compile code from `node_modules` using `babel-compiler` and
`meteor-babel` (#10585), `node_modules` code requires the same runtime
environment as any other Meteor JS code. For the most part, this need is
satisfied by the `@babel/runtime/helpers/...` modules, which are also
defined in the `modules` package because they come from `node_modules`.
However, in the legacy bundle, `meteorBabelHelpers.sanitizeForInObject` is
used to fix buggy for-in iteration in older Internet Explorers.

Thankfully, this extra helper code does not need to be included in the
modern or server bundles, but only in legacy code.
2019-06-25 13:08:38 -04:00
Ben Newman
097b493a4e Use session.withTransaction to make Mongo Livedata test more robust. 2019-06-24 15:40:46 -04:00
Ben Newman
2b53de2d21 Bump package versions for 1.8.2-beta.8 release. release/METEOR@1.8.2-beta.8 2019-06-24 15:32:29 -04:00
Ben Newman
9f6c66aa25 Stop using Mongo Timestamp as cacheKey in DocFetcher.
See my comment in issue #10512 for motivation:
https://github.com/meteor/meteor/issues/10512#issuecomment-504797861

I think the changes in b0cb1ceda3 are still
worthwhile because they ensure ops within a transaction have distinct
Timestamps, with the caveat that we should avoid assuming those Timestamps
are necessarily unique.
2019-06-24 15:22:52 -04:00
Ben Newman
9abe331ed1 Bump $BUNDLE_VERSION to 8.16.0.10 before rebuilding dev bundle. 2019-06-24 14:57:20 -04:00
Ben Newman
df6e2ac43b Update node-pre-gyp to version 0.13.0.
Since PR #10592 updated node-gyp to the latest version, we should update
node-pre-gyp as well.
2019-06-24 11:13:20 -04:00
Ben Newman
7a10dddb2e Update meteor-babel and reify to latest versions. 2019-06-24 11:11:16 -04:00
Ben Newman
758d2ce7c8 Bump package versions for 1.8.2-beta.7 release. release/METEOR@1.8.2-beta.7 2019-06-23 19:42:27 -04:00
Ben Newman
b0cb1ceda3 Give different Timestamps to operations within a transaction.
Follow-up to #10420, per this comment by @conorstrejcek:
https://github.com/meteor/meteor/issues/10420#issuecomment-476833232

Should help with #10512.
2019-06-23 19:27:36 -04:00
Ben Newman
b17dd0d3e1 Update mongodb npm package to version 3.2.7. 2019-06-23 19:27:36 -04:00
Ben Newman
e70e1cda79 Bump package versions for 1.8.2-beta.6 release. release/METEOR@1.8.2-beta.6 2019-06-23 15:03:39 -04:00