diff --git a/package.json b/package.json index d804bab..a6c645b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jsx-dom-runtime", - "version": "0.71.0", + "version": "0.71.0-dev.3", "description": "A tiny in 500 bytes library to JSX syntax templates for DOM. Support HTML, SVG and MathML tags", "type": "module", "main": "jsx-runtime/index.cjs", diff --git a/rollup.build.js b/rollup.build.js index 52dda4a..a97703d 100644 --- a/rollup.build.js +++ b/rollup.build.js @@ -30,7 +30,7 @@ export const buildPlugins = async (plugins) => { esModule: false, }, ], - external: ['../../jsx-runtime'], + external: ['jsx-dom-runtime'], plugins, }; }), diff --git a/src/plugins/dataset/index.ts b/src/plugins/dataset/index.ts index cd1df53..84a5a65 100644 --- a/src/plugins/dataset/index.ts +++ b/src/plugins/dataset/index.ts @@ -1,4 +1,4 @@ -import { extensions } from '../../jsx-runtime'; +import { extensions } from 'jsx-dom-runtime'; export const initDataset = () => /*#__PURE__*/ extensions.set('dataset', ( diff --git a/src/plugins/html/index.ts b/src/plugins/html/index.ts index 7333547..32d1247 100644 --- a/src/plugins/html/index.ts +++ b/src/plugins/html/index.ts @@ -1,4 +1,4 @@ -import { properties } from '../../jsx-runtime'; +import { properties } from 'jsx-dom-runtime'; export const initHtml = () => /*#__PURE__*/ properties diff --git a/src/plugins/media/index.ts b/src/plugins/media/index.ts index 60035d7..0614883 100644 --- a/src/plugins/media/index.ts +++ b/src/plugins/media/index.ts @@ -1,4 +1,4 @@ -import { properties } from '../../jsx-runtime'; +import { properties } from 'jsx-dom-runtime'; export const initMedia = () => /*#__PURE__*/ properties diff --git a/src/plugins/style/index.ts b/src/plugins/style/index.ts index bb22423..7710fac 100644 --- a/src/plugins/style/index.ts +++ b/src/plugins/style/index.ts @@ -1,7 +1,11 @@ -import { extensions } from '../../jsx-runtime'; +import { extensions } from 'jsx-dom-runtime'; export const initStyle = () => /*#__PURE__*/ - extensions.set('style', (node, value, key) => { + extensions.set('style', ( + node: HTMLElement | SVGAElement | MathMLElement, + value: object, + key: string, + ) => { if (typeof value == 'string') { node.setAttribute(key, value); } else { diff --git a/tests/utils/jest-setup.ts b/tests/utils/jest-setup.ts index 0a79abe..fbef0c7 100644 --- a/tests/utils/jest-setup.ts +++ b/tests/utils/jest-setup.ts @@ -1,13 +1,17 @@ import '@testing-library/jest-dom'; import { diffStringsUnified } from 'jest-diff'; +import { jest } from '@jest/globals'; import { t } from './t'; +import * as jsxRuntime from '../../jsx-runtime'; beforeEach(() => { document.head.innerHTML = ''; document.body.innerHTML = ''; }); +jest.unstable_mockModule('jsx-dom-runtime', () => jsxRuntime); + expect.extend({ toHaveOuterHTML(node: HTMLElement, html: string) { const val = node.outerHTML;