Commit Graph

5204 Commits

Author SHA1 Message Date
Ben Newman
b7c48ee8ed Bump 1.3 beta release numbers. 2016-02-04 23:48:45 -05:00
Ben Newman
7e68dacc3c Stop passing unnecessary options to Babel.parse in js-analyze.js. 2016-02-04 23:48:44 -05:00
Ben Newman
6bfb19b700 Fix Babel.compile call in isopack.js. 2016-02-04 23:46:21 -05:00
Ben Newman
4c890ac20d Use Babel 6 to implement ECMAScript 2015+ in tool code.
Note that `export default` no longer modifies `module.exports`, but simply
defines `exports.default`, so these two import styles will work:

  import DefaultExport from "./export-default-module.js"; // preferred
  var DefaultExport = require("./export-default-module.js").default;

but this style will no longer work:

  var DefaultExport = require("./export-default-module.js");
2016-02-04 21:37:34 -05:00
David Greenspan
9303c0baab Fix typo in README 2016-02-04 17:11:39 -08:00
David Greenspan
fabb20d2cd Rebuild in place for better performance
writeSiteArchive already supported rebuilding in place (rather than
creating a new build directory and moving it into place; see comments
at top of builder.js), but it was not used and didn't work:

* run-app.js only passed previousBuilders to the bundler in the case
  of a client-only refresh, in which case it also passed
  hasCachedBundle, bypassing writeSiteArchive altogether.

* writeSiteArchive's use of previousBuilders seemingly didn't work,
  because the site archive itself was never written in place, so
  trying to write the targets "in place" into a brand-new build
  directory didn't make sense (and threw an error).

With this change, previousBuilders are kept across all rebuilds
(not just client-only refreshes), which enables efficient, in-place
building (except on Windows, where in-place building has never been
supported), and writeSiteArchive is fixed to write the site archive
in place as well.
2016-02-04 17:11:39 -08:00
David Greenspan
be44a75ca3 Minor stylistic changes 2016-02-04 17:11:39 -08:00
Ben Newman
ce890c98d1 Share a cache of ASTs between js-analyze.js functions. 2016-02-04 12:08:20 -05:00
Ben Newman
084f682e28 Make findImportedModuleIdentifiers print more useful errors.
Fixes #6009.
2016-02-04 11:46:21 -05:00
Ben Newman
e150f6c919 Bump 1.3 beta release numbers.
The beta released with this commit (modules-beta.6) included everything on
the release-1.3 branch up to bdf64da339
("Avoid circular package.json resolution chains.").

Unfortunately, additional commits were pushed to the branch before this
commit was pushed, so the release tag release/METEOR@1.3-modules-beta.6
does not correspond to any commit in the branch history.

Rather than attempting to rewrite the branch history, I decided to amend
this commit with this explanation before pushing it.

To see exactly what was released with the sixth beta:

  git fetch --tags
  git log release/METEOR@1.3-modules-beta.6
2016-02-04 09:58:05 -05:00
David Greenspan
a05b81af8d Merge remote-tracking branch 'origin/devel' into release-1.3
Conflicts:
	History.md
	packages/babel-compiler/.npm/package/npm-shrinkwrap.json
	packages/ecmascript/package.js
	tools/isobuild/compiler.js
2016-02-03 13:31:29 -08:00
David Greenspan
2fca3a9599 Profile more of tool and improvements to Profile
Previously, we would generate reports on
"Selecting Package Versions" and "Rebuild App".

- Instead of just profiling constraint solving, profile the entire
  process of preparing the project via ProjectContext, by giving
  each public function that "advances the stage" a Profile.run
  (typically prepareProjectForBuild).
- Improve profiler output to better distinguish multiple runs
- Distinguish "Build App" and "Rebuild App"
- Instrument lots of calls that weren't instrumented before
2016-02-03 11:54:05 -08:00
Ben Newman
bdf64da339 Avoid circular package.json resolution chains.
Fixes #6114.
2016-02-03 13:21:58 -05:00
Ben Newman
b0da03b009 Regression test to verify #6144 fixed.
Closes #6144.
2016-02-03 10:30:49 -05:00
David Greenspan
f0b76186b5 Don't stat in Builder#write
The only reason for the files.stat in atomicallyRewriteFile (called
by Builder#write), which was taking up time comparable to write
and rename (not as much as one of those but same order of
magnitude, in the hundreds of ms total)... was for the case where we
are trying to rename a file in a way that overwrites an existing
directory.  We can avoid the stat by catching this unusual case when
rename throws an error.
2016-02-01 17:49:36 -08:00
David Greenspan
b9f7613373 Don't show "other" in profile when no signif. kids
Background: we omit entries from the report whose time is below
a threshold (by default 1ms).

This change prevents a display like the following, where the
presence of child entries creates a "group" but the group
appears to be empty except for "other":
```
foo...........30 ms
   other foo  29 ms
```
2016-02-01 08:45:36 -08:00
David Greenspan
0fdbe6e176 Profile legacy extension handlers 2016-02-01 08:45:36 -08:00
David Greenspan
d3749485be Profile a few more things 2016-02-01 08:45:36 -08:00
David Greenspan
213deebf26 Improvements to profiler report
Call counts, and visual improvements
2016-02-01 08:45:36 -08:00
David Greenspan
3c2521cc30 More detailed profiling in ImportScanner 2016-02-01 08:45:35 -08:00
David Greenspan
132c515d04 Expose "Profile" to compiler plugins
Note that for code that may or may not run in the context of a
compiler plugin, you should always test `typeof Profile` before
assuming it exists in the global environment.
2016-02-01 08:45:35 -08:00
David Greenspan
e21b5498f2 Support sub-millisecond thresholds in Profile
METEOR_PROFILE=1 sets the threshold for displaying profiler entries
to 1ms.  Previously, however, passing "0.1" or "0" would enable
profiling but use the default threshold of 100ms.  With this change,
any recognizable number passed as METEOR_PROFILE will be used as
a threshold, including "0.1" and "0".
2016-02-01 08:45:35 -08:00
David Greenspan
8edffac142 Speed improvements to Profile
profile.js uses some "dumb" data structures and algorithms that are
N^2 or even N^3.  If you experiment with adding more data to the
profile (e.g. names of files written), you'll find that the time it
takes to generate the profiler report blows up.  This commit
makes the profiler usable again in that case.

* Don't create a new array in isChild(.), and compare elements
  starting at the end (because early elements are more likely
  to be similar)
* Swap order of entryName(.) (cheap) and isLeaf(.) (expensive)
  in leafTotal(.)
2016-02-01 08:45:35 -08:00
David Greenspan
ef73a4c9e6 Cache the output of findImportedModuleIdentifiers 2016-02-01 08:44:03 -08:00
David Greenspan
ea3f8e3f15 Clarify a comment about source maps 2016-02-01 08:32:25 -08:00
David Greenspan
0dab7bdad3 Fix tool source maps (clobbered by coffee-script)
Switching from "require" to "import" in the coffeescript plugin
broke our hack that keeps coffeescript from clobbering our version
of Error.prepareStackTrace, because imports are automatically
hoisted to the top of the file, and thus so are any side effects of
requiring a module.

The new fix has the tool save a copy of the correct
Error.prepareStackTrace so that any plugin that wants to unclobber
Error.prepareStackTrace can do so.

Other, fancier fixes are possible; there's a package called
stack-chain that installs a getter/setter on
Error.prepareStackTrace:
e51a7b2e0f/stack-chain.js (L136)
2016-02-01 08:32:12 -08:00
Simon Fridlund
a3c701e9de Remove duplicate exports.hasScheme
Fixes #6089
2016-01-26 12:51:02 +01:00
Ben Newman
877cb9e61a Add a test of client/compatibility directories. 2016-01-25 15:34:16 -05:00
Ben Newman
2c1083feb3 Add basic test of async functions and await expressions. 2016-01-25 14:21:05 -05:00
Ben Newman
cd27d78d45 Update .meteor/versions for modules test app. 2016-01-25 11:12:51 -05:00
Ben Newman
a34ab3b939 Fix tests of bare files. 2016-01-21 17:33:28 -05:00
Ben Newman
819e13a562 Fix modules tests to work with Babel 6 default exports. 2016-01-20 23:57:01 -05:00
Ben Newman
b1aad31fc1 Support require("babel-runtime/...") for compatibility with Babel 6. 2016-01-20 23:32:28 -05:00
Ben Newman
3d6dfff9a3 Don't prevent plugin source batches from having a sourceRoot. 2016-01-20 23:32:28 -05:00
Ben Newman
88b238db4d Update comment about package.json files. 2016-01-20 23:31:19 -05:00
David Greenspan
2ed9c08e10 Include computeJsOutputFilesMap in Profiler output 2016-01-20 12:45:43 -08:00
David Greenspan
79292c448c Fix linker's in-memory cache to populate from disk
The linker caches files both on disk and in an in-memory LRU cache.
Because it didn't populate the in-memory cache when it hit the disk
cache, and the disk cache persists between tool runs, the in-memory
cache would typically sit empty.

This fix seems to knock 1.8s off of a 12-second rebuild time for one
app.
2016-01-20 12:45:18 -08:00
Ben Newman
524970a20e Add tests of importing lazy CSS files in apps and packages. 2016-01-19 21:00:48 -05:00
Ben Newman
12c946ee65 Allow lazy CSS resources to be imported by JS. 2016-01-19 21:00:48 -05:00
Ben Newman
18cfba4ddf Decide laziness when resources are added.
This used to happen when we ran the ImportScanner, but the earlier we can
make this decision the better.
2016-01-19 21:00:48 -05:00
Ben Newman
b04c837027 Ignore lazy non-JS resources.
Fixes #6036.
2016-01-19 20:58:29 -05:00
Ben Newman
f3a005f384 Don't fail when there is no application source batch. 2016-01-19 20:52:02 -05:00
Ben Newman
0907f52f53 Expose the "version" field of package.json files at runtime. 2016-01-18 19:27:04 -05:00
Ben Newman
c631d3ac35 Bundle global npm dependencies into the modules bundle.
This allows packages to import npm packages they have not installed, with
the expectation that the app developer will provide those dependencies by
installing them into the top-level node_modules directory in the app.

For example, an app can now `npm install react` and that npm package can
be used by any package as well as by the app.
2016-01-18 19:05:43 -05:00
Ben Newman
f73a2a968a Move implementation of meteorInstall into modules-runtime.
This allows the modules package to use meteorInstall to define itself.
2016-01-18 18:54:56 -05:00
Ben Newman
42a6bad2e3 Add some tests of importing lazy .html template modules. 2016-01-13 16:29:17 -05:00
Ben Newman
807e36a852 Make sure to run modules tests with meteor from checkout. 2016-01-13 16:29:17 -05:00
David Greenspan
c144e0c7d3 Merge pull request #5912 from mitar/better-error-messages
Better error messages for compiler plugins
2016-01-12 15:04:11 -08:00
Ben Newman
988b8b3d0c Commit an app that tests many aspects of the module system.
Partially satisfies #5782.
2016-01-11 15:31:32 -05:00
Sashko Stubailo
89161b0bec Merge pull request #5928 from bwhitty/patch-2
Fix typo in Promise resolve call
2016-01-11 11:50:17 -08:00