Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.

This commit is contained in:
becarta
2025-05-23 12:43:00 +02:00
parent f40db0f5c9
commit a544759a3b
11127 changed files with 1647032 additions and 0 deletions

5
node_modules/hastscript/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export type Child = import("./lib/create-h.js").Child;
export type Properties = import("./lib/create-h.js").Properties;
export type Result = import("./lib/create-h.js").Result;
export { h, s } from "./lib/index.js";
//# sourceMappingURL=index.d.ts.map

1
node_modules/hastscript/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"oBACa,OAAO,mBAAmB,EAAE,KAAK;yBACjC,OAAO,mBAAmB,EAAE,UAAU;qBACtC,OAAO,mBAAmB,EAAE,MAAM"}

7
node_modules/hastscript/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
/**
* @typedef {import('./lib/create-h.js').Child} Child
* @typedef {import('./lib/create-h.js').Properties} Properties
* @typedef {import('./lib/create-h.js').Result} Result
*/
export {h, s} from './lib/index.js'

View File

@@ -0,0 +1,36 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type {Element, Root} from 'hast'
import type {Child} from './create-h.js'
import type {JSXProps} from './create-automatic-runtime.js'
export * from './jsx-automatic.js'
export const Fragment: null
export const jsxDEV: {
(
type: null,
properties: {children?: Child},
key?: string | null | undefined
): Root
(type: string, properties: JSXProps, key?: string | null | undefined): Element
}
export const jsxs: {
(
type: null,
properties: {children?: Child},
key?: string | null | undefined
): Root
(type: string, properties: JSXProps, key?: string | null | undefined): Element
}
export const jsx: {
(
type: null,
properties: {children?: Child},
key?: string | null | undefined
): Root
(type: string, properties: JSXProps, key?: string | null | undefined): Element
}

View File

@@ -0,0 +1,9 @@
// Note: types exposed from `automatic-runtime-html.d.ts` because TS has bugs
// when generating types.
import {createAutomaticRuntime} from './create-automatic-runtime.js'
import {h} from './index.js'
// Export `JSX` as a global for TypeScript.
export * from './jsx-automatic.js'
export const {Fragment, jsxDEV, jsxs, jsx} = createAutomaticRuntime(h)

36
node_modules/hastscript/lib/automatic-runtime-svg.d.ts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type {Element, Root} from 'hast'
import type {Child} from './create-h.js'
import type {JSXProps} from './create-automatic-runtime.js'
export * from './jsx-automatic.js'
export const Fragment: null
export const jsxDEV: {
(
type: null,
properties: {children?: Child},
key?: string | null | undefined
): Root
(type: string, properties: JSXProps, key?: string | null | undefined): Element
}
export const jsxs: {
(
type: null,
properties: {children?: Child},
key?: string | null | undefined
): Root
(type: string, properties: JSXProps, key?: string | null | undefined): Element
}
export const jsx: {
(
type: null,
properties: {children?: Child},
key?: string | null | undefined
): Root
(type: string, properties: JSXProps, key?: string | null | undefined): Element
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"automatic-runtime-svg.d.ts","sourceRoot":"","sources":["automatic-runtime-svg.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;gBAOsiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAD,CAAC"}

7
node_modules/hastscript/lib/automatic-runtime-svg.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import {createAutomaticRuntime} from './create-automatic-runtime.js'
import {s} from './index.js'
// Export `JSX` as a global for TypeScript.
export * from './jsx-automatic.js'
export const {Fragment, jsxDEV, jsxs, jsx} = createAutomaticRuntime(s)

View File

@@ -0,0 +1,237 @@
/**
* Create an automatic runtime.
*
* @param {ReturnType<CreateH>} f
* `h` function.
* @returns
* Automatic JSX runtime.
*/
export function createAutomaticRuntime(f: ReturnType<typeof CreateH>): {
Fragment: null;
jsxDEV: {
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
(type: null, properties: {
children?: Child;
}, key?: string | null | undefined): Root;
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
(type: string, properties: JSXProps, key?: string | null | undefined): Element;
};
jsxs: {
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
(type: null, properties: {
children?: Child;
}, key?: string | null | undefined): Root;
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
(type: string, properties: JSXProps, key?: string | null | undefined): Element;
};
jsx: {
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
(type: null, properties: {
children?: Child;
}, key?: string | null | undefined): Root;
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
(type: string, properties: JSXProps, key?: string | null | undefined): Element;
};
};
export type JSXProps = Record<string, Child | PropertyValue | Style>;
import type { createH as CreateH } from './create-h.js';
import type { Child } from './create-h.js';
import type { Root } from 'hast';
import type { Element } from 'hast';
import type { PropertyValue } from './create-h.js';
import type { Style } from './create-h.js';
//# sourceMappingURL=create-automatic-runtime.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"create-automatic-runtime.d.ts","sourceRoot":"","sources":["create-automatic-runtime.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,0CALW,UAAU,gBAAS;;;;;;;;;;;;;;;;;;;;;;;eAQjB,IAAI,cACJ;YAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;SAAC,QAClB,MAAM,GAAG,IAAI,GAAG,SAAS,GACvB,IAAI;;;;;;;;;;;;;;;;;;;;;eAGN,MAAM,cACN,QAAQ,QACR,MAAM,GAAG,IAAI,GAAG,SAAS,GACvB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eATT,IAAI,cACJ;YAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;SAAC,QAClB,MAAM,GAAG,IAAI,GAAG,SAAS,GACvB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAGN,MAAM,cACN,QAAQ,QACR,MAAM,GAAG,IAAI,GAAG,SAAS,GACvB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eATT,IAAI,cACJ;YAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;SAAC,QAClB,MAAM,GAAG,IAAI,GAAG,SAAS,GACvB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAGN,MAAM,cACN,QAAQ,QACR,MAAM,GAAG,IAAI,GAAG,SAAS,GACvB,OAAO;;EAmBrB;uBA7CY,MAAM,CAAC,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,KAAK,CAAC;wCAJ4B,eAAe;2BAAf,eAAe;0BADrE,MAAM;6BAAN,MAAM;mCACgD,eAAe;2BAAf,eAAe"}

View File

@@ -0,0 +1,52 @@
/**
* @import {Element, Root} from 'hast'
* @import {Child, Properties, PropertyValue, Result, Style, createH as CreateH} from './create-h.js'
*/
/**
* @typedef {Record<string, Child | PropertyValue | Style>} JSXProps
*/
// Make VS code see references to above symbols.
''
/**
* Create an automatic runtime.
*
* @param {ReturnType<CreateH>} f
* `h` function.
* @returns
* Automatic JSX runtime.
*/
export function createAutomaticRuntime(f) {
/**
* @overload
* @param {null} type
* @param {{children?: Child}} properties
* @param {string | null | undefined} [key]
* @returns {Root}
*
* @overload
* @param {string} type
* @param {JSXProps} properties
* @param {string | null | undefined} [key]
* @returns {Element}
*
* @param {string | null} type
* Element name or `null` to get a root.
* @param {Properties & {children?: Child}} properties
* Properties.
* @returns {Result}
* Result.
*/
function jsx(type, properties) {
const {children, ...properties_} = properties
const result =
// @ts-ignore: `children` is fine: TS has a recursion problem which
// sometimes generates broken types.
type === null ? f(null, children) : f(type, properties_, children)
return result
}
return {Fragment: null, jsxDEV: jsx, jsxs: jsx, jsx}
}

148
node_modules/hastscript/lib/create-h.d.ts generated vendored Normal file
View File

@@ -0,0 +1,148 @@
/**
* @param {Schema} schema
* Schema to use.
* @param {string} defaultTagName
* Default tag name.
* @param {ReadonlyArray<string> | undefined} [caseSensitive]
* Case-sensitive tag names (default: `undefined`).
* @returns
* `h`.
*/
export function createH(schema: Schema, defaultTagName: string, caseSensitive?: ReadonlyArray<string> | undefined): {
/**
* Hyperscript compatible DSL for creating virtual hast trees.
*
* @overload
* @param {null | undefined} [selector]
* @param {...Child} children
* @returns {Root}
*
* @overload
* @param {string} selector
* @param {Properties} properties
* @param {...Child} children
* @returns {Element}
*
* @overload
* @param {string} selector
* @param {...Child} children
* @returns {Element}
*
* @param {string | null | undefined} [selector]
* Selector.
* @param {Child | Properties | null | undefined} [properties]
* Properties (or first child) (default: `undefined`).
* @param {...Child} children
* Children.
* @returns {Result}
* Result.
*/
(selector?: null | undefined, ...children: Child[]): Root;
/**
* Hyperscript compatible DSL for creating virtual hast trees.
*
* @overload
* @param {null | undefined} [selector]
* @param {...Child} children
* @returns {Root}
*
* @overload
* @param {string} selector
* @param {Properties} properties
* @param {...Child} children
* @returns {Element}
*
* @overload
* @param {string} selector
* @param {...Child} children
* @returns {Element}
*
* @param {string | null | undefined} [selector]
* Selector.
* @param {Child | Properties | null | undefined} [properties]
* Properties (or first child) (default: `undefined`).
* @param {...Child} children
* Children.
* @returns {Result}
* Result.
*/
(selector: string, properties: Properties, ...children: Child[]): Element;
/**
* Hyperscript compatible DSL for creating virtual hast trees.
*
* @overload
* @param {null | undefined} [selector]
* @param {...Child} children
* @returns {Root}
*
* @overload
* @param {string} selector
* @param {Properties} properties
* @param {...Child} children
* @returns {Element}
*
* @overload
* @param {string} selector
* @param {...Child} children
* @returns {Element}
*
* @param {string | null | undefined} [selector]
* Selector.
* @param {Child | Properties | null | undefined} [properties]
* Properties (or first child) (default: `undefined`).
* @param {...Child} children
* Children.
* @returns {Result}
* Result.
*/
(selector: string, ...children: Child[]): Element;
};
/**
* List of children (deep).
*/
export type ArrayChildNested = Array<Nodes | PrimitiveChild>;
/**
* List of children.
*/
export type ArrayChild = Array<ArrayChildNested | Nodes | PrimitiveChild>;
/**
* List of property values for space- or comma separated values (such as `className`).
*/
export type ArrayValue = Array<number | string>;
/**
* Acceptable child value.
*/
export type Child = ArrayChild | Nodes | PrimitiveChild;
/**
* Primitive children, either ignored (nullish), or turned into text nodes.
*/
export type PrimitiveChild = number | string | null | undefined;
/**
* Primitive property value.
*/
export type PrimitiveValue = boolean | number | string | null | undefined;
/**
* Acceptable value for element properties.
*/
export type Properties = Record<string, PropertyValue | Style>;
/**
* Primitive value or list value.
*/
export type PropertyValue = ArrayValue | PrimitiveValue;
/**
* Result from a `h` (or `s`) call.
*/
export type Result = Element | Root;
/**
* Value for a CSS style field.
*/
export type StyleValue = number | string;
/**
* Supported value of a `style` prop.
*/
export type Style = Record<string, StyleValue>;
import type { Schema } from 'property-information';
import type { Root } from 'hast';
import type { Element } from 'hast';
import type { Nodes } from 'hast';
//# sourceMappingURL=create-h.d.ts.map

1
node_modules/hastscript/lib/create-h.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"create-h.d.ts","sourceRoot":"","sources":["create-h.js"],"names":[],"mappings":"AAiEA;;;;;;;;;GASG;AACH,gCATW,MAAM,kBAEN,MAAM,kBAEN,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAY/B,IAAI,GAAG,SAAS,eACb,KAAK,EAAA,GACN,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAGN,MAAM,cACN,UAAU,eACP,KAAK,EAAA,GACN,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAGT,MAAM,eACH,KAAK,EAAA,GACN,OAAO;EAmDrB;;;;+BA5IY,KAAK,CAAC,KAAK,GAAG,cAAc,CAAC;;;;yBAK7B,KAAK,CAAC,gBAAgB,GAAG,KAAK,GAAG,cAAc,CAAC;;;;yBAKhD,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;;;;oBAKtB,UAAU,GAAG,KAAK,GAAG,cAAc;;;;6BAKnC,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;6BAKlC,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;yBAK5C,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,KAAK,CAAC;;;;4BAKrC,UAAU,GAAG,cAAc;;;;qBAK3B,OAAO,GAAG,IAAI;;;;yBAKd,MAAM,GAAG,MAAM;;;;oBAKf,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;4BAtDR,sBAAsB;0BADD,MAAM;6BAAN,MAAM;2BAAN,MAAM"}

365
node_modules/hastscript/lib/create-h.js generated vendored Normal file
View File

@@ -0,0 +1,365 @@
/**
* @import {Element, Nodes, RootContent, Root} from 'hast'
* @import {Info, Schema} from 'property-information'
*/
/**
* @typedef {Array<Nodes | PrimitiveChild>} ArrayChildNested
* List of children (deep).
*/
/**
* @typedef {Array<ArrayChildNested | Nodes | PrimitiveChild>} ArrayChild
* List of children.
*/
/**
* @typedef {Array<number | string>} ArrayValue
* List of property values for space- or comma separated values (such as `className`).
*/
/**
* @typedef {ArrayChild | Nodes | PrimitiveChild} Child
* Acceptable child value.
*/
/**
* @typedef {number | string | null | undefined} PrimitiveChild
* Primitive children, either ignored (nullish), or turned into text nodes.
*/
/**
* @typedef {boolean | number | string | null | undefined} PrimitiveValue
* Primitive property value.
*/
/**
* @typedef {Record<string, PropertyValue | Style>} Properties
* Acceptable value for element properties.
*/
/**
* @typedef {ArrayValue | PrimitiveValue} PropertyValue
* Primitive value or list value.
*/
/**
* @typedef {Element | Root} Result
* Result from a `h` (or `s`) call.
*/
/**
* @typedef {number | string} StyleValue
* Value for a CSS style field.
*/
/**
* @typedef {Record<string, StyleValue>} Style
* Supported value of a `style` prop.
*/
import {parse as parseCommas} from 'comma-separated-tokens'
import {parseSelector} from 'hast-util-parse-selector'
import {find, normalize} from 'property-information'
import {parse as parseSpaces} from 'space-separated-tokens'
/**
* @param {Schema} schema
* Schema to use.
* @param {string} defaultTagName
* Default tag name.
* @param {ReadonlyArray<string> | undefined} [caseSensitive]
* Case-sensitive tag names (default: `undefined`).
* @returns
* `h`.
*/
export function createH(schema, defaultTagName, caseSensitive) {
const adjust = caseSensitive ? createAdjustMap(caseSensitive) : undefined
/**
* Hyperscript compatible DSL for creating virtual hast trees.
*
* @overload
* @param {null | undefined} [selector]
* @param {...Child} children
* @returns {Root}
*
* @overload
* @param {string} selector
* @param {Properties} properties
* @param {...Child} children
* @returns {Element}
*
* @overload
* @param {string} selector
* @param {...Child} children
* @returns {Element}
*
* @param {string | null | undefined} [selector]
* Selector.
* @param {Child | Properties | null | undefined} [properties]
* Properties (or first child) (default: `undefined`).
* @param {...Child} children
* Children.
* @returns {Result}
* Result.
*/
function h(selector, properties, ...children) {
/** @type {Result} */
let node
if (selector === null || selector === undefined) {
node = {type: 'root', children: []}
// Properties are not supported for roots.
const child = /** @type {Child} */ (properties)
children.unshift(child)
} else {
node = parseSelector(selector, defaultTagName)
// Normalize the name.
const lower = node.tagName.toLowerCase()
const adjusted = adjust ? adjust.get(lower) : undefined
node.tagName = adjusted || lower
// Handle properties.
if (isChild(properties)) {
children.unshift(properties)
} else {
for (const [key, value] of Object.entries(properties)) {
addProperty(schema, node.properties, key, value)
}
}
}
// Handle children.
for (const child of children) {
addChild(node.children, child)
}
if (node.type === 'element' && node.tagName === 'template') {
node.content = {type: 'root', children: node.children}
node.children = []
}
return node
}
return h
}
/**
* Check if something is properties or a child.
*
* @param {Child | Properties} value
* Value to check.
* @returns {value is Child}
* Whether `value` is definitely a child.
*/
function isChild(value) {
// Never properties if not an object.
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
return true
}
// Never node without `type`; thats the main discriminator.
if (typeof value.type !== 'string') return false
// Slower check: never property value if object or array with
// non-number/strings.
const record = /** @type {Record<string, unknown>} */ (value)
const keys = Object.keys(value)
for (const key of keys) {
const value = record[key]
if (value && typeof value === 'object') {
if (!Array.isArray(value)) return true
const list = /** @type {ReadonlyArray<unknown>} */ (value)
for (const item of list) {
if (typeof item !== 'number' && typeof item !== 'string') {
return true
}
}
}
}
// Also see empty `children` as a node.
if ('children' in value && Array.isArray(value.children)) {
return true
}
// Default to properties, someone can always pass an empty object,
// put `data: {}` in a node,
// or wrap it in an array.
return false
}
/**
* @param {Schema} schema
* Schema.
* @param {Properties} properties
* Properties object.
* @param {string} key
* Property name.
* @param {PropertyValue | Style} value
* Property value.
* @returns {undefined}
* Nothing.
*/
function addProperty(schema, properties, key, value) {
const info = find(schema, key)
/** @type {PropertyValue} */
let result
// Ignore nullish and NaN values.
if (value === null || value === undefined) return
if (typeof value === 'number') {
// Ignore NaN.
if (Number.isNaN(value)) return
result = value
}
// Booleans.
else if (typeof value === 'boolean') {
result = value
}
// Handle list values.
else if (typeof value === 'string') {
if (info.spaceSeparated) {
result = parseSpaces(value)
} else if (info.commaSeparated) {
result = parseCommas(value)
} else if (info.commaOrSpaceSeparated) {
result = parseSpaces(parseCommas(value).join(' '))
} else {
result = parsePrimitive(info, info.property, value)
}
} else if (Array.isArray(value)) {
result = [...value]
} else {
result = info.property === 'style' ? style(value) : String(value)
}
if (Array.isArray(result)) {
/** @type {Array<number | string>} */
const finalResult = []
for (const item of result) {
// Assume no booleans in array.
finalResult.push(
/** @type {number | string} */ (
parsePrimitive(info, info.property, item)
)
)
}
result = finalResult
}
// Class names (which can be added both on the `selector` and here).
if (info.property === 'className' && Array.isArray(properties.className)) {
// Assume no booleans in `className`.
result = properties.className.concat(
/** @type {Array<number | string> | number | string} */ (result)
)
}
properties[info.property] = result
}
/**
* @param {Array<RootContent>} nodes
* Children.
* @param {Child} value
* Child.
* @returns {undefined}
* Nothing.
*/
function addChild(nodes, value) {
if (value === null || value === undefined) {
// Empty.
} else if (typeof value === 'number' || typeof value === 'string') {
nodes.push({type: 'text', value: String(value)})
} else if (Array.isArray(value)) {
for (const child of value) {
addChild(nodes, child)
}
} else if (typeof value === 'object' && 'type' in value) {
if (value.type === 'root') {
addChild(nodes, value.children)
} else {
nodes.push(value)
}
} else {
throw new Error('Expected node, nodes, or string, got `' + value + '`')
}
}
/**
* Parse a single primitives.
*
* @param {Info} info
* Property information.
* @param {string} name
* Property name.
* @param {PrimitiveValue} value
* Property value.
* @returns {PrimitiveValue}
* Property value.
*/
function parsePrimitive(info, name, value) {
if (typeof value === 'string') {
if (info.number && value && !Number.isNaN(Number(value))) {
return Number(value)
}
if (
(info.boolean || info.overloadedBoolean) &&
(value === '' || normalize(value) === normalize(name))
) {
return true
}
}
return value
}
/**
* Serialize a `style` object as a string.
*
* @param {Style} styles
* Style object.
* @returns {string}
* CSS string.
*/
function style(styles) {
/** @type {Array<string>} */
const result = []
for (const [key, value] of Object.entries(styles)) {
result.push([key, value].join(': '))
}
return result.join('; ')
}
/**
* Create a map to adjust casing.
*
* @param {ReadonlyArray<string>} values
* List of properly cased keys.
* @returns {Map<string, string>}
* Map of lowercase keys to uppercase keys.
*/
function createAdjustMap(values) {
/** @type {Map<string, string>} */
const result = new Map()
for (const value of values) {
result.set(value.toLowerCase(), value)
}
return result
}

22
node_modules/hastscript/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
/** @type {ReturnType<createH>} */
export const h: ReturnType<typeof createH>;
export namespace h {
namespace JSX {
type Element = import("./jsx-classic.js").Element;
type ElementChildrenAttribute = import("./jsx-classic.js").ElementChildrenAttribute;
type IntrinsicAttributes = import("./jsx-classic.js").IntrinsicAttributes;
type IntrinsicElements = import("./jsx-classic.js").IntrinsicElements;
}
}
/** @type {ReturnType<createH>} */
export const s: ReturnType<typeof createH>;
export namespace s {
namespace JSX {
type Element = import("./jsx-classic.js").Element;
type ElementChildrenAttribute = import("./jsx-classic.js").ElementChildrenAttribute;
type IntrinsicAttributes = import("./jsx-classic.js").IntrinsicAttributes;
type IntrinsicElements = import("./jsx-classic.js").IntrinsicElements;
}
}
import { createH } from './create-h.js';
//# sourceMappingURL=index.d.ts.map

1
node_modules/hastscript/lib/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAqBA,kCAAkC;AAClC,gBADW,UAAU,gBAAS,CACO;;;uBApBxB,OAAO,kBAAkB,EAAE,OAAO;wCAClC,OAAO,kBAAkB,EAAE,wBAAwB;mCACnD,OAAO,kBAAkB,EAAE,mBAAmB;iCAC9C,OAAO,kBAAkB,EAAE,iBAAiB;;;AAoBzD,kCAAkC;AAClC,gBADW,UAAU,gBAAS,CAC8B;;;uBAhB/C,OAAO,kBAAkB,EAAE,OAAO;wCAClC,OAAO,kBAAkB,EAAE,wBAAwB;mCACnD,OAAO,kBAAkB,EAAE,mBAAmB;iCAC9C,OAAO,kBAAkB,EAAE,iBAAiB;;;wBAInC,eAAe"}

27
node_modules/hastscript/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
// Register the JSX namespace on `h`.
/**
* @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
*/
// Register the JSX namespace on `s`.
/**
* @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 {createH} from './create-h.js'
import {svgCaseSensitiveTagNames} from './svg-case-sensitive-tag-names.js'
// Note: this explicit type is needed, otherwise TS creates broken types.
/** @type {ReturnType<createH>} */
export const h = createH(html, 'div')
// Note: this explicit type is needed, otherwise TS creates broken types.
/** @type {ReturnType<createH>} */
export const s = createH(svg, 'g', svgCaseSensitiveTagNames)

43
node_modules/hastscript/lib/jsx-automatic.d.ts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import type {Child, Properties, Result} from './create-h.js'
export namespace JSX {
/**
* Define the return value of JSX syntax.
*/
type Element = Result
/**
* Key of this interface defines as what prop children are passed.
*/
interface ElementChildrenAttribute {
/**
* Only the key matters, not the value.
*/
children?: never
}
/**
* Disallow the use of functional components.
*/
type IntrinsicAttributes = never
/**
* Define the prop types for known elements.
*
* For `hastscript` this defines any string may be used in combination with
* `hast` `Properties`.
*
* This **must** be an interface.
*/
type IntrinsicElements = Record<
string,
| Properties
| {
/**
* The prop that matches `ElementChildrenAttribute` key defines the
* type of JSX children, defines the children type.
*/
children?: Child
}
>
}

2
node_modules/hastscript/lib/jsx-automatic.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
// Empty (only used for TypeScript).
export {}

47
node_modules/hastscript/lib/jsx-classic.d.ts generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import type {Child, Properties, Result} from './create-h.js'
/**
* This unique symbol is declared to specify the key on which JSX children are
* passed, without conflicting with the `Attributes` type.
*/
declare const children: unique symbol
/**
* Define the return value of JSX syntax.
*/
export type Element = Result
/**
* Key of this interface defines as what prop children are passed.
*/
export interface ElementChildrenAttribute {
/**
* Only the key matters, not the value.
*/
[children]?: never
}
/**
* Disallow the use of functional components.
*/
export type IntrinsicAttributes = never
/**
* Define the prop types for known elements.
*
* For `hastscript` this defines any string may be used in combination with
* `hast` `Properties`.
*
* This **must** be an interface.
*/
export type IntrinsicElements = Record<
string,
| Properties
| {
/**
* The prop that matches `ElementChildrenAttribute` key defines the
* type of JSX children, defines the children type.
*/
[children]?: Child
}
>

2
node_modules/hastscript/lib/jsx-classic.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
// Empty (only used for TypeScript).
export {}

View File

@@ -0,0 +1,7 @@
/**
* List of case-sensitive SVG tag names.
*
* @type {ReadonlyArray<string>}
*/
export const svgCaseSensitiveTagNames: ReadonlyArray<string>;
//# sourceMappingURL=svg-case-sensitive-tag-names.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"svg-case-sensitive-tag-names.d.ts","sourceRoot":"","sources":["svg-case-sensitive-tag-names.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,uCAFU,aAAa,CAAC,MAAM,CAAC,CA0C9B"}

View File

@@ -0,0 +1,46 @@
/**
* List of case-sensitive SVG tag names.
*
* @type {ReadonlyArray<string>}
*/
export const svgCaseSensitiveTagNames = [
'altGlyph',
'altGlyphDef',
'altGlyphItem',
'animateColor',
'animateMotion',
'animateTransform',
'clipPath',
'feBlend',
'feColorMatrix',
'feComponentTransfer',
'feComposite',
'feConvolveMatrix',
'feDiffuseLighting',
'feDisplacementMap',
'feDistantLight',
'feDropShadow',
'feFlood',
'feFuncA',
'feFuncB',
'feFuncG',
'feFuncR',
'feGaussianBlur',
'feImage',
'feMerge',
'feMergeNode',
'feMorphology',
'feOffset',
'fePointLight',
'feSpecularLighting',
'feSpotLight',
'feTile',
'feTurbulence',
'foreignObject',
'glyphRef',
'linearGradient',
'radialGradient',
'solidColor',
'textArea',
'textPath'
]

22
node_modules/hastscript/license generated vendored Normal file
View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

126
node_modules/hastscript/package.json generated vendored Normal file
View File

@@ -0,0 +1,126 @@
{
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"bugs": "https://github.com/syntax-tree/hastscript/issues",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"dependencies": {
"@types/hast": "^3.0.0",
"comma-separated-tokens": "^2.0.0",
"hast-util-parse-selector": "^4.0.0",
"property-information": "^7.0.0",
"space-separated-tokens": "^2.0.0"
},
"description": "hast utility to create trees",
"devDependencies#": "note: some bug with `typescript` 5.5 being broken",
"devDependencies": {
"@types/node": "^22.0.0",
"acorn-jsx": "^5.0.0",
"c8": "^10.0.0",
"esast-util-from-js": "^2.0.0",
"estree-util-build-jsx": "^3.0.0",
"estree-util-to-js": "^2.0.0",
"prettier": "^3.0.0",
"remark-cli": "^12.0.0",
"remark-preset-wooorm": "^11.0.0",
"svg-tag-names": "^3.0.0",
"tsd": "^0.31.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
"xo": "^0.60.0"
},
"exports": {
"./jsx-dev-runtime": "./lib/automatic-runtime-html.js",
"./jsx-runtime": "./lib/automatic-runtime-html.js",
"./svg/jsx-dev-runtime": "./lib/automatic-runtime-svg.js",
"./svg/jsx-runtime": "./lib/automatic-runtime-svg.js",
".": "./index.js"
},
"files": [
"index.d.ts.map",
"index.d.ts",
"index.js",
"lib/"
],
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
},
"keywords": [
"dom",
"dsl",
"hast-util",
"hast",
"html",
"hyperscript",
"rehype",
"unist",
"utility",
"util",
"vdom",
"virtual"
],
"license": "MIT",
"name": "hastscript",
"prettier": {
"bracketSpacing": false,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
},
"remarkConfig": {
"plugins": [
"remark-preset-wooorm"
]
},
"repository": "syntax-tree/hastscript",
"scripts": {
"build": "tsc --build --clean && tsc --build && tsd && type-coverage",
"format": "remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix",
"generate": "node --conditions development script/generate-jsx.js && node --conditions development script/build.js",
"test-api": "node --conditions development test/index.js",
"test-coverage": "c8 --100 --reporter lcov -- npm run test-api",
"test": "npm run generate && npm run build && npm run format && npm run test-coverage"
},
"sideEffects": false,
"typeCoverage": {
"atLeast": 100,
"ignoreFiles#": "needed `any`s :'(",
"ignoreFiles": [
"test/jsx-build-jsx-automatic-development.js"
],
"strict": true
},
"type": "module",
"version": "9.0.1",
"xo": {
"overrides": [
{
"files": [
"**/*.ts"
],
"rules": {
"@typescript-eslint/array-type": [
"error",
{
"default": "generic"
}
],
"@typescript-eslint/ban-types": [
"error",
{
"extendDefaults": true
}
],
"@typescript-eslint/consistent-type-definitions": [
"error",
"interface"
]
}
}
],
"prettier": true
}
}

477
node_modules/hastscript/readme.md generated vendored Normal file
View File

@@ -0,0 +1,477 @@
# hastscript
[![Build][badge-build-image]][badge-build-url]
[![Coverage][badge-coverage-image]][badge-coverage-url]
[![Downloads][badge-downloads-image]][badge-downloads-url]
[![Size][badge-size-image]][badge-size-url]
[hast][github-hast] utility to create trees with ease.
## Contents
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`h(selector?[, properties][, …children])`](#hselector-properties-children)
* [`s(selector?[, properties][, …children])`](#sselector-properties-children)
* [`Child`](#child)
* [`Properties`](#properties-1)
* [`Result`](#result)
* [Syntax tree](#syntax-tree)
* [JSX](#jsx)
* [Compatibility](#compatibility)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package is a hyperscript interface (like `createElement` from React and
`h` from Vue and such) to help with creating hast trees.
## When should I use this?
You can use this utility in your project when you generate hast syntax trees
with code.
It helps because it replaces most of the repetition otherwise needed in a syntax
tree with function calls.
It also helps as it improves the attributes you pass by turning them into the
form that is required by hast.
You can instead use [`unist-builder`][github-unist-builder]
when creating any unist nodes and
[`xastscript`][github-xastscript] when creating xast (XML) nodes.
## Install
This package is [ESM only][github-gist-esm].
In Node.js (version 16+),
install with [npm][npmjs-install]:
```sh
npm install hastscript
```
In Deno with [`esm.sh`][esmsh]:
```js
import {h} from 'https://esm.sh/hastscript@9'
```
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import {h} from 'https://esm.sh/hastscript@9?bundle'
</script>
```
## Use
```js
import {h, s} from 'hastscript'
console.log(
h('.foo#some-id', [
h('span', 'some text'),
h('input', {type: 'text', value: 'foo'}),
h('a.alpha', {class: 'bravo charlie', download: 'download'}, [
'delta',
'echo'
])
])
)
console.log(
s('svg', {viewbox: '0 0 500 500', xmlns: 'http://www.w3.org/2000/svg'}, [
s('title', 'SVG `<circle>` element'),
s('circle', {cx: 120, cy: 120, r: 100})
])
)
```
Yields:
```js
{
type: 'element',
tagName: 'div',
properties: {className: ['foo'], id: 'some-id'},
children: [
{
type: 'element',
tagName: 'span',
properties: {},
children: [{type: 'text', value: 'some text'}]
},
{
type: 'element',
tagName: 'input',
properties: {type: 'text', value: 'foo'},
children: []
},
{
type: 'element',
tagName: 'a',
properties: {className: ['alpha', 'bravo', 'charlie'], download: true},
children: [{type: 'text', value: 'delta'}, {type: 'text', value: 'echo'}]
}
]
}
{
type: 'element',
tagName: 'svg',
properties: {viewBox: '0 0 500 500', xmlns: 'http://www.w3.org/2000/svg'},
children: [
{
type: 'element',
tagName: 'title',
properties: {},
children: [{type: 'text', value: 'SVG `<circle>` element'}]
},
{
type: 'element',
tagName: 'circle',
properties: {cx: 120, cy: 120, r: 100},
children: []
}
]
}
```
## API
This package exports the identifiers [`h`][api-h] and [`s`][api-s].
There is no default export.
It exports the additional [TypeScript][] types
[`Child`][api-child],
[`Properties`][api-properties],
and
[`Result`][api-result].
The export map supports the automatic JSX runtime.
You can pass `hastscript` or `hastscript/svg` to your build tool
(TypeScript, Babel, SWC)
with an `importSource` option or similar.
### `h(selector?[, properties][, …children])`
Create virtual **[hast][github-hast]** trees for HTML.
##### Signatures
* `h(): root`
* `h(null[, …children]): root`
* `h(selector[, properties][, …children]): element`
##### Parameters
###### `selector`
Simple CSS selector
(`string`, optional).
When string, builds an [`Element`][github-hast-element].
When nullish, builds a [`Root`][github-hast-root] instead.
The selector can contain a tag name (`foo`),
IDs (`#bar`),
and classes (`.baz`).
If the selector is a string but there is no tag name in it then `h` defaults to
build a `div` element and `s` to a `g` element.
`selector` is parsed by
[`hast-util-parse-selector`][github-hast-util-parse-selector].
###### `properties`
Properties of the element
([`Properties`][api-properties], optional).
###### `children`
Children of the node ([`Child`][api-child] or `Array<Child>`, optional).
##### Returns
Created tree ([`Result`][api-result]).
[`Element`][github-hast-element] when a `selector` is passed,
otherwise [`Root`][github-hast-root].
### `s(selector?[, properties][, …children])`
Create virtual **[hast][github-hast]** trees for SVG.
Signatures, parameters, and return value are the same as `h` above.
Importantly,
the `selector` and `properties` parameters are interpreted as SVG.
### `Child`
(Lists of) children (TypeScript type).
When strings or numbers are encountered,
they are turned into [`Text`][github-hast-text]
nodes.
[`Root`][github-hast-root] nodes are treated as “fragments”,
meaning that their children are used instead.
###### Type
```ts
type Child =
| Array<Node | number | string | null | undefined>
| Node
| number
| string
| null
| undefined
```
### `Properties`
Map of properties (TypeScript type).
Keys should match either the HTML attribute name or the DOM property name,
but are case-insensitive.
###### Type
```ts
type Properties = Record<
string,
| boolean
| number
| string
| null
| undefined
// For comma- and space-separated values such as `className`:
| Array<number | string>
// Accepts value for `style` prop as object.
| Record<string, number | string>
>
```
### `Result`
Result from a `h` (or `s`) call (TypeScript type).
###### Type
```ts
type Result = Element | Root
```
## Syntax tree
The syntax tree is [hast][github-hast].
## JSX
This package can be used with JSX.
You should use the automatic JSX runtime set to `hastscript` or
`hastscript/svg`.
> 👉 **Note**
> while `h` supports dots (`.`) for classes or number signs (`#`)
> for IDs in `selector`,
> those are not supported in JSX.
> 🪦 **Legacy**:
> you can also use the classic JSX runtime,
> but this is not recommended.
> To do so,
> import `h` (or `s`) yourself and define it as the pragma
> (plus set the fragment to `null`).
The Use example above can then be written like so,
using inline pragmas,
so that SVG can be used too:
`example-html.jsx`:
```js
/** @jsxImportSource hastscript */
console.log(
<div class="foo" id="some-id">
<span>some text</span>
<input type="text" value="foo" />
<a class="alpha bravo charlie" download>
deltaecho
</a>
</div>
)
```
`example-svg.jsx`:
```js
/** @jsxImportSource hastscript/svg */
console.log(
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 500 500">
<title>SVG `&lt;circle&gt;` element</title>
<circle cx={120} cy={120} r={100} />
</svg>
)
```
## Compatibility
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
When we cut a new major release,
we drop support for unmaintained versions of Node.
This means we try to keep the current release line,
`hastscript@9`,
compatible with Node.js 16.
## Security
Use of `hastscript` can open you up to a
[cross-site scripting (XSS)][wikipedia-xss]
when you pass user-provided input to it because values are injected into the
syntax tree.
The following example shows how an image is injected that fails loading and
therefore runs code in a browser.
```js
const tree = h()
// Somehow someone injected these properties instead of an expected `src` and
// `alt`:
const otherProps = {onError: 'alert(1)', src: 'x'}
tree.children.push(h('img', {src: 'default.png', ...otherProps}))
```
Yields:
```html
<img onerror="alert(1)" src="x">
```
The following example shows how code can run in a browser because someone stored
an object in a database instead of the expected string.
```js
const tree = h()
// Somehow this isnt the expected `'wooorm'`.
const username = {
type: 'element',
tagName: 'script',
children: [{type: 'text', value: 'alert(2)'}]
}
tree.children.push(h('span.handle', username))
```
Yields:
```html
<span class="handle"><script>alert(2)</script></span>
```
Either do not use user-provided input in `hastscript` or use
[`hast-util-santize`][github-hast-util-sanitize].
## Related
* [`unist-builder`][github-unist-builder]
— create unist trees
* [`xastscript`][github-xastscript]
— create xast trees
* [`hast-to-hyperscript`](https://github.com/syntax-tree/hast-to-hyperscript)
— turn hast into React, Preact, Vue, etc
* [`hast-util-to-html`](https://github.com/syntax-tree/hast-util-to-html)
— turn hast into HTML
* [`hast-util-to-dom`](https://github.com/syntax-tree/hast-util-to-dom)
— turn hast into DOM trees
* [`estree-util-build-jsx`](https://github.com/syntax-tree/estree-util-build-jsx)
— compile JSX away
## Contribute
See
[`contributing.md`][health-contributing]
in
[`syntax-tree/.github`][health]
for ways to get started.
See [`support.md`][health-support] for ways to get help.
This project has a [code of conduct][health-coc].
By interacting with this repository,
organization,
or community you agree to abide by its terms.
## License
[MIT][file-license] © [Titus Wormer][wooorm]
<!-- Definitions -->
[api-child]: #child
[api-h]: #hselector-properties-children
[api-properties]: #properties-1
[api-result]: #result
[api-s]: #sselector-properties-children
[badge-build-image]: https://github.com/syntax-tree/hastscript/workflows/main/badge.svg
[badge-build-url]: https://github.com/syntax-tree/hastscript/actions
[badge-coverage-image]: https://img.shields.io/codecov/c/github/syntax-tree/hastscript.svg
[badge-coverage-url]: https://codecov.io/github/syntax-tree/hastscript
[badge-downloads-image]: https://img.shields.io/npm/dm/hastscript.svg
[badge-downloads-url]: https://www.npmjs.com/package/hastscript
[badge-size-image]: https://img.shields.io/bundlejs/size/hastscript
[badge-size-url]: https://bundlejs.com/?q=hastscript
[esmsh]: https://esm.sh
[file-license]: license
[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[github-hast]: https://github.com/syntax-tree/hast
[github-hast-element]: https://github.com/syntax-tree/hast#element
[github-hast-root]: https://github.com/syntax-tree/hast#root
[github-hast-text]: https://github.com/syntax-tree/hast#text
[github-hast-util-parse-selector]: https://github.com/syntax-tree/hast-util-parse-selector
[github-hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize
[github-unist-builder]: https://github.com/syntax-tree/unist-builder
[github-xastscript]: https://github.com/syntax-tree/xastscript
[health]: https://github.com/syntax-tree/.github
[health-coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
[health-contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
[health-support]: https://github.com/syntax-tree/.github/blob/main/support.md
[npmjs-install]: https://docs.npmjs.com/cli/install
[typescript]: https://www.typescriptlang.org
[wikipedia-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
[wooorm]: https://wooorm.com