devstar插件

This commit is contained in:
2025-07-26 16:40:29 +08:00
commit 30033daafe
4387 changed files with 1041101 additions and 0 deletions

19
node_modules/hast-util-to-html/lib/handle/comment.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/**
* Serialize a comment.
*
* @param {Comment} node
* Node to handle.
* @param {number | undefined} _1
* Index of `node` in `parent.
* @param {Parents | undefined} _2
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function comment(node: Comment, _1: number | undefined, _2: Parents | undefined, state: State): string;
import type { Comment } from 'hast';
import type { Parents } from 'hast';
import type { State } from '../index.js';
//# sourceMappingURL=comment.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["comment.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;GAaG;AACH,8BAXW,OAAO,MAEP,MAAM,GAAG,SAAS,MAElB,OAAO,GAAG,SAAS,SAEnB,KAAK,GAEH,MAAM,CA2BlB;6BAlDkC,MAAM;6BAAN,MAAM;2BACjB,aAAa"}

52
node_modules/hast-util-to-html/lib/handle/comment.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
/**
* @import {Comment, Parents} from 'hast'
* @import {State} from '../index.js'
*/
import {stringifyEntities} from 'stringify-entities'
const htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g
// Declare arrays as variables so it can be cached by `stringifyEntities`
const bogusCommentEntitySubset = ['>']
const commentEntitySubset = ['<', '>']
/**
* Serialize a comment.
*
* @param {Comment} node
* Node to handle.
* @param {number | undefined} _1
* Index of `node` in `parent.
* @param {Parents | undefined} _2
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function comment(node, _1, _2, state) {
// See: <https://html.spec.whatwg.org/multipage/syntax.html#comments>
return state.settings.bogusComments
? '<?' +
stringifyEntities(
node.value,
Object.assign({}, state.settings.characterReferences, {
subset: bogusCommentEntitySubset
})
) +
'>'
: '<!--' + node.value.replace(htmlCommentRegex, encode) + '-->'
/**
* @param {string} $0
*/
function encode($0) {
return stringifyEntities(
$0,
Object.assign({}, state.settings.characterReferences, {
subset: commentEntitySubset
})
)
}
}

23
node_modules/hast-util-to-html/lib/handle/doctype.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
/**
* @import {Doctype, Parents} from 'hast'
* @import {State} from '../index.js'
*/
/**
* Serialize a doctype.
*
* @param {Doctype} _1
* Node to handle.
* @param {number | undefined} _2
* Index of `node` in `parent.
* @param {Parents | undefined} _3
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function doctype(_1: Doctype, _2: number | undefined, _3: Parents | undefined, state: State): string;
import type { Doctype } from 'hast';
import type { Parents } from 'hast';
import type { State } from '../index.js';
//# sourceMappingURL=doctype.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["doctype.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AACH,4BAXW,OAAO,MAEP,MAAM,GAAG,SAAS,MAElB,OAAO,GAAG,SAAS,SAEnB,KAAK,GAEH,MAAM,CAUlB;6BAzBkC,MAAM;6BAAN,MAAM;2BACjB,aAAa"}

27
node_modules/hast-util-to-html/lib/handle/doctype.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
* @import {Doctype, Parents} from 'hast'
* @import {State} from '../index.js'
*/
/**
* Serialize a doctype.
*
* @param {Doctype} _1
* Node to handle.
* @param {number | undefined} _2
* Index of `node` in `parent.
* @param {Parents | undefined} _3
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function doctype(_1, _2, _3, state) {
return (
'<!' +
(state.settings.upperDoctype ? 'DOCTYPE' : 'doctype') +
(state.settings.tightDoctype ? '' : ' ') +
'html>'
)
}

19
node_modules/hast-util-to-html/lib/handle/element.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/**
* Serialize an element node.
*
* @param {Element} node
* Node to handle.
* @param {number | undefined} index
* Index of `node` in `parent.
* @param {Parents | undefined} parent
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function element(node: Element, index: number | undefined, parent: Parents | undefined, state: State): string;
import type { Element } from 'hast';
import type { Parents } from 'hast';
import type { State } from '../index.js';
//# sourceMappingURL=element.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["element.js"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;;GAaG;AACH,8BAXW,OAAO,SAEP,MAAM,GAAG,SAAS,UAElB,OAAO,GAAG,SAAS,SAEnB,KAAK,GAEH,MAAM,CAgElB;6BAvH8C,MAAM;6BAAN,MAAM;2BAC7B,aAAa"}

265
node_modules/hast-util-to-html/lib/handle/element.js generated vendored Normal file
View File

@@ -0,0 +1,265 @@
/**
* @import {Element, Parents, Properties} from 'hast'
* @import {State} from '../index.js'
*/
import {ccount} from 'ccount'
import {stringify as commas} from 'comma-separated-tokens'
import {find, svg} from 'property-information'
import {stringify as spaces} from 'space-separated-tokens'
import {stringifyEntities} from 'stringify-entities'
import {closing} from '../omission/closing.js'
import {opening} from '../omission/opening.js'
/**
* Maps of subsets.
*
* Each value is a matrix of tuples.
* The value at `0` causes parse errors, the value at `1` is valid.
* Of both, the value at `0` is unsafe, and the value at `1` is safe.
*
* @type {Record<'double' | 'name' | 'single' | 'unquoted', Array<[Array<string>, Array<string>]>>}
*/
const constants = {
// See: <https://html.spec.whatwg.org/#attribute-name-state>.
name: [
['\t\n\f\r &/=>'.split(''), '\t\n\f\r "&\'/=>`'.split('')],
['\0\t\n\f\r "&\'/<=>'.split(''), '\0\t\n\f\r "&\'/<=>`'.split('')]
],
// See: <https://html.spec.whatwg.org/#attribute-value-(unquoted)-state>.
unquoted: [
['\t\n\f\r &>'.split(''), '\0\t\n\f\r "&\'<=>`'.split('')],
['\0\t\n\f\r "&\'<=>`'.split(''), '\0\t\n\f\r "&\'<=>`'.split('')]
],
// See: <https://html.spec.whatwg.org/#attribute-value-(single-quoted)-state>.
single: [
["&'".split(''), '"&\'`'.split('')],
["\0&'".split(''), '\0"&\'`'.split('')]
],
// See: <https://html.spec.whatwg.org/#attribute-value-(double-quoted)-state>.
double: [
['"&'.split(''), '"&\'`'.split('')],
['\0"&'.split(''), '\0"&\'`'.split('')]
]
}
/**
* Serialize an element node.
*
* @param {Element} node
* Node to handle.
* @param {number | undefined} index
* Index of `node` in `parent.
* @param {Parents | undefined} parent
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function element(node, index, parent, state) {
const schema = state.schema
const omit = schema.space === 'svg' ? false : state.settings.omitOptionalTags
let selfClosing =
schema.space === 'svg'
? state.settings.closeEmptyElements
: state.settings.voids.includes(node.tagName.toLowerCase())
/** @type {Array<string>} */
const parts = []
/** @type {string} */
let last
if (schema.space === 'html' && node.tagName === 'svg') {
state.schema = svg
}
const attributes = serializeAttributes(state, node.properties)
const content = state.all(
schema.space === 'html' && node.tagName === 'template' ? node.content : node
)
state.schema = schema
// If the node is categorised as void, but it has children, remove the
// categorisation.
// This enables for example `menuitem`s, which are void in W3C HTML but not
// void in WHATWG HTML, to be stringified properly.
// Note: `menuitem` has since been removed from the HTML spec, and so is no
// longer void.
if (content) selfClosing = false
if (attributes || !omit || !opening(node, index, parent)) {
parts.push('<', node.tagName, attributes ? ' ' + attributes : '')
if (
selfClosing &&
(schema.space === 'svg' || state.settings.closeSelfClosing)
) {
last = attributes.charAt(attributes.length - 1)
if (
!state.settings.tightSelfClosing ||
last === '/' ||
(last && last !== '"' && last !== "'")
) {
parts.push(' ')
}
parts.push('/')
}
parts.push('>')
}
parts.push(content)
if (!selfClosing && (!omit || !closing(node, index, parent))) {
parts.push('</' + node.tagName + '>')
}
return parts.join('')
}
/**
* @param {State} state
* @param {Properties | null | undefined} properties
* @returns {string}
*/
function serializeAttributes(state, properties) {
/** @type {Array<string>} */
const values = []
let index = -1
/** @type {string} */
let key
if (properties) {
for (key in properties) {
if (properties[key] !== null && properties[key] !== undefined) {
const value = serializeAttribute(state, key, properties[key])
if (value) values.push(value)
}
}
}
while (++index < values.length) {
const last = state.settings.tightAttributes
? values[index].charAt(values[index].length - 1)
: undefined
// In tight mode, dont add a space after quoted attributes.
if (index !== values.length - 1 && last !== '"' && last !== "'") {
values[index] += ' '
}
}
return values.join('')
}
/**
* @param {State} state
* @param {string} key
* @param {Properties[keyof Properties]} value
* @returns {string}
*/
function serializeAttribute(state, key, value) {
const info = find(state.schema, key)
const x =
state.settings.allowParseErrors && state.schema.space === 'html' ? 0 : 1
const y = state.settings.allowDangerousCharacters ? 0 : 1
let quote = state.quote
/** @type {string | undefined} */
let result
if (info.overloadedBoolean && (value === info.attribute || value === '')) {
value = true
} else if (
(info.boolean || info.overloadedBoolean) &&
(typeof value !== 'string' || value === info.attribute || value === '')
) {
value = Boolean(value)
}
if (
value === null ||
value === undefined ||
value === false ||
(typeof value === 'number' && Number.isNaN(value))
) {
return ''
}
const name = stringifyEntities(
info.attribute,
Object.assign({}, state.settings.characterReferences, {
// Always encode without parse errors in non-HTML.
subset: constants.name[x][y]
})
)
// No value.
// There is currently only one boolean property in SVG: `[download]` on
// `<a>`.
// This property does not seem to work in browsers (Firefox, Safari, Chrome),
// so I cant test if dropping the value works.
// But I assume that it should:
//
// ```html
// <!doctype html>
// <svg viewBox="0 0 100 100">
// <a href=https://example.com download>
// <circle cx=50 cy=40 r=35 />
// </a>
// </svg>
// ```
//
// See: <https://github.com/wooorm/property-information/blob/main/lib/svg.js>
if (value === true) return name
// `spaces` doesnt accept a second argument, but its given here just to
// keep the code cleaner.
value = Array.isArray(value)
? (info.commaSeparated ? commas : spaces)(value, {
padLeft: !state.settings.tightCommaSeparatedLists
})
: String(value)
if (state.settings.collapseEmptyAttributes && !value) return name
// Check unquoted value.
if (state.settings.preferUnquoted) {
result = stringifyEntities(
value,
Object.assign({}, state.settings.characterReferences, {
attribute: true,
subset: constants.unquoted[x][y]
})
)
}
// If we dont want unquoted, or if `value` contains character references when
// unquoted…
if (result !== value) {
// If the alternative is less common than `quote`, switch.
if (
state.settings.quoteSmart &&
ccount(value, quote) > ccount(value, state.alternative)
) {
quote = state.alternative
}
result =
quote +
stringifyEntities(
value,
Object.assign({}, state.settings.characterReferences, {
// Always encode without parse errors in non-HTML.
subset: (quote === "'" ? constants.single : constants.double)[x][y],
attribute: true
})
) +
quote
}
// Dont add a `=` for unquoted empties.
return name + (result ? '=' + result : result)
}

8
node_modules/hast-util-to-html/lib/handle/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* @type {(node: Nodes, index: number | undefined, parent: Parents | undefined, state: State) => string}
*/
export const handle: (node: Nodes, index: number | undefined, parent: Parents | undefined, state: State) => string;
import type { Nodes } from 'hast';
import type { Parents } from 'hast';
import type { State } from '../index.js';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;GAEG;AACH,qBAFU,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,KAAK,EAAE,KAAK,KAAK,MAAM,CAMrG;2BAnB+B,MAAM;6BAAN,MAAM;2BACf,aAAa"}

47
node_modules/hast-util-to-html/lib/handle/index.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
/**
* @import {Nodes, Parents} from 'hast'
* @import {State} from '../index.js'
*/
import {zwitch} from 'zwitch'
import {comment} from './comment.js'
import {doctype} from './doctype.js'
import {element} from './element.js'
import {raw} from './raw.js'
import {root} from './root.js'
import {text} from './text.js'
/**
* @type {(node: Nodes, index: number | undefined, parent: Parents | undefined, state: State) => string}
*/
export const handle = zwitch('type', {
invalid,
unknown,
handlers: {comment, doctype, element, raw, root, text}
})
/**
* Fail when a non-node is found in the tree.
*
* @param {unknown} node
* Unknown value.
* @returns {never}
* Never.
*/
function invalid(node) {
throw new Error('Expected node, not `' + node + '`')
}
/**
* Fail when a node with an unknown type is found in the tree.
*
* @param {unknown} node_
* Unknown node.
* @returns {never}
* Never.
*/
function unknown(node_) {
// `type` is guaranteed by runtime JS.
const node = /** @type {Nodes} */ (node_)
throw new Error('Cannot compile unknown node `' + node.type + '`')
}

19
node_modules/hast-util-to-html/lib/handle/raw.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/**
* Serialize a raw node.
*
* @param {Raw} node
* Node to handle.
* @param {number | undefined} index
* Index of `node` in `parent.
* @param {Parents | undefined} parent
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function raw(node: Raw, index: number | undefined, parent: Parents | undefined, state: State): string;
import type { Raw } from 'mdast-util-to-hast';
import type { Parents } from 'hast';
import type { State } from '../index.js';
//# sourceMappingURL=raw.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["raw.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,0BAXW,GAAG,SAEH,MAAM,GAAG,SAAS,UAElB,OAAO,GAAG,SAAS,SAEnB,KAAK,GAEH,MAAM,CAOlB;yBAxBqB,oBAAoB;6BADhB,MAAM;2BAER,aAAa"}

27
node_modules/hast-util-to-html/lib/handle/raw.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
* @import {Parents} from 'hast'
* @import {Raw} from 'mdast-util-to-hast'
* @import {State} from '../index.js'
*/
import {text} from './text.js'
/**
* Serialize a raw node.
*
* @param {Raw} node
* Node to handle.
* @param {number | undefined} index
* Index of `node` in `parent.
* @param {Parents | undefined} parent
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function raw(node, index, parent, state) {
return state.settings.allowDangerousHtml
? node.value
: text(node, index, parent, state)
}

23
node_modules/hast-util-to-html/lib/handle/root.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
/**
* @import {Parents, Root} from 'hast'
* @import {State} from '../index.js'
*/
/**
* Serialize a root.
*
* @param {Root} node
* Node to handle.
* @param {number | undefined} _1
* Index of `node` in `parent.
* @param {Parents | undefined} _2
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function root(node: Root, _1: number | undefined, _2: Parents | undefined, state: State): string;
import type { Root } from 'hast';
import type { Parents } from 'hast';
import type { State } from '../index.js';
//# sourceMappingURL=root.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["root.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AACH,2BAXW,IAAI,MAEJ,MAAM,GAAG,SAAS,MAElB,OAAO,GAAG,SAAS,SAEnB,KAAK,GAEH,MAAM,CAKlB;0BApB+B,MAAM;6BAAN,MAAM;2BACd,aAAa"}

22
node_modules/hast-util-to-html/lib/handle/root.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
/**
* @import {Parents, Root} from 'hast'
* @import {State} from '../index.js'
*/
/**
* Serialize a root.
*
* @param {Root} node
* Node to handle.
* @param {number | undefined} _1
* Index of `node` in `parent.
* @param {Parents | undefined} _2
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function root(node, _1, _2, state) {
return state.all(node)
}

20
node_modules/hast-util-to-html/lib/handle/text.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* Serialize a text node.
*
* @param {Raw | Text} node
* Node to handle.
* @param {number | undefined} _
* Index of `node` in `parent.
* @param {Parents | undefined} parent
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function text(node: Raw | Text, _: number | undefined, parent: Parents | undefined, state: State): string;
import type { Raw } from 'mdast-util-to-hast';
import type { Text } from 'hast';
import type { Parents } from 'hast';
import type { State } from '../index.js';
//# sourceMappingURL=text.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,2BAXW,GAAG,GAAG,IAAI,KAEV,MAAM,GAAG,SAAS,UAElB,OAAO,GAAG,SAAS,SAEnB,KAAK,GAEH,MAAM,CAelB;yBAnCqB,oBAAoB;0BADV,MAAM;6BAAN,MAAM;2BAEd,aAAa"}

38
node_modules/hast-util-to-html/lib/handle/text.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
/**
* @import {Parents, Text} from 'hast'
* @import {Raw} from 'mdast-util-to-hast'
* @import {State} from '../index.js'
*/
import {stringifyEntities} from 'stringify-entities'
// Declare array as variable so it can be cached by `stringifyEntities`
const textEntitySubset = ['<', '&']
/**
* Serialize a text node.
*
* @param {Raw | Text} node
* Node to handle.
* @param {number | undefined} _
* Index of `node` in `parent.
* @param {Parents | undefined} parent
* Parent of `node`.
* @param {State} state
* Info passed around about the current state.
* @returns {string}
* Serialized node.
*/
export function text(node, _, parent, state) {
// Check if content of `node` should be escaped.
return parent &&
parent.type === 'element' &&
(parent.tagName === 'script' || parent.tagName === 'style')
? node.value
: stringifyEntities(
node.value,
Object.assign({}, state.settings.characterReferences, {
subset: textEntitySubset
})
)
}