Skip to content

Commit

Permalink
feat(html): add jsx-dev-runtime (#166)
Browse files Browse the repository at this point in the history
* feat: add jsx-dev-runtime

* chore: update CHANGELOG

* Create stupid-owls-think.md

Signed-off-by: Arthur Fiorette <47537704+arthurfiorette@users.noreply.github.com>

* chore: remove change on CHANGELOG

---------

Signed-off-by: Arthur Fiorette <47537704+arthurfiorette@users.noreply.github.com>
Co-authored-by: Arthur Fiorette <47537704+arthurfiorette@users.noreply.github.com>
  • Loading branch information
aralroca and arthurfiorette authored Mar 27, 2024
1 parent d56c683 commit d4e1d36
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-owls-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kitajs/html": patch
---

Added jsx-dev-runtime to re-enable Bun support in development mode.
37 changes: 37 additions & 0 deletions packages/html/jsx-dev-runtime.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference path="./jsx.d.ts" />
/// <reference types="./suspense.d.ts" />
/// <reference types="./error-boundary.d.ts" />

import type { Children } from './index';

/**
* Generates a html string from an attribute name of component and it's props.
*
* This function is meant to be used by the jsx runtime and should not be called directly.
*
* @param name The name of the element to create or another component function
* @param attributes The props to apply to the component
* @retuns The generated html string or a promise that resolves to the generated html string
*/
export function jsxDEV(
this: void,
name: string | Function,
attributes: { children?: Children; [k: string]: any }
): JSX.Element;

/**
* Generates a html string from an attribute name of component and it's props.
*
* This function is meant to be used by the jsx runtime and should not be called directly.
*
* @param name The name of the element to create or another component function
* @param attributes The props to apply to the component
* @retuns The generated html string or a promise that resolves to the generated html string
*/
export function jsxs(
this: void,
name: string | Function,
attributes: { children: Children[]; [k: string]: any }
): JSX.Element;

export { Fragment } from './index';
12 changes: 12 additions & 0 deletions packages/html/jsx-dev-runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference path="./jsx.d.ts" />

const { Fragment, jsx, jsxs } = require('./jsx-runtime');

const JsxRuntime = {
jsxDEV: jsx,
jsxs,
Fragment
};

module.exports = JsxRuntime;
module.exports.default = JsxRuntime;

0 comments on commit d4e1d36

Please sign in to comment.