Commit Graph

22122 Commits

Author SHA1 Message Date
Ben Newman
755d0d1722 Fix outdated import of optimism package in dynamic-import test. 2019-07-04 16:18:59 -04:00
Ben Newman
6d24ab5293 Update all dependencies of dynamic-import test app. 2019-07-04 16:18:45 -04:00
Ben Newman
146e6ba1d4 Update @babel/{runtime,...} dependencies of modules test app. 2019-07-04 16:04:33 -04:00
Ben Newman
c1520052f5 Bump $BUNDLE_VERSION to 8.16.0.18 before rebuilding dev bundle. 2019-07-04 15:58:01 -04:00
Ben Newman
c632542a04 Update meteor-babel to version 7.5.0. 2019-07-04 15:57:25 -04:00
Ben Newman
150fc96040 Bump $BUNDLE_VERSION to 8.16.0.17 before rebuilding dev bundle. 2019-07-04 15:03:15 -04:00
Ben Newman
cdd8f32196 Update npm to 6.10.0 and pacote to 9.5.1. 2019-07-04 15:02:26 -04:00
Ben Newman
0fe3451c49 Merge pull request #10607 from meteor/convert-tools/fs/files-to-typescript
Convert tools/fs/files.js to TypeScript.
2019-07-04 14:57:18 -04:00
Ben Newman
8a409d196c Convert mini-files.js to TypeScript. 2019-07-04 14:43:51 -04:00
Ben Newman
0d99790127 Add back profiling of files.* functions. 2019-07-04 14:18:30 -04:00
Ben Newman
c8766aee77 Bring back files.withCache, with a different implementation. 2019-07-04 14:18:30 -04:00
Ben Newman
2c39986f31 Use a few more import declarations in tools/fs/files. 2019-07-04 14:18:30 -04:00
Ben Newman
0df070fc5f Use const and let more consistently in tools/fs/files. 2019-07-04 14:18:30 -04:00
Ben Newman
62a78c5860 Finish converting tools/fs/files.ts to TypeScript. 2019-07-04 14:18:29 -04:00
Ben Newman
5ed64fb1db Remove explicit .js extension from tools/fs/files imports. 2019-07-04 10:32:09 -04:00
Ben Newman
f77cbc5bcf Rename tools/fs/files.js to files.ts. 2019-07-04 10:21:00 -04:00
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