style: lint fix
This commit is contained in:
parent
89e0cb04e8
commit
520dce22c1
@ -1,12 +1,12 @@
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import process from 'node:process'
|
||||
import fs from 'node:fs'
|
||||
import { execaCommand } from 'execa'
|
||||
import { DeployType, Mode } from './constants.js'
|
||||
import { createPackageJson } from './packageJson.js'
|
||||
import { createRender } from './render.js'
|
||||
import { getTemplate, readFiles, readJsonFile, writeFiles } from './utils/index.js'
|
||||
import type { File, ResolvedData } from './types.js'
|
||||
import { DeployType, Mode } from './constants.js'
|
||||
|
||||
export async function generate(mode: Mode, data: ResolvedData): Promise<void> {
|
||||
const cwd = process.cwd()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import cac from 'cac'
|
||||
import { run } from './run.js'
|
||||
import { Mode } from './constants.js'
|
||||
import { run } from './run.js'
|
||||
|
||||
declare const __CLI_VERSION__: string
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import type { Langs, Locale } from '../types.js'
|
||||
import { en } from './en.js'
|
||||
import { zh } from './zh.js'
|
||||
import type { Langs, Locale } from '../types.js'
|
||||
|
||||
export const locales: Record<Langs, Locale> = {
|
||||
'zh-CN': zh,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { execaCommand } from 'execa'
|
||||
import { kebabCase } from '@pengzhanbo/utils'
|
||||
import { execaCommand } from 'execa'
|
||||
import { Mode } from './constants.js'
|
||||
import { getDependenciesVersion, readJsonFile, resolve } from './utils/index.js'
|
||||
import type { File, ResolvedData } from './types.js'
|
||||
import { Mode } from './constants.js'
|
||||
|
||||
export async function createPackageJson(
|
||||
mode: Mode,
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import process from 'node:process'
|
||||
import { createRequire } from 'node:module'
|
||||
import process from 'node:process'
|
||||
import { cancel, confirm, group, select, text } from '@clack/prompts'
|
||||
import { bundlerOptions, deployOptions, DeployType, languageOptions, Mode } from './constants.js'
|
||||
import { setLang, t } from './translate.js'
|
||||
import type { Bundler, Langs, Options, PromptResult } from './types.js'
|
||||
import { DeployType, Mode, bundlerOptions, deployOptions, languageOptions } from './constants.js'
|
||||
|
||||
const require = createRequire(process.cwd())
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import handlebars from 'handlebars'
|
||||
import { kebabCase } from '@pengzhanbo/utils'
|
||||
import handlebars from 'handlebars'
|
||||
import type { ResolvedData } from './types.js'
|
||||
|
||||
export interface RenderData extends ResolvedData {
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
import process from 'node:process'
|
||||
import path from 'node:path'
|
||||
import process from 'node:process'
|
||||
import { intro, outro, spinner } from '@clack/prompts'
|
||||
import { execaCommand } from 'execa'
|
||||
import colors from 'picocolors'
|
||||
import { prompt } from './prompt.js'
|
||||
import { generate } from './generate.js'
|
||||
import { t } from './translate.js'
|
||||
import { Mode } from './constants.js'
|
||||
import type { PromptResult, ResolvedData } from './types.js'
|
||||
import { generate } from './generate.js'
|
||||
import { prompt } from './prompt.js'
|
||||
import { t } from './translate.js'
|
||||
import { getPackageManager } from './utils/index.js'
|
||||
import type { PromptResult, ResolvedData } from './types.js'
|
||||
|
||||
export async function run(mode: Mode, root?: string) {
|
||||
intro(colors.cyan('Welcome to VuePress and vuepress-theme-plume !'))
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { Langs, Locale } from './types.js'
|
||||
import { locales } from './locales/index.js'
|
||||
import type { Langs, Locale } from './types.js'
|
||||
|
||||
function createTranslate(lang?: Langs) {
|
||||
let current: Langs = lang || 'en-US'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import path from 'node:path'
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import type { File } from '../types.js'
|
||||
|
||||
export async function readFiles(root: string): Promise<File[]> {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
export const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
@ -7,6 +7,6 @@ export const resolve = (...args: string[]) => path.resolve(__dirname, '../', ...
|
||||
|
||||
export const getTemplate = (dir: string) => resolve('templates', dir)
|
||||
|
||||
export * from './fs.js'
|
||||
export * from './depsVersion.js'
|
||||
export * from './fs.js'
|
||||
export * from './getPackageManager.js'
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { type ClientConfig, defineClientConfig } from 'vuepress/client'
|
||||
import HeroTintPlateConfig from './themes/components/HeroTintPlateConfig.vue'
|
||||
import CanIUseConfig from './themes/components/CanIUseConfig.vue'
|
||||
import Demos from './themes/components/Demos.vue'
|
||||
import ThemeColors from './themes/components/ThemeColors.vue'
|
||||
import Contributors from './themes/components/Contributors.vue'
|
||||
import Demos from './themes/components/Demos.vue'
|
||||
import HeroTintPlateConfig from './themes/components/HeroTintPlateConfig.vue'
|
||||
import ThemeColors from './themes/components/ThemeColors.vue'
|
||||
import { setupThemeColors } from './themes/composables/theme-colors.js'
|
||||
|
||||
export default defineClientConfig({
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as path from 'node:path'
|
||||
import { type UserConfig, defineUserConfig } from 'vuepress'
|
||||
import { viteBundler } from '@vuepress/bundler-vite'
|
||||
import { addViteOptimizeDepsInclude, addViteSsrExternal } from '@vuepress/helper'
|
||||
import { defineUserConfig, type UserConfig } from 'vuepress'
|
||||
import { peerDependencies } from '../package.json'
|
||||
import { theme } from './theme.js'
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { defineNotesConfig } from 'vuepress-theme-plume'
|
||||
import { themeGuide } from './theme-guide'
|
||||
import { themeConfig } from './theme-config'
|
||||
import { plugins } from './plugins'
|
||||
import { themeConfig } from './theme-config'
|
||||
import { themeGuide } from './theme-guide'
|
||||
import { tools } from './tools'
|
||||
|
||||
export const zhNotes = defineNotesConfig({
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { defineThemeConfig } from 'vuepress-theme-plume'
|
||||
import { enNotes, zhNotes } from './notes/index.js'
|
||||
import { enNavbar, zhNavbar } from './navbar.js'
|
||||
import { enNotes, zhNotes } from './notes/index.js'
|
||||
|
||||
export default defineThemeConfig({
|
||||
logo: '/plume.png',
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import '@simonwep/pickr/dist/themes/nano.min.css'
|
||||
import { onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import '@simonwep/pickr/dist/themes/nano.min.css'
|
||||
|
||||
const emit = defineEmits<{ (e: 'update:modelValue', value: string): void }>()
|
||||
|
||||
|
||||
@ -1,14 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
defineProps<{
|
||||
contributors: string[]
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps<{
|
||||
contributors: ({ github: string, name: string } | string)[]
|
||||
}>()
|
||||
|
||||
const list = computed(() =>
|
||||
props.contributors.map(contributor =>
|
||||
typeof contributor === 'string' ? { github: contributor, name: contributor } : contributor),
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="contributors">
|
||||
<div v-for="contributor in contributors" :key="contributor" class="contributor">
|
||||
<img :src="`https://github.com/${contributor}.png`" :alt="contributor">
|
||||
<a :href="`https://github.com/${contributor}`" target="_blank" rel="noopener noreferrer">{{ contributor }}</a>
|
||||
<div v-for="contributor in list" :key="contributor.github" class="contributor">
|
||||
<img :src="`https://avatars.githubusercontent.com/${contributor.github}?v=4`" :alt="contributor.name">
|
||||
<a :href="`https://github.com/${contributor.github}`" target="_blank" rel="noopener noreferrer">{{ contributor.name }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { PlumeThemeHomeHeroTintPlate } from 'vuepress-theme-plume/client'
|
||||
import { computed, watch } from 'vue'
|
||||
import type { PlumeThemeHomeHeroTintPlate } from 'vuepress-theme-plume/client'
|
||||
import InputRange from './InputRange.vue'
|
||||
|
||||
const min = 20
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import VPHomeHero from 'vuepress-theme-plume/components/Home/VPHomeHero.vue'
|
||||
import { useDarkMode } from 'vuepress-theme-plume/composables'
|
||||
import type { PlumeThemeHomeHeroTintPlate } from 'vuepress-theme-plume/client'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import CodeViewer from './CodeViewer.vue'
|
||||
import CustomTintPlate from './CustomTintPlate.vue'
|
||||
import DemoWrapper from './DemoWrapper.vue'
|
||||
import SingleTintPlate from './SingleTintPlate.vue'
|
||||
import TripletTintPlate from './TripletTintPlate.vue'
|
||||
import CustomTintPlate from './CustomTintPlate.vue'
|
||||
import CodeViewer from './CodeViewer.vue'
|
||||
|
||||
type Mode = 'single' | 'triplet' | 'custom'
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import VPButton from '@theme/VPButton.vue'
|
||||
import { useThemeColors } from '../composables/theme-colors.js'
|
||||
import ColorPick from './ColorPick.vue'
|
||||
import CodeViewer from './CodeViewer.vue'
|
||||
import ColorPick from './ColorPick.vue'
|
||||
|
||||
const { lightColors, darkColors, css, reset } = useThemeColors()
|
||||
</script>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { type Ref, computed, onMounted, readonly, ref, watch } from 'vue'
|
||||
import { onClickOutside, useDebounceFn, useEventListener, useLocalStorage } from '@vueuse/core'
|
||||
import { computed, onMounted, readonly, type Ref, ref, watch } from 'vue'
|
||||
|
||||
interface Feature {
|
||||
label: string
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { type InjectionKey, type Ref, inject, provide, watch } from 'vue'
|
||||
import { useSessionStorage, useStyleTag } from '@vueuse/core'
|
||||
import { inject, type InjectionKey, provide, type Ref, watch } from 'vue'
|
||||
|
||||
export interface ThemeColor {
|
||||
name: string
|
||||
|
||||
@ -172,12 +172,12 @@ export default defineUserConfig({
|
||||
<Contributors
|
||||
:contributors="[
|
||||
'pengzhanbo',
|
||||
'huankong233',
|
||||
'northword',
|
||||
{ github: 'huankong233', name: 'huan_kong' },
|
||||
{ github: 'northword', name: 'Northword' },
|
||||
'KrLite',
|
||||
'shylock-wu',
|
||||
'hrradev',
|
||||
'TheCoderAlex'
|
||||
{ github: 'TheCoderAlex', name: 'Tang Zifeng' },
|
||||
]"
|
||||
/>
|
||||
|
||||
|
||||
@ -49,8 +49,8 @@ pnpm add @vuepress-plume/plugin-caniuse
|
||||
@tab .vuepress/config.ts
|
||||
|
||||
``` ts
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { caniusePlugin } from '@vuepress-plume/plugin-caniuse'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
|
||||
export default defineUserConfig({
|
||||
plugins: [
|
||||
|
||||
@ -56,8 +56,8 @@ yarn add @vuepress-plume/plugin-content-update
|
||||
@tab .vuepress/config.ts
|
||||
|
||||
``` ts
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { contentUpdatePlugin } from '@vuepress-plume/plugin-content-update'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
|
||||
export default defineUserConfig({
|
||||
plugins: [
|
||||
@ -86,8 +86,8 @@ onContentUpdated(() => {
|
||||
|
||||
```vue
|
||||
<script lang="ts" setup>
|
||||
import { onContentUpdated } from '@vuepress-plume/plugin-content-update/client'
|
||||
import { useMediumZoom } from '@vuepress/plugin-medium-zoom/client'
|
||||
import { onContentUpdated } from '@vuepress-plume/plugin-content-update/client'
|
||||
|
||||
const mediumZoom = useMediumZoom()
|
||||
|
||||
|
||||
@ -12,8 +12,8 @@ permalink: /config/plugins/
|
||||
所有主题内部使用的插件, 均在 `plugins` 字段中进行配置。
|
||||
|
||||
``` js
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
|
||||
@ -16,8 +16,8 @@ permalink: /config/plugin/markdown-power/
|
||||
默认配置:
|
||||
|
||||
```ts
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
|
||||
@ -14,8 +14,8 @@ permalink: /config/plugins/markdown-enhance/
|
||||
默认配置:
|
||||
|
||||
```ts
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
|
||||
@ -40,8 +40,8 @@ Shiki 支持多种编程语言。
|
||||
默认配置:
|
||||
|
||||
```ts
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
|
||||
@ -14,8 +14,8 @@ permalink: /config/plugins/reading-time/
|
||||
默认配置:
|
||||
|
||||
```ts
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
|
||||
@ -30,8 +30,8 @@ VuePress 站点的基本配置文件是 `.vuepress/config.js` ,但也同样支
|
||||
|
||||
```ts
|
||||
import { viteBundler } from '@vuepress/bundler-vite'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
export default defineUserConfig({
|
||||
bundler: viteBundler(),
|
||||
@ -61,8 +61,8 @@ export default defineUserConfig({
|
||||
一般我们使用 `.vuepress/config.js` 或者 `.vuepress/config.ts` 来配置主题。
|
||||
|
||||
```ts
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
@ -122,8 +122,8 @@ export default defineThemeConfig({
|
||||
|
||||
```ts
|
||||
import path from 'node:path'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
|
||||
@ -33,8 +33,8 @@ import { Layout, NotFound } from 'vuepress-theme-plume/client'
|
||||
更多其他组件请查看 [源代码](https://github.com/pengzhanbo/vuepress-theme-plume/tree/main/theme/src/client/components)
|
||||
|
||||
```ts
|
||||
import VPLink from 'vuepress-theme-plume/components/VPLink.vue'
|
||||
import VPButton from 'vuepress-theme-plume/components/VPButton.vue'
|
||||
import VPLink from 'vuepress-theme-plume/components/VPLink.vue'
|
||||
```
|
||||
|
||||
## 组合式 API
|
||||
|
||||
@ -189,8 +189,8 @@ config:
|
||||
(还可以在重新修改 分类页/标签页/归档页的链接地址)
|
||||
|
||||
```ts
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
|
||||
@ -54,8 +54,8 @@ export default defineUserConfig({
|
||||
`locales` 支持 所有主题配置项。
|
||||
|
||||
```js
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from '@vuepress-plume/vuepress-theme-plume'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
|
||||
export default defineUserConfig({
|
||||
lang: 'en-US',
|
||||
|
||||
@ -196,8 +196,8 @@ cd open-source # 进入 D: 分区下的 open-source 目录
|
||||
@tab docs/.vuepress/config.js
|
||||
|
||||
``` ts :no-line-numbers
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { viteBundler } from '@vuepress/bundler-vite'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
export default defineUserConfig({
|
||||
|
||||
@ -53,8 +53,8 @@ import { Layout } from 'vuepress-theme-plume/client'
|
||||
也可以使用 渲染函数 实现注入内容,在 `.vuepress/client.ts` 中:
|
||||
|
||||
```ts
|
||||
import { defineClientConfig } from 'vuepress/client'
|
||||
import { h } from 'vue'
|
||||
import { defineClientConfig } from 'vuepress/client'
|
||||
import { Layout } from 'vuepress-theme-plume/client'
|
||||
import CustomContent from './components/CustomContent.vue'
|
||||
|
||||
|
||||
@ -24,9 +24,9 @@ permalink: /guide/component-overrides/
|
||||
如果你想要覆写 `VPFooter.vue` 组件,只需要在配置文件 `.vuepress/config.ts` 中覆盖这个别名即可:
|
||||
|
||||
```ts
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import { defineUserConfig } from 'vuepress'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import { plumeTheme } from 'vuepress-theme-plume'
|
||||
|
||||
const __dirname = getDirname(import.meta.url)
|
||||
|
||||
|
||||
@ -21,10 +21,10 @@ permalink: /guide/custom-style/
|
||||
@tab .vuepress/client.ts
|
||||
|
||||
```ts {1}
|
||||
import './styles/index.css'
|
||||
|
||||
import { defineClientConfig } from 'vuepress/client'
|
||||
|
||||
import './styles/index.css'
|
||||
|
||||
export default defineClientConfig({
|
||||
// ...
|
||||
})
|
||||
|
||||
@ -49,8 +49,8 @@ cupiditate sequi.
|
||||
|
||||
@tab TS
|
||||
```ts
|
||||
import MarkdownIt from 'markdown-it'
|
||||
import { include } from '@mdit/plugin-include'
|
||||
import MarkdownIt from 'markdown-it'
|
||||
|
||||
// #region snippet
|
||||
const mdIt = MarkdownIt().use(include, {
|
||||
@ -66,8 +66,8 @@ mdIt.render('<!-- @include: ./path/to/include/file.md -->', {
|
||||
|
||||
@tab JS
|
||||
```js
|
||||
const MarkdownIt = require('markdown-it')
|
||||
const { include } = require('@mdit/plugin-include')
|
||||
const MarkdownIt = require('markdown-it')
|
||||
|
||||
// #region snippet
|
||||
const mdIt = MarkdownIt().use(include, {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
|
||||
const __dirname = getDirname(import.meta.url)
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
import { defineConfig, type Options } from 'tsup'
|
||||
|
||||
const clientExternal: (string | RegExp)[] = [
|
||||
/.*\.vue$/,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
|
||||
export function fontsPlugin(): Plugin {
|
||||
return {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
import { defineConfig, type Options } from 'tsup'
|
||||
|
||||
const clientExternal: (string | RegExp)[] = [
|
||||
/.*\.vue$/,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, getCurrentInstance, ref } from 'vue'
|
||||
import { useEventListener } from '@vueuse/core'
|
||||
import { computed, getCurrentInstance, ref } from 'vue'
|
||||
|
||||
interface MessageData {
|
||||
type: string
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { getHighlighterCore } from 'shiki/core'
|
||||
import type { HighlighterCore } from 'shiki/core'
|
||||
import editorData from '@internal/md-power/replEditorData'
|
||||
import { getHighlighterCore } from 'shiki/core'
|
||||
import { onMounted, onUnmounted, ref, shallowRef, watch } from 'vue'
|
||||
import type { HighlighterCore } from 'shiki/core'
|
||||
import { resolveCodeInfo } from '../composables/codeRepl.js'
|
||||
|
||||
let highlighter: HighlighterCore | null = null
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { defineAsyncComponent, shallowRef } from 'vue'
|
||||
import { useCodeRepl } from '../composables/codeRepl.js'
|
||||
import IconClose from './IconClose.vue'
|
||||
import IconConsole from './IconConsole.vue'
|
||||
import IconRun from './IconRun.vue'
|
||||
import Loading from './Loading.vue'
|
||||
import IconConsole from './IconConsole.vue'
|
||||
import IconClose from './IconClose.vue'
|
||||
|
||||
defineProps<{
|
||||
editable?: boolean
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, toRefs } from 'vue'
|
||||
import type { PDFTokenMeta } from '../../shared/index.js'
|
||||
import { useSize } from '../composables/size.js'
|
||||
import { usePDF } from '../composables/pdf.js'
|
||||
import { useSize } from '../composables/size.js'
|
||||
import type { PDFTokenMeta } from '../../shared/index.js'
|
||||
|
||||
const props = defineProps<PDFTokenMeta>()
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, shallowRef } from 'vue'
|
||||
import { onClickOutside, useMediaQuery } from '@vueuse/core'
|
||||
import { computed, ref, shallowRef } from 'vue'
|
||||
import { usePageFrontmatter } from 'vuepress/client'
|
||||
import type { PlotOptions } from '../../shared/index.js'
|
||||
import { pluginOptions } from '../options.js'
|
||||
import type { PlotOptions } from '../../shared/index.js'
|
||||
|
||||
const props = defineProps<Omit<PlotOptions, 'tag'>>()
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, getCurrentInstance, ref } from 'vue'
|
||||
import type { ReplitTokenMeta } from '../../shared/index.js'
|
||||
import Loading from './Loading.vue'
|
||||
import type { ReplitTokenMeta } from '../../shared/index.js'
|
||||
|
||||
const props = defineProps<ReplitTokenMeta>()
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { type Ref, onMounted, ref } from 'vue'
|
||||
import { onMounted, type Ref, ref } from 'vue'
|
||||
import { http } from '../utils/http.js'
|
||||
import { sleep } from '../utils/sleep.js'
|
||||
import { rustExecute } from './rustRepl.js'
|
||||
|
||||
@ -11,11 +11,11 @@
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { ensureEndingSlash, isLinkHttp } from 'vuepress/shared'
|
||||
import { withBase } from 'vuepress/client'
|
||||
import type { PDFEmbedType, PDFTokenMeta } from '../../shared/index.js'
|
||||
import { ensureEndingSlash, isLinkHttp } from 'vuepress/shared'
|
||||
import { pluginOptions } from '../options.js'
|
||||
import { checkIsMobile, checkIsSafari, checkIsiPad } from '../utils/is.js'
|
||||
import { checkIsiPad, checkIsMobile, checkIsSafari } from '../utils/is.js'
|
||||
import type { PDFEmbedType, PDFTokenMeta } from '../../shared/index.js'
|
||||
|
||||
function queryStringify(options: PDFTokenMeta): string {
|
||||
const { page, noToolbar, zoom } = options
|
||||
@ -105,7 +105,7 @@ export function usePDF(
|
||||
// We're moving into the age of MIME-less browsers. They mostly all support PDF rendering without plugins.
|
||||
&& (isModernBrowser
|
||||
// Modern versions of Firefox come bundled with PDFJS
|
||||
|| isFirefoxWithPDFJS)
|
||||
|| isFirefoxWithPDFJS)
|
||||
|
||||
if (!url)
|
||||
return
|
||||
|
||||
@ -11,10 +11,10 @@
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import type { MaybeRef } from '@vueuse/core'
|
||||
import { useEventListener } from '@vueuse/core'
|
||||
import type { Ref, ShallowRef, ToRefs } from 'vue'
|
||||
import { computed, isRef, onMounted, ref, shallowRef, toValue, watch } from 'vue'
|
||||
import type { MaybeRef } from '@vueuse/core'
|
||||
import type { Ref, ShallowRef, ToRefs } from 'vue'
|
||||
import type { SizeOptions } from '../../shared/index.js'
|
||||
|
||||
export interface SizeInfo<T extends HTMLElement> {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import { withBase } from 'vuepress/client'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
|
||||
export function normalizeLink(url: string): string {
|
||||
return isLinkHttp(url) ? url : withBase(url)
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
* @[caniuse embed{1,2,3,4}](feature_name)
|
||||
* @[caniuse image](feature_name)
|
||||
*/
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import type Token from 'markdown-it/lib/token.mjs'
|
||||
import type MarkdownIt from 'markdown-it'
|
||||
import container from 'markdown-it-container'
|
||||
import { customAlphabet } from 'nanoid'
|
||||
import type { CanIUseMode, CanIUseOptions, CanIUseTokenMeta } from '../../shared/index.js'
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import type MarkdownIt from 'markdown-it'
|
||||
import type Token from 'markdown-it/lib/token.mjs'
|
||||
import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
import type { CanIUseMode, CanIUseOptions, CanIUseTokenMeta } from '../../shared/index.js'
|
||||
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz', 5)
|
||||
const UNDERLINE_RE = /_+/g
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
* @[codesanbox title="xxx" layout="Editor+Preview" height="500px" navbar="false" console="false"](id#filepath)
|
||||
*/
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import type { CodeSandboxTokenMeta } from '../../shared/index.js'
|
||||
import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import type { CodeSandboxTokenMeta } from '../../shared/index.js'
|
||||
|
||||
export const codeSandboxPlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<CodeSandboxTokenMeta>(md, {
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
* @[codepen preview editable title="" height="400px" tab="css,result" theme="dark"](user/slash)
|
||||
*/
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import type { CodepenTokenMeta } from '../../shared/index.js'
|
||||
import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import type { CodepenTokenMeta } from '../../shared/index.js'
|
||||
|
||||
const CODEPEN_LINK = 'https://codepen.io/'
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { FileIcons, definitions } from './icons.js'
|
||||
import { definitions, FileIcons } from './icons.js'
|
||||
|
||||
export interface FileIcon {
|
||||
name: string
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import fs from 'node:fs'
|
||||
import container from 'markdown-it-container'
|
||||
import type { Markdown } from 'vuepress/markdown'
|
||||
import type Token from 'markdown-it/lib/token.mjs'
|
||||
import type { App } from 'vuepress/core'
|
||||
import { resolveTreeNodeInfo, updateInlineToken } from './resolveTreeNodeInfo.js'
|
||||
import type { Markdown } from 'vuepress/markdown'
|
||||
import { type FileIcon, folderIcon, getFileIcon } from './findIcon.js'
|
||||
import { resolveTreeNodeInfo, updateInlineToken } from './resolveTreeNodeInfo.js'
|
||||
|
||||
const type = 'file-tree'
|
||||
const closeType = `container_${type}_close`
|
||||
@ -21,7 +21,7 @@ export async function fileTreePlugin(app: App, md: Markdown) {
|
||||
for (
|
||||
let i = idx + 1;
|
||||
!(tokens[i].nesting === -1
|
||||
&& tokens[i].type === closeType);
|
||||
&& tokens[i].type === closeType);
|
||||
++i
|
||||
) {
|
||||
const token = tokens[i]
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { removeLeadingSlash } from 'vuepress/shared'
|
||||
import Token from 'markdown-it/lib/token.mjs'
|
||||
import { removeLeadingSlash } from 'vuepress/shared'
|
||||
|
||||
interface FileTreeNode {
|
||||
filename: string
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { URL } from 'node:url'
|
||||
import http from 'node:https'
|
||||
import { Buffer } from 'node:buffer'
|
||||
import type { App } from 'vuepress'
|
||||
import type { Markdown, MarkdownEnv } from 'vuepress/markdown'
|
||||
import http from 'node:https'
|
||||
import { URL } from 'node:url'
|
||||
import { isLinkExternal } from '@vuepress/helper'
|
||||
import imageSize from 'image-size'
|
||||
import { fs, path } from 'vuepress/utils'
|
||||
import type { RenderRule } from 'markdown-it/lib/renderer.mjs'
|
||||
import imageSize from 'image-size'
|
||||
import type { App } from 'vuepress'
|
||||
import type { Markdown, MarkdownEnv } from 'vuepress/markdown'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
|
||||
interface ImgSize {
|
||||
@ -151,7 +151,7 @@ function resolveImageUrl(src: string, env: MarkdownEnv, app: App): string {
|
||||
if (env.filePath && (src[0] === '.' || src[0] === '/'))
|
||||
return path.resolve(env.filePath, src)
|
||||
|
||||
return ''
|
||||
return path.resolve(src)
|
||||
}
|
||||
|
||||
export async function scanRemoteImageSize(
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
* @[jsfiddle theme="dark" tab="js,css,html,result"](user/id)
|
||||
*/
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import type { JSFiddleTokenMeta } from '../../shared/index.js'
|
||||
import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import type { JSFiddleTokenMeta } from '../../shared/index.js'
|
||||
|
||||
export const jsfiddlePlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<JSFiddleTokenMeta>(md, {
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import type markdownIt from 'markdown-it'
|
||||
import container from 'markdown-it-container'
|
||||
import { fs, getDirname, path } from 'vuepress/utils'
|
||||
import type markdownIt from 'markdown-it'
|
||||
import type Token from 'markdown-it/lib/token.mjs'
|
||||
import type { App } from 'vuepress/core'
|
||||
import { fs, getDirname, path } from 'vuepress/utils'
|
||||
import type { ReplEditorData, ReplOptions } from '../../shared/index.js'
|
||||
|
||||
const RE_INFO = /^(#editable)?(.*)$/
|
||||
|
||||
@ -5,10 +5,10 @@
|
||||
*/
|
||||
import { path } from 'vuepress/utils'
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import type { PDFTokenMeta } from '../../shared/index.js'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import type { PDFTokenMeta } from '../../shared/index.js'
|
||||
|
||||
export const pdfPlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<PDFTokenMeta>(md, {
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
* @[replit title="" height="400px" width="100%" theme="dark"](user/repl-name)
|
||||
*/
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import type { ReplitTokenMeta } from '../../shared/index.js'
|
||||
import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import type { ReplitTokenMeta } from '../../shared/index.js'
|
||||
|
||||
export const replitPlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<ReplitTokenMeta>(md, {
|
||||
|
||||
@ -6,11 +6,11 @@
|
||||
*/
|
||||
import { URLSearchParams } from 'node:url'
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import type { BilibiliTokenMeta } from '../../../shared/index.js'
|
||||
import { resolveAttrs } from '../../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../../utils/parseRect.js'
|
||||
import { timeToSeconds } from '../../utils/timeToSeconds.js'
|
||||
import { createRuleBlock } from '../../utils/createRuleBlock.js'
|
||||
import { parseRect } from '../../utils/parseRect.js'
|
||||
import { resolveAttrs } from '../../utils/resolveAttrs.js'
|
||||
import { timeToSeconds } from '../../utils/timeToSeconds.js'
|
||||
import type { BilibiliTokenMeta } from '../../../shared/index.js'
|
||||
|
||||
const BILIBILI_LINK = 'https://player.bilibili.com/player.html'
|
||||
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
*/
|
||||
import { URLSearchParams } from 'node:url'
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import type { YoutubeTokenMeta } from '../../../shared/index.js'
|
||||
import { resolveAttrs } from '../../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../../utils/parseRect.js'
|
||||
import { timeToSeconds } from '../../utils/timeToSeconds.js'
|
||||
import { createRuleBlock } from '../../utils/createRuleBlock.js'
|
||||
import { parseRect } from '../../utils/parseRect.js'
|
||||
import { resolveAttrs } from '../../utils/resolveAttrs.js'
|
||||
import { timeToSeconds } from '../../utils/timeToSeconds.js'
|
||||
import type { YoutubeTokenMeta } from '../../../shared/index.js'
|
||||
|
||||
const YOUTUBE_LINK = 'https://www.youtube.com/embed/'
|
||||
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './plugin.js'
|
||||
export * from '../shared/index.js'
|
||||
export * from './plugin.js'
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
import type MarkdownIt from 'markdown-it'
|
||||
import { addViteOptimizeDepsInclude } from '@vuepress/helper'
|
||||
import type { CanIUseOptions, MarkdownPowerPluginOptions } from '../shared/index.js'
|
||||
import type MarkdownIt from 'markdown-it'
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
import { caniusePlugin, legacyCaniuse } from './features/caniuse.js'
|
||||
import { pdfPlugin } from './features/pdf.js'
|
||||
import { codepenPlugin } from './features/codepen.js'
|
||||
import { codeSandboxPlugin } from './features/codeSandbox.js'
|
||||
import { fileTreePlugin } from './features/fileTree/index.js'
|
||||
import { iconsPlugin } from './features/icons.js'
|
||||
import { imageSizePlugin } from './features/imageSize.js'
|
||||
import { jsfiddlePlugin } from './features/jsfiddle.js'
|
||||
import { langReplPlugin } from './features/langRepl.js'
|
||||
import { pdfPlugin } from './features/pdf.js'
|
||||
import { plotPlugin } from './features/plot.js'
|
||||
import { replitPlugin } from './features/replit.js'
|
||||
import { bilibiliPlugin } from './features/video/bilibili.js'
|
||||
import { youtubePlugin } from './features/video/youtube.js'
|
||||
import { codepenPlugin } from './features/codepen.js'
|
||||
import { replitPlugin } from './features/replit.js'
|
||||
import { codeSandboxPlugin } from './features/codeSandbox.js'
|
||||
import { jsfiddlePlugin } from './features/jsfiddle.js'
|
||||
import { plotPlugin } from './features/plot.js'
|
||||
import { langReplPlugin } from './features/langRepl.js'
|
||||
import { prepareConfigFile } from './prepareConfigFile.js'
|
||||
import { fileTreePlugin } from './features/fileTree/index.js'
|
||||
import { imageSizePlugin } from './features/imageSize.js'
|
||||
import type { CanIUseOptions, MarkdownPowerPluginOptions } from '../shared/index.js'
|
||||
|
||||
export function markdownPowerPlugin(options: MarkdownPowerPluginOptions = {}): Plugin {
|
||||
return (app) => {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import { ensureEndingSlash } from '@vuepress/helper'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import type { App } from 'vuepress/core'
|
||||
import type { MarkdownPowerPluginOptions } from '../shared/index.js'
|
||||
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
export * from './caniuse.js'
|
||||
export * from './pdf.js'
|
||||
export * from './icons.js'
|
||||
export * from './video.js'
|
||||
export * from './codepen.js'
|
||||
export * from './codeSandbox.js'
|
||||
export * from './icons.js'
|
||||
export * from './jsfiddle.js'
|
||||
export * from './pdf.js'
|
||||
export * from './plot.js'
|
||||
export * from './plugin.js'
|
||||
export * from './repl.js'
|
||||
export * from './replit.js'
|
||||
export * from './jsfiddle.js'
|
||||
export * from './plot.js'
|
||||
|
||||
export * from './plugin.js'
|
||||
|
||||
export * from './size.js'
|
||||
|
||||
export * from './video.js'
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import type { CanIUseOptions } from './caniuse.js'
|
||||
import type { PDFOptions } from './pdf.js'
|
||||
import type { IconsOptions } from './icons.js'
|
||||
import type { PDFOptions } from './pdf.js'
|
||||
import type { PlotOptions } from './plot.js'
|
||||
import type { ReplOptions } from './repl.js'
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
import { defineConfig, type Options } from 'tsup'
|
||||
|
||||
const config = [
|
||||
{ dir: 'composables', files: ['codeRepl.ts', 'pdf.ts', 'rustRepl.ts', 'size.ts'] },
|
||||
|
||||
@ -4,8 +4,8 @@ import {
|
||||
defineAsyncComponent,
|
||||
ref,
|
||||
} from 'vue'
|
||||
import type { SearchBoxLocales, SearchOptions } from '../../shared/index.js'
|
||||
import SearchButton from './SearchButton.vue'
|
||||
import type { SearchBoxLocales, SearchOptions } from '../../shared/index.js'
|
||||
|
||||
defineProps<{
|
||||
locales: SearchBoxLocales
|
||||
|
||||
@ -1,17 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
type Ref,
|
||||
computed,
|
||||
markRaw,
|
||||
nextTick,
|
||||
onBeforeUnmount,
|
||||
onMounted,
|
||||
ref,
|
||||
shallowRef,
|
||||
toRef,
|
||||
watch,
|
||||
} from 'vue'
|
||||
import { useRouteLocale, useRouter } from 'vuepress/client'
|
||||
import {
|
||||
computedAsync,
|
||||
debouncedWatch,
|
||||
@ -20,15 +7,28 @@ import {
|
||||
useScrollLock,
|
||||
useSessionStorage,
|
||||
} from '@vueuse/core'
|
||||
import Mark from 'mark.js/src/vanilla.js'
|
||||
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
||||
import Mark from 'mark.js/src/vanilla.js'
|
||||
import MiniSearch, { type SearchResult } from 'minisearch'
|
||||
import {
|
||||
computed,
|
||||
markRaw,
|
||||
nextTick,
|
||||
onBeforeUnmount,
|
||||
onMounted,
|
||||
type Ref,
|
||||
ref,
|
||||
shallowRef,
|
||||
toRef,
|
||||
watch,
|
||||
} from 'vue'
|
||||
import { useRouteLocale, useRouter } from 'vuepress/client'
|
||||
import { useLocale, useSearchIndex } from '../composables/index.js'
|
||||
import type { SearchBoxLocales, SearchOptions } from '../../shared/index.js'
|
||||
import { LRUCache } from '../utils/index.js'
|
||||
import SearchIcon from './icons/SearchIcon.vue'
|
||||
import ClearIcon from './icons/ClearIcon.vue'
|
||||
import BackIcon from './icons/BackIcon.vue'
|
||||
import ClearIcon from './icons/ClearIcon.vue'
|
||||
import SearchIcon from './icons/SearchIcon.vue'
|
||||
import type { SearchBoxLocales, SearchOptions } from '../../shared/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
locales: SearchBoxLocales
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { toRef } from 'vue'
|
||||
import type { SearchBoxLocales } from '../../shared/index.js'
|
||||
import { useLocale } from '../composables/index.js'
|
||||
import type { SearchBoxLocales } from '../../shared/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
locales: SearchBoxLocales
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export * from './searchIndex.js'
|
||||
export * from './locale.js'
|
||||
export * from './searchIndex.js'
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import type { MaybeRef } from 'vue'
|
||||
import { useRouteLocale } from 'vuepress/client'
|
||||
import { computed, toRef } from 'vue'
|
||||
import { useRouteLocale } from 'vuepress/client'
|
||||
import type { MaybeRef } from 'vue'
|
||||
import type { SearchBoxLocales } from '../../shared/index.js'
|
||||
|
||||
const defaultLocales: SearchBoxLocales = {
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { h } from 'vue'
|
||||
import { defineClientConfig } from 'vuepress/client'
|
||||
import type { ClientConfig } from 'vuepress/client'
|
||||
import { h } from 'vue'
|
||||
import type { SearchBoxLocales, SearchOptions } from '../shared/index.js'
|
||||
import Search from './components/Search.vue'
|
||||
import type { SearchBoxLocales, SearchOptions } from '../shared/index.js'
|
||||
|
||||
declare const __SEARCH_LOCALES__: SearchBoxLocales
|
||||
declare const __SEARCH_OPTIONS__: SearchOptions
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { searchPlugin } from './searchPlugin.js'
|
||||
|
||||
export { prepareSearchIndex } from './prepareSearchIndex.js'
|
||||
export * from '../shared/index.js'
|
||||
export { prepareSearchIndex } from './prepareSearchIndex.js'
|
||||
|
||||
export {
|
||||
searchPlugin,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { App, Page } from 'vuepress/core'
|
||||
import MiniSearch from 'minisearch'
|
||||
import pMap from 'p-map'
|
||||
import { colors, logger } from 'vuepress/utils'
|
||||
import type { App, Page } from 'vuepress/core'
|
||||
import type { SearchOptions, SearchPluginOptions } from '../shared/index.js'
|
||||
|
||||
export interface SearchIndexOptions {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import chokidar from 'chokidar'
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import { addViteOptimizeDepsInclude } from '@vuepress/helper'
|
||||
import type { SearchPluginOptions } from '../shared/index.js'
|
||||
import chokidar from 'chokidar'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
import { onSearchIndexRemoved, onSearchIndexUpdated, prepareSearchIndex } from './prepareSearchIndex.js'
|
||||
import type { SearchPluginOptions } from '../shared/index.js'
|
||||
|
||||
const __dirname = getDirname(import.meta.url)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { LocaleConfig, Page } from 'vuepress/core'
|
||||
import type { Options as MiniSearchOptions } from 'minisearch'
|
||||
import type { LocaleConfig, Page } from 'vuepress/core'
|
||||
|
||||
export interface SearchLocaleOptions {
|
||||
placeholder: string
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
import { defineConfig, type Options } from 'tsup'
|
||||
|
||||
const sharedExternal: (string | RegExp)[] = [
|
||||
/.*\/shared\/index\.js$/,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { App } from 'vue'
|
||||
import FloatingVue, { recomputeAllPoppers } from 'floating-vue'
|
||||
import type { App } from 'vue'
|
||||
import 'floating-vue/dist/style.css'
|
||||
|
||||
const isMobile = typeof navigator !== 'undefined' && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { App } from 'vuepress'
|
||||
import type { Markdown, MarkdownEnv } from 'vuepress/markdown'
|
||||
import type { CopyCodeOptions } from '../types.js'
|
||||
import { createCopyCodeButtonRender } from './createCopyCodeButtonRender.js'
|
||||
import type { CopyCodeOptions } from '../types.js'
|
||||
|
||||
/**
|
||||
* This plugin should work after `preWrapperPlugin`,
|
||||
|
||||
@ -3,13 +3,13 @@ import {
|
||||
getRootLangPath,
|
||||
isPlainObject,
|
||||
} from '@vuepress/helper'
|
||||
import type { App, LocaleConfig } from 'vuepress'
|
||||
import { ensureLeadingSlash, resolveLocalePath } from 'vuepress/shared'
|
||||
import type { App, LocaleConfig } from 'vuepress'
|
||||
import { copyCodeButtonLocales } from './copyCodeButtonLocales.js'
|
||||
import type {
|
||||
CopyCodeLocaleOptions,
|
||||
CopyCodeOptions,
|
||||
} from '../types.js'
|
||||
import { copyCodeButtonLocales } from './copyCodeButtonLocales.js'
|
||||
|
||||
export function createCopyCodeButtonRender(app: App, options?: boolean | CopyCodeOptions): ((filePathRelative: string) => string) | null {
|
||||
if (options === false)
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
export * from './createCopyCodeButtonRender.js'
|
||||
export * from './copyCodeButtonLocales.js'
|
||||
export * from './copyCodeButtonPlugin.js'
|
||||
export * from './createCopyCodeButtonRender.js'
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { logger } from 'vuepress/utils'
|
||||
import { customAlphabet } from 'nanoid'
|
||||
import { bundledLanguages, createHighlighter } from 'shiki'
|
||||
import type { HighlighterOptions, ThemeOptions } from '../types.js'
|
||||
import { baseTransformers, getInlineTransformers } from './transformers.js'
|
||||
import { logger } from 'vuepress/utils'
|
||||
import { getLanguage } from './getLanguage.js'
|
||||
import { baseTransformers, getInlineTransformers } from './transformers.js'
|
||||
import type { HighlighterOptions, ThemeOptions } from '../types.js'
|
||||
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz', 10)
|
||||
const mustacheRE = /\{\{.*?\}\}/g
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import type { ShikiTransformer } from 'shiki'
|
||||
import { addClassToHast } from 'shiki'
|
||||
import {
|
||||
transformerCompactLineOptions,
|
||||
transformerNotationDiff,
|
||||
@ -10,9 +8,11 @@ import {
|
||||
transformerRemoveNotationEscape,
|
||||
transformerRenderWhitespace,
|
||||
} from '@shikijs/transformers'
|
||||
import type { WhitespacePosition } from '../utils/index.js'
|
||||
import { attrsToLines, resolveWhitespacePosition } from '../utils/index.js'
|
||||
import { addClassToHast } from 'shiki'
|
||||
import type { ShikiTransformer } from 'shiki'
|
||||
import { defaultHoverInfoProcessor, transformerTwoslash } from '../twoslash/rendererTransformer.js'
|
||||
import { attrsToLines, resolveWhitespacePosition } from '../utils/index.js'
|
||||
import type { WhitespacePosition } from '../utils/index.js'
|
||||
|
||||
const decorationsRE = /^\/\/ @decorations:(.*)\n/
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
// markdown-it plugin for generating line numbers.
|
||||
// v-pre block logic is in `../highlight.ts`
|
||||
import type { Markdown } from 'vuepress/markdown'
|
||||
import type { PreWrapperOptions } from '../types.js'
|
||||
import { resolveAttr, resolveCollapsedLines, resolveLanguage } from '../utils/index.js'
|
||||
import type { PreWrapperOptions } from '../types.js'
|
||||
|
||||
export function preWrapperPlugin(
|
||||
md: Markdown,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { ensureEndingSlash } from '@vuepress/helper'
|
||||
import type { App } from 'vuepress'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import type { App } from 'vuepress'
|
||||
|
||||
const __dirname = getDirname(import.meta.url)
|
||||
|
||||
@ -21,19 +21,19 @@ import { useCollapsedLines } from '${CLIENT_FOLDER}composables/collapsed-lines.j
|
||||
|
||||
export default {
|
||||
${twoslash
|
||||
? `enhance({ app }) {
|
||||
? `enhance({ app }) {
|
||||
enhanceTwoslash(app)
|
||||
},`
|
||||
: ''}
|
||||
: ''}
|
||||
${copyCode
|
||||
? `setup() {
|
||||
? `setup() {
|
||||
useCopyCode({
|
||||
selector: __CC_SELECTOR__,
|
||||
duration: __CC_DURATION__,
|
||||
})
|
||||
useCollapsedLines()
|
||||
},`
|
||||
: ''}
|
||||
: ''}
|
||||
}
|
||||
`,
|
||||
)
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
import { isPlainObject } from 'vuepress/shared'
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
import { copyCodeButtonPlugin } from './copy-code-button/index.js'
|
||||
import { highlight } from './highlight/index.js'
|
||||
import {
|
||||
highlightLinesPlugin,
|
||||
lineNumberPlugin,
|
||||
preWrapperPlugin,
|
||||
} from './markdown/index.js'
|
||||
import { prepareClientConfigFile } from './prepareClientConfigFile.js'
|
||||
import type {
|
||||
CopyCodeOptions,
|
||||
HighlighterOptions,
|
||||
LineNumberOptions,
|
||||
PreWrapperOptions,
|
||||
} from './types.js'
|
||||
import {
|
||||
highlightLinesPlugin,
|
||||
lineNumberPlugin,
|
||||
preWrapperPlugin,
|
||||
} from './markdown/index.js'
|
||||
import { copyCodeButtonPlugin } from './copy-code-button/index.js'
|
||||
import { prepareClientConfigFile } from './prepareClientConfigFile.js'
|
||||
|
||||
export interface ShikiPluginOptions
|
||||
extends HighlighterOptions, LineNumberOptions, PreWrapperOptions {
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { defaultHoverInfoProcessor, rendererRich } from '@shikijs/twoslash'
|
||||
import { fromMarkdown } from 'mdast-util-from-markdown'
|
||||
import { gfmFromMarkdown } from 'mdast-util-gfm'
|
||||
import { defaultHandlers, toHast } from 'mdast-util-to-hast'
|
||||
import type { RendererRichOptions, TwoslashRenderer } from '@shikijs/twoslash'
|
||||
import type { Element, ElementContent, Text } from 'hast'
|
||||
import type { ShikiTransformerContextCommon } from 'shiki'
|
||||
import { gfmFromMarkdown } from 'mdast-util-gfm'
|
||||
import { fromMarkdown } from 'mdast-util-from-markdown'
|
||||
import { defaultHandlers, toHast } from 'mdast-util-to-hast'
|
||||
|
||||
export { defaultHoverInfoProcessor }
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import process from 'node:process'
|
||||
import type { TransformerTwoslashOptions } from '@shikijs/twoslash/core'
|
||||
import { createTransformerFactory } from '@shikijs/twoslash/core'
|
||||
import type { VueSpecificOptions } from 'twoslash-vue'
|
||||
import { createTwoslasher } from 'twoslash-vue'
|
||||
import type { ShikiTransformer } from 'shiki'
|
||||
import { removeTwoslashNotations } from 'twoslash'
|
||||
import type { TwoslashFloatingVueRendererOptions } from './renderer-floating-vue.js'
|
||||
import { createTwoslasher } from 'twoslash-vue'
|
||||
import type { TransformerTwoslashOptions } from '@shikijs/twoslash/core'
|
||||
import type { ShikiTransformer } from 'shiki'
|
||||
import type { VueSpecificOptions } from 'twoslash-vue'
|
||||
import { rendererFloatingVue } from './renderer-floating-vue.js'
|
||||
import type { TwoslashFloatingVueRendererOptions } from './renderer-floating-vue.js'
|
||||
|
||||
export * from './renderer-floating-vue.js'
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
export * from './attrsToLines.js'
|
||||
export * from './collapsedLines.js'
|
||||
export * from './lru.js'
|
||||
export * from './resolveAttr.js'
|
||||
export * from './resolveLanguage.js'
|
||||
export * from './lru.js'
|
||||
export * from './whitespace.js'
|
||||
export * from './collapsedLines.js'
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
import { defineConfig, type Options } from 'tsup'
|
||||
|
||||
export default defineConfig(() => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
<script lang="ts" setup>
|
||||
import VPPostList from '@theme/Blog/VPPostList.vue'
|
||||
import VPBlogArchives from '@theme/Blog/VPBlogArchives.vue'
|
||||
import VPBlogAside from '@theme/Blog/VPBlogAside.vue'
|
||||
import VPBlogExtract from '@theme/Blog/VPBlogExtract.vue'
|
||||
import VPBlogTags from '@theme/Blog/VPBlogTags.vue'
|
||||
import VPBlogCategories from '@theme/Blog/VPBlogCategories.vue'
|
||||
import VPBlogExtract from '@theme/Blog/VPBlogExtract.vue'
|
||||
import VPBlogNav from '@theme/Blog/VPBlogNav.vue'
|
||||
import VPBlogTags from '@theme/Blog/VPBlogTags.vue'
|
||||
import VPPostList from '@theme/Blog/VPPostList.vue'
|
||||
import VPTransitionFadeSlideY from '@theme/VPTransitionFadeSlideY.vue'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<script lang="ts" setup>
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import { useScrollLock } from '@vueuse/core'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useRoute, withBase } from 'vuepress/client'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import { useBlogExtract, useData } from '../../composables/index.js'
|
||||
import { inBrowser } from '../../utils/index.js'
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { useRoute } from 'vuepress/client'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import { useRoute } from 'vuepress/client'
|
||||
import { useBlogExtract } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import VPSocialLinks from '@theme/VPSocialLinks.vue'
|
||||
import { computed } from 'vue'
|
||||
import { withBase } from 'vuepress/client'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import VPSocialLinks from '@theme/VPSocialLinks.vue'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import VPCategoriesGroup from '@theme/Blog/VPCategoriesGroup.vue'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import type { BlogCategoryItem, BlogCategoryItemWithPost } from '../../composables/index.js'
|
||||
|
||||
defineProps<{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user