Commit Graph

7172 Commits

Author SHA1 Message Date
Ben Newman
543bed4e0b Convert tools/isobuild/css-modules.js to TypeScript.
Choosing this module first because it's tiny and only imported twice.
2019-04-14 14:00:48 -04:00
Ben Newman
798a155c64 Enable Babel-powered TypeScript compilation of meteor/tools.
These changes pave the way for incrementally converting the implementation
of Meteor's command-line tool to TypeScript, which should have profound
benefits for self-documentation via types, as well as substantially
improving navigability and approachability for community contributors.

Just imagine being able to auto-complete the fields of the various
File-like classes currently floating around the codebase, instead of
having to track down their implementations every time. TypeScript was
designed with large projects like Meteor in mind, and it seems
increasingly irresponsible to forgo the benefits of a type system by
relying on the expertise of a few core contributors who know the codebase
inside and out. I am one of those few people, and I am very excited to
have the assistance of a type system, so I can only imagine how
transformative and empowering it will be for everyone else.

If you've ever wanted to get involved in core Meteor development, picking
a few meteor/tools modules to convert to TypeScript is a great way to get
to know that part of the codebase, while also making things easier for
everyone else who interacts with that code in the future.

Because we already compile meteor/tools using Babel, it makes the most
sense to use Babel's @babel/preset-typescript to compile .ts files:
https://babeljs.io/docs/en/next/babel-preset-typescript.html

Using Babel also means we get to keep all of our current advanced
compilation strategies, such as using Reify to compile module syntax:
https://www.npmjs.com/package/reify

Since we're using Babel, the meteor/tools/tsconfig.json file exists mostly
for the benefit of external tools like VSCode, rather than as a source of
truth for compilation behavior.

Despite our existing convention of including explicit .js file extensions
when importing modules, TypeScript and VSCode strongly encourage omitting
the file extension, so the import can be resolved to a .ts file in
development or a .js file when compiled. Although I find this ambiguity
somewhat unfortunate, it makes sense to follow community norms, at least
until Node.js begins supporting .ts modules by default.
2019-04-14 13:06:49 -04:00
Ben Newman
466cda693e Use wrapYieldingFiberMethods from @wry/context. 2019-04-10 18:48:10 -04:00
Ben Newman
5adb7c64ab Wrap Fiber.prototype.{run,throwInto} as well as Fiber.yield.
ddebed9b8a/fibers.js (L97-L100)
2019-04-10 17:14:26 -04:00
Ben Newman
0383f01c63 Update optimism and use noContext to isolate Fiber contexts.
The optimism package no longer knows anything about Fibers, but it does
export various helpers for managing execution contexts, one of which
(noContext) allows us to censor the current context for the duration of a
function call. By wrapping Fiber.yield with noContext, we keep distinct
Fibers from accidentally registering cache dependencies on one another.
2019-04-10 14:42:34 -04:00
Christian Klaussner
2b21a901a5 Wait until Mongo primary node is writable (#10500)
Using the `isMaster` command instead of checking the replica set member state is more reliable because a node can be a primary without being writable.

Fixes #10381 and #9026.
2019-03-19 19:12:12 -04:00
Ben Newman
038e35357e Apply reasoning from PR #10402 to package code as well.
Follow-up to fb2146cb3b.

Should fix #10481.
2019-03-19 14:02:03 -04:00
Ben Newman
44e293b741 Merge branch 'devel' into release-1.8.1 2019-03-19 13:10:35 -04:00
Ben Newman
55d1ffa3f2 Revert "Skip regenerating main bundle when only a dynamic file changed." (#10497)
This reverts commit 95a1f54cce.

Although at first this commit seemed like a nice optimization, after
digging into #10496 I was reminded that the main bundle includes the paths
and hashes of available dynamic modules, so rebuilding the main bundle is
important even when only dynamic modules have changed.

Many thanks to @arggh for testing 1.8.1-beta.20 and putting together the
https://github.com/arggh/meteor-bundler-issue reproduction.

Should fix #10496 and #10494.
2019-03-19 12:22:54 -04:00
georgyberdyshev
65747fc29f Updated meteor create --list Angular boilerplate name and URL. (#10363) 2019-03-15 11:23:46 -04:00
Jan Dvorak
ae397a3632 Fix #10428 facebook permissions (#10429)
* Fix #10428 facebook permissions 🛂

* Add missing semicolon in tools/upgraders.js
2019-03-15 11:08:01 -04:00
Simon Schick
40e8da227e Added an environment variable to determine if Meteor will restart automatically (#10465) 2019-03-15 11:01:13 -04:00
Ben Newman
642be6dc38 Attempt to fix tests by reverting puppeteer from 1.12.1 to 1.6.2.
Tests have started failing for reasons that may be related to puppeteer's
Meteor process management: https://circleci.com/gh/meteor/meteor/31035

Since I can't identify any other possible causes, using the same version
of puppeteer that other tests use (e.g. modules, dynamic-import) seems
like a reasonable first step.

Also updated puppeteer in tests/apps/app-config/package-lock.json to
version 1.6.2 (was 1.3.0), in an attempt to fix some unhandled promise
rejection warnings: https://circleci.com/gh/meteor/meteor/31063
2019-03-04 14:28:12 -05:00
Ben Newman
bb564dd93f Address my own (minor) review feedback. 2019-02-28 14:55:38 -05:00
zodern
95a1f54cce Skip regenerating main bundle when only a dynamic file changed. 2019-02-28 14:55:38 -05:00
zodern
7b2adcb9da Cache stringified prelinked output for dynamic files. 2019-02-28 14:55:38 -05:00
Ben Newman
eda0146266 Merge pull request #10454 from zodern/write-performance 2019-02-28 14:52:05 -05:00
Ben Newman
7c7dea58a7 Double-check isDirectory before calling copyNpmPackageWithSymlinkedNodeModules. 2019-02-28 14:47:44 -05:00
Ben Newman
61ee90ef2d Begin garbage directory names with a '.' character. 2019-02-28 14:34:37 -05:00
Ben Newman
01f515e6b2 Inconsequential style tweaks. 2019-02-28 14:02:59 -05:00
zodern
aadbbfbd2b Clean up code. 2019-02-28 14:02:57 -05:00
zodern
c34a61a3f9 Simplify deciding when to not calculate SRI. 2019-02-28 14:02:52 -05:00
zodern
29b6ca6483 Avoid unnecessary work if the file was already written. 2019-02-28 14:02:48 -05:00
zodern
b48715d804 Improve performance of minifying dynamic files.
Avoids converting file contents to and from buffers and strings. The
conversion had been done for dynamic files before minifying them, and all
files after they were minified.
2019-02-28 14:02:41 -05:00
zodern
79d643574a Skip calculating SRI for assets from the public/ folder.
Saves on average ~2ms per file in one app, which adds up when there are
hundreds. SRI is currently only supported for js and css files, and Meteor
only uses it for the main bundles.
2019-02-28 14:02:27 -05:00
Ben Newman
24e8d1d6f9 Merge pull request #10452 from zodern/cache-assets
Use optimistic functions with assets
2019-02-27 11:07:36 -05:00
Ben Newman
743bfb6f43 Update RegExp for detecting non-existent npm packages.
Should fix failures like https://circleci.com/gh/meteor/meteor/31259.
2019-02-26 20:49:01 -05:00
Ben Newman
83ec5e9ff8 Update meteor-babel to version 7.3.4. 2019-02-26 19:09:43 -05:00
zodern
f11b905185 Use optimistic functions with assets 2019-02-13 11:13:00 -06:00
Ben Newman
0f4802883a Attempt to fix tests by reverting puppeteer from 1.12.1 to 1.6.2.
Tests have started failing for reasons that may be related to puppeteer's
Meteor process management: https://circleci.com/gh/meteor/meteor/31035

Since I can't identify any other possible causes, using the same version
of puppeteer that other tests use (e.g. modules, dynamic-import) seems
like a reasonable first step.

Also updated puppeteer in tests/apps/app-config/package-lock.json to
version 1.6.2 (was 1.3.0), in an attempt to fix some unhandled promise
rejection warnings: https://circleci.com/gh/meteor/meteor/31063
2019-02-04 15:46:19 -05:00
Ben Newman
a96241911a Address review feedback from @glasser. 2019-02-04 14:22:29 -05:00
Ben Newman
2486743aab Expose Meteor.gitRevision for even easier access. 2019-02-04 13:21:06 -05:00
Ben Newman
ccab56380a Add a self-test of gitRevision extraction. 2019-02-04 12:06:45 -05:00
Ben Newman
312d06a90a Add gitRevision property to star.json and __meteor_runtime_config__.
This information is useful when you need a unique identifier for the
current version of the application (and you're using Git).

If the current Git HEAD revision can't be found for any reason, the
gitRevision property simply will not appear in star.json or
__meteor_runtime_config__.
2019-02-04 11:51:38 -05:00
Ben Newman
419ff7ce92 Merge pull request #10399 from zodern/windows-build-performance
Windows build performance
2019-01-31 12:02:41 -05:00
zodern
ead0a6de1f Fix indentation 2019-01-17 16:12:15 -06:00
zodern
31dfb0cc06 Remove timeout for starting delayed build 2019-01-17 16:09:21 -06:00
zodern
f9d17aaf0f Fix delaying render 2019-01-16 22:17:28 -06:00
zodern
285e1b50c3 Clean up code 2019-01-16 22:16:51 -06:00
zodern
65bc2b0100 Fix reusing symlinks from initial build 2019-01-16 20:21:00 -06:00
Ben Newman
a89b34c4c2 Remove hash of minimum modern browser versions from client hash.
This partially reverts commit 99b79dc00f,
which was added as part of PR #10055 in an effort to trigger hot reloads
on the client when/if the definition of a "modern" browser happened to
change, due to server code calling setMinimumBrowserVersions. Although
changes in the minimum modern browser versions are pretty rare, it seemed
important to incorporate this information into the client hash, because
code sent to the client tends to be dramatically different depending on
whether the client is considered modern.

However, this change was made without updating the corresponding version
calculations in CordovaBuilder#appendVersion in tools/cordova/builder.js,
so the versions in program.json for Cordova apps disagreed with the
versions served in manifest.json by the web server, leading to the
problems described by @lorensr in this cordova-plugin-meteor-webapp issue:
https://github.com/meteor/cordova-plugin-meteor-webapp/issues/69

It would be nice to include the minimum versions hash in program.json for
Cordova builds, but unfortunately these versions are not known at build
time, because they are determined by calls to setMinimumBrowserVersions
during server startup. In other words, if we wanted to access that
information during Cordova builds, we would have to start the web server
and run all server-side application initialization code just to find out
if setMinimumBrowserVersions was called anywhere.

In the future, we could consider including the minimum versions hash in
manifest.json, so cordova-plugin-meteor-webapp could compare the current
version to the new version whenever it fetches manifest.json. However, I
think simply removing the minimum versions hash from the client version
calculation is a fine solution in the meantime. If a developer needs to
trigger a hot reload because they changed their minimum modern versions,
they should just be sure to change their client code at the same time.
Any change that would normally trigger a client reload will work.
2019-01-14 20:41:16 -05:00
Ben Newman
5e26ebb6a9 Update cordova-{android,ios} to latest versions.
This version of cordova-android includes the PR that previously required
us to fork the package: https://github.com/apache/cordova-android/pull/417

The cordova-ios update is just 4.5.4 => 4.5.5, so hopefully entirely
backwards compatible. :crossed-fingers:
2019-01-14 15:58:10 -05:00
Ben Newman
cdb5854662 Merge branch 'devel' into release-1.8.1 2019-01-14 10:42:51 -05:00
Ben Newman
20da99c219 Do not treat client and server directories specially in packages. (#10414)
Fixes #10393.

Bumping compiler.BUILT_BY and LINKER_CACHE_SALT because
PR #10414 changes the behavior of the build system in a subtle way that
does not automatically trigger recompilation.
2019-01-11 16:52:23 -05:00
Ben Newman
f4485fe807 Use build.json to opt out of incompatible Xcode 10 build system.
https://github.com/apache/cordova-ios/issues/407
2019-01-11 12:14:51 -05:00
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