planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

68
node_modules/rehype-minify-whitespace/block.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
// See: <https://html.spec.whatwg.org/#the-css-user-agent-style-sheet-and-presentational-hints>
module.exports = [
// Contribute whitespace intrinsically.
'br',
'wbr',
// Similar to block.
'li',
'table',
'caption',
'colgroup',
'col',
'thead',
'tbody',
'tfoot',
'tr',
'td',
'th',
'summary',
'optgroup',
'option',
// Page
'html',
'head',
'body',
// Flow content
'address',
'blockquote',
'center', // Legacy
'dialog',
'div',
'figure',
'figcaption',
'footer',
'form',
'header',
'hr',
'legend',
'listing', // Legacy
'main',
'p',
'plaintext', // Legacy
'pre',
'xmp', // Legacy
// Sections and headings
'article',
'aside',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'hgroup',
'nav',
'section',
// Lists
'dir', // Legacy
'dd',
'dl',
'dt',
'menu',
'ol',
'ul',
// Block-like:
'li',
'th',
'td'
]

7
node_modules/rehype-minify-whitespace/content.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
module.exports = [
// Form.
'button',
'input',
'select',
'textarea'
]

253
node_modules/rehype-minify-whitespace/index.js generated vendored Normal file
View File

@@ -0,0 +1,253 @@
/**
* @fileoverview
* Collapse whitespace.
*
* Normally, collapses to a single space.
* If `newlines: true`, collapses whitespace containing newlines to `'\n'`
* instead of `' '`.
* @example
* <h1>Heading</h1>
* <p><strong>This</strong> and <em>that</em></p>
*/
'use strict'
var is = require('hast-util-is-element')
var embedded = require('hast-util-embedded')
var convert = require('unist-util-is/convert')
var whitespace = require('hast-util-whitespace')
var blocks = require('./block')
var contents = require('./content')
var skippables = require('./skippable')
module.exports = minifyWhitespace
var ignorableNode = convert(['doctype', 'comment'])
var parent = convert(['element', 'root'])
var root = convert(['root'])
var element = convert(['element'])
var text = convert(['text'])
function minifyWhitespace(options) {
var collapse = collapseFactory(
(options || {}).newlines ? replaceNewlines : replaceWhitespace
)
return transform
function transform(tree) {
minify(tree, {collapse: collapse, whitespace: 'normal'})
}
}
function minify(node, options) {
var settings
if (parent(node)) {
settings = Object.assign({}, options)
if (root(node) || blocklike(node)) {
settings.before = true
settings.after = true
}
settings.whitespace = inferWhiteSpace(node, options)
return all(node, settings)
}
if (text(node)) {
if (options.whitespace === 'normal') {
return minifyText(node, options)
}
// Naïve collapse, but no trimming:
if (options.whitespace === 'nowrap') {
node.value = options.collapse(node.value)
}
// The `pre-wrap` or `pre` whitespace settings are neither collapsed nor
// trimmed.
}
return {
remove: false,
ignore: ignorableNode(node),
stripAtStart: false
}
}
function minifyText(node, options) {
var value = options.collapse(node.value)
var start = 0
var end = value.length
var result = {remove: false, ignore: false, stripAtStart: false}
if (options.before && removable(value.charAt(0))) {
start++
}
if (start !== end && removable(value.charAt(end - 1))) {
if (options.after) {
end--
} else {
result.stripAtStart = true
}
}
if (start === end) {
result.remove = true
} else {
node.value = value.slice(start, end)
}
return result
}
function all(parent, options) {
var before = options.before
var after = options.after
var children = parent.children
var length = children.length
var index = -1
var result
while (++index < length) {
result = minify(
children[index],
Object.assign({}, options, {
before: before,
after: collapsableAfter(children, index, after)
})
)
if (result.remove) {
children.splice(index, 1)
index--
length--
} else if (!result.ignore) {
before = result.stripAtStart
}
// If this element, such as a `<select>` or `<img>`, contributes content
// somehow, allow whitespace again.
if (content(children[index])) {
before = false
}
}
return {
remove: false,
ignore: false,
stripAtStart: before || after
}
}
function collapsableAfter(nodes, index, after) {
var length = nodes.length
var node
var result
while (++index < length) {
node = nodes[index]
result = inferBoundary(node)
if (result === undefined && node.children && !skippable(node)) {
result = collapsableAfter(node.children, -1)
}
if (typeof result === 'boolean') {
return result
}
}
return after
}
// Infer two types of boundaries:
//
// 1. `true` — boundary for which whitespace around it does not contribute
// anything
// 2. `false` — boundary for which whitespace around it *does* contribute
//
// No result (`undefined`) is returned if it is unknown.
function inferBoundary(node) {
if (element(node)) {
if (content(node)) {
return false
}
if (blocklike(node)) {
return true
}
// Unknown: either depends on siblings if embedded or metadata, or on
// children.
} else if (text(node)) {
if (!whitespace(node)) {
return false
}
} else if (!ignorableNode(node)) {
return false
}
}
// Infer whether a node is skippable.
function content(node) {
return embedded(node) || is(node, contents)
}
// See: <https://html.spec.whatwg.org/#the-css-user-agent-style-sheet-and-presentational-hints>
function blocklike(node) {
return is(node, blocks)
}
function skippable(node) {
/* istanbul ignore next - currently only used on elements, but just to make sure. */
var props = node.properties || {}
return ignorableNode(node) || is(node, skippables) || props.hidden
}
function removable(character) {
return character === ' ' || character === '\n'
}
function replaceNewlines(value) {
var match = /\r?\n|\r/.exec(value)
return match ? match[0] : ' '
}
function replaceWhitespace() {
return ' '
}
function collapseFactory(replace) {
return collapse
function collapse(value) {
return String(value).replace(/[\t\n\v\f\r ]+/g, replace)
}
}
// We dont support void elements here (so `nobr wbr` -> `normal` is ignored).
function inferWhiteSpace(node, options) {
var props = node.properties || {}
switch (node.tagName) {
case 'listing':
case 'plaintext':
case 'xmp':
return 'pre'
case 'nobr':
return 'nowrap'
case 'pre':
return props.wrap ? 'pre-wrap' : 'pre'
case 'td':
case 'th':
return props.noWrap ? 'nowrap' : options.whitespace
case 'textarea':
return 'pre-wrap'
default:
return options.whitespace
}
}

42
node_modules/rehype-minify-whitespace/package.json generated vendored Normal file
View File

@@ -0,0 +1,42 @@
{
"name": "rehype-minify-whitespace",
"version": "4.0.5",
"description": "rehype plugin to collapse whitespace",
"license": "MIT",
"keywords": [
"unified",
"rehype",
"rehype-plugin",
"plugin",
"html",
"minify",
"mangle",
"collapse",
"whitespace",
"white",
"space"
],
"repository": "https://github.com/rehypejs/rehype-minify/tree/main/packages/rehype-minify-whitespace",
"bugs": "https://github.com/rehypejs/rehype-minify/issues",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
},
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com>"
],
"files": [
"block.js",
"content.js",
"index.js",
"skippable.js"
],
"dependencies": {
"hast-util-embedded": "^1.0.0",
"hast-util-is-element": "^1.0.0",
"hast-util-whitespace": "^1.0.4",
"unist-util-is": "^4.0.0"
},
"xo": false
}

115
node_modules/rehype-minify-whitespace/readme.md generated vendored Normal file
View File

@@ -0,0 +1,115 @@
<!--This file is generated by `build-packages.js`-->
# rehype-minify-whitespace
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
Collapse whitespace.
Normally, collapses to a single space.
If `newlines: true`, collapses whitespace containing newlines to `'\n'`
instead of `' '`.
## Install
[npm][]:
```sh
npm install rehype-minify-whitespace
```
## Use
On the API:
```diff
unified()
.use(require('rehype-parse'))
+ .use(require('rehype-minify-whitespace'))
.use(require('rehype-stringify'))
.process('<span>some html</span>', function (err, file) {
console.error(report(err || file))
console.log(String(file))
})
```
On the CLI:
```sh
rehype input.html --use minify-whitespace > output.html
```
## Example
##### In
```html
<h1>Heading</h1>
<p><strong>This</strong> and <em>that</em></p>
```
##### Out
```html
<h1>Heading</h1><p><strong>This</strong> and <em>that</em></p>
```
## Contribute
See [`contributing.md`][contributing] in [`rehypejs/.github`][health] for ways
to get started.
See [`support.md`][support] for ways to get help.
This project has a [code of conduct][coc].
By interacting with this repository, organization, or community you agree to
abide by its terms.
## License
[MIT][license] © [Titus Wormer][author]
[build-badge]: https://img.shields.io/travis/rehypejs/rehype-minify.svg
[build]: https://travis-ci.org/rehypejs/rehype-minify
[coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-minify.svg
[coverage]: https://codecov.io/github/rehypejs/rehype-minify
[downloads-badge]: https://img.shields.io/npm/dm/rehype-minify-whitespace.svg
[downloads]: https://www.npmjs.com/package/rehype-minify-whitespace
[size-badge]: https://img.shields.io/bundlephobia/minzip/rehype-minify-whitespace.svg
[size]: https://bundlephobia.com/result?p=rehype-minify-whitespace
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[collective]: https://opencollective.com/unified
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[chat]: https://github.com/rehypejs/rehype/discussions
[npm]: https://docs.npmjs.com/cli/install
[health]: https://github.com/rehypejs/.github
[contributing]: https://github.com/rehypejs/.github/blob/main/contributing.md
[support]: https://github.com/rehypejs/.github/blob/main/support.md
[coc]: https://github.com/rehypejs/.github/blob/main/code-of-conduct.md
[license]: https://github.com/rehypejs/rehype-minify/blob/main/license
[author]: https://wooorm.com

20
node_modules/rehype-minify-whitespace/skippable.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
module.exports = [
'area',
'base',
'basefont',
'dialog',
'datalist',
'head',
'link',
'meta',
'noembed',
'noframes',
'param',
'rp',
'script',
'source',
'style',
'template',
'track',
'title'
]