riot-compiler
Advanced tools
Comparing version 2.0.0-beta to 2.3.0-beta.4
@@ -7,3 +7,3 @@ # Compiler | ||
### <a name="compile"></a> riot.compile(callback) | ||
### <a name="compile"></a> compiler.compile(callback) | ||
@@ -13,3 +13,3 @@ Compile all tags defined with `<script type="riot/tag">` to JavaScript. These can be inlined script definitions or external resources that load scripts defined with `src` attribute. After all scripts are compiled the given `callback` method is called. For example: | ||
``` javascript | ||
riot.compile(function() { | ||
compiler.compile(function() { | ||
var tags = riot.mount('*') | ||
@@ -19,3 +19,3 @@ }) | ||
You can leave out the `riot.compile` call and write just: | ||
You can leave out the `compiler.compile` call and write just: | ||
@@ -26,7 +26,7 @@ ``` javascript | ||
but you don't get to know when external resources are loaded and compiled and the return value is an empty array if you have external scripts. If all scripts are defined on the page then riot.compile step can be left out. | ||
but you don't get to know when external resources are loaded and compiled and the return value is an empty array if you have external scripts. If all scripts are defined on the page then compiler.compile step can be left out. | ||
For more details, read the compiler [general introduction](/guide/compiler/). | ||
### <a name="compile-fn"></a> riot.compile(url, callback) | ||
### <a name="compile-fn"></a> compiler.compile(url, callback) | ||
@@ -36,3 +36,3 @@ Loads the given URL and compiles all tags after which the `callback` is called. For example: | ||
``` javascript | ||
riot.compile('my/tags.tag', function() { | ||
compiler.compile('my/tags.tag', function() { | ||
// the loaded tags are ready to be used | ||
@@ -42,7 +42,7 @@ }) | ||
### <a name="compile-tag"></a> riot.compile(tag) | ||
### <a name="compile-tag"></a> compiler.compile(tag) | ||
Compiles and executes the given `tag`. For example: | ||
``` | ||
```html | ||
<template id="my_tag"> | ||
@@ -55,3 +55,3 @@ <my-tag> | ||
<script> | ||
riot.compile(my_tag.innerHTML) | ||
compiler.compile(my_tag.innerHTML) | ||
</script> | ||
@@ -66,3 +66,3 @@ ``` | ||
### <a name="compile-to-str"></a> riot.compile(tag, true) | ||
### <a name="compile-to-str"></a> compiler.compile(tag, true) | ||
@@ -72,3 +72,3 @@ Compiles the `tag` and returns it as a string. Only the transformation from the tag to JavaScript is performed and the tag is not executed on the browser. You can use this method to benchmark the compiler performance for example. | ||
``` js | ||
var js = riot.compile(my_tag.innerHTML, true) | ||
var js = compiler.compile(my_tag.innerHTML, true) | ||
``` | ||
@@ -80,6 +80,6 @@ | ||
``` | ||
```js | ||
var riot = require('riot') | ||
var js = riot.compile(tag) | ||
var js = compiler.compile(tag) | ||
``` | ||
@@ -89,3 +89,3 @@ | ||
### <a name="css-parser"></a> riot.parsers.css [tagName, css] | ||
### <a name="css-parser"></a> compiler.parsers.css [tagName, css] | ||
@@ -95,3 +95,3 @@ Custom parsers that could be used to compile your tags css. For example: | ||
```js | ||
riot.parsers.css.myparser = function(tag, css) { | ||
compiler.parsers.css.myparser = function(tag, css) { | ||
return css.replace(/@tag/, tag) | ||
@@ -121,3 +121,3 @@ } | ||
### <a name="js-parser"></a> riot.parsers.js [js, options] | ||
### <a name="js-parser"></a> compiler.parsers.js [js, options] | ||
@@ -127,3 +127,3 @@ Custom parsers that could be used to compile your tags javascript. For example | ||
```js | ||
riot.parsers.js.myparser = function(js) { | ||
compiler.parsers.js.myparser = function(js) { | ||
return js.replace(/@version/, '1.0.0') | ||
@@ -153,6 +153,22 @@ } | ||
### <a name="html-parser"></a> riot.parsers.html [html] | ||
### <a name="html-parser"></a> compiler.parsers.html [html] | ||
Custom parsers that could be used to compile your tags html | ||
Custom parsers that could be used to compile your tags html. | ||
The predefined parsers are: | ||
#### html | ||
- `jade` | ||
#### css | ||
- `stylus` | ||
#### js | ||
- `none` or `javascript` | ||
- `livescript` | ||
- `typescript` | ||
- `es6` - (using `babel-core` or `babel`) | ||
- `coffee` or `coffeescript` | ||
## Changes | ||
In previous versions, escaped brackets were preserved, generating incorrect HTML or invalid JavaScript code. This version removes them at an early stage, after passing the tag to the html parser, but before that the JavaScript code and expressions are sent to the js parser. |
{ | ||
"name": "riot-compiler", | ||
"version": "2.0.0-beta", | ||
"version": "2.3.0-beta.4", | ||
"description": "Compiler for riot .tag files", | ||
"main": "index.js", | ||
"main": "dist/compiler.js", | ||
"directories": { | ||
"lib": "lib" | ||
"lib": "lib", | ||
"doc": "doc" | ||
}, | ||
"files": [ | ||
"lib", | ||
"doc", | ||
"dist/*.js", | ||
"test/**" | ||
], | ||
"scripts": { | ||
"test": "make test" | ||
"test": "make test", | ||
"prepublish": "make build" | ||
}, | ||
@@ -22,10 +30,12 @@ "repository": { | ||
], | ||
"dependencies": { | ||
"riot-tmpl": "2.3.0-beta.4" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^2.11.3", | ||
"eslint": "^1.0.0", | ||
"coveralls": "^2.11.4", | ||
"eslint": "^1.7.2", | ||
"expect.js": "^0.3.1", | ||
"karma": "^0.13.3", | ||
"karma-coverage": "^0.4.2", | ||
"karma-mocha": "^0.2.0", | ||
"karma-phantomjs-launcher": "^0.2.0" | ||
"istanbul": "^0.4.0", | ||
"jspreproc": "^0.2.3", | ||
"mocha": "^2.3.3" | ||
}, | ||
@@ -37,7 +47,3 @@ "author": "Muut, Inc. and other contributors", | ||
}, | ||
"homepage": "https://github.com/riot/compiler#readme", | ||
"dependencies": { | ||
"riot": "^2.2.4", | ||
"shelljs": "^0.5.3" | ||
} | ||
"homepage": "https://github.com/riot/compiler#readme" | ||
} |
[![Build Status][travis-image]][travis-url] | ||
[![Code Quality][codeclimate-image]][codeclimate-url] | ||
[![Coverage Status][coverage-image]][coverage-url] | ||
[![NPM version][npm-version-image]][npm-url] | ||
[![NPM downloads][npm-downloads-image]][npm-url] | ||
[![MIT License][license-image]][license-url] | ||
[![Coverage Status][coverage-image]][coverage-url] | ||
@@ -24,14 +24,10 @@ ## Documentation | ||
[travis-url]:https://travis-ci.org/riot/compiler | ||
[license-image]:http://img.shields.io/badge/license-MIT-000000.svg?style=flat-square | ||
[license-url]:LICENSE.txt | ||
[npm-version-image]:http://img.shields.io/npm/v/riot-compiler.svg?style=flat-square | ||
[npm-downloads-image]:http://img.shields.io/npm/dm/riot-compiler.svg?style=flat-square | ||
[npm-url]:https://npmjs.org/package/riot-compiler | ||
[coverage-image]:https://img.shields.io/coveralls/riot/compiler/master.svg?style=flat-square | ||
[coverage-url]:https://coveralls.io/r/riot/compiler/?branch=master | ||
[codeclimate-image]:https://img.shields.io/codeclimate/github/riot/compiler.svg?style=flat-square | ||
[codeclimate-url]:https://codeclimate.com/github/riot/compiler |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
105917
1
6
92
2624
33
11
2
+ Addedriot-tmpl@2.3.0-beta.4
+ Addedriot-tmpl@2.3.0-beta.4(transitive)
- Removedriot@^2.2.4
- Removedshelljs@^0.5.3
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedanymatch@1.3.2(transitive)
- Removedarr-diff@2.0.04.0.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarr-union@3.1.0(transitive)
- Removedarray-unique@0.2.10.3.2(transitive)
- Removedassign-symbols@1.0.0(transitive)
- Removedasync-each@1.0.6(transitive)
- Removedatob@2.1.2(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbase@0.11.2(transitive)
- Removedbinary-extensions@1.13.1(transitive)
- Removedbindings@1.5.0(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbraces@1.8.52.3.2(transitive)
- Removedcache-base@1.0.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedchokidar@1.7.0(transitive)
- Removedclass-utils@0.3.6(transitive)
- Removedco@4.6.0(transitive)
- Removedcollection-visit@1.0.0(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcopy-descriptor@0.1.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removeddeep-is@0.1.4(transitive)
- Removeddefine-property@0.2.51.0.02.0.2(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedexpand-brackets@0.1.52.1.4(transitive)
- Removedexpand-range@1.8.2(transitive)
- Removedextend-shallow@2.0.13.0.2(transitive)
- Removedextglob@0.3.22.0.4(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedfilename-regex@2.0.1(transitive)
- Removedfill-range@2.2.44.0.0(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedfor-own@0.1.5(transitive)
- Removedfragment-cache@0.2.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfsevents@1.2.13(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-value@2.0.6(transitive)
- Removedglob@7.2.3(transitive)
- Removedglob-base@0.3.0(transitive)
- Removedglob-parent@2.0.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-value@0.3.11.0.0(transitive)
- Removedhas-values@0.1.41.0.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedinterpret@1.4.0(transitive)
- Removedis-accessor-descriptor@1.0.1(transitive)
- Removedis-binary-path@1.0.1(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-core-module@2.14.0(transitive)
- Removedis-data-descriptor@1.0.1(transitive)
- Removedis-descriptor@0.1.71.0.3(transitive)
- Removedis-dotfile@1.0.3(transitive)
- Removedis-equal-shallow@0.1.3(transitive)
- Removedis-extendable@0.1.11.0.1(transitive)
- Removedis-extglob@1.0.0(transitive)
- Removedis-glob@2.0.1(transitive)
- Removedis-number@2.1.03.0.04.0.0(transitive)
- Removedis-plain-object@2.0.4(transitive)
- Removedis-posix-bracket@0.1.1(transitive)
- Removedis-primitive@2.0.0(transitive)
- Removedis-windows@1.0.2(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisobject@2.1.03.0.1(transitive)
- Removedkind-of@3.2.24.0.06.0.3(transitive)
- Removedlevn@0.3.0(transitive)
- Removedmap-cache@0.2.2(transitive)
- Removedmap-visit@1.0.0(transitive)
- Removedmath-random@1.0.4(transitive)
- Removedmicromatch@2.3.113.1.10(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedmixin-deep@1.3.2(transitive)
- Removedms@2.0.0(transitive)
- Removednan@2.20.0(transitive)
- Removednanomatch@1.2.13(transitive)
- Removednormalize-path@2.1.1(transitive)
- Removedobject-copy@0.1.0(transitive)
- Removedobject-visit@1.0.1(transitive)
- Removedobject.omit@2.0.1(transitive)
- Removedobject.pick@1.3.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedparse-glob@3.0.4(transitive)
- Removedpascalcase@0.1.1(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedposix-character-classes@0.1.1(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedpreserve@0.2.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedrandomatic@3.1.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedreaddirp@2.2.1(transitive)
- Removedrechoir@0.6.2(transitive)
- Removedregex-cache@0.4.4(transitive)
- Removedregex-not@1.0.2(transitive)
- Removedremove-trailing-separator@1.1.0(transitive)
- Removedrepeat-element@1.1.4(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedresolve@1.22.8(transitive)
- Removedresolve-url@0.2.1(transitive)
- Removedret@0.1.15(transitive)
- Removedriot@2.6.9(transitive)
- Removedriot-cli@2.6.2(transitive)
- Removedriot-compiler@2.5.7(transitive)
- Removedriot-observable@2.5.0(transitive)
- Removedriot-route@2.5.0(transitive)
- Removedriot-tmpl@2.4.2(transitive)
- Removedrollup@0.36.4(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsafe-regex@1.1.0(transitive)
- Removedset-value@2.0.1(transitive)
- Removedshelljs@0.5.30.7.8(transitive)
- Removedsimple-dom@0.3.2(transitive)
- Removedsimple-html-tokenizer@0.2.6(transitive)
- Removedsnapdragon@0.8.2(transitive)
- Removedsnapdragon-node@2.1.1(transitive)
- Removedsnapdragon-util@3.0.1(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedsource-map-resolve@0.5.3(transitive)
- Removedsource-map-support@0.4.18(transitive)
- Removedsource-map-url@0.4.1(transitive)
- Removedsplit-string@3.1.0(transitive)
- Removedstatic-extend@0.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedto-object-path@0.3.0(transitive)
- Removedto-regex@3.0.2(transitive)
- Removedto-regex-range@2.1.1(transitive)
- Removedtype-check@0.3.2(transitive)
- Removedunion-value@1.0.1(transitive)
- Removedunset-value@1.0.0(transitive)
- Removedurix@0.1.0(transitive)
- Removeduse@3.1.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedword-wrap@1.2.5(transitive)
- Removedwrappy@1.0.2(transitive)