1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-27 17:00:54 +01:00

Removed necessity for Array.flat and Array.flatMap polyfill

This commit is contained in:
squidfunk 2023-07-07 10:22:47 +02:00
parent 54bef7bfe5
commit b37c668a9a
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
11 changed files with 24 additions and 17 deletions

View File

@ -23,5 +23,5 @@
{% endblock %}
{% block scripts %}
{{ super() }}
<script src="{{ 'assets/javascripts/custom.a2f5d53d.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/custom.785bde5b.min.js' | url }}"></script>
{% endblock %}

View File

@ -222,7 +222,7 @@
"base": base_url,
"features": features,
"translations": {},
"search": "assets/javascripts/workers/search.780af0f4.min.js" | url
"search": "assets/javascripts/workers/search.dfff1995.min.js" | url
} -%}
{%- if config.extra.version -%}
{%- set _ = app.update({ "version": config.extra.version }) -%}
@ -250,7 +250,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.c1c13a0d.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.4e31edb1.min.js' | url }}"></script>
{% for path in config.extra_javascript %}
{% if path.endswith(".mjs") %}
<script type="module" src="{{ path | url }}"></script>

View File

@ -80,7 +80,7 @@ export type Translations =
*/
export interface Versioning {
provider: "mike" /* Version provider */
default?: string /* Default version */
default?: string | string[] /* Default version */
}
/**

View File

@ -89,7 +89,10 @@ export function transform(
/* => 4 */
.split(/\s+/g)
.flatMap(fn)
.reduce((prev, term) => {
const next = fn(term)
return [...prev, ...Array.isArray(next) ? next : [next]]
}, [] as string[])
.map(term => /([~^]$)/.test(term) ? `${term}1` : term)
.map(term => /(^[+-]|[~^]\d+$)/.test(term) ? term : `${term}*`)
.join(" ")

View File

@ -161,8 +161,12 @@ export function setupVersionSelector(
if (outdated === null) {
outdated = true
/* Obtain and normalize default versions */
let ignored = config.version?.default || "latest"
if (!Array.isArray(ignored))
ignored = [ignored]
/* Check if version is considered a default */
const ignored = [config.version?.default || ["latest"]].flat()
main: for (const ignore of ignored)
for (const alias of current.aliases)
if (new RegExp(ignore, "i").test(alias)) {