Commit Graph

14659 Commits

Author SHA1 Message Date
Ben Newman
5bbcaedc01 Allow source processors to be registered for .js files.
We now fall back to hardcoded JS support only when no source processor is
registered, instead of simply ignoring .js source processors.
2015-07-16 18:02:07 -04:00
Ben Newman
181f7c1c93 Use the ecmascript package for all new packages. 2015-07-16 18:02:07 -04:00
Ben Newman
9088eb2b4d Install the ecmascript package by default for all new apps.
It's tempting to rewrite the skeletal .js file using ES2015+ syntax, but
that would effectively prevent the ecmascript package from being removed.
2015-07-16 18:02:07 -04:00
Ben Newman
095ded40b0 Add an ecmascript core package.
This package will be installed by default for all new apps and packages.

Passing the {transpile:false} option to api.addFiles makes it possible for
a dependent package to specify that some files should not be processed
through babel-compiler.
2015-07-16 18:02:07 -04:00
Ben Newman
caca6565eb Add a babel-runtime core package. 2015-07-16 18:02:06 -04:00
Ben Newman
cd483bf172 Add a babel-compiler core package. 2015-07-16 17:41:09 -04:00
Ben Newman
87347928b1 Rename ie8 package to ie8-support. 2015-07-16 17:39:34 -04:00
David Glasser
52e6b38ea1 Merge branch 'batch-plugins' into devel
Add new batch plugin APIs to Isobuild

New `Plugin.registerCompiler`, `Plugin.registerLinter`, and
`Plugin.registerMinifier` plugin methods.

* `registerCompiler` replaces the now-deprecated `Plugin.registerSourceHandler`
  and expands it to allow compilers which process more than one file at a time,
  and which always run in the context of your app (instead of before publishing
  a package). Compilers can use in-memory and on-disk caches, which are
  automatically cleared if the compiler itself changes version or is rebuilt
  (and on `meteor rebuild`).  Compilers can register for specific filenames
  in addition to extensions.

* `registerLinter` allows you to check code for style violations and other
  warnings. Unlike compilers, multiple linters can apply to the same file and
  linter violations do not prevent the app from building.

* `registerMinifier` allows you to override the default minification logic.  The
  default minification logic (which includes CSS merging which runs even in
  devel mode) now lives in the `standard-minifiers` package instead of
  hard-coded in Isobuild).  `standard-minifiers` is added to apps by
  a new upgrader.

To use these new APIs, your package must depend on a special pseudo-package like
`isobuild:compiler-plugin@1.0.0`.

Static assets in `package.js` files must be explicitly declared with
`{isAsset: true}` (and you should choose client vs server).  Existing
published packages will work, but their source will raise an error asking you
to add the flag.

`api.addFiles('foo.css')` without explicitly including `'client'` used to also
add `foo.css` as a server-side static asset. (This affected any handler using
archMatching, such as most CSS compilers and the templating `*.html` handler.)
Now, if a file is handled by a legacy source handler (or new compiler plugin) on
a subset of arches, it is *ignored* on other arches instead of treated as a
static asset. (This did not affect files in apps.)

New `meteor lint` command.

`meteor run`, `test-packages`, and `debug` display linter warnings by
default; this can be turned off with the `--no-lint` option.

Isopacks built by Isobuild are in a newer format, `isopack-2` (which contain
`isopack-2-unibuild` unibuilds). These can contain `source` resources (as well
as css/js, but those only come from legacy source handlers) and do not contain
`prelink` resources. They also don't contain a list of package variables,
because that is determined after running compiler plugins in the context of an
app. When possible, isopacks that are published to Atmosphere or placed in the
tropohouse also contain `isopack-1` data for older Isobuild versions to use.

The Windows-only colon conversion done when downloading packages to tropohouse
is skipped for `isopack-2` packages.

New `jshint` linter plugin package. (This package is currently in the core
release, but we may change our mind about this before the next Meteor release.)

`less` and `stylus` imports may cross package boundaries: `@import
"{packagename}/foo/bar.less";`.

In addition to the existing rules where files named `*.import.less` or
`*.lessimport` are not processed as "root" files, files in any subdirectory
named `imports` or tagged with `{isImport: true}` in `api.addFiles` are also
treated as "import-only" files and are not processed as root files.
The same goes for `stylus`.

In-memory and on-disk caches have been added to `coffeescript`, and
`less`. In-memory caches have been added to `stylus` and `templating`.

The `templating` package now detects duplicate `body` attributes across packages.

The default CSS minifier in `standard-minifiers` splits the merged CSS into
multiple files to keep each under the limit for maximum rules per file in IE.

We only prepend an anti-XSSI `)]}'` to source maps in production mode.

In `meteor run`, when rewriting the app bundle, the bundler defaults to
overwriting an existing app bundle instead of creating a new directory from
scratch. This behavior can be disabled by setting
`$METEOR_DISABLE_BUILDER_IN_PLACE`.

Version Solver: optimize the case where the constraint solver is called twice in
a row with the same input.

`linker` does more in-memory caching.

`sourceMap` can be now be specified to compiler plugins (and legacy source
handlers) as a JSON object as well as its stringified form

The URL used for original sources in source maps now begins with
`meteor://{PERSONAL COMPUTER EMOJI}app`, to make them more distinctive from the served files.

`linker` uses source maps to reflect the initial closure added around each file.

`WatchSet`s can now contain specific filenames that we expect to see in a
directory. Unlike `include` regexps, these take precedence over `exclude`
patterns.

- `source-map-support` to a fork of 0.3.2 (I think it was upgraded on devel too)
- `stylus` to a fork of 0.51.1 (from 0.46.3)
- `css-parse` to 2.0.0 (from an unreleased commit)
- `css-stringify` to 2.0.0 (from an unreleased commit)
- `less` to 2.5.0 (from 1.7.4)
2015-07-16 14:30:40 -07:00
David Glasser
d9fff9b981 Clean up a test so the next test doesn't fail
For some reason I decided that tests should, on cleanup, stop their
runs *and not wait for the stop to take effect* before running the next
test. Maybe this could be reconsidered but for now, explicitly stop this
run (and wait) so the next test (npm: npm) doesn't fail.
2015-07-16 14:27:48 -07:00
David Glasser
9bda5a5bb1 remove unnecessary metadata files 2015-07-16 14:24:44 -07:00
David Glasser
c8d4d0c722 Use our babel configuration in old tests
Now old tests pass again :)
2015-07-16 14:22:10 -07:00
Ben Newman
8f4767fa78 Create an ie8 package to improve ES5 support for older browsers. 2015-07-16 17:07:15 -04:00
Slava Kim
dcf0a3a9f2 Add a test of custom minifiers 2015-07-16 14:03:19 -07:00
David Glasser
dfd287b0a3 Merge branch 'devel' into batch-plugins
Fix conflicts and continue elimination of startsWith/endsWith
2015-07-16 12:52:21 -07:00
David Glasser
cf737183ca Change import subdirectory name to 'imports'
@dgreensp:

    The more I think about it, the more I don't like naming a directory
    after a singular noun like `import`.  We have `packages/` already,
    and I want to put my modules in a directory called `modules/`, not
    `module/`, just like I don't want to put my assets in `asset/`, or
    my stylesheets in `stylesheet/`, etc.  It's ok to have a singular
    suffix and a plural directory name: to have `.import` files go in
    `imports` or `.template` files go in `templates`.  Directory names
    like `doc` and `lib` follow an old Unix convention of three-letter
    names.  And if the `import` directory name is actually a verb, not a
    noun, that is confusing because putting files in the `import`
    directory does not import them.  It just causes them to be
    considered imports (noun).
2015-07-16 12:48:53 -07:00
Slava Kim
c1e7f76d38 Fix the CSS splitting test 2015-07-16 11:12:24 -07:00
Ben Newman
0679da7cf4 Use String#{starts,ends}With instead of ad-hoc utility functions. 2015-07-16 13:54:12 -04:00
Ben Newman
01526d30ab Install ES2015 String polyfills in tool code, too. 2015-07-16 13:37:42 -04:00
David Glasser
2e34ec1933 Merge branch 'devel' into batch-plugins 2015-07-16 00:47:15 -07:00
David Glasser
68b8455345 fix archMatching typo 2015-07-16 00:45:26 -07:00
David Glasser
f9ac25dd6b use new names in stylus test 2015-07-16 00:45:05 -07:00
David Glasser
36f4656ecb Revert "Move old stylus tests to new extensions"
This reverts commit 79a53736bb.
2015-07-16 00:37:08 -07:00
David Glasser
3a678154d9 Change stylus too 2015-07-16 00:34:50 -07:00
David Glasser
2f2f57e046 Revert "Move docs to the new Less batch plugin"
This reverts commit 56ad641f1b.
2015-07-16 00:33:27 -07:00
David Glasser
1c65e8e73c Revert "todos: Rename main less file to *.main.less"
This reverts commit 9fbb4e01a3.
2015-07-16 00:31:38 -07:00
David Glasser
bdf1968ceb Change less heuristic back to default-process
In addition to the old `*.lessimport` and `*.import.less` mechanisms for
telling the `less` package that a file isn't a root, you can also put it
in an `import` subdirectory or pass `{isImport: true}` to
`api.addFiles`. We no longer will need to rename every less file when we
upgrade.

Next commit will revert the changes to examples and docs.
2015-07-16 00:29:19 -07:00
David Glasser
92bd8f98d2 Check for empty SourceProcessorSet correctly
Similar to a fix in 95b4b8f0b. "Linted your app. No linting errors." was
being incorrectly printed in cases with no linters.
2015-07-15 23:24:44 -07:00
David Glasser
1ce0b009bd Fix Plugin.registerSourceHandler('x', null) crash
This is bad use of the API, but mquandalle:bower does it, and since
we're deprecating this API anyway, no reason to arbitrarily break that package.
2015-07-15 23:22:01 -07:00
David Glasser
ced06d50f5 A missed spot to parse sourceMaps
Follow-up to 9d610e8d

Without this, a read/write JsImage (eg plugin) roundtrip would end up
writing escaped JSON to the map file!
2015-07-15 23:00:43 -07:00
Slava Kim
c0cf8b078b A WIP test to check CSS splitting in minifier working 2015-07-15 19:15:33 -07:00
Slava Kim
b470105b5f Invalidate stylus cache based on the contents
because it breaks our sourcemaps paths
2015-07-15 18:56:02 -07:00
Ben Newman
1702e8a164 Globally polyfill ES2015-compliant Map and Set constructors for tool code.
Using these collections with for-of loops also requires a global Symbol
polyfill.
2015-07-15 18:57:20 -04:00
David Glasser
67091efe7c Remove js-analyze special case
js-analyze is a tiny wrapper around esprima and escope. We don't use it
anywhere but in the tool. We even already use esprima in the tool
elsewhere.

It creates a fair amount of additional complexity. None of the other
isopackets are used as part of the isopack-building process, so it has a
bunch of random special case code for it.
2015-07-15 14:17:53 -07:00
David Glasser
0514518e60 move escope into dev bundle
Preparation for removing the JSAnalyze special case.
2015-07-15 13:49:48 -07:00
David Glasser
5a17a2064b Mostly tweak comments
Replace "XXX BBP" with more specific #BBPFoo
2015-07-15 13:33:51 -07:00
David Glasser
53038bf544 test getExtension() === null 2015-07-15 00:30:29 -07:00
David Glasser
19177cd778 mostly comments 2015-07-15 00:20:17 -07:00
David Glasser
4b8d5b9ab9 Delete large unused less dist files
This isn't as bad as it was with the older version of less we used where
they actually distributed *every version of less* in the dist directory,
not just the current one.  But every byte counts!

(This is what Npm.strip is made for, but that doesn't support plugins.)
2015-07-15 00:03:19 -07:00
David Glasser
bb0880c381 Fix and test registerCompiler addAsset 2015-07-14 23:55:49 -07:00
David Glasser
95b4b8f0b0 clean up error handling around linters
There were a few problems here:

- compiler.lint actually did things that could seriously fail (eg loading
  plugins) but used its buildmessage context to return *linter
  warnings*. So actual errors got lumped in with warnings and didn't
  prevent builds.  Fixed this by changing compiler.lint to return linter
  warnings as a return value and use its implicit buildmessage context
  only for build errors

- We weren't checking for errors after compiler.getMinifiers even though
  that loaded plugins and could fail

- We were using _.isEmpty(app.sourceProcessors.linter) to decide in
  lintBundle if we should say "no linter warnings" or "no linters were
  run", but this is a SourceProcessorSet now, not a dictionary, so we
  should have used the isEmpty method instead (so we were getting
  unnecessary "No linting errors" messages when there were no linters)

- compiler.compile still tried to run getSourcesFunc even if
  initializing the SourceProcessorSets failed

- Printing linter warnings in the runner looked different depending on
  whether it was right after doing a client refresh or not

- We were doing a temporary log of "Linting your app" and immediately
  logging "Linted your app". The point of temporary logs is to display
  while long processes run, but since linting is integrated, this didn't
  really make sense.  (Really we need to better integrate the progress
  bar and runlog, since progress fulfills most of the needs formerly
  done by the runlog.)
2015-07-14 23:28:23 -07:00
David Glasser
1a71752f8b Don't allow slashes in extensions/filenames
These go to watch's addDirectory which considers trailing slashes to
mean directories, but plugins can't process directories
2015-07-14 23:18:54 -07:00
David Glasser
5dab967dab missing default argument 2015-07-14 21:54:30 -07:00
David Glasser
772034d176 Change linter API name to processFilesForPackage
Linters run on one package at a time rather than one target at a
time. This is mostly because they need to run outside the context of
apps in various places (eg when you publish the package, though that's
currently unimplemented).
2015-07-14 21:46:21 -07:00
David Glasser
4c2359feff Explain why minifiers is client-only
And drop an ignored `minifyMode: 'development'`
2015-07-14 21:26:00 -07:00
David Glasser
7d53e53a4a Add a comment about isopack.isobuildFeatures 2015-07-14 20:30:56 -07:00
David Glasser
7a219989cc Clean up classifyFilename
- Make the return value be an object with class (and more error
  checking)

- Rename legacyHandler type to legacy-handler (to match wrong-arch)

- Fix `isTempate` typo which probably broke loadOrderSort for legacy
  handlers
2015-07-14 20:25:25 -07:00
O'meid
b6e578092e packages/facebook: Request fields using Graph 2.4. Closes #4743, closes #4744
Signed-off-by: O'meid <public@omeid.me>
2015-07-14 16:49:30 -07:00
David Glasser
ed55018477 Fix crash on Windows in meteor mongo
Fixes #4711.
2015-07-14 16:02:28 -07:00
Tom Freudenberg
09e07c6f4d Always have Meteor.settings.public
Even if it isn't set by command line, so that it can be set at runtime by
server code.

[stubailo: update commit message, remove extra if statement]
2015-07-14 15:58:46 -07:00
Slava Kim
325e97cd5d Clean up 4b9dde2d23 2015-07-14 15:57:51 -07:00