init
This commit is contained in:
4
node_modules/coffeeify/.travis.yml
generated
vendored
Normal file
4
node_modules/coffeeify/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 6
|
||||
- 8
|
18
node_modules/coffeeify/LICENSE
generated
vendored
Normal file
18
node_modules/coffeeify/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
112
node_modules/coffeeify/README.md
generated
vendored
Normal file
112
node_modules/coffeeify/README.md
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
# coffeeify [](https://travis-ci.org/jnordberg/coffeeify)
|
||||
|
||||
CoffeeScript browserify transform. Mix and match `.coffee` and `.js` files in the same project.
|
||||
|
||||
**NOTE: As of version 3.0.0 coffeeify requires CoffeeScript to be installed manually as a peerDependency, also note that the CoffeeScript package has changed name from `coffee-script` to `coffeescript`.**
|
||||
|
||||
## Example
|
||||
|
||||
Given some files written in a mix of `js` and `coffee`:
|
||||
|
||||
foo.coffee:
|
||||
|
||||
```coffee
|
||||
console.log require './bar.js'
|
||||
```
|
||||
|
||||
bar.js:
|
||||
|
||||
```javascript
|
||||
module.exports = require('./baz.coffee')(5)
|
||||
```
|
||||
|
||||
baz.coffee:
|
||||
|
||||
```coffee
|
||||
module.exports = (n) -> n ** n
|
||||
```
|
||||
|
||||
Install coffeeify into your app, and CoffeeScript if you don't have it already:
|
||||
|
||||
```
|
||||
$ npm install --save-dev coffeeify coffeescript
|
||||
```
|
||||
|
||||
When you compile your app, just pass `-t coffeeify` to browserify:
|
||||
|
||||
```shell
|
||||
$ browserify -t coffeeify foo.coffee > bundle.js
|
||||
$ node bundle.js
|
||||
3125
|
||||
```
|
||||
|
||||
You can omit the `.coffee` extension from your requires if you add the extension to browserify's module extensions:
|
||||
|
||||
```javascript
|
||||
module.exports = require('./baz')(5)
|
||||
```
|
||||
|
||||
```
|
||||
$ browserify -t coffeeify --extension=".coffee" foo.coffee > bundle.js
|
||||
$ node bundle.js
|
||||
3125
|
||||
```
|
||||
|
||||
You can also pass options to the CoffeeScript compiler:
|
||||
|
||||
```
|
||||
$ browserify -t [ coffeeify --bare false --header true ] --extension=".coffee" foo.coffee
|
||||
..
|
||||
// Generated by CoffeeScript 1.10.0
|
||||
(function() {
|
||||
console.log(require('./bar.js'));
|
||||
|
||||
}).call(this);
|
||||
..
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
Name | Default | Description
|
||||
-----------|-----------|-------------------------------------------------------------------------------------------
|
||||
sourceMap | `null` | Generate source maps, deteremined from browserify's `--debug` option if not set.
|
||||
bare | `true` | Omit the `(function(){ .. }).call(this);` wrapper.
|
||||
header | `false` | Include the `// Generated by CoffeeScript <version>` header in every file processed.
|
||||
|
||||
When using browserify programatically options can be passed as an object, example:
|
||||
|
||||
```coffee
|
||||
browserify = require 'browserify'
|
||||
coffeeify = require 'coffeeify'
|
||||
|
||||
bundle = browserify
|
||||
extensions: ['.coffee']
|
||||
|
||||
bundle.transform coffeeify,
|
||||
bare: false
|
||||
header: true
|
||||
|
||||
bundle.add 'foo.coffee'
|
||||
|
||||
bundle.bundle (error, result) ->
|
||||
throw error if error?
|
||||
process.stdout.write result
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install --save-dev coffeeify
|
||||
```
|
||||
|
||||
CoffeeScript is not installed automatically, so that you can choose what version of CoffeeScript you'd like:
|
||||
|
||||
```bash
|
||||
npm install --save-dev coffeescript # Or coffeescript@1 to use CoffeeScript 1.x
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
1
node_modules/coffeeify/example/bar.js
generated
vendored
Normal file
1
node_modules/coffeeify/example/bar.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./baz.coffee')(5)
|
1
node_modules/coffeeify/example/bat.js
generated
vendored
Normal file
1
node_modules/coffeeify/example/bat.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./baz.litcoffee')(5)
|
1
node_modules/coffeeify/example/baz.coffee
generated
vendored
Normal file
1
node_modules/coffeeify/example/baz.coffee
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = (n) -> n * 111
|
3
node_modules/coffeeify/example/baz.litcoffee
generated
vendored
Normal file
3
node_modules/coffeeify/example/baz.litcoffee
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Multiply all the things with 111
|
||||
|
||||
module.exports = (n) -> n * 111
|
5
node_modules/coffeeify/example/error.coffee
generated
vendored
Normal file
5
node_modules/coffeeify/example/error.coffee
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#----------------------------------#
|
||||
# hello, my name is: SµNTtaX E®Rör #
|
||||
#----------------------------------#
|
||||
|
||||
thisIsWrong = , 'waaa'
|
1
node_modules/coffeeify/example/foo.coffee
generated
vendored
Normal file
1
node_modules/coffeeify/example/foo.coffee
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
console.log(require './bar.js')
|
3
node_modules/coffeeify/example/foo.litcoffee
generated
vendored
Normal file
3
node_modules/coffeeify/example/foo.litcoffee
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Here is a bat
|
||||
|
||||
console.log(require './bat.js')
|
7
node_modules/coffeeify/example/multiline_error.coffee
generated
vendored
Normal file
7
node_modules/coffeeify/example/multiline_error.coffee
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#----------------------------------#
|
||||
# hello, my name is: SµNTtaX E®Rör #
|
||||
#----------------------------------#
|
||||
|
||||
|
||||
'this is very wrong. notice that the first line is''
|
||||
longer'
|
120
node_modules/coffeeify/index.js
generated
vendored
Normal file
120
node_modules/coffeeify/index.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
var coffee = require('coffeescript');
|
||||
var convert = require('convert-source-map');
|
||||
var path = require('path');
|
||||
var through = require('through2');
|
||||
|
||||
var filePattern = /\.((lit)?coffee|coffee\.md)$/;
|
||||
|
||||
function isCoffee (file) {
|
||||
return filePattern.test(file);
|
||||
}
|
||||
|
||||
function isLiterate (file) {
|
||||
return (/\.(litcoffee|coffee\.md)$/).test(file);
|
||||
}
|
||||
|
||||
function ParseError(error, src, file) {
|
||||
/* Creates a ParseError from a CoffeeScript SyntaxError
|
||||
modeled after substack's syntax-error module */
|
||||
SyntaxError.call(this);
|
||||
|
||||
this.message = error.message;
|
||||
|
||||
this.line = error.location.first_line + 1; // cs linenums are 0-indexed
|
||||
this.column = error.location.first_column + 1; // same with columns
|
||||
|
||||
var markerLen = 2;
|
||||
if(error.location.first_line === error.location.last_line) {
|
||||
markerLen += error.location.last_column - error.location.first_column;
|
||||
}
|
||||
this.annotated = [
|
||||
file + ':' + this.line,
|
||||
src.split('\n')[this.line - 1],
|
||||
Array(this.column).join(' ') + Array(markerLen).join('^'),
|
||||
'ParseError: ' + this.message
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
ParseError.prototype = Object.create(SyntaxError.prototype);
|
||||
|
||||
ParseError.prototype.toString = function () {
|
||||
return this.annotated;
|
||||
};
|
||||
|
||||
ParseError.prototype.inspect = function () {
|
||||
return this.annotated;
|
||||
};
|
||||
|
||||
function compile(filename, source, options, callback) {
|
||||
var compiled;
|
||||
try {
|
||||
compiled = coffee.compile(source, Object.assign({
|
||||
inline: true,
|
||||
literate: isLiterate(filename)
|
||||
}, options));
|
||||
} catch (e) {
|
||||
var error = e;
|
||||
if (e.location) {
|
||||
error = new ParseError(e, source, filename);
|
||||
}
|
||||
callback(error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.sourceMap) {
|
||||
var map = convert.fromJSON(compiled.v3SourceMap);
|
||||
var basename = path.basename(filename);
|
||||
map.setProperty('file', basename.replace(filePattern, '.js'));
|
||||
map.setProperty('sources', [basename]);
|
||||
map.setProperty('sourcesContent', [source]);
|
||||
callback(null, compiled.js + '\n' + map.toComment() + '\n');
|
||||
} else {
|
||||
callback(null, compiled + '\n');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function coffeeify(filename, options) {
|
||||
if (!isCoffee(filename)) return through();
|
||||
|
||||
if (typeof options === 'undefined' || options === null) options = {};
|
||||
|
||||
var compileOptions = {
|
||||
sourceMap: (options._flags && options._flags.debug),
|
||||
bare: true,
|
||||
header: false
|
||||
};
|
||||
|
||||
for (var i = 0, keys = Object.keys(options); i < keys.length; i++) {
|
||||
var key = keys[i], option = options[key];
|
||||
if (typeof option !== 'undefined' && option !== null) {
|
||||
if (option === 'false' || option === 'no' || option === '0') {
|
||||
option = false;
|
||||
}
|
||||
compileOptions[key] = option;
|
||||
}
|
||||
}
|
||||
|
||||
var chunks = [];
|
||||
function transform(chunk, encoding, callback) {
|
||||
chunks.push(chunk);
|
||||
callback();
|
||||
}
|
||||
|
||||
function flush(callback) {
|
||||
var stream = this;
|
||||
var source = Buffer.concat(chunks).toString();
|
||||
compile(filename, source, compileOptions, function(error, result) {
|
||||
if (!error) stream.push(result);
|
||||
callback(error);
|
||||
});
|
||||
}
|
||||
|
||||
return through(transform, flush);
|
||||
}
|
||||
|
||||
coffeeify.compile = compile;
|
||||
coffeeify.isCoffee = isCoffee;
|
||||
coffeeify.isLiterate = isLiterate;
|
||||
|
||||
module.exports = coffeeify;
|
51
node_modules/coffeeify/package.json
generated
vendored
Normal file
51
node_modules/coffeeify/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "coffeeify",
|
||||
"version": "3.0.1",
|
||||
"description": "browserify plugin for coffeescript with support for mixed .js and .coffee files",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"convert-source-map": "^1.3.0",
|
||||
"through2": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"coffeescript": ">1.9.2 <3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^14.4.0",
|
||||
"proxyquire": "^1.8.0",
|
||||
"sinon": "^4.0.2",
|
||||
"tap": "^10.7.2",
|
||||
"test-all-versions": "^3.1.1",
|
||||
"through": "^2.3.8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tav coffeescript '>1.9.2 <99' tap test/*.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jnordberg/coffeeify.git"
|
||||
},
|
||||
"homepage": "https://github.com/jnordberg/coffeeify",
|
||||
"keywords": [
|
||||
"coffeescript",
|
||||
"coffee-script",
|
||||
"browserify",
|
||||
"v2",
|
||||
"js",
|
||||
"plugin",
|
||||
"transform"
|
||||
],
|
||||
"contributors": [
|
||||
{
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
{
|
||||
"name": "Johan Nordberg",
|
||||
"email": "code@johan-nordberg.com",
|
||||
"url": "http://johan-nordberg.com"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
Reference in New Issue
Block a user