Socket
Socket
Sign inDemoInstall

riot-compiler

Package Overview
Dependencies
1
Maintainers
4
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-beta to 2.3.0-beta.4

dist/compiler.js

54

doc/README.md

@@ -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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc