-
Notifications
You must be signed in to change notification settings - Fork 3
/
rave.js
37 lines (30 loc) · 825 Bytes
/
rave.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/** @license MIT License (c) copyright 2014 original authors */
/** @author Karolis Narkevicius */
var jsxTransformer = require('./JSXTransformer');
var defaultExtensions = [ 'jsx' ];
exports.create = create;
function create (context) {
// override extensions if supplied by dev
var env = context.env;
var extensions = (env.loadJsx && env.loadJsx.extensions)
|| defaultExtensions;
return {
load: [
{
extensions: extensions,
hooks: {
locate: locate,
translate: function (file) {
var pragma = '/** @jsx React.DOM */';
return jsxTransformer.transform(pragma + file.source).code;
}
}
}
]
};
}
function locate (load) {
var metadata = load.metadata;
metadata.dontAddExt = true;
return false;
}