Sorry, the diff of this file is not supported yet
+63
| # fly-imba [![][travis-badge]][travis-link] | ||
| > Compile [Imba](http://imba.io/home) files with Fly. | ||
| ## Install | ||
| ``` | ||
| npm install --save-dev fly-imba | ||
| ``` | ||
| ## Usage | ||
| ```js | ||
| exports.default = function * () { | ||
| yield this.source('app/**/*.imba') | ||
| .imba({ | ||
| bare: true, | ||
| sourceMap: true | ||
| }) | ||
| .target('dist/js'); | ||
| } | ||
| ``` | ||
| ## API | ||
| ### .imba(options) | ||
| #### options.bare | ||
| Type: `boolean`<br> | ||
| Default: `false` | ||
| Compile without a top-level function wrapper. | ||
| #### options.sourceMap | ||
| Type: `boolean`<br> | ||
| Default: `false` | ||
| Generate a source map per file. External source maps will be created unless `sourceMapInline` is specified. | ||
| ``` | ||
| \src | ||
| |- app.imba | ||
| \dist | ||
| |- app.js | ||
| |- app.js.map | ||
| ``` | ||
| #### options.sourceMapInline | ||
| Type: `boolean`<br> | ||
| Default: `false` | ||
| Embed the file's source mapping as a `base64` string. You must set `sourceMap` to `true` in order for this setting to work. | ||
| ## License | ||
| MIT © [Luke Edwards](https://lukeed.com) | ||
| [travis-link]: https://travis-ci.org/lukeed/fly-imba | ||
| [travis-badge]: http://img.shields.io/travis/lukeed/fly-imba.svg?style=flat-square |
+43
-4
@@ -1,7 +0,46 @@ | ||
| const imba = require('imba/compiler') | ||
| 'use strict'; | ||
| const format = require('path').format; | ||
| const imba = require('imba/compiler'); | ||
| module.exports = function () { | ||
| this.filter('imba', function(data) { | ||
| return {code: imba.compile(data.toString()), ext: '.js'} | ||
| }); | ||
| this.plugin('imba', {}, function * (file, opts) { | ||
| opts = Object.assign({bare: false, sourceMap: false}, opts); | ||
| // modify options for source mapping | ||
| if (opts.sourceMap) { | ||
| opts.sourcePath = format(file); | ||
| } | ||
| // update file type | ||
| file.base = file.base.replace('.imba', '.js'); | ||
| // compile data | ||
| const out = imba.compile(file.data.toString(), opts); | ||
| // if had sourcemap content | ||
| if (out.sourcemap) { | ||
| let add; | ||
| const map = new Buffer(JSON.stringify(out.sourcemap)); | ||
| // if was `inline` | ||
| if (opts.sourceMapInline) { | ||
| add = `data:application/json;base64,${map.toString('base64')}`; | ||
| } else { | ||
| add = file.base.concat('.map'); | ||
| // add to `fly._.files` | ||
| this._.files.push({ | ||
| base: add, | ||
| dir: file.dir, | ||
| data: map | ||
| }); | ||
| } | ||
| // add sourcemap reference to output | ||
| out.js += `\n//# sourceMappingURL=${add}`; | ||
| } | ||
| // set data | ||
| file.data = new Buffer(out.js); | ||
| }); | ||
| }; |
+11
-10
| { | ||
| "name": "fly-imba", | ||
| "version": "1.0.0", | ||
| "version": "2.0.0", | ||
| "description": "Compile Imba files with Fly.", | ||
@@ -17,8 +17,3 @@ "license": "MIT", | ||
| "scripts": { | ||
| "setup": "npm i && npm test", | ||
| "spec": "npm run test | tspec", | ||
| "test": "npm run tape", | ||
| "build": "echo No build task specified.", | ||
| "deploy": "npm run test && git push origin master && npm publish", | ||
| "tape": "node --harmony --harmony_arrow_functions ./node_modules/tape/bin/tape test/*.js" | ||
| "test": "xo && tape test/*.js | tap-spec" | ||
| }, | ||
@@ -34,9 +29,15 @@ "author": { | ||
| "devDependencies": { | ||
| "fly": "beta", | ||
| "tap-spec": "^4.1.1", | ||
| "tape": "^4.2.2" | ||
| "tape": "^4.2.2", | ||
| "xo": "*" | ||
| }, | ||
| "engines": { | ||
| "iojs": ">= 1.0.0", | ||
| "node": ">= 0.11.0" | ||
| "node": ">= 4.6.0" | ||
| }, | ||
| "xo": { | ||
| "rules": { | ||
| "require-yield": 1 | ||
| } | ||
| } | ||
| } |
-20
| This software is released under the MIT license: | ||
| Copyright (c) 2015 Luke Edwards <luke.edwards05@gmail.com> (https://lukeed.com) | ||
| 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.)) |
-43
| <div align="center"> | ||
| <a href="http://github.com/flyjs/fly"> | ||
| <img width=200px src="https://cloud.githubusercontent.com/assets/8317250/8733685/0be81080-2c40-11e5-98d2-c634f076ccd7.png"> | ||
| </a> | ||
| </div> | ||
| > Compile [Imba](http://imba.io/home) files with Fly. | ||
| [![][fly-badge]][fly] | ||
| [![npm package][npm-ver-link]][releases] | ||
| [![][dl-badge]][npm-pkg-link] | ||
| [![][travis-badge]][travis-link] | ||
| ## Install | ||
| ```a | ||
| npm install -D fly-imba | ||
| ``` | ||
| ## Example | ||
| ```js | ||
| export default function* () { | ||
| yield this.source('app/**/*.imba') | ||
| .imba() | ||
| .target('dist/js'); | ||
| } | ||
| ``` | ||
| ## License | ||
| MIT © [Luke Edwards](https://lukeed.com) et [al][contributors] | ||
| [contributors]: https://github.com/lukeed/fly-imba/graphs/contributors | ||
| [releases]: https://github.com/lukeed/fly-imba/releases | ||
| [fly]: https://www.github.com/flyjs/fly | ||
| [fly-badge]: https://img.shields.io/badge/fly-JS-05B3E1.svg?style=flat-square | ||
| [mit-badge]: https://img.shields.io/badge/license-MIT-444444.svg?style=flat-square | ||
| [npm-pkg-link]: https://www.npmjs.org/package/fly-imba | ||
| [npm-ver-link]: https://img.shields.io/npm/v/fly-imba.svg?style=flat-square | ||
| [dl-badge]: http://img.shields.io/npm/dm/fly-imba.svg?style=flat-square | ||
| [travis-link]: https://travis-ci.org/lukeed/fly-imba | ||
| [travis-badge]: http://img.shields.io/travis/lukeed/fly-imba.svg?style=flat-square |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
4016
11.87%37
516.67%64
45.45%0
-100%4
100%