Comparing version 0.5.5 to 0.5.7
@@ -0,1 +1,5 @@ | ||
## 0.5.7 / 2014-04-13 04:00 PM | ||
- Add React support - `.jsx` and `.csbx` (Coffee&React) | ||
## 0.5.5 / 2014-04-04 12:00 AM | ||
@@ -2,0 +6,0 @@ |
@@ -106,3 +106,3 @@ // Generated by CoffeeScript 1.7.1 | ||
Clinch.prototype._configureComponents = function() { | ||
var jade, log, packer_settings, setting_name, _i, _len, _ref; | ||
var jade, log, packer_settings, react, setting_name, _i, _len, _ref; | ||
log = !!this._options_.log; | ||
@@ -127,2 +127,11 @@ | ||
/* | ||
set React compiller settings | ||
react = | ||
harmony: off | ||
*/ | ||
if (react = this._options_.react) { | ||
this._di_cont_obj_.addComponentsSettings('FileProcessor', 'react', react); | ||
} | ||
/* | ||
set packer settings, default setting are | ||
@@ -129,0 +138,0 @@ |
@@ -8,3 +8,3 @@ // Generated by CoffeeScript 1.7.1 | ||
(function() { | ||
var CoffeeScript, Eco, FileProcessor, Jade, LRU, path, rejectOnInvalidFilenameType, _; | ||
var CoffeeScript, Eco, FileProcessor, Jade, LRU, React, path, rejectOnInvalidFilenameType, _; | ||
@@ -21,2 +21,4 @@ path = require('path'); | ||
React = require('react-tools'); | ||
LRU = require('lru-cache'); | ||
@@ -52,3 +54,3 @@ | ||
}); | ||
this._compilers_ = this._getAsyncCompilers(this._getJadeSettings(this._options_.jade)); | ||
this._compilers_ = this._getAsyncCompilers(this._getCompillersSettings(this._options_)); | ||
_.assign(this._compilers_, this._options_.third_party_compilers); | ||
@@ -139,2 +141,17 @@ } | ||
/* | ||
This method return whole compillers settings | ||
*/ | ||
FileProcessor.prototype._getCompillersSettings = function(options) { | ||
if (options == null) { | ||
options = {}; | ||
} | ||
return { | ||
jade_settings: this._getJadeSettings(options.jade), | ||
react_settings: this._getReactSettings(options.react) | ||
}; | ||
}; | ||
/* | ||
This internal method for Jade settings | ||
@@ -156,2 +173,16 @@ */ | ||
/* | ||
This internal method for React settings | ||
*/ | ||
FileProcessor.prototype._getReactSettings = function(options) { | ||
if (options == null) { | ||
options = {}; | ||
} | ||
return _.defaults(options, { | ||
harmony: false | ||
}); | ||
}; | ||
/* | ||
This is Async compilers list. | ||
@@ -161,3 +192,5 @@ @return - error, data, isRealCode (ie. may have 'require' and should to be processed) | ||
FileProcessor.prototype._getAsyncCompilers = function(jade_settings) { | ||
FileProcessor.prototype._getAsyncCompilers = function(_arg) { | ||
var jade_settings, react_settings; | ||
jade_settings = _arg.jade_settings, react_settings = _arg.react_settings; | ||
return { | ||
@@ -188,2 +221,15 @@ '.js': function(data, filename, cb) { | ||
return cb(null, "module.exports = " + content); | ||
}, | ||
'.jsx': function(data, filename, cb) { | ||
var content; | ||
content = React.transform(data, react_settings); | ||
return cb(null, content, true); | ||
}, | ||
'.csbx': function(data, filename, cb) { | ||
var content, pre_content; | ||
pre_content = CoffeeScript.compile(data, { | ||
bare: CS_BARE | ||
}); | ||
content = React.transform(pre_content, react_settings); | ||
return cb(null, content, true); | ||
} | ||
@@ -190,0 +236,0 @@ }; |
{ | ||
"name": "clinch", | ||
"version": "0.5.5", | ||
"version": "0.5.7", | ||
"dependencies": { | ||
@@ -47,4 +47,5 @@ "coffee-script": { | ||
"jade": { | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"from": "jade@*", | ||
"resolved": "https://registry.npmjs.org/jade/-/jade-1.3.1.tgz", | ||
"dependencies": { | ||
@@ -57,3 +58,4 @@ "commander": { | ||
"version": "0.3.5", | ||
"from": "mkdirp@~0.3.5" | ||
"from": "mkdirp@~0.3.5", | ||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz" | ||
}, | ||
@@ -228,4 +230,5 @@ "transformers": { | ||
"async": { | ||
"version": "0.6.2", | ||
"from": "async@*" | ||
"version": "0.7.0", | ||
"from": "async@*", | ||
"resolved": "https://registry.npmjs.org/async/-/async-0.7.0.tgz" | ||
}, | ||
@@ -266,3 +269,3 @@ "detective": { | ||
"version": "3001.1.0-dev-harmony-fb", | ||
"from": "esprima-fb@3001.1.0-dev-harmony-fb", | ||
"from": "esprima-fb@~3001.1.0-dev-harmony-fb", | ||
"resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-3001.0001.0000-dev-harmony-fb.tgz" | ||
@@ -279,4 +282,205 @@ } | ||
"from": "lru-cache@*" | ||
}, | ||
"react-tools": { | ||
"version": "0.10.0", | ||
"from": "react-tools@*", | ||
"dependencies": { | ||
"commoner": { | ||
"version": "0.9.3", | ||
"from": "commoner@^0.9.2", | ||
"dependencies": { | ||
"q": { | ||
"version": "1.0.1", | ||
"from": "q@~1.0.1" | ||
}, | ||
"recast": { | ||
"version": "0.5.16", | ||
"from": "recast@~0.5.12", | ||
"dependencies": { | ||
"esprima": { | ||
"version": "1.1.1", | ||
"from": "esprima@~1.1.1" | ||
}, | ||
"source-map": { | ||
"version": "0.1.32", | ||
"from": "source-map@0.1.32", | ||
"dependencies": { | ||
"amdefine": { | ||
"version": "0.1.0", | ||
"from": "amdefine@>=0.0.4" | ||
} | ||
} | ||
}, | ||
"cls": { | ||
"version": "0.1.4", | ||
"from": "cls@~0.1.3" | ||
}, | ||
"ast-types": { | ||
"version": "0.3.22", | ||
"from": "ast-types@~0.3.22" | ||
} | ||
} | ||
}, | ||
"commander": { | ||
"version": "2.2.0", | ||
"from": "commander@~2.2.0" | ||
}, | ||
"graceful-fs": { | ||
"version": "2.0.3", | ||
"from": "graceful-fs@~2.0.3" | ||
}, | ||
"glob": { | ||
"version": "3.2.9", | ||
"from": "glob@~3.2.9", | ||
"dependencies": { | ||
"minimatch": { | ||
"version": "0.2.14", | ||
"from": "minimatch@~0.2.11", | ||
"dependencies": { | ||
"sigmund": { | ||
"version": "1.0.0", | ||
"from": "sigmund@~1.0.0" | ||
} | ||
} | ||
}, | ||
"inherits": { | ||
"version": "2.0.1", | ||
"from": "inherits@2" | ||
} | ||
} | ||
}, | ||
"mkdirp": { | ||
"version": "0.3.5", | ||
"from": "mkdirp@~0.3.5" | ||
}, | ||
"private": { | ||
"version": "0.1.3", | ||
"from": "private@~0.1.2" | ||
}, | ||
"install": { | ||
"version": "0.1.7", | ||
"from": "install@~0.1.7" | ||
}, | ||
"iconv-lite": { | ||
"version": "0.2.11", | ||
"from": "iconv-lite@~0.2.11" | ||
}, | ||
"whiskey": { | ||
"version": "0.6.13", | ||
"from": "whiskey@0.6.x", | ||
"dependencies": { | ||
"sprintf": { | ||
"version": "0.1.3", | ||
"from": "sprintf@>= 0.1.1" | ||
}, | ||
"magic-templates": { | ||
"version": "0.1.1", | ||
"from": "magic-templates@= 0.1.1" | ||
}, | ||
"rimraf": { | ||
"version": "1.0.1", | ||
"from": "rimraf@= 1.0.1" | ||
}, | ||
"terminal": { | ||
"version": "0.1.3", | ||
"from": "terminal@= 0.1.3" | ||
}, | ||
"gex": { | ||
"version": "0.0.1", | ||
"from": "gex@= 0.0.1" | ||
}, | ||
"simplesets": { | ||
"version": "1.1.6", | ||
"from": "simplesets@= 1.1.6" | ||
}, | ||
"logmagic": { | ||
"version": "0.1.4", | ||
"from": "logmagic@= 0.1.4" | ||
}, | ||
"underscore": { | ||
"version": "1.6.0", | ||
"from": "underscore@>= 1.4.2" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"esprima-fb": { | ||
"version": "3001.1.0-dev-harmony-fb", | ||
"from": "esprima-fb@~3001.1.0-dev-harmony-fb" | ||
}, | ||
"jstransform": { | ||
"version": "3.0.0", | ||
"from": "jstransform@~3.0.0", | ||
"dependencies": { | ||
"base62": { | ||
"version": "0.1.1", | ||
"from": "base62@0.1.1" | ||
}, | ||
"source-map": { | ||
"version": "0.1.31", | ||
"from": "source-map@0.1.31", | ||
"dependencies": { | ||
"amdefine": { | ||
"version": "0.1.0", | ||
"from": "amdefine@>=0.0.4" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"envify": { | ||
"version": "1.2.1", | ||
"from": "envify@~1.2.0", | ||
"resolved": "https://registry.npmjs.org/envify/-/envify-1.2.1.tgz", | ||
"dependencies": { | ||
"xtend": { | ||
"version": "2.1.2", | ||
"from": "xtend@~2.1.2", | ||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", | ||
"dependencies": { | ||
"object-keys": { | ||
"version": "0.4.0", | ||
"from": "object-keys@~0.4.0", | ||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz" | ||
} | ||
} | ||
}, | ||
"through": { | ||
"version": "2.3.4", | ||
"from": "through@~2.3.4" | ||
}, | ||
"esprima-fb": { | ||
"version": "3001.1.0-dev-harmony-fb", | ||
"from": "esprima-fb@~3001.1.0-dev-harmony-fb", | ||
"resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-3001.0001.0000-dev-harmony-fb.tgz" | ||
}, | ||
"jstransform": { | ||
"version": "3.0.0", | ||
"from": "jstransform@~3.0.0", | ||
"resolved": "https://registry.npmjs.org/jstransform/-/jstransform-3.0.0.tgz", | ||
"dependencies": { | ||
"base62": { | ||
"version": "0.1.1", | ||
"from": "base62@0.1.1", | ||
"resolved": "https://registry.npmjs.org/base62/-/base62-0.1.1.tgz" | ||
}, | ||
"source-map": { | ||
"version": "0.1.31", | ||
"from": "source-map@0.1.31", | ||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.31.tgz", | ||
"dependencies": { | ||
"amdefine": { | ||
"version": "0.1.0", | ||
"from": "amdefine@>=0.0.4" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
{ | ||
"name": "clinch", | ||
"version": "0.5.5", | ||
"version": "0.5.7", | ||
"description": "YA ComonJS to browser packer tool, well-suited for widgets by small overhead and big app by smart settings", | ||
@@ -19,3 +19,5 @@ "main": "./lib/app", | ||
"npm", | ||
"javascript" | ||
"javascript", | ||
"react", | ||
"coffeescript" | ||
], | ||
@@ -33,3 +35,4 @@ "author": "Dmitrii Karpich <meettya@gmail.com>", | ||
"shorthash": "*", | ||
"lru-cache": "*" | ||
"lru-cache": "*", | ||
"react-tools": "*" | ||
}, | ||
@@ -44,3 +47,6 @@ "devDependencies": { | ||
"walkdir": "*", | ||
"fs-extra": "*" | ||
"fs-extra": "*", | ||
"jsdom": "*", | ||
"node-jsx": "*", | ||
"react": "*" | ||
}, | ||
@@ -47,0 +53,0 @@ "engines": { |
@@ -16,2 +16,4 @@ # clinch | ||
- `.jade` - прекомпилируется как [client-mode](https://github.com/visionmedia/jade#a4) вариант | ||
- `.jsx` - компилирует [React '.jsx'](http://facebook.github.io/react/index.html) в JavaScript | ||
- `.csbx` - компилирует '.jsx', написанный на Coffee с обратными лапками в JavaScript (да, мы так делаем) | ||
@@ -32,2 +34,12 @@ ## а можно подключить мой любимый шаблонизатор? | ||
### Немного про React (.jsx, .csbx) | ||
Созданый с помощью clinch файл можно запросить через `require()`, как это сделано в тестах. Для использования в браузере требуется подключение самого React, его runtime-transfom не нужен, все уже будет подготовлено и упаковано. | ||
React был добавлен в ядро и в обязательном порядке будет поддерживаться, это феноменальный инструмент для написания поддерживаемого кода. | ||
К сожалению пока совмещение лучшего из двух миров - CoffeeScrip и jsx от React реализовано "по месту" - использея трюк с обратным лапками (backticks), которые позволяют вставлять в CoffeScript конструкции, не обрабатываемые им. Именно по этой причине для файлов выбрано такое расширение - "Coffee Script with Backticks eXt" - `.csbx` | ||
Как только появится нормальный метод совместить оба инструмента - я в кратчайшие сроки сделаю это, вероятнее всего расширение файлов при этом будет `.csx` | ||
## installation | ||
@@ -219,2 +231,8 @@ | ||
### | ||
эти настройки могут быть переданы компилятору React | ||
### | ||
react : | ||
harmony : off | ||
### package_config | ||
@@ -221,0 +239,0 @@ |
@@ -15,2 +15,4 @@ [![Dependency Status](https://gemnasium.com/Meettya/clinch.png)](https://gemnasium.com/Meettya/clinch) | ||
- `.jade` - precompile it in [client-mode](https://github.com/visionmedia/jade#a4) way | ||
- `.jsx` - compile [React '.jsx'](http://facebook.github.io/react/index.html) to JavaScript | ||
- `.csbx` - compile '.jsx' on Coffee with backticks to JavaScript (yes, we do it) | ||
@@ -29,2 +31,12 @@ ## what about my custom template engine? | ||
### More about React (.jsx, .csbx) | ||
Created by clinch file can be requested via the `require ()`, as is done in the tests. For use in the browser requires the connect of the React, its runtime-transfom tool not needed, everything will be prepared and packed. | ||
React was added to the kernel and will be mandatory to be supported, it's a phenomenal tool for writing maintainable code. | ||
Unfortunately while combining the best of two worlds - CoffeeScrip and jsx by React implemented "in place" - used trick with the backticks, which allow you to insert in CoffeScript js code that are not parsed them . This is the reason for such an extension of selected files - "Coffee Script with Backticks eXt" - `.csb` | ||
As soon as the normal method to combine both of these tools - I 'll do it ASAP, most likely with the file extension is `.csx` | ||
## installation | ||
@@ -172,2 +184,8 @@ | ||
### | ||
this settings will be applied to React compiler | ||
### | ||
react : | ||
harmony : off | ||
### package_config | ||
@@ -174,0 +192,0 @@ ### |
@@ -14,2 +14,3 @@ ## Roadmap for clinch | ||
- Add 'clinch require start/end' statimen support to speed up require parsing (with RegExp, not detective) | ||
- Add travis-ci - done | ||
- Add travis-ci - done | ||
- Add React support - done |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
250325
112
2813
267
10
11
11
+ Addedreact-tools@*
+ Addedacorn@5.7.4(transitive)
+ Addedast-types@0.9.6(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbase62@0.1.1(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcommoner@0.10.8(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddetective@4.7.1(transitive)
+ Addedesprima@3.1.3(transitive)
+ Addedesprima-fb@13001.1001.0-dev-harmony-fb(transitive)
+ Addedglob@5.0.15(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjstransform@10.1.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedprivate@0.1.8(transitive)
+ Addedq@1.5.1(transitive)
+ Addedreact-tools@0.13.3(transitive)
+ Addedrecast@0.11.23(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsource-map@0.1.31(transitive)
+ Addedwrappy@1.0.2(transitive)