Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add jsx-dev-runtime #166

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions packages/html/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @kitajs/html

## 4.0.0-next.3

### Minor Changes

- [`bab34f8`](https://github.com/kitajs/html/pull/166/commits/bab34f87a9043b117b528ca3789dcba47fb8ca73)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our changeset is generated automatically. You just need to run pnpm changeset at the project root... Can you reset this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, good to know! Thanks

Thanks [@aralroca](https://github.com/aralroca)! - feat: add jsx-dev-runtime

## 4.0.0-next.2

### Patch Changes
Expand Down
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;