Add documentation

This commit is contained in:
mrjvs 2023-09-05 22:18:59 +02:00
parent 6c445c33cf
commit 26e8653ce4
8 changed files with 1450 additions and 19 deletions

3
.docs/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules
.vitepress/cache
.vitepress/dist

View File

@ -0,0 +1,28 @@
import { defineConfig } from 'vitepress'
export default defineConfig({
title: "MW provider docs",
description: "Documentation for @movie-web/providers",
srcDir: "src",
themeConfig: {
nav: [
{ text: 'Home', link: '/' },
{ text: 'Get Started', link: '/get-started/start' },
{ text: 'Reference', link: '/reference/start' }
],
sidebar: [
{
text: 'Examples',
items: [
{ text: 'Markdown Examples', link: '/markdown-examples' },
{ text: 'Runtime API Examples', link: '/api-examples' }
]
}
],
socialLinks: [
{ icon: 'github', link: 'https://github.com/movie-web/providers' }
]
}
})

1252
.docs/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

9
.docs/package.json Normal file
View File

@ -0,0 +1,9 @@
{
"scripts": {
"dev": "vitepress dev .",
"build": "vitepress build ."
},
"devDependencies": {
"vitepress": "^1.0.0-rc.10"
}
}

View File

@ -0,0 +1,49 @@
---
outline: deep
---
# Runtime API Examples
This page demonstrates usage of some of the runtime APIs provided by VitePress.
The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
```md
<script setup>
import { useData } from 'vitepress'
const { theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```
<script setup>
import { useData } from 'vitepress'
const { site, theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>
## More
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).

24
.docs/src/index.md Normal file
View File

@ -0,0 +1,24 @@
---
layout: home
hero:
name: "@movie-web/providers"
tagline: Providers for all kinds of media
actions:
- theme: brand
text: Get Started
link: /get-started/start
- theme: alt
text: reference
link: /reference/start
features:
- title: All the scraping!
icon: '!'
details: scrape popular streaming websites
- title: Client & server
icon: '!'
details: This library can be ran both server-side and client-side (with CORS proxy)
---

View File

@ -0,0 +1,85 @@
# Markdown Extension Examples
This page demonstrates some of the built-in markdown extensions provided by VitePress.
## Syntax Highlighting
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
**Input**
````
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````
**Output**
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
## Custom Containers
**Input**
```md
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
```
**Output**
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
## More
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

View File

@ -1,19 +0,0 @@
async function example() {
const providers = makeProviders({
fetcher: makeStandardFetcher(fetch),
});
const source = await providers.runAll({
media: {
title: 'Spider-Man: Across the Spider-Verse',
releaseYear: 2023,
imbdId: 'tt9362722',
tmdbId: '569094',
type: 'movie',
},
});
if (!source) throw new Error("Couldn't find a stream");
if (source.stream.type === 'file') return source.stream.qualities['1080']?.url;
if (source.stream.type === 'hls') return source.stream.playlist;
}