preact-jsx-runtime
Advanced tools
Comparing version
@@ -1,3 +0,8 @@ | ||
var preact = require("preact"); | ||
var preact = require('preact'); | ||
/** | ||
* @param {import('preact').ComponentType} type Component type. | ||
* @param {import('preact').Attributes} config Component props. | ||
* @param {string=} maybeKey Key, or undefined. | ||
*/ | ||
function jsx(type, config, maybeKey) { | ||
@@ -8,3 +13,3 @@ var props = {}, | ||
if (maybeKey !== undefined) { | ||
props.key = "" + maybeKey; | ||
props.key = '' + maybeKey; | ||
} | ||
@@ -11,0 +16,0 @@ |
{ | ||
"name": "preact-jsx-runtime", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Preact JSX runtime definition for use with automatic JSX import", | ||
@@ -13,2 +13,8 @@ "main": "jsx-runtime.js", | ||
], | ||
"scripts": { | ||
"test:lint": "eslint jsx-runtime.js test", | ||
"test:typescript": "npx tsc", | ||
"test:unit": "mocha", | ||
"test": "run-p test:*" | ||
}, | ||
"author": { | ||
@@ -33,3 +39,19 @@ "name": "Andrew Duthie", | ||
"preact": "*" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.11.1", | ||
"@babel/preset-env": "^7.11.0", | ||
"@babel/preset-react": "^7.10.4", | ||
"chai": "^4.2.0", | ||
"eslint": "^7.6.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"mocha": "^8.1.1", | ||
"npm-run-all": "^4.1.5", | ||
"preact": "^10.4.7", | ||
"preact-jsx-runtime": "file:.", | ||
"preact-render-to-string": "^5.1.10", | ||
"prettier": "^2.0.5", | ||
"typescript": "^3.9.7" | ||
} | ||
} |
@@ -20,8 +20,10 @@ # Preact JSX Runtime | ||
Then, install `preact-jsx-runtime` as a development dependency: | ||
Then, install `preact-jsx-runtime`. | ||
``` | ||
npm install --dev preact-jsx-runtime | ||
npm install preact-jsx-runtime | ||
``` | ||
It should be installed as a regular dependency (_not_ a development dependency), since the transformed code will import using `preact-jsx-runtime` as a proxy to Preact. | ||
## Usage | ||
@@ -47,2 +49,6 @@ | ||
You can also refer to the [`test/` directory](./test) for example Babel configuration and fixture inputs and outputs. | ||
Or, [try the live demo on Glitch](https://glitch.com/edit/#!/join/9772d8b5-e057-424a-8291-d10ea9152b57). | ||
## License | ||
@@ -49,0 +55,0 @@ |
5343
41.65%5
25%24
26.32%57
11.76%14
Infinity%