Commit Graph

7311 Commits

Author SHA1 Message Date
Ben Newman
ebdaa230d5 Update meteor-babel to version 7.7.5. 2019-12-18 12:39:57 -05:00
filipenevola
1a5d6fb5b6 - MDG => Meteor Software
- updates CONTRIBUTING.md
2019-12-13 08:05:14 -04:00
Filipe Névola
a1caff04b7 Merge pull request #10789 from sebakerckhof/patch-2
Fix comment in resolver
2019-11-28 13:51:03 -04:00
Ben Newman
cf8dbf1c37 Add static-html compiler plugin to custom-minifier test app. 2019-11-26 12:58:49 -05:00
Ben Newman
f6fcd620a7 Add a package.json to custom-minifiers test app.
Self-tests involving this test app were failing because of an undefined
jQuery reference on the client.
2019-11-26 12:49:23 -05:00
Seba Kerckhof
a72c92c852 Fix comment in resolver
Between 1.3 and 1.3.1 the modules.js file got moved from modules to modules-runtime
2019-11-21 20:53:37 +01:00
Ben Newman
407b2d17cb Remove eslint and pre-commit hook to fix npm security warnings. 2019-11-14 17:34:29 -05:00
Ben Newman
0af5c64bd1 Update modules test app to Meteor 1.8.2. 2019-11-14 17:21:02 -05:00
Ben Newman
c24077e65f Allow relative --test-app-path arguments when running test-packages.
https://github.com/meteor/meteor/pull/10772#issuecomment-553517459

The assertion in tools/fs/optimistic.ts was failing if I passed a relative
path for --test-app-path, and passing the path as a second argument when
calling assert made it easier to tell what was going on, so I decided to
keep that change.
2019-11-13 12:43:42 -05:00
Ben Newman
faeab6c7d4 Revert "Temporarily wrap files.rename on non-Windows platforms to validate safety."
This reverts commit 52d4809aeb, as promised
in the previous commit message.
2019-11-12 17:22:33 -05:00
Ben Newman
52d4809aeb Temporarily wrap files.rename on non-Windows platforms to validate safety.
Now that files.rename uses Promise.prototype.await on Windows, it's
important to be sure it never gets called outside of a Fiber. Though we
don't run our full test suite on Windows, we can validate this expectation
by wrapping files.rename on all platforms. This commit should be reverted
once the validation is complete.
2019-11-12 17:12:02 -05:00
Ben Newman
d52c9cc82f Avoid calling writeFileAtomically outside Fiber. 2019-11-12 16:58:05 -05:00
Ben Newman
8567390e7e Fix error stack trace parsing during Windows self-tests. 2019-11-12 16:38:22 -05:00
Ben Newman
c4e05dfffe Rewrite files.rename on Windows to retry after 50ms intervals.
Falling back to a full recursive copy was MUCH more expensive than waiting
a short amount of time before retrying the rename.

This aligns with the way graceful-fs handles EPERM and EACCES errors on
Windows: https://www.npmjs.com/package/graceful-fs#improvements-over-fs-module
2019-11-12 15:06:41 -05:00
Ben Newman
1b9fec3f8d Tolerate variable startup message order in static-html self-test. 2019-11-12 12:52:39 -05:00
Ben Newman
41868fa165 Attempt to make static-html self-tests less flaky.
Salvaged from PR #10771, which I had to revert because it caused EMFILE
(too many open files) errors on Windows.
2019-11-11 19:35:48 -05:00
Ben Newman
926cba9a77 Revert "Merge pull request #10771 from meteor/copy-directories-asynchronously"
This reverts commit 77a9784929, reversing
changes made to e0ddae2cc7.
2019-11-11 19:35:16 -05:00
Ben Newman
b71ab5bec5 Bump compiler.BUILT_BY and LINKER_CACHE_SALT to force rebuild. 2019-11-11 19:12:11 -05:00
Ben Newman
61b2d1710b Attempt to make static-html self-tests less flaky. 2019-11-11 18:41:43 -05:00
Ben Newman
c7cc817d69 Use wrapDestructiveFsFunc for files.promises.writeFile. 2019-11-11 17:39:35 -05:00
Ben Newman
cf04e051e3 Write files in Builder#_copyDirectory asynchronously.
Using fs.writeFileSync in a serial style becomes especially costly when
we're writing a lot of files. In a recent profiling exercise I did on
Windows, nearly 80% of the time taken by Builder#_copyDirectory was spent
just closing the written files. By using the asynchronous fs.writeFile
function, we should be able to parallelize at least some of this work, and
await all the promises at the very end of copying the directory.
2019-11-11 17:26:03 -05:00
Ben Newman
bd9043db20 Prefer "main" field of package.json over "module" in legacy bundle.
https://github.com/meteor/meteor/issues/10658#issuecomment-550456095
https://github.com/meteor/meteor/issues/10658#issuecomment-551870115

As usual, changes to module resolution logic need to happen in parallel in
tools/isobuild/resolver.ts and in packages/modules-runtime. However,
thanks to the modern/legacy system, it's easy to make the modules-runtime
package behave exactly the way(s) we want in the server, modern client,
and legacy client bundles.
2019-11-08 11:15:23 -05:00
Ben Newman
37b1683fbc Centralize legacy arch logic in tools/utils/archinfo.ts. 2019-11-08 11:15:23 -05:00
Ben Newman
f290eef631 Simplify delayed watching of lazy modules. (#10763)
* Avoid modifying unibuild.watchSet in PackageSourceBatch._watchOutputFiles.

Should fix #10736 by preventing old hashes from remaining in
unibuild.watchSet, which was sometimes causing isUpToDate to fail
immediately upon restart.

* Regression test for issue #10736.
2019-11-08 11:08:56 -05:00
Ben Newman
dea305ca4a Set a higher LRU cache size for makeCheapPathFunction entries.
In PR #10720, we introduced the makeCheapPathFunction in an effort to
reduce the caching overhead for very frequently called (and already pretty
quick) operations like files.stat.

However, the default maximum LRU cache size of Math.pow(2, 16) can cause
quite a bit of cache eviction churn for large applications, which @veered
has identified as a potential source of build performance problems.

By setting the maximum cache size to Math.pow(2, 20) instead, I am no
longer seeing any files.stat calls in the profiling output for rebuilding
a large internal app, saving several seconds of rebuild time. The obvious
downside is that this cache might accumulate more memory over time, which
is why I didn't just set the max to Infinity, though that might be a
viable option if the total set of paths ever stat'd is small enough to fit
into the available memory.

In the future, I hope to find ways of managing LRU cache size that respond
to actual memory pressure (relative to available memory), rather than
pruning the cache after an arbitrary numeric threshold is reached.
2019-11-05 11:19:43 -05:00
David Glasser
3e9e11d76c tools/deploy: provide more context for version-status errors (#10670)
Also only print the error once on failure.
2019-11-05 10:01:53 -05:00
Ben Newman
1cf59867b2 Remove no-longer-necessary noYieldsAllowed wrapper from loadIsopackage. 2019-10-24 19:36:32 -04:00
Ben Newman
7fb7fcdd6d Work around incorrect fs.statSync type inference. 2019-10-24 19:36:32 -04:00
Ben Newman
56c21a9796 Attempt to make optimisticStatOrNull less expensive. (#10720) 2019-10-24 18:55:12 -04:00
Ben Newman
11e60dc22e Finish converting changes from PR #10730 to TypeScript. 2019-10-24 18:17:41 -04:00
filipenevola
bbd256ffd1 Fix "Cannot find module" error when using dynamic and nested imports.
Fixes #10643.
2019-10-24 18:09:29 -04:00
Ben Newman
a102e5fe37 Use optimisticStatOrNull in readAndStatDirectory.
This drastically (by more than half) cuts down the number of calls to
files.stat that occur during PackageSource#_findSources scanning.
2019-09-23 12:02:32 -04:00
Ben Newman
48d27202e7 Skip watching output files without absPath or sourcePath properties.
https://github.com/meteor/meteor/pull/10522#issuecomment-533393100
2019-09-22 11:50:52 -04:00
Ben Newman
9cba123401 Restore CLI progress messages by revisiting progress.ts conversion.
I noticed recently that progress messages were no longer displayed (though
the ASCII spinner was still animating). I bisected the problem to the
progress.ts conversion in #10650, and I attempted to reproduce the
conversion, step by step. The problem ended up being the renaming of
._title to .title, which was a mistake because external code accesses
progress._title. Once I updated those invasive access points, progress
messages began displaying once again.
2019-09-19 19:01:33 -04:00
Ben Newman
df3fac2e1f Sanitize risky whitespace characters to recover from failed JSON.parse.
Partial alternative to using json5, which we tried in commit
5124cb495c, which was recently reverted due
to performance concerns: 0e19c365a8.

Should solve the specific problem reported in #10688.
2019-09-19 16:14:56 -04:00
Ben Newman
0e19c365a8 Revert "Use json5 for optimisticReadJsonOrNull."
This reverts commit 5124cb495c.

Perhaps unsurprisingly, JSON5 is much slower than JSON, so much so that
"other optimisticReadJsonOrNull" has become the single most expensive leaf
when building one of our internal applications. We will have to find
another solution.
2019-09-19 15:15:47 -04:00
Ben Newman
d0781233e8 Install typescript in devDependencies of skel-typescript.
This is important so that tools like VSCode will pick up the correct
version of the TypeScript SDK, rather than whatever default version was
installed with VSCode.
2019-09-19 13:22:22 -04:00
Ben Newman
2468d17fec Allow creating Meteor apps with --typescript skeleton.
Just as developers can run

  meteor create --react my-react-app
  meteor create --minimal my-minimal-app
  meteor create --bare my-bare-app
  meteor create --full my-full-app

they can now run

  meteor create --typescript my-typescript-app

to produce a new TypeScript application, based on the --react application,
configured using a recommended tsconfig.json file.

This app represents the current best/simplest-known way to set up a
Meteor-compatible TypeScript application, but it is still very much a work
in progress. Please feel free to submit pull requests to improve it, or
create issues to discuss how it should work.

For example, the community-maintained @types/meteor package covers all the
core packages used by this starter application, but it has not been
updated in a while, so there will no doubt be meteor/* packages with
missing types. In future versions, Meteor should ideally generate the
appropriate .d.ts files from TypeScript package source code, so that no
separate @types/meteor/* declarations need to be maintained.
2019-09-19 09:27:23 -04:00
Ben Newman
f9c498adb8 Improve the shouldWatch function in tools/fs/optimistic.ts. (#10693)
This function determines whether the optimistic caching system should
subscribe to file change notifications for a given path.

Note that Meteor has other ways of watching for file changes (e.g. the
WatchSet abstraction), as well as other mechanisms for invalidating cached
results, so time and resources can often be saved by returning false here,
if we know that the path will be watched in other ways.

Improvements:

- Add METEOR_PROFILE instrumentation to the shouldWatch implementation.

- Stop exporting shouldWatch, since it is no longer used anywhere else in
  the codebase.

- Return false early to avoid watching files inside the .meteor directory,
  a significant shortcut.

- Allow watching files in application node_modules directories that are
  not located directly in the root application directory (closes #10664).
2019-09-18 16:19:02 -04:00
Ben Newman
7bc5b5b061 Use dep API from optimism instead of wrap in a few places.
Background: https://github.com/benjamn/optimism/pull/50
2019-09-18 12:08:30 -04:00
Ben Newman
5124cb495c Use json5 for optimisticReadJsonOrNull.
Because json5 is more tolerant of non-standards-compliant input, it has no
trouble with \t tab characters outside of string literals, so this change
should fix issue #10688.

Note that json5 is already installed in dev_bundle/lib/node_modules/json5,
because it is a dependency of @babel/core, so we don't need to rebuild the
dev bundle immediately, though it would be a good idea to do so before the
next beta/RC release.
2019-09-07 21:04:29 -04:00
Ben Newman
7bf1b3cbc5 Update 'meteor create --react' react[-dom] versions to 16.9.0. 2019-09-06 18:45:04 -04:00
Ben Newman
cf5db3626e Update meteor-babel to version 7.6.0. 2019-09-06 18:40:50 -04:00
Ben Newman
e4101e1f0a Go back to using LRU cache for findImportedModuleIdentifiers.
Should fix #10674.
May help with #10608.

cc @houshuang @klaussner
2019-09-06 18:29:14 -04:00
Ben Newman
7155feaaa1 Test dependency-tree-based client refresh detection.
Part of #10686.
2019-09-06 17:21:57 -04:00
Ben Newman
b3d88944ae Explicitly track potentially unused WatchSet files.
The previous implementation simply avoided calling watchSet.addFile for
potentially unused files, trusting that addFile would be called later if
the file was eventually used. However, this strategy left the contents of
watchSet.files incomplete for tasks such as IsopackCache._checkUpToDate,
which require full information about all files, even the ones that might
not be used by the bundle. The new strategy maintains metadata about
potentially unused files in a separate data structure, which will be
merged/cloned/serialized/deserialized along with other WatchSet data.
2019-09-06 16:24:41 -04:00
Ben Newman
4084848d2f Add files to unibuild.watchSet only if needed by unibuild.arch.
Most importantly, this change means that changes to files not used by the
server bundle will not trigger a server restart.

Fixes #10449 by implementing the strategy I described in this comment:
https://github.com/meteor/meteor/pull/10414#issuecomment-481293530
2019-09-05 18:44:19 -04:00
Ben Newman
5957e046fb Prevent cordova-lib from using its own copy of graceful-fs. 2019-09-05 15:22:52 -04:00
Ben Newman
e497085474 Update meteor-babel and @babel/{runtime,parser} to latest versions.
Among other benefits, this should address #10622.
2019-07-30 14:03:58 -04:00
Michael Newman
26c0d5cf16 Convert tools/console/progress.js to TypeScript (#10650) 2019-07-26 09:22:19 -04:00