Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
"scripts": {
"build": "npm run -s build:main && npm run -s build:preact && npm run -s build:babel",
"build:main": "microbundle src/index.mjs -f es,umd --no-sourcemap --target web",
"build:preact": "microbundle src/integrations/preact.mjs -o preact/index.js -f es,umd --no-sourcemap --target web",
"build:preact": "microbundle src/integrations/preact/index.mjs -o preact/index.js -f es,umd --no-sourcemap --target web && cp src/integrations/preact/{index.d.ts,package.json} preact/",
"build:babel": "microbundle src/babel.mjs -o babel/index.js -f es,cjs --target node --no-compress --no-sourcemap",
"test": "eslint src/**/*.mjs test && jest test"
"test": "eslint src/**/*.mjs test && jest test",
"postpublish": "tag-dist-files --overwrite-existing-tag"
},
"files": [
"dist",
"preact",
"babel"
],
"eslintConfig": {
"extends": "developit",
"rules": {
Expand All @@ -37,6 +43,7 @@
"eslint-config-developit": "^1.1.1",
"jest": "^23.4.2",
"microbundle": "^0.6.0",
"preact": "^8.2.9"
"preact": "^8.2.9",
"tag-dist-files": "^0.1.6"
}
}
9 changes: 9 additions & 0 deletions src/integrations/preact/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
declare module "htm/preact" {
import { h, Component, VNode } from 'preact';

function render(tree: Component, parent: HTMLElement): void;

const html: (strings: string[], values: any[]) => VNode;

export { h, html, render, Component };
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

import { h, Component, render as preactRender } from 'preact';
import htm from '../index.mjs';
import htm from '../../index.mjs';

function render(tree, parent) {
preactRender(tree, parent, parent.firstElementChild);
Expand Down
5 changes: 5 additions & 0 deletions src/integrations/preact/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "htm_preact",
"module": "index.mjs",
"main": "index.js"
}