babel-plugin-knifecycle
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,10 @@ | ||
## [1.0.2](https://github.com/nfroidure/babel-plugin-knifecycle/compare/v1.0.1...v1.0.2) (2019-01-26) | ||
### Bug Fixes | ||
* **autoInject:** Avoid to fail when no dependencies are involved ([163a70c](https://github.com/nfroidure/babel-plugin-knifecycle/commit/163a70c)), closes [#2](https://github.com/nfroidure/babel-plugin-knifecycle/issues/2) | ||
## [1.0.1](https://github.com/nfroidure/babel-plugin-knifecycle/compare/v1.0.0...v1.0.1) (2019-01-12) | ||
@@ -2,0 +11,0 @@ |
@@ -143,2 +143,6 @@ "use strict"; | ||
if (!handlerArgumentPath) { | ||
return injections; | ||
} | ||
if (!handlerArgumentPath.isObjectPattern()) { | ||
@@ -145,0 +149,0 @@ throw handlerArgumentPath.buildCodeFrameError('Expect the dependencies to be defined through an object pattern.'); |
@@ -30,2 +30,20 @@ "use strict"; | ||
}); | ||
it('should work with no injection', () => { | ||
var example = ` | ||
import noop from 'noop'; | ||
import { autoInject } from 'knifecycle'; | ||
export default autoInject(getUser); | ||
async function getUser() { | ||
return {}; | ||
} | ||
`; | ||
const { | ||
code | ||
} = (0, _core.transform)(example, { | ||
plugins: [_.default] | ||
}); | ||
expect(code).toMatchSnapshot(); | ||
}); | ||
it('should work with several auto functions', () => { | ||
@@ -109,2 +127,22 @@ var example = ` | ||
}); | ||
it('should work with no dependencies', () => { | ||
var example = ` | ||
import noop from 'noop'; | ||
import { autoService } from 'knifecycle'; | ||
export default autoService(getUser); | ||
async function getUser() { | ||
return async ({ userId }) => { | ||
return {}; | ||
} | ||
} | ||
`; | ||
const { | ||
code | ||
} = (0, _core.transform)(example, { | ||
plugins: [_.default] | ||
}); | ||
expect(code).toMatchSnapshot(); | ||
}); | ||
}); | ||
@@ -111,0 +149,0 @@ describe('autoProvider', () => { |
{ | ||
"name": "babel-plugin-knifecycle", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A Babel plugin to transform Knifecycle auto* functions to their raw equivalent.", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"scripts": { | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md", | ||
"cli": "env NODE_ENV=${NODE_ENV:-cli}", | ||
@@ -47,3 +47,3 @@ "compile": "babel src --out-dir=dist", | ||
"test": "npm run jest", | ||
"version": "npm run changelog && git add CHANGELOG.md" | ||
"version": "npm run changelog" | ||
}, | ||
@@ -68,8 +68,8 @@ "author": { | ||
"cz-conventional-changelog": "^2.1.0", | ||
"eslint": "^5.12.0", | ||
"eslint": "^5.12.1", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
"jest": "^23.6.0", | ||
"metapak": "^2.0.0", | ||
"metapak-nfroidure": "9.0.4", | ||
"prettier": "^1.15.3" | ||
"metapak-nfroidure": "9.3.1", | ||
"prettier": "^1.16.0" | ||
}, | ||
@@ -104,3 +104,10 @@ "repository": { | ||
"eslint-config-prettier", | ||
"prettier" | ||
"prettier", | ||
"@babel/cli", | ||
"@babel/core", | ||
"@babel/register", | ||
"@babel/preset-env", | ||
"@babel/plugin-proposal-object-rest-spread", | ||
"babel-eslint", | ||
"babel-core" | ||
] | ||
@@ -110,3 +117,4 @@ }, | ||
"coverageReporters": [ | ||
"lcov" | ||
"lcov", | ||
"html" | ||
], | ||
@@ -167,4 +175,4 @@ "testPathIgnorePatterns": [ | ||
"dependencies": { | ||
"knifecycle": "^5.0.4" | ||
"knifecycle": "^5.1.3" | ||
} | ||
} |
@@ -10,2 +10,3 @@ [//]: # ( ) | ||
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/babel-plugin-knifecycle/blob/master/LICENSE) | ||
[![Build status](https://secure.travis-ci.org/nfroidure/babel-plugin-knifecycle.svg)](https://travis-ci.org/nfroidure/babel-plugin-knifecycle) | ||
@@ -16,3 +17,2 @@ [![Coverage Status](https://coveralls.io/repos/nfroidure/babel-plugin-knifecycle/badge.svg?branch=master)](https://coveralls.io/r/nfroidure/babel-plugin-knifecycle?branch=master) | ||
[![devDependency Status](https://david-dm.org/nfroidure/babel-plugin-knifecycle/dev-status.svg)](https://david-dm.org/nfroidure/babel-plugin-knifecycle#info=devDependencies) | ||
[![Dependency Status](https://dependencyci.com/github/nfroidure/babel-plugin-knifecycle/badge)](https://dependencyci.com/github/nfroidure/babel-plugin-knifecycle) | ||
[![Package Quality](http://npm.packagequality.com/shield/babel-plugin-knifecycle.svg)](http://packagequality.com/#?package=babel-plugin-knifecycle) | ||
@@ -19,0 +19,0 @@ |
20235
349
Updatedknifecycle@^5.1.3