Skip to content

Commit

Permalink
Add JSX dev runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jan 4, 2023
1 parent 001ed11 commit f06247f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/runtime-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import {runtime} from './runtime.js'
import {h} from './html.js'

export * from './jsx-automatic.js'
export const {Fragment, jsx, jsxs} = runtime(h)
export const {Fragment, jsx, jsxs, jsxDEV} = runtime(h)
2 changes: 1 addition & 1 deletion lib/runtime-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import {runtime} from './runtime.js'
import {s} from './svg.js'

export * from './jsx-automatic.js'
export const {Fragment, jsx, jsxs} = runtime(s)
export const {Fragment, jsx, jsxs, jsxDEV} = runtime(s)
2 changes: 1 addition & 1 deletion lib/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ export function runtime(f) {
}
)

return {Fragment: null, jsx, jsxs: jsx}
return {Fragment: null, jsx, jsxs: jsx, jsxDEV: jsx}
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@
"./html.js": "./html.js",
"./svg.js": "./svg.js",
"./jsx-runtime": "./jsx-runtime.js",
"./jsx-dev-runtime": "./jsx-runtime.js",
"./html/jsx-runtime": "./html/jsx-runtime.js",
"./svg/jsx-runtime": "./svg/jsx-runtime.js"
"./html/jsx-dev-runtime": "./html/jsx-runtime.js",
"./svg/jsx-runtime": "./svg/jsx-runtime.js",
"./svg/jsx-dev-runtime": "./svg/jsx-runtime.js"
},
"files": [
"lib/",
Expand Down
12 changes: 12 additions & 0 deletions test/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ test('api', () => {
)
assert(jsxCore.includes('jsx'), 'should expose `jsx` from `/jsx-runtime`')
assert(jsxCore.includes('jsxs'), 'should expose `jsxs` from `/jsx-runtime`')
assert(
jsxCore.includes('jsxDEV'),
'should expose `jsxDEV` from `/jsx-runtime`'
)
const jsxHtml = Object.keys(jsxHtmlMod)
assert(
jsxHtml.includes('Fragment'),
Expand All @@ -38,6 +42,10 @@ test('api', () => {
jsxHtml.includes('jsxs'),
'should expose `jsxs` from `/html/jsx-runtime`'
)
assert(
jsxHtml.includes('jsxDEV'),
'should expose `jsxDEV` from `/html/jsx-runtime`'
)
const jsxSvg = Object.keys(jsxSvgMod)
assert(
jsxSvg.includes('Fragment'),
Expand All @@ -48,6 +56,10 @@ test('api', () => {
jsxSvg.includes('jsxs'),
'should expose `jsxs` from `/svg/jsx-runtime`'
)
assert(
jsxSvg.includes('jsxDEV'),
'should expose `jsxDEV` from `/svg/jsx-runtime`'
)
})

test('hastscript', async (t) => {
Expand Down

0 comments on commit f06247f

Please sign in to comment.