move to cloudflare workers (#1229)
* move to cloudflare workers * remove junk
This commit is contained in:
1 parent
05d994889d
commit
4c8c35a25a
7 files changed
+1771
-942
No files matched your search
@@ -5,7 +5,9 @@ node_modules
|
||||
.cache
|
||||
.output
|
||||
.env
|
||||
.dev.vars
|
||||
dist
|
||||
.wrangler/
|
||||
|
||||
generated/
|
||||
!.gitkeep
|
||||
|
||||
+8
-4
@@ -258,8 +258,10 @@ export default defineNuxtConfig({
|
||||
},
|
||||
},
|
||||
runtimeConfig: {
|
||||
apiBaseUrl: process.env.BASE_URL ?? getApiUrl(),
|
||||
rateLimitKey: process.env.RATE_LIMIT_IGNORE_KEY,
|
||||
// @ts-ignore
|
||||
apiBaseUrl: process.env.BASE_URL ?? globalThis.BASE_URL ?? getApiUrl(),
|
||||
// @ts-ignore
|
||||
rateLimitKey: process.env.RATE_LIMIT_IGNORE_KEY ?? globalThis.RATE_LIMIT_IGNORE_KEY,
|
||||
public: {
|
||||
apiBaseUrl: getApiUrl(),
|
||||
ariadneBaseUrl: getAriadneUrl(),
|
||||
@@ -294,11 +296,13 @@ export default defineNuxtConfig({
|
||||
})
|
||||
|
||||
function getApiUrl() {
|
||||
return process.env.BROWSER_BASE_URL ?? STAGING_API_URL
|
||||
// @ts-ignore
|
||||
return process.env.BROWSER_BASE_URL ?? globalThis.BROWSER_BASE_URL ?? STAGING_API_URL
|
||||
}
|
||||
|
||||
function getAriadneUrl() {
|
||||
return process.env.BROWSER_ARIADNE_URL ?? STAGING_ARIADNE_URL
|
||||
// @ts-ignore
|
||||
return process.env.BROWSER_ARIADNE_URL ?? globalThis.BROWSER_ARIADNE_URL ?? STAGING_ARIADNE_URL
|
||||
}
|
||||
|
||||
function getDomain() {
|
||||
|
||||
+3
-2
@@ -5,7 +5,7 @@
|
||||
"dev": "nuxi dev",
|
||||
"generate": "nuxi generate",
|
||||
"preview": "nuxi preview",
|
||||
"postinstall": "nuxi prepare",
|
||||
"postinstall": "nuxi prepare && patch-package",
|
||||
"lint:js": "eslint . --ext .js,.vue,.ts",
|
||||
"lint": "npm run lint:js && prettier --check .",
|
||||
"fix": "eslint . --fix --ext .js,.vue,.ts && prettier --write .",
|
||||
@@ -33,7 +33,8 @@
|
||||
"typescript": "^5.0.4",
|
||||
"vite-plugin-eslint": "^1.8.1",
|
||||
"vite-svg-loader": "^4.0.0",
|
||||
"vue-tsc": "^1.6.5"
|
||||
"vue-tsc": "^1.6.5",
|
||||
"patch-package": "^7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ltd/j-toml": "^1.38.0",
|
||||
|
||||
@@ -341,7 +341,7 @@
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
<script setup>
|
||||
import { Multiselect } from 'vue-multiselect'
|
||||
import ProjectCard from '~/components/ui/ProjectCard.vue'
|
||||
import Pagination from '~/components/ui/Pagination.vue'
|
||||
@@ -361,477 +361,429 @@ import ImageIcon from '~/assets/images/utils/image.svg'
|
||||
|
||||
import Promotion from '~/components/ads/Promotion.vue'
|
||||
|
||||
export default defineNuxtComponent({
|
||||
components: {
|
||||
LogoAnimated,
|
||||
Promotion,
|
||||
ProjectCard,
|
||||
Pagination,
|
||||
Multiselect,
|
||||
SearchFilter,
|
||||
Checkbox,
|
||||
ClientIcon,
|
||||
ServerIcon,
|
||||
SearchIcon,
|
||||
ClearIcon,
|
||||
FilterIcon,
|
||||
GridIcon,
|
||||
ListIcon,
|
||||
ImageIcon,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
previousMaxResults: 20,
|
||||
const sidebarMenuOpen = ref(false)
|
||||
const showAllLoaders = ref(false)
|
||||
|
||||
maxResultsForView: {
|
||||
list: [5, 10, 15, 20, 50, 100],
|
||||
grid: [6, 12, 18, 24, 48, 96],
|
||||
gallery: [6, 10, 16, 20, 50, 100],
|
||||
},
|
||||
const data = useNuxtApp()
|
||||
const route = useRoute()
|
||||
|
||||
sidebarMenuOpen: false,
|
||||
showAllLoaders: false,
|
||||
}
|
||||
},
|
||||
setup() {
|
||||
const data = useNuxtApp()
|
||||
const route = useRoute()
|
||||
const query = ref('')
|
||||
const facets = ref([])
|
||||
const orFacets = ref([])
|
||||
const selectedVersions = ref([])
|
||||
const onlyOpenSource = ref(false)
|
||||
const showSnapshots = ref(false)
|
||||
const selectedEnvironments = ref([])
|
||||
const sortTypes = shallowReadonly([
|
||||
{ display: 'Relevance', name: 'relevance' },
|
||||
{ display: 'Download count', name: 'downloads' },
|
||||
{ display: 'Follow count', name: 'follows' },
|
||||
{ display: 'Recently published', name: 'newest' },
|
||||
{ display: 'Recently updated', name: 'updated' },
|
||||
])
|
||||
const sortType = ref({ display: 'Relevance', name: 'relevance' })
|
||||
const maxResults = ref(20)
|
||||
const currentPage = ref(1)
|
||||
const projectType = ref({ id: 'mod', display: 'mod', actual: 'mod' })
|
||||
|
||||
const query = ref('')
|
||||
const facets = ref([])
|
||||
const orFacets = ref([])
|
||||
const selectedVersions = ref([])
|
||||
const onlyOpenSource = ref(false)
|
||||
const showSnapshots = ref(false)
|
||||
const selectedEnvironments = ref([])
|
||||
const sortTypes = shallowReadonly([
|
||||
{ display: 'Relevance', name: 'relevance' },
|
||||
{ display: 'Download count', name: 'downloads' },
|
||||
{ display: 'Follow count', name: 'follows' },
|
||||
{ display: 'Recently published', name: 'newest' },
|
||||
{ display: 'Recently updated', name: 'updated' },
|
||||
])
|
||||
const sortType = ref({ display: 'Relevance', name: 'relevance' })
|
||||
const maxResults = ref(20)
|
||||
const currentPage = ref(1)
|
||||
const projectType = ref({ id: 'mod', display: 'mod', actual: 'mod' })
|
||||
const metaDescription = computed(
|
||||
() =>
|
||||
`Search and browse thousands of Minecraft ${data.$formatProjectType(
|
||||
projectType.value.display
|
||||
)}s on Modrinth with instant, accurate search results. Our filters help you quickly find the best Minecraft ${data.$formatProjectType(
|
||||
projectType.value.display
|
||||
)}s.`
|
||||
)
|
||||
if (route.query.q) {
|
||||
query.value = route.query.q
|
||||
}
|
||||
if (route.query.f) {
|
||||
facets.value = getArrayOrString(route.query.f)
|
||||
}
|
||||
if (route.query.g) {
|
||||
orFacets.value = getArrayOrString(route.query.g)
|
||||
}
|
||||
if (route.query.v) {
|
||||
selectedVersions.value = getArrayOrString(route.query.v)
|
||||
}
|
||||
if (route.query.l) {
|
||||
onlyOpenSource.value = route.query.l === 'true'
|
||||
}
|
||||
if (route.query.h) {
|
||||
showSnapshots.value = route.query.h === 'true'
|
||||
}
|
||||
if (route.query.e) {
|
||||
selectedEnvironments.value = getArrayOrString(route.query.e)
|
||||
}
|
||||
if (route.query.s) {
|
||||
sortType.value.name = route.query.s
|
||||
|
||||
const metaDescription = computed(
|
||||
() =>
|
||||
`Search and browse thousands of Minecraft ${data.$formatProjectType(
|
||||
projectType.value.display
|
||||
)}s on Modrinth with instant, accurate search results. Our filters help you quickly find the best Minecraft ${data.$formatProjectType(
|
||||
projectType.value.display
|
||||
)}s.`
|
||||
)
|
||||
if (route.query.q) {
|
||||
query.value = route.query.q
|
||||
}
|
||||
if (route.query.f) {
|
||||
facets.value = getArrayOrString(route.query.f)
|
||||
}
|
||||
if (route.query.g) {
|
||||
orFacets.value = getArrayOrString(route.query.g)
|
||||
}
|
||||
if (route.query.v) {
|
||||
selectedVersions.value = getArrayOrString(route.query.v)
|
||||
}
|
||||
if (route.query.l) {
|
||||
onlyOpenSource.value = route.query.l === 'true'
|
||||
}
|
||||
if (route.query.h) {
|
||||
showSnapshots.value = route.query.h === 'true'
|
||||
}
|
||||
if (route.query.e) {
|
||||
selectedEnvironments.value = getArrayOrString(route.query.e)
|
||||
}
|
||||
if (route.query.s) {
|
||||
sortType.value.name = route.query.s
|
||||
switch (sortType.value.name) {
|
||||
case 'relevance':
|
||||
sortType.value.display = 'Relevance'
|
||||
break
|
||||
case 'downloads':
|
||||
sortType.value.display = 'Downloads'
|
||||
break
|
||||
case 'newest':
|
||||
sortType.value.display = 'Recently published'
|
||||
break
|
||||
case 'updated':
|
||||
sortType.value.display = 'Recently updated'
|
||||
break
|
||||
case 'follows':
|
||||
sortType.value.display = 'Follow count'
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
switch (sortType.value.name) {
|
||||
case 'relevance':
|
||||
sortType.value.display = 'Relevance'
|
||||
break
|
||||
case 'downloads':
|
||||
sortType.value.display = 'Downloads'
|
||||
break
|
||||
case 'newest':
|
||||
sortType.value.display = 'Recently published'
|
||||
break
|
||||
case 'updated':
|
||||
sortType.value.display = 'Recently updated'
|
||||
break
|
||||
case 'follows':
|
||||
sortType.value.display = 'Follow count'
|
||||
break
|
||||
}
|
||||
if (route.query.m) {
|
||||
maxResults.value = route.query.m
|
||||
}
|
||||
if (route.query.o) {
|
||||
currentPage.value = Math.ceil(route.query.o / maxResults.value) + 1
|
||||
}
|
||||
|
||||
projectType.value = data.$tag.projectTypes.find(
|
||||
(x) => x.id === route.path.substring(1, route.path.length - 1)
|
||||
)
|
||||
|
||||
const noLoad = ref(false)
|
||||
const {
|
||||
data: rawResults,
|
||||
refresh: refreshSearch,
|
||||
pending: searchLoading,
|
||||
} = useLazyFetch(
|
||||
() => {
|
||||
const config = useRuntimeConfig()
|
||||
const base = process.server ? config.apiBaseUrl : config.public.apiBaseUrl
|
||||
|
||||
const params = [`limit=${maxResults.value}`, `index=${sortType.value.name}`]
|
||||
|
||||
if (query.value.length > 0) {
|
||||
params.push(`query=${encodeURIComponent(query.value.replace(/ /g, '+'))}`)
|
||||
}
|
||||
|
||||
if (route.query.m) {
|
||||
maxResults.value = route.query.m
|
||||
}
|
||||
if (route.query.o) {
|
||||
currentPage.value = Math.ceil(route.query.o / maxResults.value) + 1
|
||||
}
|
||||
|
||||
projectType.value = data.$tag.projectTypes.find(
|
||||
(x) => x.id === route.path.substring(1, route.path.length - 1)
|
||||
)
|
||||
|
||||
const noLoad = ref(false)
|
||||
const {
|
||||
data: rawResults,
|
||||
refresh: refreshSearch,
|
||||
pending: searchLoading,
|
||||
} = useLazyFetch(
|
||||
() => {
|
||||
const config = useRuntimeConfig()
|
||||
const base = process.server ? config.apiBaseUrl : config.public.apiBaseUrl
|
||||
|
||||
const params = [`limit=${maxResults.value}`, `index=${sortType.value.name}`]
|
||||
|
||||
if (query.value.length > 0) {
|
||||
params.push(`query=${query.value.replace(/ /g, '+')}`)
|
||||
}
|
||||
|
||||
if (
|
||||
facets.value.length > 0 ||
|
||||
orFacets.value.length > 0 ||
|
||||
selectedVersions.value.length > 0 ||
|
||||
selectedEnvironments.value.length > 0 ||
|
||||
projectType.value
|
||||
) {
|
||||
let formattedFacets = []
|
||||
for (const facet of facets.value) {
|
||||
formattedFacets.push([facet])
|
||||
}
|
||||
|
||||
// loaders specifier
|
||||
if (orFacets.value.length > 0) {
|
||||
formattedFacets.push(orFacets.value)
|
||||
} else if (projectType.value.id === 'plugin') {
|
||||
formattedFacets.push(
|
||||
data.$tag.loaderData.allPluginLoaders.map(
|
||||
(x) => `categories:'${encodeURIComponent(x)}'`
|
||||
)
|
||||
)
|
||||
} else if (projectType.value.id === 'mod') {
|
||||
formattedFacets.push(
|
||||
data.$tag.loaderData.modLoaders.map((x) => `categories:'${encodeURIComponent(x)}'`)
|
||||
)
|
||||
} else if (projectType.value.id === 'datapack') {
|
||||
formattedFacets.push(
|
||||
data.$tag.loaderData.dataPackLoaders.map(
|
||||
(x) => `categories:'${encodeURIComponent(x)}'`
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if (selectedVersions.value.length > 0) {
|
||||
const versionFacets = []
|
||||
for (const facet of selectedVersions.value) {
|
||||
versionFacets.push('versions:' + facet)
|
||||
}
|
||||
formattedFacets.push(versionFacets)
|
||||
}
|
||||
|
||||
if (onlyOpenSource.value) {
|
||||
formattedFacets.push(['open_source:true'])
|
||||
}
|
||||
|
||||
if (selectedEnvironments.value.length > 0) {
|
||||
let environmentFacets = []
|
||||
|
||||
const includesClient = selectedEnvironments.value.includes('client')
|
||||
const includesServer = selectedEnvironments.value.includes('server')
|
||||
if (includesClient && includesServer) {
|
||||
environmentFacets = [['client_side:required'], ['server_side:required']]
|
||||
} else {
|
||||
if (includesClient) {
|
||||
environmentFacets = [
|
||||
['client_side:optional', 'client_side:required'],
|
||||
['server_side:optional', 'server_side:unsupported'],
|
||||
]
|
||||
}
|
||||
if (includesServer) {
|
||||
environmentFacets = [
|
||||
['client_side:optional', 'client_side:unsupported'],
|
||||
['server_side:optional', 'server_side:required'],
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
formattedFacets = [...formattedFacets, ...environmentFacets]
|
||||
}
|
||||
|
||||
if (projectType.value) {
|
||||
formattedFacets.push([`project_type:${projectType.value.actual}`])
|
||||
}
|
||||
|
||||
params.push(`facets=${JSON.stringify(formattedFacets)}`)
|
||||
}
|
||||
|
||||
const offset = (currentPage.value - 1) * maxResults.value
|
||||
if (currentPage.value !== 1) {
|
||||
params.push(`offset=${offset}`)
|
||||
}
|
||||
|
||||
let url = 'search'
|
||||
|
||||
if (params.length > 0) {
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
url += i === 0 ? `?${params[i]}` : `&${params[i]}`
|
||||
}
|
||||
}
|
||||
|
||||
return `${base}${url}`
|
||||
},
|
||||
{
|
||||
transform(hits) {
|
||||
noLoad.value = false
|
||||
return hits
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
const results = shallowRef(toRaw(rawResults))
|
||||
const pageCount = computed(() =>
|
||||
results.value ? Math.ceil(results.value.total_hits / results.value.limit) : 1
|
||||
)
|
||||
|
||||
const onSearchChange = (newPageNumber) => {
|
||||
noLoad.value = true
|
||||
|
||||
currentPage.value = newPageNumber
|
||||
|
||||
if (query.value === null) {
|
||||
return
|
||||
if (
|
||||
facets.value.length > 0 ||
|
||||
orFacets.value.length > 0 ||
|
||||
selectedVersions.value.length > 0 ||
|
||||
selectedEnvironments.value.length > 0 ||
|
||||
projectType.value
|
||||
) {
|
||||
let formattedFacets = []
|
||||
for (const facet of facets.value) {
|
||||
formattedFacets.push([facet])
|
||||
}
|
||||
|
||||
refreshSearch()
|
||||
|
||||
if (process.client) {
|
||||
const router = useRouter()
|
||||
const obj = getSearchUrl((currentPage.value - 1) * maxResults.value, true)
|
||||
router.replace({ path: route.path, query: obj })
|
||||
}
|
||||
}
|
||||
|
||||
const getSearchUrl = (offset, useObj) => {
|
||||
const queryItems = []
|
||||
const obj = {}
|
||||
|
||||
if (query.value) {
|
||||
queryItems.push(`q=${encodeURIComponent(query.value)}`)
|
||||
obj.q = query.value
|
||||
}
|
||||
if (offset > 0) {
|
||||
queryItems.push(`o=${offset}`)
|
||||
obj.o = offset
|
||||
}
|
||||
if (facets.value.length > 0) {
|
||||
queryItems.push(`f=${encodeURIComponent(facets.value)}`)
|
||||
obj.f = facets.value
|
||||
}
|
||||
// loaders specifier
|
||||
if (orFacets.value.length > 0) {
|
||||
queryItems.push(`g=${encodeURIComponent(orFacets.value)}`)
|
||||
obj.g = orFacets.value
|
||||
}
|
||||
if (selectedVersions.value.length > 0) {
|
||||
queryItems.push(`v=${encodeURIComponent(selectedVersions.value)}`)
|
||||
obj.v = selectedVersions.value
|
||||
}
|
||||
if (onlyOpenSource.value) {
|
||||
queryItems.push('l=true')
|
||||
obj.l = true
|
||||
}
|
||||
if (showSnapshots.value) {
|
||||
queryItems.push('h=true')
|
||||
obj.h = true
|
||||
}
|
||||
if (selectedEnvironments.value.length > 0) {
|
||||
queryItems.push(`e=${encodeURIComponent(selectedEnvironments.value)}`)
|
||||
obj.e = selectedEnvironments.value
|
||||
}
|
||||
if (sortType.value.name !== 'relevance') {
|
||||
queryItems.push(`s=${encodeURIComponent(sortType.value.name)}`)
|
||||
obj.s = sortType.value.name
|
||||
}
|
||||
if (maxResults.value !== 20) {
|
||||
queryItems.push(`m=${encodeURIComponent(maxResults.value)}`)
|
||||
obj.m = maxResults.value
|
||||
}
|
||||
|
||||
let url = `${route.path}`
|
||||
|
||||
if (queryItems.length > 0) {
|
||||
url += `?${queryItems[0]}`
|
||||
|
||||
for (let i = 1; i < queryItems.length; i++) {
|
||||
url += `&${queryItems[i]}`
|
||||
}
|
||||
}
|
||||
|
||||
return useObj ? obj : url
|
||||
}
|
||||
|
||||
return {
|
||||
query,
|
||||
results,
|
||||
facets,
|
||||
orFacets,
|
||||
selectedVersions,
|
||||
onlyOpenSource,
|
||||
showSnapshots,
|
||||
selectedEnvironments,
|
||||
sortTypes,
|
||||
sortType,
|
||||
maxResults,
|
||||
currentPage,
|
||||
pageCount,
|
||||
projectType,
|
||||
onSearchChange,
|
||||
getSearchUrl,
|
||||
searchLoading,
|
||||
noLoad,
|
||||
metaDescription,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
categoriesMap() {
|
||||
const categories = {}
|
||||
|
||||
for (const category of this.$sortedCategories) {
|
||||
if (categories[category.header]) {
|
||||
categories[category.header].push(category)
|
||||
} else {
|
||||
categories[category.header] = [category]
|
||||
}
|
||||
}
|
||||
|
||||
const newVals = Object.keys(categories).reduce((obj, key) => {
|
||||
obj[key] = categories[key]
|
||||
return obj
|
||||
}, {})
|
||||
|
||||
return newVals
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
clearFilters() {
|
||||
for (const facet of [...this.facets]) {
|
||||
this.toggleFacet(facet, true)
|
||||
}
|
||||
for (const facet of [...this.orFacets]) {
|
||||
this.toggleOrFacet(facet, true)
|
||||
}
|
||||
|
||||
this.onlyOpenSource = false
|
||||
this.selectedVersions = []
|
||||
this.selectedEnvironments = []
|
||||
this.onSearchChange(1)
|
||||
},
|
||||
toggleFacet(elementName, doNotSendRequest = false) {
|
||||
const index = this.facets.indexOf(elementName)
|
||||
|
||||
if (index !== -1) {
|
||||
this.facets.splice(index, 1)
|
||||
} else {
|
||||
this.facets.push(elementName)
|
||||
}
|
||||
|
||||
if (!doNotSendRequest) {
|
||||
this.onSearchChange(1)
|
||||
}
|
||||
},
|
||||
toggleOrFacet(elementName, doNotSendRequest) {
|
||||
const index = this.orFacets.indexOf(elementName)
|
||||
if (index !== -1) {
|
||||
this.orFacets.splice(index, 1)
|
||||
} else {
|
||||
if (elementName === 'categories:purpur') {
|
||||
if (!this.orFacets.includes('categories:paper')) {
|
||||
this.orFacets.push('categories:paper')
|
||||
}
|
||||
if (!this.orFacets.includes('categories:spigot')) {
|
||||
this.orFacets.push('categories:spigot')
|
||||
}
|
||||
if (!this.orFacets.includes('categories:bukkit')) {
|
||||
this.orFacets.push('categories:bukkit')
|
||||
}
|
||||
} else if (elementName === 'categories:paper') {
|
||||
if (!this.orFacets.includes('categories:spigot')) {
|
||||
this.orFacets.push('categories:spigot')
|
||||
}
|
||||
if (!this.orFacets.includes('categories:bukkit')) {
|
||||
this.orFacets.push('categories:bukkit')
|
||||
}
|
||||
} else if (elementName === 'categories:spigot') {
|
||||
if (!this.orFacets.includes('categories:bukkit')) {
|
||||
this.orFacets.push('categories:bukkit')
|
||||
}
|
||||
} else if (elementName === 'categories:waterfall') {
|
||||
if (!this.orFacets.includes('categories:bungeecord')) {
|
||||
this.orFacets.push('categories:bungeecord')
|
||||
}
|
||||
}
|
||||
this.orFacets.push(elementName)
|
||||
}
|
||||
|
||||
if (!doNotSendRequest) {
|
||||
this.onSearchChange(1)
|
||||
}
|
||||
},
|
||||
toggleEnv(environment, sendRequest) {
|
||||
const index = this.selectedEnvironments.indexOf(environment)
|
||||
if (index !== -1) {
|
||||
this.selectedEnvironments.splice(index, 1)
|
||||
} else {
|
||||
this.selectedEnvironments.push(environment)
|
||||
}
|
||||
|
||||
if (!sendRequest) {
|
||||
this.onSearchChange(1)
|
||||
}
|
||||
},
|
||||
onSearchChangeToTop(newPageNumber) {
|
||||
if (process.client) {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||
}
|
||||
|
||||
this.onSearchChange(newPageNumber)
|
||||
},
|
||||
onMaxResultsChange(newPageNumber) {
|
||||
newPageNumber = Math.max(
|
||||
1,
|
||||
Math.min(
|
||||
Math.floor(newPageNumber / (this.maxResults / this.previousMaxResults)),
|
||||
this.pageCount
|
||||
formattedFacets.push(orFacets.value)
|
||||
} else if (projectType.value.id === 'plugin') {
|
||||
formattedFacets.push(
|
||||
data.$tag.loaderData.allPluginLoaders.map((x) => `categories:'${encodeURIComponent(x)}'`)
|
||||
)
|
||||
} else if (projectType.value.id === 'mod') {
|
||||
formattedFacets.push(
|
||||
data.$tag.loaderData.modLoaders.map((x) => `categories:'${encodeURIComponent(x)}'`)
|
||||
)
|
||||
} else if (projectType.value.id === 'datapack') {
|
||||
formattedFacets.push(
|
||||
data.$tag.loaderData.dataPackLoaders.map((x) => `categories:'${encodeURIComponent(x)}'`)
|
||||
)
|
||||
)
|
||||
this.previousMaxResults = this.maxResults
|
||||
this.onSearchChange(newPageNumber)
|
||||
},
|
||||
cycleSearchDisplayMode() {
|
||||
this.$cosmetics.searchDisplayMode[this.projectType.id] = this.$cycleValue(
|
||||
this.$cosmetics.searchDisplayMode[this.projectType.id],
|
||||
this.$tag.projectViewModes
|
||||
)
|
||||
saveCosmetics()
|
||||
this.setClosestMaxResults()
|
||||
},
|
||||
setClosestMaxResults() {
|
||||
const view = this.$cosmetics.searchDisplayMode[this.projectType.id]
|
||||
const maxResultsOptions = this.maxResultsForView[view] ?? [20]
|
||||
const currentMax = this.maxResults
|
||||
if (!maxResultsOptions.includes(currentMax)) {
|
||||
this.maxResults = maxResultsOptions.reduce(function (prev, curr) {
|
||||
return Math.abs(curr - currentMax) <= Math.abs(prev - currentMax) ? curr : prev
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
if (selectedVersions.value.length > 0) {
|
||||
const versionFacets = []
|
||||
for (const facet of selectedVersions.value) {
|
||||
versionFacets.push('versions:' + facet)
|
||||
}
|
||||
formattedFacets.push(versionFacets)
|
||||
}
|
||||
|
||||
if (onlyOpenSource.value) {
|
||||
formattedFacets.push(['open_source:true'])
|
||||
}
|
||||
|
||||
if (selectedEnvironments.value.length > 0) {
|
||||
let environmentFacets = []
|
||||
|
||||
const includesClient = selectedEnvironments.value.includes('client')
|
||||
const includesServer = selectedEnvironments.value.includes('server')
|
||||
if (includesClient && includesServer) {
|
||||
environmentFacets = [['client_side:required'], ['server_side:required']]
|
||||
} else {
|
||||
if (includesClient) {
|
||||
environmentFacets = [
|
||||
['client_side:optional', 'client_side:required'],
|
||||
['server_side:optional', 'server_side:unsupported'],
|
||||
]
|
||||
}
|
||||
if (includesServer) {
|
||||
environmentFacets = [
|
||||
['client_side:optional', 'client_side:unsupported'],
|
||||
['server_side:optional', 'server_side:required'],
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
formattedFacets = [...formattedFacets, ...environmentFacets]
|
||||
}
|
||||
|
||||
if (projectType.value) {
|
||||
formattedFacets.push([`project_type:${projectType.value.actual}`])
|
||||
}
|
||||
|
||||
params.push(`facets=${encodeURIComponent(JSON.stringify(formattedFacets))}`)
|
||||
}
|
||||
|
||||
const offset = (currentPage.value - 1) * maxResults.value
|
||||
if (currentPage.value !== 1) {
|
||||
params.push(`offset=${offset}`)
|
||||
}
|
||||
|
||||
let url = 'search'
|
||||
|
||||
if (params.length > 0) {
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
url += i === 0 ? `?${params[i]}` : `&${params[i]}`
|
||||
}
|
||||
}
|
||||
|
||||
return `${base}${url}`
|
||||
},
|
||||
{
|
||||
transform: (hits) => {
|
||||
noLoad.value = false
|
||||
return hits
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
const results = shallowRef(toRaw(rawResults))
|
||||
const pageCount = computed(() =>
|
||||
results.value ? Math.ceil(results.value.total_hits / results.value.limit) : 1
|
||||
)
|
||||
|
||||
function onSearchChange(newPageNumber) {
|
||||
noLoad.value = true
|
||||
|
||||
currentPage.value = newPageNumber
|
||||
|
||||
if (query.value === null) {
|
||||
return
|
||||
}
|
||||
|
||||
refreshSearch()
|
||||
|
||||
if (process.client) {
|
||||
const router = useRouter()
|
||||
const obj = getSearchUrl((currentPage.value - 1) * maxResults.value, true)
|
||||
router.replace({ path: route.path, query: obj })
|
||||
}
|
||||
}
|
||||
|
||||
function getSearchUrl(offset, useObj) {
|
||||
const queryItems = []
|
||||
const obj = {}
|
||||
|
||||
if (query.value) {
|
||||
queryItems.push(`q=${encodeURIComponent(query.value)}`)
|
||||
obj.q = query.value
|
||||
}
|
||||
if (offset > 0) {
|
||||
queryItems.push(`o=${offset}`)
|
||||
obj.o = offset
|
||||
}
|
||||
if (facets.value.length > 0) {
|
||||
queryItems.push(`f=${encodeURIComponent(facets.value)}`)
|
||||
obj.f = facets.value
|
||||
}
|
||||
if (orFacets.value.length > 0) {
|
||||
queryItems.push(`g=${encodeURIComponent(orFacets.value)}`)
|
||||
obj.g = orFacets.value
|
||||
}
|
||||
if (selectedVersions.value.length > 0) {
|
||||
queryItems.push(`v=${encodeURIComponent(selectedVersions.value)}`)
|
||||
obj.v = selectedVersions.value
|
||||
}
|
||||
if (onlyOpenSource.value) {
|
||||
queryItems.push('l=true')
|
||||
obj.l = true
|
||||
}
|
||||
if (showSnapshots.value) {
|
||||
queryItems.push('h=true')
|
||||
obj.h = true
|
||||
}
|
||||
if (selectedEnvironments.value.length > 0) {
|
||||
queryItems.push(`e=${encodeURIComponent(selectedEnvironments.value)}`)
|
||||
obj.e = selectedEnvironments.value
|
||||
}
|
||||
if (sortType.value.name !== 'relevance') {
|
||||
queryItems.push(`s=${encodeURIComponent(sortType.value.name)}`)
|
||||
obj.s = sortType.value.name
|
||||
}
|
||||
if (maxResults.value !== 20) {
|
||||
queryItems.push(`m=${encodeURIComponent(maxResults.value)}`)
|
||||
obj.m = maxResults.value
|
||||
}
|
||||
|
||||
let url = `${route.path}`
|
||||
|
||||
if (queryItems.length > 0) {
|
||||
url += `?${queryItems[0]}`
|
||||
|
||||
for (let i = 1; i < queryItems.length; i++) {
|
||||
url += `&${queryItems[i]}`
|
||||
}
|
||||
}
|
||||
|
||||
return useObj ? obj : url
|
||||
}
|
||||
|
||||
const categoriesMap = computed(() => {
|
||||
const categories = {}
|
||||
|
||||
for (const category of data.$sortedCategories) {
|
||||
if (categories[category.header]) {
|
||||
categories[category.header].push(category)
|
||||
} else {
|
||||
categories[category.header] = [category]
|
||||
}
|
||||
}
|
||||
|
||||
return Object.keys(categories).reduce((obj, key) => {
|
||||
obj[key] = categories[key]
|
||||
return obj
|
||||
}, {})
|
||||
})
|
||||
|
||||
function clearFilters() {
|
||||
for (const facet of [...facets.value]) {
|
||||
toggleFacet(facet, true)
|
||||
}
|
||||
for (const facet of [...orFacets.value]) {
|
||||
toggleOrFacet(facet, true)
|
||||
}
|
||||
|
||||
onlyOpenSource.value = false
|
||||
selectedVersions.value = []
|
||||
selectedEnvironments.value = []
|
||||
onSearchChange(1)
|
||||
}
|
||||
|
||||
function toggleFacet(elementName, doNotSendRequest = false) {
|
||||
const index = facets.value.indexOf(elementName)
|
||||
|
||||
if (index !== -1) {
|
||||
facets.value.splice(index, 1)
|
||||
} else {
|
||||
facets.value.push(elementName)
|
||||
}
|
||||
|
||||
if (!doNotSendRequest) {
|
||||
onSearchChange(1)
|
||||
}
|
||||
}
|
||||
|
||||
function toggleOrFacet(elementName, doNotSendRequest) {
|
||||
const index = orFacets.value.indexOf(elementName)
|
||||
if (index !== -1) {
|
||||
orFacets.value.splice(index, 1)
|
||||
} else {
|
||||
if (elementName === 'categories:purpur') {
|
||||
if (!orFacets.value.includes('categories:paper')) {
|
||||
orFacets.value.push('categories:paper')
|
||||
}
|
||||
if (!orFacets.value.includes('categories:spigot')) {
|
||||
orFacets.value.push('categories:spigot')
|
||||
}
|
||||
if (!orFacets.value.includes('categories:bukkit')) {
|
||||
orFacets.value.push('categories:bukkit')
|
||||
}
|
||||
} else if (elementName === 'categories:paper') {
|
||||
if (!orFacets.value.includes('categories:spigot')) {
|
||||
orFacets.value.push('categories:spigot')
|
||||
}
|
||||
if (!orFacets.value.includes('categories:bukkit')) {
|
||||
orFacets.value.push('categories:bukkit')
|
||||
}
|
||||
} else if (elementName === 'categories:spigot') {
|
||||
if (!orFacets.value.includes('categories:bukkit')) {
|
||||
orFacets.value.push('categories:bukkit')
|
||||
}
|
||||
} else if (elementName === 'categories:waterfall') {
|
||||
if (!orFacets.value.includes('categories:bungeecord')) {
|
||||
orFacets.value.push('categories:bungeecord')
|
||||
}
|
||||
}
|
||||
orFacets.value.push(elementName)
|
||||
}
|
||||
|
||||
if (!doNotSendRequest) {
|
||||
onSearchChange(1)
|
||||
}
|
||||
}
|
||||
|
||||
function toggleEnv(environment, sendRequest) {
|
||||
const index = selectedEnvironments.value.indexOf(environment)
|
||||
if (index !== -1) {
|
||||
selectedEnvironments.value.splice(index, 1)
|
||||
} else {
|
||||
selectedEnvironments.value.push(environment)
|
||||
}
|
||||
|
||||
if (!sendRequest) {
|
||||
onSearchChange(1)
|
||||
}
|
||||
}
|
||||
|
||||
function onSearchChangeToTop(newPageNumber) {
|
||||
if (process.client) {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||
}
|
||||
|
||||
onSearchChange(newPageNumber)
|
||||
}
|
||||
|
||||
function cycleSearchDisplayMode() {
|
||||
data.$cosmetics.searchDisplayMode[projectType.value.id] = data.$cycleValue(
|
||||
data.$cosmetics.searchDisplayMode[projectType.value.id],
|
||||
data.$tag.projectViewModes
|
||||
)
|
||||
saveCosmetics()
|
||||
setClosestMaxResults()
|
||||
}
|
||||
|
||||
const previousMaxResults = ref(20)
|
||||
const maxResultsForView = ref({
|
||||
list: [5, 10, 15, 20, 50, 100],
|
||||
grid: [6, 12, 18, 24, 48, 96],
|
||||
gallery: [6, 10, 16, 20, 50, 100],
|
||||
})
|
||||
|
||||
function onMaxResultsChange(newPageNumber) {
|
||||
newPageNumber = Math.max(
|
||||
1,
|
||||
Math.min(
|
||||
Math.floor(newPageNumber / (maxResults.value / previousMaxResults.value)),
|
||||
pageCount.value
|
||||
)
|
||||
)
|
||||
previousMaxResults.value = maxResults.value
|
||||
onSearchChange(newPageNumber)
|
||||
}
|
||||
|
||||
function setClosestMaxResults() {
|
||||
const view = data.$cosmetics.searchDisplayMode[projectType.value.id]
|
||||
const maxResultsOptions = maxResultsForView.value[view] ?? [20]
|
||||
const currentMax = maxResults.value
|
||||
if (!maxResultsOptions.includes(currentMax)) {
|
||||
maxResults.value = maxResultsOptions.reduce(function (prev, curr) {
|
||||
return Math.abs(curr - currentMax) <= Math.abs(prev - currentMax) ? curr : prev
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -0,0 +1,482 @@
|
||||
diff --git a/node_modules/markdown-it/dist/markdown-it.js b/node_modules/markdown-it/dist/markdown-it.js
|
||||
index 938677a..0729f10 100644
|
||||
--- a/node_modules/markdown-it/dist/markdown-it.js
|
||||
+++ b/node_modules/markdown-it/dist/markdown-it.js
|
||||
@@ -2698,9 +2698,9 @@
|
||||
var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g;
|
||||
var ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;
|
||||
var UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + "|" + ENTITY_RE.source, "gi");
|
||||
- var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;
|
||||
+ var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
|
||||
function replaceEntityPattern(match, name) {
|
||||
- var code = 0;
|
||||
+ var code;
|
||||
if (has(entities, name)) {
|
||||
return entities[name];
|
||||
}
|
||||
@@ -2951,8 +2951,8 @@
|
||||
return labelEnd;
|
||||
};
|
||||
var unescapeAll$2 = utils.unescapeAll;
|
||||
- var parse_link_destination = function parseLinkDestination(str, pos, max) {
|
||||
- var code, level, lines = 0, start = pos, result = {
|
||||
+ var parse_link_destination = function parseLinkDestination(str, start, max) {
|
||||
+ var code, level, pos = start, result = {
|
||||
ok: false,
|
||||
pos: 0,
|
||||
lines: 0,
|
||||
@@ -3022,14 +3022,13 @@
|
||||
return result;
|
||||
}
|
||||
result.str = unescapeAll$2(str.slice(start, pos));
|
||||
- result.lines = lines;
|
||||
result.pos = pos;
|
||||
result.ok = true;
|
||||
return result;
|
||||
};
|
||||
var unescapeAll$1 = utils.unescapeAll;
|
||||
- var parse_link_title = function parseLinkTitle(str, pos, max) {
|
||||
- var code, marker, lines = 0, start = pos, result = {
|
||||
+ var parse_link_title = function parseLinkTitle(str, start, max) {
|
||||
+ var code, marker, lines = 0, pos = start, result = {
|
||||
ok: false,
|
||||
pos: 0,
|
||||
lines: 0,
|
||||
@@ -3084,7 +3083,7 @@
|
||||
var default_rules = {};
|
||||
default_rules.code_inline = function(tokens, idx, options, env, slf) {
|
||||
var token = tokens[idx];
|
||||
- return "<code" + slf.renderAttrs(token) + ">" + escapeHtml(tokens[idx].content) + "</code>";
|
||||
+ return "<code" + slf.renderAttrs(token) + ">" + escapeHtml(token.content) + "</code>";
|
||||
};
|
||||
default_rules.code_block = function(tokens, idx, options, env, slf) {
|
||||
var token = tokens[idx];
|
||||
@@ -3306,7 +3305,7 @@
|
||||
if (type === "inline") {
|
||||
result += this.renderInline(tokens[i].children, options, env);
|
||||
} else if (typeof rules[type] !== "undefined") {
|
||||
- result += rules[tokens[i].type](tokens, i, options, env, this);
|
||||
+ result += rules[type](tokens, i, options, env, this);
|
||||
} else {
|
||||
result += this.renderToken(tokens, i, options, env);
|
||||
}
|
||||
@@ -4527,7 +4526,7 @@
|
||||
return false;
|
||||
}
|
||||
// check the block quote marker
|
||||
- if (state.src.charCodeAt(pos++) !== 62 /* > */) {
|
||||
+ if (state.src.charCodeAt(pos) !== 62 /* > */) {
|
||||
return false;
|
||||
}
|
||||
// we know that it's going to be a valid blockquote,
|
||||
@@ -4535,57 +4534,10 @@
|
||||
if (silent) {
|
||||
return true;
|
||||
}
|
||||
- // set offset past spaces and ">"
|
||||
- initial = offset = state.sCount[startLine] + 1;
|
||||
- // skip one optional space after '>'
|
||||
- if (state.src.charCodeAt(pos) === 32 /* space */) {
|
||||
- // ' > test '
|
||||
- // ^ -- position start of line here:
|
||||
- pos++;
|
||||
- initial++;
|
||||
- offset++;
|
||||
- adjustTab = false;
|
||||
- spaceAfterMarker = true;
|
||||
- } else if (state.src.charCodeAt(pos) === 9 /* tab */) {
|
||||
- spaceAfterMarker = true;
|
||||
- if ((state.bsCount[startLine] + offset) % 4 === 3) {
|
||||
- // ' >\t test '
|
||||
- // ^ -- position start of line here (tab has width===1)
|
||||
- pos++;
|
||||
- initial++;
|
||||
- offset++;
|
||||
- adjustTab = false;
|
||||
- } else {
|
||||
- // ' >\t test '
|
||||
- // ^ -- position start of line here + shift bsCount slightly
|
||||
- // to make extra space appear
|
||||
- adjustTab = true;
|
||||
- }
|
||||
- } else {
|
||||
- spaceAfterMarker = false;
|
||||
- }
|
||||
- oldBMarks = [ state.bMarks[startLine] ];
|
||||
- state.bMarks[startLine] = pos;
|
||||
- while (pos < max) {
|
||||
- ch = state.src.charCodeAt(pos);
|
||||
- if (isSpace$9(ch)) {
|
||||
- if (ch === 9) {
|
||||
- offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4;
|
||||
- } else {
|
||||
- offset++;
|
||||
- }
|
||||
- } else {
|
||||
- break;
|
||||
- }
|
||||
- pos++;
|
||||
- }
|
||||
- oldBSCount = [ state.bsCount[startLine] ];
|
||||
- state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0);
|
||||
- lastLineEmpty = pos >= max;
|
||||
- oldSCount = [ state.sCount[startLine] ];
|
||||
- state.sCount[startLine] = offset - initial;
|
||||
- oldTShift = [ state.tShift[startLine] ];
|
||||
- state.tShift[startLine] = pos - state.bMarks[startLine];
|
||||
+ oldBMarks = [];
|
||||
+ oldBSCount = [];
|
||||
+ oldSCount = [];
|
||||
+ oldTShift = [];
|
||||
terminatorRules = state.md.block.ruler.getRules("blockquote");
|
||||
oldParentType = state.parentType;
|
||||
state.parentType = "blockquote";
|
||||
@@ -4607,7 +4559,7 @@
|
||||
// > test
|
||||
// - - -
|
||||
// ```
|
||||
- for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {
|
||||
+ for (nextLine = startLine; nextLine < endLine; nextLine++) {
|
||||
// check if it's outdented, i.e. it's inside list item and indented
|
||||
// less than said list item:
|
||||
// ```
|
||||
@@ -4625,24 +4577,22 @@
|
||||
if (state.src.charCodeAt(pos++) === 62 /* > */ && !isOutdented) {
|
||||
// This line is inside the blockquote.
|
||||
// set offset past spaces and ">"
|
||||
- initial = offset = state.sCount[nextLine] + 1;
|
||||
+ initial = state.sCount[nextLine] + 1;
|
||||
// skip one optional space after '>'
|
||||
if (state.src.charCodeAt(pos) === 32 /* space */) {
|
||||
// ' > test '
|
||||
// ^ -- position start of line here:
|
||||
pos++;
|
||||
initial++;
|
||||
- offset++;
|
||||
adjustTab = false;
|
||||
spaceAfterMarker = true;
|
||||
} else if (state.src.charCodeAt(pos) === 9 /* tab */) {
|
||||
spaceAfterMarker = true;
|
||||
- if ((state.bsCount[nextLine] + offset) % 4 === 3) {
|
||||
+ if ((state.bsCount[nextLine] + initial) % 4 === 3) {
|
||||
// ' >\t test '
|
||||
// ^ -- position start of line here (tab has width===1)
|
||||
pos++;
|
||||
initial++;
|
||||
- offset++;
|
||||
adjustTab = false;
|
||||
} else {
|
||||
// ' >\t test '
|
||||
@@ -4653,6 +4603,7 @@
|
||||
} else {
|
||||
spaceAfterMarker = false;
|
||||
}
|
||||
+ offset = initial;
|
||||
oldBMarks.push(state.bMarks[nextLine]);
|
||||
state.bMarks[nextLine] = pos;
|
||||
while (pos < max) {
|
||||
@@ -4845,9 +4796,9 @@
|
||||
}
|
||||
}
|
||||
var list = function list(state, startLine, endLine, silent) {
|
||||
- var ch, contentStart, i, indent, indentAfterMarker, initial, isOrdered, itemLines, l, listLines, listTokIdx, markerCharCode, markerValue, max, nextLine, offset, oldListIndent, oldParentType, oldSCount, oldTShift, oldTight, pos, posAfterMarker, prevEmptyEnd, start, terminate, terminatorRules, token, isTerminatingParagraph = false, tight = true;
|
||||
+ var ch, contentStart, i, indent, indentAfterMarker, initial, isOrdered, itemLines, l, listLines, listTokIdx, markerCharCode, markerValue, max, offset, oldListIndent, oldParentType, oldSCount, oldTShift, oldTight, pos, posAfterMarker, prevEmptyEnd, start, terminate, terminatorRules, token, nextLine = startLine, isTerminatingParagraph = false, tight = true;
|
||||
// if it's indented more than 3 spaces, it should be a code block
|
||||
- if (state.sCount[startLine] - state.blkIndent >= 4) {
|
||||
+ if (state.sCount[nextLine] - state.blkIndent >= 4) {
|
||||
return false;
|
||||
}
|
||||
// Special case:
|
||||
@@ -4856,7 +4807,7 @@
|
||||
// - item 3
|
||||
// - item 4
|
||||
// - this one is a paragraph continuation
|
||||
- if (state.listIndent >= 0 && state.sCount[startLine] - state.listIndent >= 4 && state.sCount[startLine] < state.blkIndent) {
|
||||
+ if (state.listIndent >= 0 && state.sCount[nextLine] - state.listIndent >= 4 && state.sCount[nextLine] < state.blkIndent) {
|
||||
return false;
|
||||
}
|
||||
// limit conditions when list can interrupt
|
||||
@@ -4865,19 +4816,19 @@
|
||||
// Next list item should still terminate previous list item;
|
||||
// This code can fail if plugins use blkIndent as well as lists,
|
||||
// but I hope the spec gets fixed long before that happens.
|
||||
- if (state.sCount[startLine] >= state.blkIndent) {
|
||||
+ if (state.sCount[nextLine] >= state.blkIndent) {
|
||||
isTerminatingParagraph = true;
|
||||
}
|
||||
}
|
||||
// Detect list type and position after marker
|
||||
- if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {
|
||||
+ if ((posAfterMarker = skipOrderedListMarker(state, nextLine)) >= 0) {
|
||||
isOrdered = true;
|
||||
- start = state.bMarks[startLine] + state.tShift[startLine];
|
||||
+ start = state.bMarks[nextLine] + state.tShift[nextLine];
|
||||
markerValue = Number(state.src.slice(start, posAfterMarker - 1));
|
||||
// If we're starting a new ordered list right after
|
||||
// a paragraph, it should start with 1.
|
||||
if (isTerminatingParagraph && markerValue !== 1) return false;
|
||||
- } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {
|
||||
+ } else if ((posAfterMarker = skipBulletListMarker(state, nextLine)) >= 0) {
|
||||
isOrdered = false;
|
||||
} else {
|
||||
return false;
|
||||
@@ -4885,14 +4836,14 @@
|
||||
// If we're starting a new unordered list right after
|
||||
// a paragraph, first line should not be empty.
|
||||
if (isTerminatingParagraph) {
|
||||
- if (state.skipSpaces(posAfterMarker) >= state.eMarks[startLine]) return false;
|
||||
+ if (state.skipSpaces(posAfterMarker) >= state.eMarks[nextLine]) return false;
|
||||
}
|
||||
- // We should terminate list on style change. Remember first one to compare.
|
||||
- markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
|
||||
// For validation mode we can terminate immediately
|
||||
if (silent) {
|
||||
return true;
|
||||
}
|
||||
+ // We should terminate list on style change. Remember first one to compare.
|
||||
+ markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
|
||||
// Start list
|
||||
listTokIdx = state.tokens.length;
|
||||
if (isOrdered) {
|
||||
@@ -4903,20 +4854,19 @@
|
||||
} else {
|
||||
token = state.push("bullet_list_open", "ul", 1);
|
||||
}
|
||||
- token.map = listLines = [ startLine, 0 ];
|
||||
+ token.map = listLines = [ nextLine, 0 ];
|
||||
token.markup = String.fromCharCode(markerCharCode);
|
||||
|
||||
// Iterate list items
|
||||
|
||||
- nextLine = startLine;
|
||||
- prevEmptyEnd = false;
|
||||
+ prevEmptyEnd = false;
|
||||
terminatorRules = state.md.block.ruler.getRules("list");
|
||||
oldParentType = state.parentType;
|
||||
state.parentType = "list";
|
||||
while (nextLine < endLine) {
|
||||
pos = posAfterMarker;
|
||||
max = state.eMarks[nextLine];
|
||||
- initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);
|
||||
+ initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[nextLine] + state.tShift[nextLine]);
|
||||
while (pos < max) {
|
||||
ch = state.src.charCodeAt(pos);
|
||||
if (ch === 9) {
|
||||
@@ -4946,14 +4896,14 @@
|
||||
// Run subparser & write tokens
|
||||
token = state.push("list_item_open", "li", 1);
|
||||
token.markup = String.fromCharCode(markerCharCode);
|
||||
- token.map = itemLines = [ startLine, 0 ];
|
||||
+ token.map = itemLines = [ nextLine, 0 ];
|
||||
if (isOrdered) {
|
||||
token.info = state.src.slice(start, posAfterMarker - 1);
|
||||
}
|
||||
// change current state, then restore it after parser subcall
|
||||
oldTight = state.tight;
|
||||
- oldTShift = state.tShift[startLine];
|
||||
- oldSCount = state.sCount[startLine];
|
||||
+ oldTShift = state.tShift[nextLine];
|
||||
+ oldSCount = state.sCount[nextLine];
|
||||
// - example list
|
||||
// ^ listIndent position will be here
|
||||
// ^ blkIndent position will be here
|
||||
@@ -4962,9 +4912,9 @@
|
||||
state.listIndent = state.blkIndent;
|
||||
state.blkIndent = indent;
|
||||
state.tight = true;
|
||||
- state.tShift[startLine] = contentStart - state.bMarks[startLine];
|
||||
- state.sCount[startLine] = offset;
|
||||
- if (contentStart >= max && state.isEmpty(startLine + 1)) {
|
||||
+ state.tShift[nextLine] = contentStart - state.bMarks[nextLine];
|
||||
+ state.sCount[nextLine] = offset;
|
||||
+ if (contentStart >= max && state.isEmpty(nextLine + 1)) {
|
||||
// workaround for this case
|
||||
// (list item is empty, list terminates before "foo"):
|
||||
// ~~~~~~~~
|
||||
@@ -4973,7 +4923,7 @@
|
||||
// ~~~~~~~~
|
||||
state.line = Math.min(state.line + 2, endLine);
|
||||
} else {
|
||||
- state.md.block.tokenize(state, startLine, endLine, true);
|
||||
+ state.md.block.tokenize(state, nextLine, endLine, true);
|
||||
}
|
||||
// If any of list item is tight, mark list as tight
|
||||
if (!state.tight || prevEmptyEnd) {
|
||||
@@ -4981,17 +4931,16 @@
|
||||
}
|
||||
// Item become loose if finish with empty line,
|
||||
// but we should filter last element, because it means list finish
|
||||
- prevEmptyEnd = state.line - startLine > 1 && state.isEmpty(state.line - 1);
|
||||
+ prevEmptyEnd = state.line - nextLine > 1 && state.isEmpty(state.line - 1);
|
||||
state.blkIndent = state.listIndent;
|
||||
state.listIndent = oldListIndent;
|
||||
- state.tShift[startLine] = oldTShift;
|
||||
- state.sCount[startLine] = oldSCount;
|
||||
+ state.tShift[nextLine] = oldTShift;
|
||||
+ state.sCount[nextLine] = oldSCount;
|
||||
state.tight = oldTight;
|
||||
token = state.push("list_item_close", "li", -1);
|
||||
token.markup = String.fromCharCode(markerCharCode);
|
||||
- nextLine = startLine = state.line;
|
||||
+ nextLine = state.line;
|
||||
itemLines[1] = nextLine;
|
||||
- contentStart = state.bMarks[startLine];
|
||||
if (nextLine >= endLine) {
|
||||
break;
|
||||
}
|
||||
@@ -5002,7 +4951,7 @@
|
||||
break;
|
||||
}
|
||||
// if it's indented more than 3 spaces, it should be a code block
|
||||
- if (state.sCount[startLine] - state.blkIndent >= 4) {
|
||||
+ if (state.sCount[nextLine] - state.blkIndent >= 4) {
|
||||
break;
|
||||
}
|
||||
// fail if terminating block found
|
||||
@@ -5410,8 +5359,8 @@
|
||||
return true;
|
||||
};
|
||||
// Paragraph
|
||||
- var paragraph = function paragraph(state, startLine /*, endLine*/) {
|
||||
- var content, terminate, i, l, token, oldParentType, nextLine = startLine + 1, terminatorRules = state.md.block.ruler.getRules("paragraph"), endLine = state.lineMax;
|
||||
+ var paragraph = function paragraph(state, startLine, endLine) {
|
||||
+ var content, terminate, i, l, token, oldParentType, nextLine = startLine + 1, terminatorRules = state.md.block.ruler.getRules("paragraph");
|
||||
oldParentType = state.parentType;
|
||||
state.parentType = "paragraph";
|
||||
// jump line-by-line until empty one or EOF
|
||||
@@ -5677,7 +5626,7 @@
|
||||
// Generate tokens for input range
|
||||
|
||||
ParserBlock.prototype.tokenize = function(state, startLine, endLine) {
|
||||
- var ok, i, rules = this.ruler.getRules(""), len = rules.length, line = startLine, hasEmptyLines = false, maxNesting = state.md.options.maxNesting;
|
||||
+ var ok, i, prevLine, rules = this.ruler.getRules(""), len = rules.length, line = startLine, hasEmptyLines = false, maxNesting = state.md.options.maxNesting;
|
||||
while (line < endLine) {
|
||||
state.line = line = state.skipEmptyLines(line);
|
||||
if (line >= endLine) {
|
||||
@@ -5700,12 +5649,18 @@
|
||||
// - update `state.line`
|
||||
// - update `state.tokens`
|
||||
// - return true
|
||||
- for (i = 0; i < len; i++) {
|
||||
+ prevLine = state.line;
|
||||
+ for (i = 0; i < len; i++) {
|
||||
ok = rules[i](state, line, endLine, false);
|
||||
if (ok) {
|
||||
+ if (prevLine >= state.line) {
|
||||
+ throw new Error("block rule didn't increment state.line");
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
}
|
||||
+ // this can only happen if user disables paragraph rule
|
||||
+ if (!ok) throw new Error("none of the block rules matched");
|
||||
// set state.tight if we had an empty line before current tag
|
||||
// i.e. latest empty line should not count
|
||||
state.tight = !hasEmptyLines;
|
||||
@@ -5931,7 +5886,7 @@
|
||||
state.pos += openerLength;
|
||||
return true;
|
||||
}
|
||||
- matchStart = matchEnd = pos;
|
||||
+ matchEnd = pos;
|
||||
// Nothing found in the cache, scan until the end of the line (or until marker is found)
|
||||
while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1) {
|
||||
matchEnd = matchStart + 1;
|
||||
@@ -6485,7 +6440,7 @@
|
||||
}
|
||||
if (!silent) {
|
||||
token = state.push("html_inline", "", 0);
|
||||
- token.content = state.src.slice(pos, pos + match[0].length);
|
||||
+ token.content = match[0];
|
||||
if (isLinkOpen(token.content)) state.linkLevel++;
|
||||
if (isLinkClose(token.content)) state.linkLevel--;
|
||||
}
|
||||
@@ -6533,7 +6488,7 @@
|
||||
return false;
|
||||
};
|
||||
// For each opening emphasis-like marker find a matching closing one
|
||||
- function processDelimiters(state, delimiters) {
|
||||
+ function processDelimiters(delimiters) {
|
||||
var closerIdx, openerIdx, closer, opener, minOpenerIdx, newMinOpenerIdx, isOddMatch, lastJump, openersBottom = {}, max = delimiters.length;
|
||||
if (!max) return;
|
||||
// headerIdx is the first delimiter of the current (where closer is) delimiter run
|
||||
@@ -6617,10 +6572,10 @@
|
||||
}
|
||||
var balance_pairs = function link_pairs(state) {
|
||||
var curr, tokens_meta = state.tokens_meta, max = state.tokens_meta.length;
|
||||
- processDelimiters(state, state.delimiters);
|
||||
+ processDelimiters(state.delimiters);
|
||||
for (curr = 0; curr < max; curr++) {
|
||||
if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
|
||||
- processDelimiters(state, tokens_meta[curr].delimiters);
|
||||
+ processDelimiters(tokens_meta[curr].delimiters);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -6818,6 +6773,9 @@
|
||||
ok = rules[i](state, true);
|
||||
state.level--;
|
||||
if (ok) {
|
||||
+ if (pos >= state.pos) {
|
||||
+ throw new Error("inline rule didn't increment state.pos");
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -6839,17 +6797,21 @@
|
||||
// Generate tokens for input range
|
||||
|
||||
ParserInline.prototype.tokenize = function(state) {
|
||||
- var ok, i, rules = this.ruler.getRules(""), len = rules.length, end = state.posMax, maxNesting = state.md.options.maxNesting;
|
||||
+ var ok, i, prevPos, rules = this.ruler.getRules(""), len = rules.length, end = state.posMax, maxNesting = state.md.options.maxNesting;
|
||||
while (state.pos < end) {
|
||||
// Try all possible rules.
|
||||
// On success, rule should:
|
||||
// - update `state.pos`
|
||||
// - update `state.tokens`
|
||||
// - return true
|
||||
+ prevPos = state.pos;
|
||||
if (state.level < maxNesting) {
|
||||
for (i = 0; i < len; i++) {
|
||||
ok = rules[i](state, false);
|
||||
if (ok) {
|
||||
+ if (prevPos >= state.pos) {
|
||||
+ throw new Error("inline rule didn't increment state.pos");
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -8018,7 +7980,8 @@
|
||||
// something we shouldn't (e.g. `skype:name` treated as `skype:host`)
|
||||
if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
|
||||
try {
|
||||
- parsed.hostname = punycode.toASCII(parsed.hostname);
|
||||
+ var parsedUrl = new URL(parsed.href);
|
||||
+ parsed.hostname = parsedUrl.hostname;
|
||||
} catch (er) {}
|
||||
}
|
||||
}
|
||||
diff --git a/node_modules/markdown-it/dist/markdown-it.min.js b/node_modules/markdown-it/dist/markdown-it.min.js
|
||||
index 34201f4..bc76ca6 100644
|
||||
--- a/node_modules/markdown-it/dist/markdown-it.min.js
|
||||
+++ b/node_modules/markdown-it/dist/markdown-it.min.js
|
||||
@@ -1,3 +1,3 @@
|
||||
/*! markdown-it 13.0.1 https://github.com/markdown-it/markdown-it @license MIT */
|
||||
-!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).markdownit=r()}(this,(function(){"use strict";function e(e){if(e.__esModule)return e;var r=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var r={Aacute:"\xc1",aacute:"\xe1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223e",acd:"\u223f",acE:"\u223e\u0333",Acirc:"\xc2",acirc:"\xe2",acute:"\xb4",Acy:"\u0410",acy:"\u0430",AElig:"\xc6",aelig:"\xe6",af:"\u2061",Afr:"\ud835\udd04",afr:"\ud835\udd1e",Agrave:"\xc0",agrave:"\xe0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03b1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2a3f",amp:"&",AMP:"&",andand:"\u2a55",And:"\u2a53",and:"\u2227",andd:"\u2a5c",andslope:"\u2a58",andv:"\u2a5a",ang:"\u2220",ange:"\u29a4",angle:"\u2220",angmsdaa:"\u29a8",angmsdab:"\u29a9",angmsdac:"\u29aa",angmsdad:"\u29ab",angmsdae:"\u29ac",angmsdaf:"\u29ad",angmsdag:"\u29ae",angmsdah:"\u29af",angmsd:"\u2221",angrt:"\u221f",angrtvb:"\u22be",angrtvbd:"\u299d",angsph:"\u2222",angst:"\xc5",angzarr:"\u237c",Aogon:"\u0104",aogon:"\u0105",Aopf:"\ud835\udd38",aopf:"\ud835\udd52",apacir:"\u2a6f",ap:"\u2248",apE:"\u2a70",ape:"\u224a",apid:"\u224b",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224a",Aring:"\xc5",aring:"\xe5",Ascr:"\ud835\udc9c",ascr:"\ud835\udcb6",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224d",Atilde:"\xc3",atilde:"\xe3",Auml:"\xc4",auml:"\xe4",awconint:"\u2233",awint:"\u2a11",backcong:"\u224c",backepsilon:"\u03f6",backprime:"\u2035",backsim:"\u223d",backsimeq:"\u22cd",Backslash:"\u2216",Barv:"\u2ae7",barvee:"\u22bd",barwed:"\u2305",Barwed:"\u2306",barwedge:"\u2305",bbrk:"\u23b5",bbrktbrk:"\u23b6",bcong:"\u224c",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201e",becaus:"\u2235",because:"\u2235",Because:"\u2235",bemptyv:"\u29b0",bepsi:"\u03f6",bernou:"\u212c",Bernoullis:"\u212c",Beta:"\u0392",beta:"\u03b2",beth:"\u2136",between:"\u226c",Bfr:"\ud835\udd05",bfr:"\ud835\udd1f",bigcap:"\u22c2",bigcirc:"\u25ef",bigcup:"\u22c3",bigodot:"\u2a00",bigoplus:"\u2a01",bigotimes:"\u2a02",bigsqcup:"\u2a06",bigstar:"\u2605",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",biguplus:"\u2a04",bigvee:"\u22c1",bigwedge:"\u22c0",bkarow:"\u290d",blacklozenge:"\u29eb",blacksquare:"\u25aa",blacktriangle:"\u25b4",blacktriangledown:"\u25be",blacktriangleleft:"\u25c2",blacktriangleright:"\u25b8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20e5",bnequiv:"\u2261\u20e5",bNot:"\u2aed",bnot:"\u2310",Bopf:"\ud835\udd39",bopf:"\ud835\udd53",bot:"\u22a5",bottom:"\u22a5",bowtie:"\u22c8",boxbox:"\u29c9",boxdl:"\u2510",boxdL:"\u2555",boxDl:"\u2556",boxDL:"\u2557",boxdr:"\u250c",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxh:"\u2500",boxH:"\u2550",boxhd:"\u252c",boxHd:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxhu:"\u2534",boxHu:"\u2567",boxhU:"\u2568",boxHU:"\u2569",boxminus:"\u229f",boxplus:"\u229e",boxtimes:"\u22a0",boxul:"\u2518",boxuL:"\u255b",boxUl:"\u255c",boxUL:"\u255d",boxur:"\u2514",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255a",boxv:"\u2502",boxV:"\u2551",boxvh:"\u253c",boxvH:"\u256a",boxVh:"\u256b",boxVH:"\u256c",boxvl:"\u2524",boxvL:"\u2561",boxVl:"\u2562",boxVL:"\u2563",boxvr:"\u251c",boxvR:"\u255e",boxVr:"\u255f",boxVR:"\u2560",bprime:"\u2035",breve:"\u02d8",Breve:"\u02d8",brvbar:"\xa6",bscr:"\ud835\udcb7",Bscr:"\u212c",bsemi:"\u204f",bsim:"\u223d",bsime:"\u22cd",bsolb:"\u29c5",bsol:"\\",bsolhsub:"\u27c8",bull:"\u2022",bullet:"\u2022",bump:"\u224e",bumpE:"\u2aae",bumpe:"\u224f",Bumpeq:"\u224e",bumpeq:"\u224f",Cacute:"\u0106",cacute:"\u0107",capand:"\u2a44",capbrcup:"\u2a49",capcap:"\u2a4b",cap:"\u2229",Cap:"\u22d2",capcup:"\u2a47",capdot:"\u2a40",CapitalDifferentialD:"\u2145",caps:"\u2229\ufe00",caret:"\u2041",caron:"\u02c7",Cayleys:"\u212d",ccaps:"\u2a4d",Ccaron:"\u010c",ccaron:"\u010d",Ccedil:"\xc7",ccedil:"\xe7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2a4c",ccupssm:"\u2a50",Cdot:"\u010a",cdot:"\u010b",cedil:"\xb8",Cedilla:"\xb8",cemptyv:"\u29b2",cent:"\xa2",centerdot:"\xb7",CenterDot:"\xb7",cfr:"\ud835\udd20",Cfr:"\u212d",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03a7",chi:"\u03c7",circ:"\u02c6",circeq:"\u2257",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",circledast:"\u229b",circledcirc:"\u229a",circleddash:"\u229d",CircleDot:"\u2299",circledR:"\xae",circledS:"\u24c8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cir:"\u25cb",cirE:"\u29c3",cire:"\u2257",cirfnint:"\u2a10",cirmid:"\u2aef",cirscir:"\u29c2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201d",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",colon:":",Colon:"\u2237",Colone:"\u2a74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2
Line truncated
|
||||
-/*! https://mths.be/punycode v1.4.1 by @mathias */function Lr(e){throw new RangeError(qr[e])}function zr(e,r){for(var t=e.length,n=[];t--;)n[t]=r(e[t]);return n}function Tr(e,r){var t=e.split("@"),n="";return t.length>1&&(n=t[0]+"@",e=t[1]),n+zr((e=e.replace(Er,".")).split("."),r).join(".")}function Ir(e){for(var r,t,n=[],s=0,o=e.length;s<o;)(r=e.charCodeAt(s++))>=55296&&r<=56319&&s<o?56320==(64512&(t=e.charCodeAt(s++)))?n.push(((1023&r)<<10)+(1023&t)+65536):(n.push(r),s--):n.push(r);return n}function Mr(e){return zr(e,(function(e){var r="";return e>65535&&(r+=Fr((e-=65536)>>>10&1023|55296),e=56320|1023&e),r+=Fr(e)})).join("")}function Rr(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function Br(e,r,t){var n=0;for(e=t?Sr(e/700):e>>1,e+=Sr(e/r);e>455;n+=xr)e=Sr(e/35);return Sr(n+36*e/(e+38))}function Nr(e){var r,t,n,s,o,i,a,c,l,u,p,h=[],f=e.length,d=0,m=128,g=72;for((t=e.lastIndexOf("-"))<0&&(t=0),n=0;n<t;++n)e.charCodeAt(n)>=128&&Lr("not-basic"),h.push(e.charCodeAt(n));for(s=t>0?t+1:0;s<f;){for(o=d,i=1,a=xr;s>=f&&Lr("invalid-input"),((c=(p=e.charCodeAt(s++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:xr)>=xr||c>Sr((Ar-d)/i))&&Lr("overflow"),d+=c*i,!(c<(l=a<=g?1:a>=g+26?26:a-g));a+=xr)i>Sr(Ar/(u=xr-l))&&Lr("overflow"),i*=u;g=Br(d-o,r=h.length+1,0==o),Sr(d/r)>Ar-m&&Lr("overflow"),m+=Sr(d/r),d%=r,h.splice(d++,0,m)}return Mr(h)}function Or(e){var r,t,n,s,o,i,a,c,l,u,p,h,f,d,m,g=[];for(h=(e=Ir(e)).length,r=128,t=0,o=72,i=0;i<h;++i)(p=e[i])<128&&g.push(Fr(p));for(n=s=g.length,s&&g.push("-");n<h;){for(a=Ar,i=0;i<h;++i)(p=e[i])>=r&&p<a&&(a=p);for(a-r>Sr((Ar-t)/(f=n+1))&&Lr("overflow"),t+=(a-r)*f,r=a,i=0;i<h;++i)if((p=e[i])<r&&++t>Ar&&Lr("overflow"),p==r){for(c=t,l=xr;!(c<(u=l<=o?1:l>=o+26?26:l-o));l+=xr)m=c-u,d=xr-u,g.push(Fr(Rr(u+m%d,0))),c=Sr(m/d);g.push(Fr(Rr(c,0))),o=Br(t,f,n==s),t=0,++n}++t,++r}return g.join("")}function Pr(e){return Tr(e,(function(e){return Dr.test(e)?Nr(e.slice(4).toLowerCase()):e}))}function jr(e){return Tr(e,(function(e){return wr.test(e)?"xn--"+Or(e):e}))}var Ur="1.4.1",Vr={decode:Ir,encode:Mr},Zr={version:Ur,ucs2:Vr,toASCII:jr,toUnicode:Pr,encode:Or,decode:Nr},$r=e(Object.freeze({__proto__:null,decode:Nr,encode:Or,toUnicode:Pr,toASCII:jr,version:Ur,ucs2:Vr,default:Zr})),Gr={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},Hr=/^(vbscript|javascript|file|data):/,Jr=/^data:image\/(gif|png|jpeg|webp);/;function Wr(e){var r=e.trim().toLowerCase();return!Hr.test(r)||!!Jr.test(r)}var Yr=["http:","https:","mailto:"];function Kr(e){var r=C.parse(e,!0);if(r.hostname&&(!r.protocol||Yr.indexOf(r.protocol)>=0))try{r.hostname=$r.toASCII(r.hostname)}catch(e){}return C.encode(C.format(r))}function Qr(e){var r=C.parse(e,!0);if(r.hostname&&(!r.protocol||Yr.indexOf(r.protocol)>=0))try{r.hostname=$r.toUnicode(r.hostname)}catch(e){}return C.decode(C.format(r),C.decode.defaultChars+"%")}function Xr(e,r){if(!(this instanceof Xr))return new Xr(e,r);r||w.isString(e)||(r=e||{},e="default"),this.inline=new ur,this.block=new ze,this.core=new ue,this.renderer=new B,this.linkify=new yr,this.validateLink=Wr,this.normalizeLink=Kr,this.normalizeLinkText=Qr,this.utils=w,this.helpers=w.assign({},L),this.options={},this.configure(e),r&&this.set(r)}return Xr.prototype.set=function(e){return w.assign(this.options,e),this},Xr.prototype.configure=function(e){var r,t=this;if(w.isString(e)&&!(e=Gr[r=e]))throw new Error('Wrong `markdown-it` preset "'+r+'", check name');if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach((function(r){e.components[r].rules&&t[r].ruler.enableOnly(e.components[r].rules),e.components[r].rules2&&t[r].ruler2.enableOnly(e.components[r].rules2)})),this},Xr.prototype.enable=function(e,r){var t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach((function(r){t=t.concat(this[r].ruler.enable(e,!0))}),this),t=t.concat(this.inline.ruler2.enable(e,!0));var n=e.filter((function(e){return t.indexOf(e)<0}));if(n.length&&!r)throw new Error("Mark
Line truncated
|
||||
+!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).markdownit=r()}(this,(function(){"use strict";function e(e){if(e.__esModule)return e;var r=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var r={Aacute:"\xc1",aacute:"\xe1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223e",acd:"\u223f",acE:"\u223e\u0333",Acirc:"\xc2",acirc:"\xe2",acute:"\xb4",Acy:"\u0410",acy:"\u0430",AElig:"\xc6",aelig:"\xe6",af:"\u2061",Afr:"\ud835\udd04",afr:"\ud835\udd1e",Agrave:"\xc0",agrave:"\xe0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03b1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2a3f",amp:"&",AMP:"&",andand:"\u2a55",And:"\u2a53",and:"\u2227",andd:"\u2a5c",andslope:"\u2a58",andv:"\u2a5a",ang:"\u2220",ange:"\u29a4",angle:"\u2220",angmsdaa:"\u29a8",angmsdab:"\u29a9",angmsdac:"\u29aa",angmsdad:"\u29ab",angmsdae:"\u29ac",angmsdaf:"\u29ad",angmsdag:"\u29ae",angmsdah:"\u29af",angmsd:"\u2221",angrt:"\u221f",angrtvb:"\u22be",angrtvbd:"\u299d",angsph:"\u2222",angst:"\xc5",angzarr:"\u237c",Aogon:"\u0104",aogon:"\u0105",Aopf:"\ud835\udd38",aopf:"\ud835\udd52",apacir:"\u2a6f",ap:"\u2248",apE:"\u2a70",ape:"\u224a",apid:"\u224b",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224a",Aring:"\xc5",aring:"\xe5",Ascr:"\ud835\udc9c",ascr:"\ud835\udcb6",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224d",Atilde:"\xc3",atilde:"\xe3",Auml:"\xc4",auml:"\xe4",awconint:"\u2233",awint:"\u2a11",backcong:"\u224c",backepsilon:"\u03f6",backprime:"\u2035",backsim:"\u223d",backsimeq:"\u22cd",Backslash:"\u2216",Barv:"\u2ae7",barvee:"\u22bd",barwed:"\u2305",Barwed:"\u2306",barwedge:"\u2305",bbrk:"\u23b5",bbrktbrk:"\u23b6",bcong:"\u224c",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201e",becaus:"\u2235",because:"\u2235",Because:"\u2235",bemptyv:"\u29b0",bepsi:"\u03f6",bernou:"\u212c",Bernoullis:"\u212c",Beta:"\u0392",beta:"\u03b2",beth:"\u2136",between:"\u226c",Bfr:"\ud835\udd05",bfr:"\ud835\udd1f",bigcap:"\u22c2",bigcirc:"\u25ef",bigcup:"\u22c3",bigodot:"\u2a00",bigoplus:"\u2a01",bigotimes:"\u2a02",bigsqcup:"\u2a06",bigstar:"\u2605",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",biguplus:"\u2a04",bigvee:"\u22c1",bigwedge:"\u22c0",bkarow:"\u290d",blacklozenge:"\u29eb",blacksquare:"\u25aa",blacktriangle:"\u25b4",blacktriangledown:"\u25be",blacktriangleleft:"\u25c2",blacktriangleright:"\u25b8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20e5",bnequiv:"\u2261\u20e5",bNot:"\u2aed",bnot:"\u2310",Bopf:"\ud835\udd39",bopf:"\ud835\udd53",bot:"\u22a5",bottom:"\u22a5",bowtie:"\u22c8",boxbox:"\u29c9",boxdl:"\u2510",boxdL:"\u2555",boxDl:"\u2556",boxDL:"\u2557",boxdr:"\u250c",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxh:"\u2500",boxH:"\u2550",boxhd:"\u252c",boxHd:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxhu:"\u2534",boxHu:"\u2567",boxhU:"\u2568",boxHU:"\u2569",boxminus:"\u229f",boxplus:"\u229e",boxtimes:"\u22a0",boxul:"\u2518",boxuL:"\u255b",boxUl:"\u255c",boxUL:"\u255d",boxur:"\u2514",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255a",boxv:"\u2502",boxV:"\u2551",boxvh:"\u253c",boxvH:"\u256a",boxVh:"\u256b",boxVH:"\u256c",boxvl:"\u2524",boxvL:"\u2561",boxVl:"\u2562",boxVL:"\u2563",boxvr:"\u251c",boxvR:"\u255e",boxVr:"\u255f",boxVR:"\u2560",bprime:"\u2035",breve:"\u02d8",Breve:"\u02d8",brvbar:"\xa6",bscr:"\ud835\udcb7",Bscr:"\u212c",bsemi:"\u204f",bsim:"\u223d",bsime:"\u22cd",bsolb:"\u29c5",bsol:"\\",bsolhsub:"\u27c8",bull:"\u2022",bullet:"\u2022",bump:"\u224e",bumpE:"\u2aae",bumpe:"\u224f",Bumpeq:"\u224e",bumpeq:"\u224f",Cacute:"\u0106",cacute:"\u0107",capand:"\u2a44",capbrcup:"\u2a49",capcap:"\u2a4b",cap:"\u2229",Cap:"\u22d2",capcup:"\u2a47",capdot:"\u2a40",CapitalDifferentialD:"\u2145",caps:"\u2229\ufe00",caret:"\u2041",caron:"\u02c7",Cayleys:"\u212d",ccaps:"\u2a4d",Ccaron:"\u010c",ccaron:"\u010d",Ccedil:"\xc7",ccedil:"\xe7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2a4c",ccupssm:"\u2a50",Cdot:"\u010a",cdot:"\u010b",cedil:"\xb8",Cedilla:"\xb8",cemptyv:"\u29b2",cent:"\xa2",centerdot:"\xb7",CenterDot:"\xb7",cfr:"\ud835\udd20",Cfr:"\u212d",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03a7",chi:"\u03c7",circ:"\u02c6",circeq:"\u2257",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",circledast:"\u229b",circledcirc:"\u229a",circleddash:"\u229d",CircleDot:"\u2299",circledR:"\xae",circledS:"\u24c8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cir:"\u25cb",cirE:"\u29c3",cire:"\u2257",cirfnint:"\u2a10",cirmid:"\u2aef",cirscir:"\u29c2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201d",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",colon:":",Colon:"\u2237",Colone:"\u2a74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2
Line truncated
|
||||
+/*! https://mths.be/punycode v1.4.1 by @mathias */function jr(e){throw new RangeError(Br[e])}function Ur(e,r){for(var t=e.length,n=[];t--;)n[t]=r(e[t]);return n}function Vr(e,r){var t=e.split("@"),n="";return t.length>1&&(n=t[0]+"@",e=t[1]),n+Ur((e=e.replace(Mr,".")).split("."),r).join(".")}function Zr(e){for(var r,t,n=[],s=0,o=e.length;s<o;)(r=e.charCodeAt(s++))>=55296&&r<=56319&&s<o?56320==(64512&(t=e.charCodeAt(s++)))?n.push(((1023&r)<<10)+(1023&t)+65536):(n.push(r),s--):n.push(r);return n}function $r(e){return Ur(e,(function(e){var r="";return e>65535&&(r+=Pr((e-=65536)>>>10&1023|55296),e=56320|1023&e),r+=Pr(e)})).join("")}function Gr(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function Hr(e,r,t){var n=0;for(e=t?Or(e/Fr):e>>1,e+=Or(e/r);e>Nr*qr>>1;n+=Dr)e=Or(e/Nr);return Or(n+(Nr+1)*e/(e+Sr))}function Jr(e){var r,t,n,s,o,i,a,c,l,u,p,h=[],f=e.length,d=0,m=zr,g=Lr;for((t=e.lastIndexOf(Tr))<0&&(t=0),n=0;n<t;++n)e.charCodeAt(n)>=128&&jr("not-basic"),h.push(e.charCodeAt(n));for(s=t>0?t+1:0;s<f;){for(o=d,i=1,a=Dr;s>=f&&jr("invalid-input"),((c=(p=e.charCodeAt(s++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:Dr)>=Dr||c>Or((wr-d)/i))&&jr("overflow"),d+=c*i,!(c<(l=a<=g?Er:a>=g+qr?qr:a-g));a+=Dr)i>Or(wr/(u=Dr-l))&&jr("overflow"),i*=u;g=Hr(d-o,r=h.length+1,0==o),Or(d/r)>wr-m&&jr("overflow"),m+=Or(d/r),d%=r,h.splice(d++,0,m)}return $r(h)}function Wr(e){var r,t,n,s,o,i,a,c,l,u,p,h,f,d,m,g=[];for(h=(e=Zr(e)).length,r=zr,t=0,o=Lr,i=0;i<h;++i)(p=e[i])<128&&g.push(Pr(p));for(n=s=g.length,s&&g.push(Tr);n<h;){for(a=wr,i=0;i<h;++i)(p=e[i])>=r&&p<a&&(a=p);for(a-r>Or((wr-t)/(f=n+1))&&jr("overflow"),t+=(a-r)*f,r=a,i=0;i<h;++i)if((p=e[i])<r&&++t>wr&&jr("overflow"),p==r){for(c=t,l=Dr;!(c<(u=l<=o?Er:l>=o+qr?qr:l-o));l+=Dr)m=c-u,d=Dr-u,g.push(Pr(Gr(u+m%d,0))),c=Or(m/d);g.push(Pr(Gr(c,0))),o=Hr(t,f,n==s),t=0,++n}++t,++r}return g.join("")}function Yr(e){return Vr(e,(function(e){return Ir.test(e)?Jr(e.slice(4).toLowerCase()):e}))}function Kr(e){return Vr(e,(function(e){return Rr.test(e)?"xn--"+Wr(e):e}))}var Qr="1.4.1",Xr={decode:Zr,encode:$r},et={version:Qr,ucs2:Xr,toASCII:Kr,toUnicode:Yr,encode:Wr,decode:Jr},rt=e(Object.freeze({__proto__:null,decode:Jr,encode:Wr,toUnicode:Yr,toASCII:Kr,version:Qr,ucs2:Xr,default:et})),tt={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},nt=/^(vbscript|javascript|file|data):/,st=/^data:image\/(gif|png|jpeg|webp);/;function ot(e){var r=e.trim().toLowerCase();return!nt.test(r)||!!st.test(r)}var it=["http:","https:","mailto:"];function at(e){var r=y.parse(e,!0);if(r.hostname&&(!r.protocol||it.indexOf(r.protocol)>=0))try{var t=new URL(r.href);r.hostname=t.hostname}catch(e){}return y.encode(y.format(r))}function ct(e){var r=y.parse(e,!0);if(r.hostname&&(!r.protocol||it.indexOf(r.protocol)>=0))try{r.hostname=rt.toUnicode(r.hostname)}catch(e){}return y.decode(y.format(r),y.decode.defaultChars+"%")}function lt(e,r){if(!(this instanceof lt))return new lt(e,r);r||D.isString(e)||(r=e||{},e="default"),this.inline=new ur,this.block=new ze,this.core=new ue,this.renderer=new B,this.linkify=new xr,this.validateLink=ot,this.normalizeLink=at,this.normalizeLinkText=ct,this.utils=D,this.helpers=D.assign({},L),this.options={},this.configure(e),r&&this.set(r)}return lt.prototype.set=function(e){return D.assign(this.options,e),this},lt.prototype.configure=function(e){var r,t=this;if(D.isString(e)&&!(e=tt[r=e]))throw new Error('Wrong `markdown-it` preset "'+r+'", check name');if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach((function(r){e.components[r].rules&&t[r].ruler.enableOnly(e.components[r].rules),e.components[r].rules2&&t[r].ruler2.enableOnly(e.components[r].rules2)})),this},lt.prototype.enable=function(e,r){var t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach((function(r){t=t.concat(this[r].ruler.enable(e,!0))}),this),t=t.concat(this.inline.ruler2.enable(e,!0));var n=e.filter((function(e){return t.indexOf(e)<0}));if(n.length&&!r)throw
Line truncated
|
||||
diff --git a/node_modules/markdown-it/lib/index.js b/node_modules/markdown-it/lib/index.js
|
||||
index afec8d8..94f01f0 100644
|
||||
--- a/node_modules/markdown-it/lib/index.js
|
||||
+++ b/node_modules/markdown-it/lib/index.js
|
||||
@@ -56,7 +56,8 @@ function normalizeLink(url) {
|
||||
//
|
||||
if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
|
||||
try {
|
||||
- parsed.hostname = punycode.toASCII(parsed.hostname);
|
||||
+ var parsedUrl = new URL(parsed.href);
|
||||
+ parsed.hostname = parsedUrl.hostname;
|
||||
} catch (er) { /**/ }
|
||||
}
|
||||
}
|
||||
Generated
+857
-478
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,9 @@
|
||||
name = "knossos"
|
||||
main = "./.output/server/index.mjs"
|
||||
workers_dev = true
|
||||
compatibility_date = "2022-07-12"
|
||||
account_id = "9ddae624c98677d68d93df6e524a6061"
|
||||
node_compat = true
|
||||
|
||||
[site]
|
||||
bucket = ".output/public"
|
||||
Reference in new issue
Block a user