Commit Graph

42 Commits

Author SHA1 Message Date
Ben Newman
d791447411 Use async compileOneFile to avoid Future usage in LESS plugin. 2018-06-11 19:40:47 -04:00
Ben Newman
c28065aedc Let CachingCompiler subclasses implement compileOneFileLater.
If you're subclassing `CachingCompiler` or `MultiFileCachingCompiler`, you
can now implement a `compileOneFileLater` (emphasis on `Later`) to opt into
the new lazy compilation strategy.

If you implement this method, and `inputFile.supportsLazyCompilation` is
true, then the `addCompileResult` will not be called, though it is
probably a good idea to keep any existing `addCompileResult` methods, just
in case `inputFile.supportsLazyCompilation` is not truthy.

This will be an important part of a proper solution to the issues I
described (but failed to fix) in my broken PR #9968.
2018-06-11 11:02:19 -04:00
Ben Newman
8cadd4e215 Include inputFile.getArch() in LessCompiler cache key.
Similar to this CachedCoffeeScriptCompiler change:
620689f7de
2018-01-21 11:31:04 -05:00
Ben Newman
cd8bc10b1d Allow .less files in imports/ directories to be imported.
Because the files are in an imports/ directory, they are still considered
lazy, so they will not be applied to the document unless imported from JS.

Related: #6037
2016-04-13 19:52:20 -04:00
Sashko Stubailo
e2d4556479 Special-case http imports in LESS package 2015-09-14 11:53:58 -07:00
David Glasser
4e7b24dcb3 also catch sync errors thrown by less.render
(which wouldn't actually have caught the issue in 1e3b09d, because that
error got caught by some internal less try/catch, sigh)
2015-07-24 14:51:50 -07:00
Slava Kim
1e3b09df8f Less: Pass error in callback, don't throw 2015-07-24 14:51:10 -07:00
Slava Kim
03087d10cd Less compiler should use Plugin.path 2015-07-24 14:11:33 -07:00
Slava Kim
173bfb7c03 Expose and use wrapped fs/path moduldes in Plugins 2015-07-23 13:10:26 -07:00
Slava Kim
a41dcbbd66 Add some Windows-specific paths hacks to less/stylus 2015-07-21 17:15:44 -07:00
David Glasser
efbe277309 Factor cache logic out of less
And improve the cache (now in MultiFileCachingCompiler) to not rewrite
the whole cache on every operation
2015-07-21 02:49:20 -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
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
5a17a2064b Mostly tweak comments
Replace "XXX BBP" with more specific #BBPFoo
2015-07-15 13:33:51 -07:00
David Glasser
bb50ed099d remove outdated XXX BBP comment
error handling works and is tested
2015-07-14 13:46:11 -07:00
David Greenspan
3196d6e27d Treat main.less files like *.main.less files
This means `foo/bar/main.less` is also a "main" file.
2015-07-07 14:03:06 -07:00
Slava Kim
9d610e8d26 Prefer source-maps in memory in a parsed JSON form 2015-07-06 15:25:11 -07:00
David Glasser
dd548edd72 less: better error for unknown @import
also, fix coffee/less self-test
2015-06-30 00:09:42 -07:00
Slava Kim
f23ea43168 Fix files' display paths for compiled Less in sourcemaps 2015-06-25 16:59:00 -07:00
David Glasser
02b3263961 implement (bad) cache for less too
but the magic of plugin-provided caching is that making the cache better
doesn't involve touching tools!
2015-06-09 12:40:35 -07:00
David Glasser
44c815a955 coffee uses on-disk cache
Also combine the two coffee registerCompiler calls into one

it's a bad on-disk cache that should be improved to not write out all
the unchanged files every time too.  but the tests do show that it skips
the unnecessary recompile

less doesn't use an on-disk cache yet
2015-06-09 12:33:46 -07:00
David Glasser
774b9754ec Test less caching, and improve client refresh
Specifically, ensure that we don't even include client-specific files in
the server WatchSet by making sure we pass a precise set of extensions
to initFromAppDir.  We still also rule out wrong-arch files at a later
stage too (because sourceExtensions only affects initFromAppDir).

Without the change to compiler.js, the final test (adding
yet-another-root.main.less) restarts the server rather than printing
"Client modified -- refreshing".
2015-06-08 22:41:55 -07:00
David Glasser
456d19a65e coffeescript self-test w/ local package file 2015-06-08 21:02:48 -07:00
David Glasser
01404de8fe start of a self-test showing coffee/less caching
doesn't do less yet
2015-06-04 22:49:42 -07:00
David Glasser
a0775e14a8 precise caching for less
needs tests!
2015-06-04 21:24:30 -07:00
Slava Kim
b167d6446f Checkpoint: coffeescript ported to BBP 2015-06-04 01:19:13 -07:00
Slava Kim
ce77532fc1 Remove temp xxx APIs of batch plugin 2015-06-04 01:19:11 -07:00
David Glasser
478e1f00f9 new less package (accounts-ui not yet working) 2015-06-04 01:19:10 -07:00
David Glasser
ddc3657e4f Watch files which fail before emitting a resource
Regression introduced by the CSS watching code (specifically, f230eba62)
by the sourceIsWatched check. We need to be able to tell the difference
between "source handler didn't do anything because there was an error"
and "source handler didn't do anything because it's web-specific and
this is an os arch".

A simple fix would have been to interpret compileStep.error as
"sourceIsWatched = true", but I didn't think of that until after doing
it the slightly more complicated but more precise way :)

Also, ensure that if the runner rebuilds the client and there's an
error, it properly kills the app process (and the watchers and the
keepalive interval, etc).
2014-08-04 21:32:22 -07:00
Matthew Arbesfeld
8bcbd65344 Separate "browser" target into web.browser/cordova
Cordova projects often have a different set of files than web targets,
so we would like to be able to target different client architectures in
our bundles. Ideally, we allow the user to use arbitrary client
architectures - but this patch is a step in the right direction by
abstracting out more of the hard coded "browser"/"os" lines.

We accomplish this separation in a backwards compatible way by allowing
api.___ commands to target a "client" architecture. For example,
api.addFiles('a.js', 'client') adds 'a.js' to both the 'client.browser'
and 'client.cordova' targets.

Effects on 0.9 packaging stuff: packages don't have to change, but the
"data.json" file in ".meteor0" has "browser" in some places. We think we
have to fix the troposphere code where this data.json is created.

Some plugins will also be backwards-incompatible with this change, since
many have a "clientArch.matches("browser")" line in the plugin
code. Ideally, we fix plugins so that this stops being an issue, but for
now package authors can just patch that line.

At the compiled (unipackage) level the new names are 'web.browser' and
'web.cordova', replacing 'browser'. In package.js, the new names are
'client.browser' and 'client.cordova', serving as an adjunct to 'client'.
2014-07-31 14:12:15 -07:00
Cangit
dbca6908f3 Don't decrement the line number in LESS error reporting.
LESS fixed their math problem in 1.6.0
2014-06-10 09:45:03 -07:00
Slava Kim
3d7448bcce Pass the filepath to less parser 2014-04-06 15:36:05 -07:00
David Glasser
c0447737ec Fix less error handling during ast.toCSS
Fixes #1877
2014-03-03 21:55:58 -08:00
Slava Kim
dc4eb4c496 Prevent less sourcemaps generation hanging w/o compiling less twice 2014-02-20 00:03:15 -08:00
Slava Kim
3caa824b32 Don't hang if less produces no source-map
Add a test for that
2014-02-19 22:03:14 -08:00
Slava Kim
a26822ec96 Style fixes, renames, comments 2014-02-05 13:54:30 -08:00
Maxime Quandalle
cf11139f6c Add a .import.styl handler to prevent Meteor processing a stylus file Fix #462 2014-02-03 21:58:29 -08:00
Slava Kim
efb700f4f9 Rename futures for less package 2014-02-03 21:58:29 -08:00
Maxime Quandalle
57e670440a less package ignores .import.less files, so you can import them and still haves syntax highlighting in your text editor. 2014-02-03 21:58:28 -08:00
Slava Kim
2f78babda1 Enable less sourcemaps 2014-02-03 21:58:28 -08:00
David Glasser
c3d1f7bbd2 Don't fail if stylus or less files are in a non-client-specific place.
Make the plugin's arch check less sketchy.

Improve less and stylus error handling.
2013-08-02 15:16:53 -07:00
Geoff Schmidt
4bff34a680 Port 'less' package to new plugin API 2013-05-13 11:52:43 -07:00