diff --git a/html.js b/html.js deleted file mode 100644 index 8cfe365..0000000 --- a/html.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * @typedef {import('./lib/index.js').Child} Child - * @typedef {import('./lib/index.js').Properties} Properties - */ - -export {h} from './lib/html.js' diff --git a/lib/html.js b/lib/html.js deleted file mode 100644 index d919ee3..0000000 --- a/lib/html.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @typedef {import('./core.js').HChild} Child - * Acceptable child value. - * @typedef {import('./core.js').HProperties} Properties - * Acceptable value for element properties. - * @typedef {import('./core.js').HResult} Result - * Result from a `h` (or `s`) call. - */ - -/** - * @typedef {import('./jsx-classic.js').Element} h.JSX.Element - * @typedef {import('./jsx-classic.js').ElementChildrenAttribute} h.JSX.ElementChildrenAttribute - * @typedef {import('./jsx-classic.js').IntrinsicAttributes} h.JSX.IntrinsicAttributes - * @typedef {import('./jsx-classic.js').IntrinsicElements} h.JSX.IntrinsicElements - */ - -import {html} from 'property-information' -import {core} from './core.js' - -// Note: this explicit type is needed, otherwise TS creates broken types. -/** @type {ReturnType} */ -export const h = core(html, 'div') diff --git a/lib/index.js b/lib/index.js index 4e14b52..285c708 100644 --- a/lib/index.js +++ b/lib/index.js @@ -7,5 +7,27 @@ * Result from a `h` (or `s`) call. */ -export {h} from './html.js' -export {s} from './svg.js' +// Register the JSX namespace. +/** + * @typedef {import('./jsx-classic.js').Element} h.JSX.Element + * @typedef {import('./jsx-classic.js').ElementChildrenAttribute} h.JSX.ElementChildrenAttribute + * @typedef {import('./jsx-classic.js').IntrinsicAttributes} h.JSX.IntrinsicAttributes + * @typedef {import('./jsx-classic.js').IntrinsicElements} h.JSX.IntrinsicElements + * + * @typedef {import('./jsx-classic.js').Element} s.JSX.Element + * @typedef {import('./jsx-classic.js').ElementChildrenAttribute} s.JSX.ElementChildrenAttribute + * @typedef {import('./jsx-classic.js').IntrinsicAttributes} s.JSX.IntrinsicAttributes + * @typedef {import('./jsx-classic.js').IntrinsicElements} s.JSX.IntrinsicElements + */ + +import {html, svg} from 'property-information' +import {core} from './core.js' +import {svgCaseSensitiveTagNames} from './svg-case-sensitive-tag-names.js' + +// Note: this explicit type is needed, otherwise TS creates broken types. +/** @type {ReturnType} */ +export const h = core(html, 'div') + +// Note: this explicit type is needed, otherwise TS creates broken types. +/** @type {ReturnType} */ +export const s = core(svg, 'g', svgCaseSensitiveTagNames) diff --git a/lib/runtime-html.js b/lib/runtime-html.js index 4a8f563..3d2e727 100644 --- a/lib/runtime-html.js +++ b/lib/runtime-html.js @@ -1,5 +1,5 @@ -import {h} from './html.js' import {runtime} from './runtime.js' +import {h} from './index.js' // Export `JSX` as a global for TypeScript. export * from './jsx-automatic.js' diff --git a/lib/runtime-svg.js b/lib/runtime-svg.js index 18abf66..4c6ef18 100644 --- a/lib/runtime-svg.js +++ b/lib/runtime-svg.js @@ -1,5 +1,5 @@ import {runtime} from './runtime.js' -import {s} from './svg.js' +import {s} from './index.js' // Export `JSX` as a global for TypeScript. export * from './jsx-automatic.js' diff --git a/lib/svg.js b/lib/svg.js deleted file mode 100644 index 3dc89e9..0000000 --- a/lib/svg.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @typedef {import('./core.js').HChild} Child - * Acceptable child value. - * @typedef {import('./core.js').HProperties} Properties - * Acceptable value for element properties. - * @typedef {import('./core.js').HResult} Result - * Result from a `h` (or `s`) call. - */ - -/** - * @typedef {import('./jsx-classic.js').Element} s.JSX.Element - * @typedef {import('./jsx-classic.js').ElementChildrenAttribute} s.JSX.ElementChildrenAttribute - * @typedef {import('./jsx-classic.js').IntrinsicAttributes} s.JSX.IntrinsicAttributes - * @typedef {import('./jsx-classic.js').IntrinsicElements} s.JSX.IntrinsicElements - */ - -import {svg} from 'property-information' -import {core} from './core.js' -import {svgCaseSensitiveTagNames} from './svg-case-sensitive-tag-names.js' - -// Note: this explicit type is needed, otherwise TS creates broken types. -/** @type {ReturnType} */ -export const s = core(svg, 'g', svgCaseSensitiveTagNames) diff --git a/package.json b/package.json index 7217d97..1e63895 100644 --- a/package.json +++ b/package.json @@ -33,9 +33,6 @@ "types": "index.d.ts", "exports": { ".": "./index.js", - "./index.js": "./index.js", - "./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", @@ -47,10 +44,6 @@ "lib/", "html/", "svg/", - "html.d.ts", - "html.js", - "svg.d.ts", - "svg.js", "jsx-runtime.d.ts", "jsx-runtime.js", "index.d.ts", diff --git a/svg.js b/svg.js deleted file mode 100644 index e35ceea..0000000 --- a/svg.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * @typedef {import('./lib/index.js').Child} Child - * @typedef {import('./lib/index.js').Properties} Properties - */ - -export {s} from './lib/svg.js' diff --git a/test-d/files.ts b/test-d/files.ts index 5340b5e..b5317fa 100644 --- a/test-d/files.ts +++ b/test-d/files.ts @@ -1,10 +1,6 @@ import {expectType} from 'tsd' import type {Root} from 'hast' -import {h as hFromRoot} from '../html.js' -import {s as sFromRoot} from '../svg.js' import {h as hFromIndex, s as sFromIndex} from '../index.js' -expectType(hFromRoot()) expectType(hFromIndex()) -expectType(sFromRoot()) expectType(sFromIndex()) diff --git a/test-d/index.ts b/test-d/index.ts index 2fdf187..fc47f3b 100644 --- a/test-d/index.ts +++ b/test-d/index.ts @@ -1,13 +1,7 @@ import {expectType} from 'tsd' import type {Root, Element} from 'hast' -import {h as hFromRoot} from '../html.js' import {h, s} from '../index.js' import {Fragment, jsx, jsxs} from '../jsx-runtime.js' -import {s as sFromRoot} from '../svg.js' - -// Ensure files are loadable in TS. -expectType(hFromRoot()) -expectType(sFromRoot()) expectType(h()) expectType(s()) diff --git a/test/core.js b/test/core.js index 052e42e..b985be6 100644 --- a/test/core.js +++ b/test/core.js @@ -10,14 +10,6 @@ test('core', async function (t) { ]) }) - await t.test('should expose the public api (`/html`)', async function () { - assert.deepEqual(Object.keys(await import('../html.js')).sort(), ['h']) - }) - - await t.test('should expose the public api (`/svg`)', async function () { - assert.deepEqual(Object.keys(await import('../svg.js')).sort(), ['s']) - }) - await t.test( 'should expose the public api (`/jsx-runtime`)', async function () {