mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
Merge pull request #126 from pengzhanbo/perf-bundle
optimize package bundle
This commit is contained in:
commit
55010d644b
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@ -29,5 +29,5 @@ jobs:
|
||||
|
||||
- name: Linter
|
||||
run: |
|
||||
pnpm run lint
|
||||
pnpm run lint:check
|
||||
pnpm run lint:css
|
||||
|
||||
4
.vscode/extensions.json
vendored
4
.vscode/extensions.json
vendored
@ -1,6 +1,8 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"vue.volar",
|
||||
"dbaeumer.vscode-eslint"
|
||||
"dbaeumer.vscode-eslint",
|
||||
"stylelint.vscode-stylelint",
|
||||
"DavidAnson.vscode-markdownlint"
|
||||
]
|
||||
}
|
||||
|
||||
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -11,7 +11,7 @@
|
||||
"name": "docs:dev",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "pnpm run docs"
|
||||
"command": "pnpm run docs:dev"
|
||||
},
|
||||
{
|
||||
"name": "docs:build",
|
||||
|
||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -82,8 +82,6 @@
|
||||
"twoslash",
|
||||
"vite",
|
||||
"vuepress",
|
||||
"vueuse",
|
||||
"Windi",
|
||||
"Windicss"
|
||||
"vueuse"
|
||||
]
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ sticky: 3
|
||||
- 移除 `@vuepress-plume/plugin-notes-data` 插件
|
||||
- 移除 `@vuepress-plume/plugin-auto-frontmatter` 插件
|
||||
|
||||
以上插件的功能全部移动到 `vuepress-theme-plugin` 主题包内部重新实现。原因是,单独的主题配置文件,
|
||||
以上插件的功能全部移动到 `vuepress-theme-plume` 主题包内部重新实现。原因是,单独的主题配置文件,
|
||||
在异步加载完配置、以及配置热更新时,需要对这些插件所实现的功能进行重载,为了使流程更加清晰可控,
|
||||
在主题内重新实现了这些功能,并移除了相关插件。
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
"http-server": "^14.1.1",
|
||||
"mermaid": "^10.9.1",
|
||||
"vue": "^3.4.31",
|
||||
"vuepress-theme-plume": "workspace:~"
|
||||
"vuepress-theme-plume": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.21"
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
import config from '@pengzhanbo/eslint-config-vue'
|
||||
|
||||
export default config({
|
||||
// todo: 正则校验
|
||||
// 当前项目中的 正则 还并不能完全通过 规则,存在 53 个问题
|
||||
// 但处理起来比较麻烦,因此将会作为一项比较长期的工作来完成。
|
||||
regexp: false,
|
||||
ignores: [
|
||||
'lib',
|
||||
'docs/notes/theme/snippet/code-block.snippet.md',
|
||||
|
||||
35
package.json
35
package.json
@ -14,28 +14,26 @@
|
||||
"vuepress-theme-plume"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^18 || >=20.0.0",
|
||||
"node": "^18.20.0 || >=20.0.0",
|
||||
"pnpm": ">=9"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "pnpm run clean && pnpm run build:package",
|
||||
"build:package": "pnpm --filter=!docs run -r --stream build",
|
||||
"clean": "pnpm --filter=!docs run -r --stream clean",
|
||||
"dev": "concurrently \"pnpm run dev:package\" \"pnpm run docs\"",
|
||||
"dev:package": "pnpm --filter=!docs --parallel dev",
|
||||
"dev:theme": "concurrently \"pnpm --filter=vuepress-theme-plume dev\" \"pnpm run docs\"",
|
||||
"docs": "pnpm --filter=docs docs:dev",
|
||||
"docs:build": "pnpm --filter=docs docs:build",
|
||||
"docs:clean": "pnpm --filter=docs docs:clean",
|
||||
"docs:serve": "pnpm --filter=docs docs:serve",
|
||||
"commit": "cz",
|
||||
"lint": "eslint .",
|
||||
"build": "pnpm clean && pnpm build:package",
|
||||
"build:package": "pnpm -r --stream build",
|
||||
"clean": "pnpm -r --stream clean",
|
||||
"dev": "pnpm --stream '/(dev:package|docs:dev)/'",
|
||||
"dev:package": "pnpm --parallel dev",
|
||||
"docs:dev": "wait-on -d 100 theme/lib/node/index.js && pnpm -F=docs docs:dev",
|
||||
"docs:build": "pnpm -F=docs docs:build",
|
||||
"docs:clean": "pnpm -F=docs docs:clean",
|
||||
"docs:serve": "pnpm -F=docs docs:serve",
|
||||
"lint": "pnpm lint:check && pnpm lint:css",
|
||||
"lint:check": "eslint .",
|
||||
"lint:css": "stylelint **/*.{css,scss,vue}",
|
||||
"prepare": "husky",
|
||||
"release": "pnpm release:check && pnpm release:version && pnpm release:publish",
|
||||
"release": "pnpm release:check && pnpm release:version && pnpm -r publish",
|
||||
"release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||
"release:check": "pnpm lint && pnpm lint:css && pnpm build",
|
||||
"release:publish": "pnpm -r publish",
|
||||
"release:check": "pnpm lint && pnpm build",
|
||||
"release:version": "bumpp package.json plugins/*/package.json theme/package.json --execute=\"pnpm release:changelog\" --commit \"build: publish v%s\" --all --tag --push"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -48,7 +46,6 @@
|
||||
"@types/webpack-env": "^1.18.5",
|
||||
"bumpp": "^9.4.1",
|
||||
"commitizen": "^4.3.0",
|
||||
"concurrently": "^8.2.2",
|
||||
"conventional-changelog-cli": "^5.0.0",
|
||||
"cpx2": "^7.0.1",
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
@ -58,7 +55,9 @@
|
||||
"rimraf": "^6.0.1",
|
||||
"stylelint": "^16.7.0",
|
||||
"tsconfig-vuepress": "^4.5.0",
|
||||
"typescript": "^5.5.3"
|
||||
"tsup": "^8.1.2",
|
||||
"typescript": "^5.5.3",
|
||||
"wait-on": "^7.2.0"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*": "eslint --fix"
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2021 - PRESENT by pengzhanbo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
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.
|
||||
@ -1,30 +0,0 @@
|
||||
# `@vuepress-plume/plugin-baidu-tongji`
|
||||
|
||||
在vuepress中接入百度统计
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install @vuepress-plume/plugin-baidu-tongji
|
||||
# or
|
||||
pnpm add @vuepress-plume/plugin-baidu-tongji
|
||||
# or
|
||||
yarn add @vuepress-plume/plugin-baidu-tongji
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
// .vuepress/config.[jt]s
|
||||
import { baiduTongjiPlugin } from '@vuepress-plume/plugin-baidu-tongji'
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
baiduTongjiPlugin({
|
||||
key: '', // 百度统计使用的 key
|
||||
})
|
||||
]
|
||||
// ...
|
||||
}
|
||||
```
|
||||
@ -1,47 +0,0 @@
|
||||
{
|
||||
"name": "@vuepress-plume/plugin-baidu-tongji",
|
||||
"type": "module",
|
||||
"version": "1.0.0-rc.80",
|
||||
"description": "The Plugin for VuePress 2 - baidu tongji",
|
||||
"author": "pengzhanbo <volodymyr@foxmail.com> (https://github.com/pengzhanbo/)",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/pengzhanbo/vuepress-theme-plume#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pengzhanbo/vuepress-theme-plume.git",
|
||||
"directory": "plugins/plugin-baidu-tongji"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run copy && pnpm run ts",
|
||||
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
|
||||
"ts": "tsc -b tsconfig.build.json"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vuepress": "2.0.0-rc.14"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"keyword": [
|
||||
"VuePress",
|
||||
"vuepress plugin",
|
||||
"baiduTongji",
|
||||
"vuepress-plugin-baidu-tongji"
|
||||
]
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
import { watch } from 'vue'
|
||||
import { usePageData } from 'vuepress/client'
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
_hmt?: [name: string, options: any][]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add baidu analytics to the site
|
||||
*
|
||||
* @see https://tongji.baidu.com/
|
||||
* @see https://tongji.baidu.com/holmes/Analytics/%E7%99%BE%E5%BA%A6%E7%BB%9F%E8%AE%A1%E4%BD%BF%E7%94%A8%E6%89%8B%E5%86%8C
|
||||
* @see https://tongji.baidu.com/holmes/Analytics/%E6%8A%80%E6%9C%AF%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97/JS%20API/JS%20API%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/_trackPageview
|
||||
*/
|
||||
export function useBaiduTongji(): void {
|
||||
if (!window._hmt)
|
||||
return
|
||||
|
||||
const page = usePageData()
|
||||
|
||||
watch(
|
||||
() => page.value.path,
|
||||
(newLocation) => {
|
||||
window._hmt?.push(['_trackPageview', newLocation])
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
import { defineClientConfig } from 'vuepress/client'
|
||||
import type { ClientConfig } from 'vuepress/client'
|
||||
import { useBaiduTongji } from './composables/index.js'
|
||||
|
||||
declare const __VUEPRESS_SSR__: boolean
|
||||
|
||||
export default defineClientConfig({
|
||||
setup() {
|
||||
if (__VUEPRESS_SSR__)
|
||||
return
|
||||
|
||||
useBaiduTongji()
|
||||
},
|
||||
}) as ClientConfig
|
||||
@ -1,5 +0,0 @@
|
||||
import { baiduTongjiPlugin } from './plugin.js'
|
||||
|
||||
export * from './plugin.js'
|
||||
|
||||
export default baiduTongjiPlugin
|
||||
@ -1,36 +0,0 @@
|
||||
import type { Plugin, PluginObject } from 'vuepress/core'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
|
||||
export interface BaiduTongjiOptions {
|
||||
key?: string
|
||||
}
|
||||
|
||||
const __dirname = getDirname(import.meta.url)
|
||||
|
||||
export function baiduTongjiPlugin({ key = '' }: BaiduTongjiOptions): Plugin {
|
||||
return (app) => {
|
||||
const plugin: PluginObject = {
|
||||
name: '@vuepress-plume/plugin-baidu-tongji',
|
||||
}
|
||||
|
||||
if (app.env.isDev)
|
||||
return plugin
|
||||
|
||||
return {
|
||||
...plugin,
|
||||
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
||||
extendsPage: (page) => {
|
||||
page.frontmatter.head ??= []
|
||||
page.frontmatter.head?.push([
|
||||
'script',
|
||||
{ type: 'text/javascript' },
|
||||
'window._hmt = window._hmt || []',
|
||||
])
|
||||
page.frontmatter.head?.push([
|
||||
'script',
|
||||
{ src: `https://hm.baidu.com/hm.js?${key}`, async: true },
|
||||
])
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"files": [],
|
||||
"include": ["./src"]
|
||||
}
|
||||
@ -31,10 +31,10 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run copy && pnpm run ts",
|
||||
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
||||
"build": "pnpm run copy && pnpm run tsup",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
|
||||
"ts": "tsc -b tsconfig.build.json"
|
||||
"tsup": "tsup --config tsup.config.ts"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vuepress": "2.0.0-rc.14"
|
||||
|
||||
@ -6,6 +6,6 @@ const __dirname = getDirname(import.meta.url)
|
||||
export function contentUpdatePlugin(): Plugin {
|
||||
return {
|
||||
name: '@vuepress-plume/plugin-content-update',
|
||||
clientConfigFile: path.resolve(__dirname, '../client/clientConfig.js'),
|
||||
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.build.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
}
|
||||
52
plugins/plugin-content-update/tsup.config.ts
Normal file
52
plugins/plugin-content-update/tsup.config.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
|
||||
const clientExternal: (string | RegExp)[] = [
|
||||
/.*\.vue$/,
|
||||
/.*\.css$/,
|
||||
]
|
||||
|
||||
export default defineConfig(() => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
}
|
||||
return [
|
||||
// node
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/node/index.ts'],
|
||||
outDir: './lib/node',
|
||||
target: 'node18',
|
||||
},
|
||||
// client/composables/index.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/composables/index.ts'],
|
||||
outDir: './lib/client/composables',
|
||||
external: clientExternal,
|
||||
},
|
||||
// client/components/index.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/components/Content.ts'],
|
||||
outDir: './lib/client/components',
|
||||
external: [...clientExternal, '../composables/index.js'],
|
||||
},
|
||||
// client/config.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/config.ts'],
|
||||
outDir: './lib/client',
|
||||
external: [...clientExternal, './components/Content.js'],
|
||||
},
|
||||
// client/index.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/index.ts'],
|
||||
outDir: './lib/client',
|
||||
external: [...clientExternal, './components/Content.js', './composables/index.js'],
|
||||
},
|
||||
]
|
||||
})
|
||||
@ -27,10 +27,10 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run copy && pnpm run ts",
|
||||
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
||||
"build": "pnpm run copy && pnpm run tsup",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png,woff2}\" lib",
|
||||
"ts": "tsc -b tsconfig.build.json"
|
||||
"tsup": "tsup --config tsup.config.ts"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vuepress": "2.0.0-rc.14"
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.build.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
}
|
||||
31
plugins/plugin-fonts/tsup.config.ts
Normal file
31
plugins/plugin-fonts/tsup.config.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
|
||||
const clientExternal: (string | RegExp)[] = [
|
||||
/.*\.vue$/,
|
||||
/.*\.css$/,
|
||||
]
|
||||
|
||||
export default defineConfig(() => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
}
|
||||
return [
|
||||
// node
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/node/index.ts'],
|
||||
outDir: './lib/node',
|
||||
target: 'node18',
|
||||
},
|
||||
// client/config.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/config.ts'],
|
||||
outDir: './lib/client',
|
||||
external: clientExternal,
|
||||
},
|
||||
]
|
||||
})
|
||||
@ -19,10 +19,6 @@
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./lib/client/index.d.ts",
|
||||
"import": "./lib/client/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
@ -31,10 +27,10 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run copy && pnpm run ts",
|
||||
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
||||
"build": "pnpm run copy && pnpm run tsup",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
|
||||
"ts": "tsc -b tsconfig.build.json"
|
||||
"tsup": "tsup --config tsup.config.ts"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vuepress": "2.0.0-rc.14"
|
||||
|
||||
@ -4,7 +4,7 @@ import { ClientOnly } from 'vuepress/client'
|
||||
import type { IconifyRenderMode } from '@iconify/vue'
|
||||
import type { StyleValue } from 'vue'
|
||||
import { computed, toRefs } from 'vue'
|
||||
import { useIconify } from '../composables/iconify.js'
|
||||
import { useIconify } from '../composables/index.js'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@ -31,13 +31,13 @@ const { name } = toRefs(props)
|
||||
const { icon, loaded } = useIconify(name)
|
||||
|
||||
const size = computed(() => {
|
||||
const size = props.size || __VUEPRESS_PLUGIN_ICONIFY_DEFAULT_SIZE__
|
||||
const size = props.size || __VP_ICONIFY_SIZE__
|
||||
if (String(Number(size)) === size)
|
||||
return `${size}px`
|
||||
|
||||
return size
|
||||
})
|
||||
const color = computed(() => props.color || __VUEPRESS_PLUGIN_ICONIFY_DEFAULT_COLOR__)
|
||||
const color = computed(() => props.color || __VP_ICONIFY_COLOR__)
|
||||
|
||||
const bind = computed<any>(() => ({
|
||||
icon: icon.value,
|
||||
@ -55,8 +55,8 @@ const bind = computed<any>(() => ({
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
declare const __VUEPRESS_PLUGIN_ICONIFY_DEFAULT_SIZE__: string
|
||||
declare const __VUEPRESS_PLUGIN_ICONIFY_DEFAULT_COLOR__: string
|
||||
declare const __VP_ICONIFY_SIZE__: string
|
||||
declare const __VP_ICONIFY_COLOR__: string
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
1
plugins/plugin-iconify/src/client/composables/index.ts
Normal file
1
plugins/plugin-iconify/src/client/composables/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './iconify.js'
|
||||
@ -2,10 +2,10 @@ import { defineClientConfig } from 'vuepress/client'
|
||||
import type { ClientConfig } from 'vuepress/client'
|
||||
import Iconify from './components/Iconify.vue'
|
||||
|
||||
declare const __VUEPRESS_PLUGIN_ICONIFY_COMPONENT_NAME__: string
|
||||
declare const __VP_ICONIFY_NAME__: string
|
||||
export default defineClientConfig({
|
||||
enhance({ app }) {
|
||||
const name = __VUEPRESS_PLUGIN_ICONIFY_COMPONENT_NAME__ || 'Iconify'
|
||||
const name = __VP_ICONIFY_NAME__ || 'Iconify'
|
||||
app.component(name, Iconify)
|
||||
},
|
||||
}) as ClientConfig
|
||||
@ -1,2 +0,0 @@
|
||||
export * from './composables/iconify.js'
|
||||
export * from '../shared/index.js'
|
||||
@ -1,6 +1,6 @@
|
||||
import { iconifyPlugin } from './plugin.js'
|
||||
|
||||
export * from './plugin.js'
|
||||
export * from '../shared/index.js'
|
||||
|
||||
/** @deprecated 请使用 具名导出 替代 默认导出 */
|
||||
export default iconifyPlugin
|
||||
|
||||
@ -1,24 +1,24 @@
|
||||
import type { Plugin } from 'vuepress/core'
|
||||
import { getDirname, path } from 'vuepress/utils'
|
||||
import type { IconifyOptions } from '../shared/index.js'
|
||||
|
||||
export interface IconifyPluginOptions {
|
||||
componentName?: string
|
||||
color?: string
|
||||
size?: string | number
|
||||
}
|
||||
|
||||
export function iconifyPlugin({
|
||||
componentName = 'Iconify',
|
||||
size = '1em',
|
||||
color = 'currentColor',
|
||||
}: IconifyOptions = {}): Plugin {
|
||||
return () => {
|
||||
return {
|
||||
name: '@vuepress-plume/plugin-iconify',
|
||||
define: {
|
||||
__VUEPRESS_PLUGIN_ICONIFY_COMPONENT_NAME__: componentName,
|
||||
__VUEPRESS_PLUGIN_ICONIFY_DEFAULT_SIZE__: size,
|
||||
__VUEPRESS_PLUGIN_ICONIFY_DEFAULT_COLOR__: color,
|
||||
},
|
||||
clientConfigFile: path.resolve(
|
||||
getDirname(import.meta.url),
|
||||
'../client/clientConfig.js',
|
||||
),
|
||||
}
|
||||
}: IconifyPluginOptions = {}): Plugin {
|
||||
return {
|
||||
name: '@vuepress-plume/plugin-iconify',
|
||||
define: {
|
||||
__VP_ICONIFY_NAME__: componentName,
|
||||
__VP_ICONIFY_SIZE__: size,
|
||||
__VP_ICONIFY_COLOR__: color,
|
||||
},
|
||||
clientConfigFile: path.resolve(getDirname(import.meta.url), '../client/config.js'),
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
export interface IconifyOptions {
|
||||
componentName?: string
|
||||
color?: string
|
||||
size?: string | number
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.build.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
}
|
||||
38
plugins/plugin-iconify/tsup.config.ts
Normal file
38
plugins/plugin-iconify/tsup.config.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
|
||||
const clientExternal: (string | RegExp)[] = [
|
||||
/.*\.vue$/,
|
||||
/.*\.css$/,
|
||||
]
|
||||
|
||||
export default defineConfig(() => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
}
|
||||
return [
|
||||
// node
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/node/index.ts'],
|
||||
outDir: './lib/node',
|
||||
target: 'node18',
|
||||
},
|
||||
// client/composables/index.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/composables/index.ts'],
|
||||
outDir: './lib/client/composables',
|
||||
external: clientExternal,
|
||||
},
|
||||
// client/config.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/config.ts'],
|
||||
outDir: './lib/client',
|
||||
external: clientExternal,
|
||||
},
|
||||
]
|
||||
})
|
||||
@ -31,10 +31,10 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run copy && pnpm run ts",
|
||||
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
||||
"build": "pnpm copy && pnpm tsup",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
|
||||
"ts": "tsc -b tsconfig.build.json"
|
||||
"tsup": "tsup --config tsup.config.ts"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@iconify/json": "^2",
|
||||
@ -47,7 +47,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@iconify/utils": "^2.1.25",
|
||||
"@vuepress/helper": "2.0.0-rc.38",
|
||||
"@vuepress/helper": "2.0.0-rc.39",
|
||||
"@vueuse/core": "^10.11.0",
|
||||
"local-pkg": "^0.5.0",
|
||||
"markdown-it-container": "^4.0.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { CodeSandboxTokenMeta } from '../../shared/codeSandbox.js'
|
||||
import type { CodeSandboxTokenMeta } from '../../shared/index.js'
|
||||
|
||||
const props = defineProps<CodeSandboxTokenMeta>()
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, toRefs } from 'vue'
|
||||
import type { PDFTokenMeta } from '../../shared/pdf.js'
|
||||
import type { PDFTokenMeta } from '../../shared/index.js'
|
||||
import { useSize } from '../composables/size.js'
|
||||
import { usePDF } from '../composables/pdf.js'
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { computed, ref, shallowRef } from 'vue'
|
||||
import { onClickOutside, useMediaQuery } from '@vueuse/core'
|
||||
import { usePageFrontmatter } from 'vuepress/client'
|
||||
import type { PlotOptions } from '../../shared/plot.js'
|
||||
import type { PlotOptions } from '../../shared/index.js'
|
||||
import { pluginOptions } from '../options.js'
|
||||
|
||||
const props = defineProps<Omit<PlotOptions, 'tag'>>()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, getCurrentInstance, ref } from 'vue'
|
||||
import type { ReplitTokenMeta } from '../../shared/replit.js'
|
||||
import type { ReplitTokenMeta } from '../../shared/index.js'
|
||||
import Loading from './Loading.vue'
|
||||
|
||||
const props = defineProps<ReplitTokenMeta>()
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
import { ensureEndingSlash, isLinkHttp } from 'vuepress/shared'
|
||||
import { withBase } from 'vuepress/client'
|
||||
import type { PDFEmbedType, PDFTokenMeta } from '../../shared/pdf.js'
|
||||
import type { PDFEmbedType, PDFTokenMeta } from '../../shared/index.js'
|
||||
import { pluginOptions } from '../options.js'
|
||||
import { checkIsMobile, checkIsSafari, checkIsiPad } from '../utils/is.js'
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ 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 { SizeOptions } from '../../shared/size.js'
|
||||
import type { SizeOptions } from '../../shared/index.js'
|
||||
|
||||
export interface SizeInfo<T extends HTMLElement> {
|
||||
el: ShallowRef<T | undefined>
|
||||
|
||||
@ -24,7 +24,7 @@ export const caniusePlugin: PluginWithOptions<CanIUseOptions> = (
|
||||
): void => {
|
||||
createRuleBlock<CanIUseTokenMeta>(md, {
|
||||
type: 'caniuse',
|
||||
syntaxPattern: /^@\[caniuse(?:\s*?(embed|image)?(?:{([0-9,\-]*?)})?)\]\(([^)]*)\)/,
|
||||
syntaxPattern: /^@\[caniuse\s*(embed|image)?(?:\{([0-9,\-]*)\})?\]\(([^)]*)\)/,
|
||||
meta: ([, mode, versions = '', feature]) => ({
|
||||
feature,
|
||||
mode: (mode as CanIUseMode) || defaultMode,
|
||||
@ -53,7 +53,7 @@ export function legacyCaniuse(
|
||||
|
||||
mode = isMode(mode) ? mode : modeMap[0]
|
||||
const type = 'caniuse'
|
||||
const validateReg = new RegExp(`^${type}\\s+(.*)$`)
|
||||
const validateReg = new RegExp(`^${type}`)
|
||||
|
||||
const validate = (info: string): boolean => {
|
||||
return validateReg.test(info.trim())
|
||||
|
||||
@ -6,13 +6,13 @@
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import type { CodeSandboxTokenMeta } from '../../shared/codeSandbox.js'
|
||||
import type { CodeSandboxTokenMeta } from '../../shared/index.js'
|
||||
import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
|
||||
export const codeSandboxPlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<CodeSandboxTokenMeta>(md, {
|
||||
type: 'codesandbox',
|
||||
syntaxPattern: /^@\[codesandbox(?:\s+(embed|button))?(?:\s+([^]*?))?\]\(([^)]*?)\)/,
|
||||
syntaxPattern: /^@\[codesandbox(?:\s+(embed|button))?([^\]]*)\]\(([^)]*)\)/,
|
||||
meta([, type, info = '', source = '']) {
|
||||
const { attrs } = resolveAttrs(info)
|
||||
const [profile, filepath = ''] = source.split('#')
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import type { CodepenTokenMeta } from '../../shared/codepen.js'
|
||||
import type { CodepenTokenMeta } from '../../shared/index.js'
|
||||
import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
|
||||
const CODEPEN_LINK = 'https://codepen.io/'
|
||||
@ -14,7 +14,7 @@ const CODEPEN_LINK = 'https://codepen.io/'
|
||||
export const codepenPlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<CodepenTokenMeta>(md, {
|
||||
type: 'codepen',
|
||||
syntaxPattern: /^@\[codepen(?:\s+([^]*?))?\]\(([^)]*?)\)/,
|
||||
syntaxPattern: /^@\[codepen([^\]]*)\]\(([^)]*)\)/,
|
||||
meta: ([, info = '', source = '']) => {
|
||||
const { attrs } = resolveAttrs(info)
|
||||
const [user, slash] = source.split('/')
|
||||
|
||||
@ -4,7 +4,7 @@ import { getIconContentCSS, getIconData } from '@iconify/utils'
|
||||
import { fs, logger } from 'vuepress/utils'
|
||||
import { isPackageExists } from 'local-pkg'
|
||||
import { customAlphabet } from 'nanoid'
|
||||
import type { IconsOptions } from '../../../shared/icons.js'
|
||||
import type { IconsOptions } from '../../../shared/index.js'
|
||||
import { interopDefault } from '../../utils/package.js'
|
||||
import { parseRect } from '../../utils/parseRect.js'
|
||||
|
||||
@ -15,7 +15,7 @@ export interface IconCacheItem {
|
||||
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 8)
|
||||
const iconDataCache = new Map<string, any>()
|
||||
const URL_CONTENT_RE = /(url\([^]+?\))/
|
||||
const URL_CONTENT_RE = /(url\([\s\S]+?\))/
|
||||
const CSS_PATH = 'internal/md-power/icons.css'
|
||||
|
||||
function resolveOption(opt?: boolean | IconsOptions): Required<IconsOptions> {
|
||||
|
||||
@ -5,13 +5,13 @@
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import type { JSFiddleTokenMeta } from '../../shared/jsfiddle.js'
|
||||
import type { JSFiddleTokenMeta } from '../../shared/index.js'
|
||||
import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
|
||||
export const jsfiddlePlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<JSFiddleTokenMeta>(md, {
|
||||
type: 'jsfiddle',
|
||||
syntaxPattern: /^@\[jsfiddle(?:\s+([^]*?))?\]\(([^)]*?)\)/,
|
||||
syntaxPattern: /^@\[jsfiddle([^\]]*)\]\(([^)]*)\)/,
|
||||
meta([, info = '', source]) {
|
||||
const { attrs } = resolveAttrs(info)
|
||||
const [user, id] = source.split('/')
|
||||
|
||||
@ -3,9 +3,9 @@ import container from 'markdown-it-container'
|
||||
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/repl.js'
|
||||
import type { ReplEditorData, ReplOptions } from '../../shared/index.js'
|
||||
|
||||
const RE_INFO = /^(#editable)?\s*?(.*)$/
|
||||
const RE_INFO = /^(#editable)?(.*)$/
|
||||
|
||||
function createReplContainer(md: markdownIt, lang: string) {
|
||||
const type = `${lang}-repl`
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
*/
|
||||
import { path } from 'vuepress/utils'
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import type { PDFTokenMeta } from '../../shared/pdf.js'
|
||||
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'
|
||||
@ -13,7 +13,8 @@ import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
export const pdfPlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<PDFTokenMeta>(md, {
|
||||
type: 'pdf',
|
||||
syntaxPattern: /^@\[pdf(?:\s+(\d+))?(?:\s+([^]*?))?\]\(([^)]*?)\)/,
|
||||
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
||||
syntaxPattern: /^@\[pdf(?:\s+(\d+))?([^\]]*)\]\(([^)]*)\)/,
|
||||
meta([, page, info = '', src = '']) {
|
||||
const { attrs } = resolveAttrs(info)
|
||||
return {
|
||||
|
||||
@ -6,13 +6,13 @@
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import { resolveAttrs } from '../utils/resolveAttrs.js'
|
||||
import { parseRect } from '../utils/parseRect.js'
|
||||
import type { ReplitTokenMeta } from '../../shared/replit.js'
|
||||
import type { ReplitTokenMeta } from '../../shared/index.js'
|
||||
import { createRuleBlock } from '../utils/createRuleBlock.js'
|
||||
|
||||
export const replitPlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<ReplitTokenMeta>(md, {
|
||||
type: 'replit',
|
||||
syntaxPattern: /^@\[replit(?:\s+([^]*?))?\]\(([^)]*?)\)/,
|
||||
syntaxPattern: /^@\[replit([^\]]*)\]\(([^)]*)\)/,
|
||||
meta: ([, info = '', source = '']) => {
|
||||
const { attrs } = resolveAttrs(info)
|
||||
return {
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*/
|
||||
import { URLSearchParams } from 'node:url'
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import type { BilibiliTokenMeta } from '../../../shared/video.js'
|
||||
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'
|
||||
@ -18,7 +18,8 @@ export const bilibiliPlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<BilibiliTokenMeta>(md, {
|
||||
type: 'bilibili',
|
||||
name: 'video_bilibili',
|
||||
syntaxPattern: /^@\[bilibili(?:\s+p(\d+))?(?:\s+([^]*?))?\]\(([^)]*)\)/,
|
||||
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
||||
syntaxPattern: /^@\[bilibili(?:\s+p(\d+))?([^\]]*)\]\(([^)]*)\)/,
|
||||
meta([, page, info = '', source = '']) {
|
||||
const { attrs } = resolveAttrs(info)
|
||||
const ids = source.trim().split(/\s+/)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
*/
|
||||
import { URLSearchParams } from 'node:url'
|
||||
import type { PluginWithOptions } from 'markdown-it'
|
||||
import type { YoutubeTokenMeta } from '../../../shared/video.js'
|
||||
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'
|
||||
@ -15,7 +15,7 @@ export const youtubePlugin: PluginWithOptions<never> = (md) => {
|
||||
createRuleBlock<YoutubeTokenMeta>(md, {
|
||||
type: 'youtube',
|
||||
name: 'video_youtube',
|
||||
syntaxPattern: /^@\[youtube(?:\s+([^]*?))?\]\(([^)]*)\)/,
|
||||
syntaxPattern: /^@\[youtube([^\]]*)\]\(([^)]*)\)/,
|
||||
meta([, info = '', id = '']) {
|
||||
const { attrs } = resolveAttrs(info)
|
||||
|
||||
|
||||
@ -51,18 +51,11 @@ export async function prepareConfigFile(app: App, options: MarkdownPowerPluginOp
|
||||
enhances.add(`app.component('CodeRepl', CodeRepl)`)
|
||||
}
|
||||
|
||||
// enhances.add(`if (__VUEPRESS_SSR__) return`)
|
||||
|
||||
if (options.caniuse) {
|
||||
imports.add(`import CanIUse from '${CLIENT_FOLDER}components/CanIUse.vue'`)
|
||||
enhances.add(`app.component('CanIUseViewer', CanIUse)`)
|
||||
}
|
||||
|
||||
// if (options.caniuse) {
|
||||
// imports.add(`import { setupCanIUse } from '${CLIENT_FOLDER}composables/setupCanIUse.js'`)
|
||||
// enhances.add(`router.afterEach(() => setupCanIUse())`)
|
||||
// }
|
||||
|
||||
return app.writeTemp(
|
||||
'md-power/config.js',
|
||||
`\
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const RE_ATTR_VALUE = /(?:^|\s+)(?<attr>[\w\d-]+)(?:=\s*(?<quote>['"])(?<value>.+?)\k<quote>)?(?:\s+|$)/
|
||||
const RE_ATTR_VALUE = /(?:^|\s+)(?<attr>[\w-]+)(?:=\s*(?<quote>['"])(?<value>.+?)\k<quote>)?(?:\s+|$)/
|
||||
|
||||
export function resolveAttrs(info: string): {
|
||||
attrs: Record<string, any>
|
||||
|
||||
@ -4,8 +4,11 @@ export * from './icons.js'
|
||||
export * from './video.js'
|
||||
export * from './codepen.js'
|
||||
export * from './codeSandbox.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'
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.build.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"types": [
|
||||
"vuepress/client-types",
|
||||
"vite/client",
|
||||
"webpack-env"
|
||||
],
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"files": [],
|
||||
"include": ["./src"]
|
||||
}
|
||||
45
plugins/plugin-md-power/tsup.config.ts
Normal file
45
plugins/plugin-md-power/tsup.config.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
|
||||
const config = [
|
||||
{ dir: 'composables', files: ['codeRepl.ts', 'pdf.ts', 'rustRepl.ts', 'size.ts'] },
|
||||
{ dir: 'utils', files: ['http.ts', 'is.ts', 'link.ts', 'sleep.ts'] },
|
||||
{ dir: '', files: ['index.ts', 'options.ts'] },
|
||||
]
|
||||
|
||||
const clientExternal = [
|
||||
/composables\/.*\.js$/,
|
||||
/utils\/.*\.js$/,
|
||||
/.*\/options\.js$/,
|
||||
/shared\/index\.js$/,
|
||||
]
|
||||
|
||||
export default defineConfig(() => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
}
|
||||
return [
|
||||
// shared
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/shared/index.ts'],
|
||||
outDir: './lib/shared',
|
||||
},
|
||||
// node
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/node/index.ts'],
|
||||
outDir: './lib/node',
|
||||
target: 'node18',
|
||||
},
|
||||
// client
|
||||
...config.map(({ dir, files }) => ({
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: files.map(file => `./src/client/${dir}/${file}`),
|
||||
outDir: `./lib/client/${dir}`,
|
||||
external: clientExternal,
|
||||
}) as Options),
|
||||
]
|
||||
})
|
||||
@ -31,16 +31,16 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run copy && pnpm run ts",
|
||||
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
||||
"build": "pnpm run copy && pnpm run tsup",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
|
||||
"ts": "tsc -b tsconfig.build.json"
|
||||
"tsup": "tsup --config tsup.config.ts"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vuepress": "2.0.0-rc.14"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vuepress/helper": "2.0.0-rc.38",
|
||||
"@vuepress/helper": "2.0.0-rc.39",
|
||||
"@vueuse/core": "^10.11.0",
|
||||
"@vueuse/integrations": "^10.11.0",
|
||||
"chokidar": "^3.6.0",
|
||||
|
||||
@ -23,10 +23,9 @@ import {
|
||||
import Mark from 'mark.js/src/vanilla.js'
|
||||
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
||||
import MiniSearch, { type SearchResult } from 'minisearch'
|
||||
import { useSearchIndex } from '../composables/index.js'
|
||||
import { useLocale, useSearchIndex } from '../composables/index.js'
|
||||
import type { SearchBoxLocales, SearchOptions } from '../../shared/index.js'
|
||||
import { LRUCache } from '../utils/lru.js'
|
||||
import { useLocale } from '../composables/locale.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'
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { toRef } from 'vue'
|
||||
import type { SearchBoxLocales } from '../../shared/index.js'
|
||||
import { useLocale } from '../composables/locale.js'
|
||||
import { useLocale } from '../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
locales: SearchBoxLocales
|
||||
|
||||
@ -1 +1,2 @@
|
||||
export * from './searchIndex.js'
|
||||
export * from './locale.js'
|
||||
|
||||
1
plugins/plugin-search/src/client/utils/index.ts
Normal file
1
plugins/plugin-search/src/client/utils/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './lru.js'
|
||||
@ -147,7 +147,9 @@ async function indexFile(page: Page, options: SearchIndexOptions['searchOptions'
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
||||
const headingRegex = /<h(\d*).*?>(<a.*? href="#.*?".*?>.*?<\/a>)<\/h\1>/gi
|
||||
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
||||
const headingContentRegex = /<a.*? href="#(.*?)".*?>(.*?)<\/a>/i
|
||||
|
||||
/**
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.build.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"rootDir": "./src",
|
||||
"types": [
|
||||
"vuepress/client-types",
|
||||
"vite/client",
|
||||
"webpack-env"
|
||||
],
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
}
|
||||
68
plugins/plugin-search/tsup.config.ts
Normal file
68
plugins/plugin-search/tsup.config.ts
Normal file
@ -0,0 +1,68 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
|
||||
const sharedExternal: (string | RegExp)[] = [
|
||||
/.*\/shared\/index\.js$/,
|
||||
]
|
||||
|
||||
const clientExternal: (string | RegExp)[] = [
|
||||
...sharedExternal,
|
||||
/^@internal/,
|
||||
/.*\.vue$/,
|
||||
/.*\.css$/,
|
||||
]
|
||||
|
||||
export default defineConfig(() => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
}
|
||||
return [
|
||||
// shared
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/shared/index.ts'],
|
||||
outDir: './lib/shared',
|
||||
},
|
||||
// node
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/node/index.ts'],
|
||||
outDir: './lib/node',
|
||||
external: sharedExternal,
|
||||
target: 'node18',
|
||||
},
|
||||
// client/utils/index.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/utils/index.ts'],
|
||||
outDir: './lib/client/utils',
|
||||
external: clientExternal,
|
||||
},
|
||||
// client/composables/index.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/composables/index.ts'],
|
||||
outDir: './lib/client/composables',
|
||||
external: clientExternal,
|
||||
},
|
||||
// client/config.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/config.ts'],
|
||||
outDir: './lib/client',
|
||||
external: clientExternal,
|
||||
},
|
||||
// client/index.js
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/client/index.ts'],
|
||||
outDir: './lib/client',
|
||||
external: [
|
||||
...clientExternal,
|
||||
'./composables/index.js',
|
||||
],
|
||||
},
|
||||
]
|
||||
})
|
||||
@ -27,10 +27,10 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run copy && pnpm run ts",
|
||||
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
||||
"build": "pnpm run copy && pnpm run tsup",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
|
||||
"ts": "tsc -b tsconfig.build.json"
|
||||
"tsup": "tsup --config tsup.config.ts"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vuepress": "2.0.0-rc.14"
|
||||
@ -39,7 +39,8 @@
|
||||
"@shikijs/transformers": "^1.10.3",
|
||||
"@shikijs/twoslash": "^1.10.3",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@vuepress/helper": "2.0.0-rc.38",
|
||||
"@vuepress/helper": "2.0.0-rc.39",
|
||||
"@vueuse/core": "^10.11.0",
|
||||
"floating-vue": "^5.2.2",
|
||||
"mdast-util-from-markdown": "^2.0.1",
|
||||
"mdast-util-gfm": "^3.0.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useClipboard, useEventListener } from '@vueuse/core'
|
||||
|
||||
const SHELL_RE = /language-(shellscript|shell|bash|sh|zsh)/
|
||||
const SHELL_RE = /language-(?:shellscript|shell|bash|sh|zsh)/
|
||||
const IGNORE_NODES = ['.vp-copy-ignore', '.diff.remove']
|
||||
|
||||
interface CopyCodeOptions {
|
||||
|
||||
@ -27,7 +27,7 @@ const cache = new LRUCache<string, string>(64)
|
||||
|
||||
const vueRE = /-vue$/
|
||||
const mustacheRE = /\{\{.*?\}\}/g
|
||||
const decorationsRE = /^\/\/ @decorations:(.*?)\n/
|
||||
const decorationsRE = /^\/\/ @decorations:(.*)\n/
|
||||
|
||||
export async function highlight(
|
||||
theme: ThemeOptions,
|
||||
@ -136,7 +136,7 @@ export async function highlight(
|
||||
})
|
||||
|
||||
if (enabledTwoslash && options.twoslash)
|
||||
s = s.replace(/{/g, '{')
|
||||
s = s.replace(/\{/g, '{')
|
||||
|
||||
return `${s}\n`
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
import type { Markdown } from 'vuepress/markdown'
|
||||
|
||||
const HIGHLIGHT_LINES_REGEXP = /{([\d,-]+)}/
|
||||
const HIGHLIGHT_LINES_REGEXP = /\{([\d,-]+)\}/
|
||||
|
||||
export function highlightLinesPlugin(md: Markdown): void {
|
||||
const rawFence = md.renderer.rules.fence!
|
||||
|
||||
@ -56,7 +56,7 @@ export function lineNumberPlugin(md: Markdown, { lineNumbers = true }: LineNumbe
|
||||
|
||||
const finalCode = rawCode
|
||||
.replace(/<\/div>$/, `${lineNumbersWrapperCode}</div>`)
|
||||
.replace(/"(language-[^"]*?)"/, '"$1 line-numbers-mode"')
|
||||
.replace(/"(language-[^"]*)"/, '"$1 line-numbers-mode"')
|
||||
|
||||
return finalCode
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ export function preWrapperPlugin(md: Markdown, { preWrapper = true }: PreWrapper
|
||||
|
||||
if (!preWrapper) {
|
||||
// remove `<code>` attributes
|
||||
result = result.replace(/<code[^]*?>/, '<code>')
|
||||
result = result.replace(/<code[\s\S]*?>/, '<code>')
|
||||
result = `<pre class="${languageClass}"${result.slice('<pre'.length)}`
|
||||
return result
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ function vPre<T extends ElementContent>(el: T): T {
|
||||
|
||||
function renderMarkdown(this: ShikiTransformerContextCommon, md: string): ElementContent[] {
|
||||
const mdast = fromMarkdown(
|
||||
md.replace(/{@link ([^}]*)}/g, '$1'), // replace jsdoc links
|
||||
md.replace(/\{@link ([^}]*)\}/g, '$1'), // replace jsdoc links
|
||||
{ mdastExtensions: [gfmFromMarkdown()] },
|
||||
)
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ export function transformerTwoslash(options: VitePressPluginTwoslashOptions = {}
|
||||
},
|
||||
postprocess(html) {
|
||||
if (this.meta.twoslash)
|
||||
return html.replace(/{/g, '{')
|
||||
return html.replace(/\{/g, '{')
|
||||
|
||||
return html
|
||||
},
|
||||
|
||||
@ -9,6 +9,7 @@ import type { TransformerCompactLineOption } from '@shikijs/transformers'
|
||||
* [{ line: number, classes: string[] }]
|
||||
*/
|
||||
export function attrsToLines(attrs: string): TransformerCompactLineOption[] {
|
||||
// eslint-disable-next-line regexp/optimal-quantifier-concatenation, regexp/no-super-linear-backtracking
|
||||
attrs = attrs.replace(/^(?:\[.*?\])?.*?([\d,-]+).*/, '$1').trim()
|
||||
|
||||
const result: number[] = []
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
const RE_ATTR_VALUE = /(?:^|\s+)(?<attr>[\w\d-]+)(?:=\s*(?<quote>['"])(?<value>.+?)\k<quote>)?(?:\s+|$)/
|
||||
const RE_CODE_BLOCKS = /^[\w\d-]*(\s*:[\w\d-]*)?(\s*\{[\d\w-,\s]+\})?\s*/
|
||||
const RE_ATTR_VALUE = /(?:^|\s+)(?<attr>[\w-]+)(?:=\s*(?<quote>['"])(?<value>.+?)\k<quote>)?(?:\s+|$)/
|
||||
const RE_CODE_BLOCKS = /^[\w\-]*(\s*:[\w\-]*)?(\s*\{[\w\-,\s]+\})?\s*/
|
||||
|
||||
export function resolveAttrs(info: string): {
|
||||
attrs: Record<string, string | boolean>
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.build.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"types": ["vuepress/client-types"],
|
||||
"outDir": "./lib"
|
||||
},
|
||||
"include": ["./src"]
|
||||
}
|
||||
29
plugins/plugin-shikiji/tsup.config.ts
Normal file
29
plugins/plugin-shikiji/tsup.config.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
|
||||
export default defineConfig(() => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: true,
|
||||
sourcemap: false,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
}
|
||||
return [
|
||||
// node
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: ['./src/node/index.ts'],
|
||||
outDir: './lib/node',
|
||||
target: 'node18',
|
||||
},
|
||||
// client/composables/
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: [
|
||||
'copy-code.ts',
|
||||
'twoslash.ts',
|
||||
].map(file => `./src/client/composables/${file}`),
|
||||
outDir: './lib/client/composables',
|
||||
external: [/.*\.css$/],
|
||||
},
|
||||
]
|
||||
})
|
||||
@ -1,16 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"composite": true
|
||||
},
|
||||
"references": [
|
||||
{ "path": "./plugin-baidu-tongji/tsconfig.build.json" },
|
||||
{ "path": "./plugin-iconify/tsconfig.build.json" },
|
||||
{ "path": "./plugin-fonts/tsconfig.build.json" },
|
||||
{ "path": "./plugin-shikiji/tsconfig.build.json" },
|
||||
{ "path": "./plugin-content-update/tsconfig.build.json" },
|
||||
{ "path": "./plugin-search/tsconfig.build.json" },
|
||||
{ "path": "./plugin-md-power/tsconfig.build.json" }
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
1450
pnpm-lock.yaml
generated
1450
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
18
readme.md
18
readme.md
@ -76,21 +76,3 @@ __options__ : `PlumeThemeOptions`
|
||||
## 贡献指南
|
||||
|
||||
查看 [[贡献指南]](/CONTRIBUTING.md) 了解更多
|
||||
|
||||
### 效果图
|
||||
|
||||
#### home page
|
||||
|
||||

|
||||
|
||||
#### blog page
|
||||
|
||||

|
||||
|
||||
#### post page
|
||||
|
||||

|
||||
|
||||
#### note page
|
||||
|
||||

|
||||
|
||||
@ -37,10 +37,6 @@
|
||||
"types": "./lib/client/composables/index.d.ts",
|
||||
"import": "./lib/client/composables/index.js"
|
||||
},
|
||||
"./composables/*": {
|
||||
"types": "./lib/client/composables/*.d.ts",
|
||||
"import": "./lib/client/composables/*.js"
|
||||
},
|
||||
"./shared": {
|
||||
"types": "./lib/shared/index.d.ts",
|
||||
"import": "./lib/shared/index.js"
|
||||
@ -54,52 +50,50 @@
|
||||
"templates"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm run copy && pnpm run ts",
|
||||
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
||||
"dev": "pnpm '/(copy|tsup):watch/'",
|
||||
"build": "pnpm run copy && pnpm run tsup",
|
||||
"clean": "rimraf --glob ./lib",
|
||||
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png,woff2}\" lib",
|
||||
"copy:watch": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png,woff2}\" lib -w",
|
||||
"dev": "concurrently \"pnpm copy:watch\" \"pnpm ts:watch\"",
|
||||
"ts": "tsc -b tsconfig.build.json",
|
||||
"ts:watch": "tsc -b tsconfig.build.json --watch"
|
||||
"tsup": "tsup --config tsup.config.ts",
|
||||
"tsup:watch": "tsup --config tsup.config.ts --watch"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vuepress": "2.0.0-rc.14"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pengzhanbo/utils": "^1.1.2",
|
||||
"@vue/devtools-api": "6.6.3",
|
||||
"@vuepress-plume/plugin-baidu-tongji": "workspace:*",
|
||||
"@vuepress-plume/plugin-content-update": "workspace:*",
|
||||
"@vuepress-plume/plugin-fonts": "workspace:*",
|
||||
"@vuepress-plume/plugin-iconify": "workspace:*",
|
||||
"@vuepress-plume/plugin-search": "workspace:*",
|
||||
"@vuepress-plume/plugin-shikiji": "workspace:*",
|
||||
"@vuepress/helper": "2.0.0-rc.38",
|
||||
"@vuepress/plugin-active-header-links": "2.0.0-rc.38",
|
||||
"@vuepress/plugin-comment": "2.0.0-rc.38",
|
||||
"@vuepress/plugin-docsearch": "2.0.0-rc.38",
|
||||
"@vuepress/helper": "2.0.0-rc.39",
|
||||
"@vuepress/plugin-active-header-links": "2.0.0-rc.39",
|
||||
"@vuepress/plugin-comment": "2.0.0-rc.39",
|
||||
"@vuepress/plugin-docsearch": "2.0.0-rc.39",
|
||||
"@vuepress/plugin-git": "2.0.0-rc.38",
|
||||
"@vuepress/plugin-markdown-container": "2.0.0-rc.37",
|
||||
"@vuepress/plugin-nprogress": "2.0.0-rc.38",
|
||||
"@vuepress/plugin-photo-swipe": "2.0.0-rc.38",
|
||||
"@vuepress/plugin-reading-time": "2.0.0-rc.38",
|
||||
"@vuepress/plugin-seo": "2.0.0-rc.38",
|
||||
"@vuepress/plugin-sitemap": "2.0.0-rc.38",
|
||||
"@vuepress/plugin-watermark": "2.0.0-rc.38",
|
||||
"@vuepress/plugin-nprogress": "2.0.0-rc.39",
|
||||
"@vuepress/plugin-photo-swipe": "2.0.0-rc.39",
|
||||
"@vuepress/plugin-reading-time": "2.0.0-rc.39",
|
||||
"@vuepress/plugin-seo": "2.0.0-rc.39",
|
||||
"@vuepress/plugin-sitemap": "2.0.0-rc.39",
|
||||
"@vuepress/plugin-watermark": "2.0.0-rc.39",
|
||||
"@vueuse/core": "^10.11.0",
|
||||
"bcrypt-ts": "^5.0.2",
|
||||
"chokidar": "^3.6.0",
|
||||
"create-filter": "^1.1.0",
|
||||
"date-fns": "^3.6.0",
|
||||
"esbuild": "~0.21.5",
|
||||
"esbuild": "^0.23.0",
|
||||
"fast-glob": "^3.3.2",
|
||||
"gray-matter": "^4.0.3",
|
||||
"json2yaml": "^1.1.0",
|
||||
"katex": "^0.16.11",
|
||||
"nanoid": "^5.0.7",
|
||||
"vue": "^3.4.31",
|
||||
"vue": "^3.4.32",
|
||||
"vue-router": "^4.4.0",
|
||||
"vuepress-plugin-md-enhance": "2.0.0-rc.51",
|
||||
"vuepress-plugin-md-enhance": "2.0.0-rc.52",
|
||||
"vuepress-plugin-md-power": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import VPBlogTags from '@theme/Blog/VPBlogTags.vue'
|
||||
import VPBlogCategories from '@theme/Blog/VPBlogCategories.vue'
|
||||
import VPBlogNav from '@theme/Blog/VPBlogNav.vue'
|
||||
import VPTransitionFadeSlideY from '@theme/VPTransitionFadeSlideY.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme, page } = useData()
|
||||
</script>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import VPShortPostList from '@theme/Blog/VPShortPostList.vue'
|
||||
import { useBlogNavTitle } from '../../composables/blog-extract.js'
|
||||
import { useArchives } from '../../composables/blog-archives.js'
|
||||
import { useArchives, useBlogNavTitle } from '../../composables/index.js'
|
||||
|
||||
const title = useBlogNavTitle('archive')
|
||||
const { archives } = useArchives()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import VPBlogNav from '@theme/Blog/VPBlogNav.vue'
|
||||
import VPBlogProfile from '@theme/Blog/VPBlogProfile.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
</script>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import VPCategories from '@theme/Blog/VPCategories.vue'
|
||||
import { useBlogCategory } from '../../composables/blog-category.js'
|
||||
import { useBlogNavTitle } from '../../composables/blog-extract.js'
|
||||
import { useBlogCategory, useBlogNavTitle } from '../../composables/index.js'
|
||||
|
||||
const title = useBlogNavTitle('category')
|
||||
const { categories } = useBlogCategory()
|
||||
|
||||
@ -4,8 +4,7 @@ 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 } from '../../composables/blog-extract.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useBlogExtract, useData } from '../../composables/index.js'
|
||||
import { inBrowser } from '../../utils/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { useRoute } from 'vuepress/client'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import { useBlogExtract } from '../../composables/blog-extract.js'
|
||||
import { useBlogExtract } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
isLocal?: boolean
|
||||
|
||||
@ -3,7 +3,7 @@ import { computed } from 'vue'
|
||||
import { withBase } from 'vuepress/client'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import VPSocialLinks from '@theme/VPSocialLinks.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const { theme } = useData()
|
||||
const profile = computed(() => theme.value.profile)
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import VPShortPostList from '@theme/Blog/VPShortPostList.vue'
|
||||
import { useBlogNavTitle } from '../../composables/blog-extract.js'
|
||||
import { useTags } from '../../composables/blog-tags.js'
|
||||
import { useBlogNavTitle, useTags } from '../../composables/index.js'
|
||||
|
||||
const { tags, currentTag, postList, handleTagClick } = useTags()
|
||||
const title = useBlogNavTitle('tag')
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import VPCategoriesGroup from '@theme/Blog/VPCategoriesGroup.vue'
|
||||
import type { BlogCategoryItem, BlogCategoryItemWithPost } from '../../composables/blog-category.js'
|
||||
import type { BlogCategoryItem, BlogCategoryItemWithPost } from '../../composables/index.js'
|
||||
|
||||
defineProps < {
|
||||
items: (BlogCategoryItem | BlogCategoryItemWithPost)[]
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { useRoute } from 'vuepress/client'
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import VPCategories from '@theme/Blog/VPCategories.vue'
|
||||
import type { BlogCategoryItem } from '../../composables/blog-category.js'
|
||||
import type { BlogCategoryItem } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
item: BlogCategoryItem
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
defineProps<{
|
||||
page: number
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { computed } from 'vue'
|
||||
import VPLink from '@theme/VPLink.vue'
|
||||
import type { PlumeThemeBlogPostItem } from '../../../shared/index.js'
|
||||
import { useTagColors } from '../../composables/tag-colors.js'
|
||||
import { useTagColors } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
post: PlumeThemeBlogPostItem
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import VPTransitionDrop from '@theme/VPTransitionDrop.vue'
|
||||
import VPPostItem from '@theme/Blog/VPPostItem.vue'
|
||||
import VPPagination from '@theme/Blog/VPPagination.vue'
|
||||
import { usePostListControl } from '../../composables/blog-post-list.js'
|
||||
import { usePostListControl } from '../../composables/index.js'
|
||||
|
||||
const {
|
||||
postList,
|
||||
|
||||
@ -6,7 +6,7 @@ import VPHomeFeatures from '@theme/Home/VPHomeFeatures.vue'
|
||||
import VPHomeTextImage from '@theme/Home/VPHomeTextImage.vue'
|
||||
import VPHomeProfile from '@theme/Home/VPHomeProfile.vue'
|
||||
import VPHomeCustom from '@theme/Home/VPHomeCustom.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const components: Record<string, Component<any, any, any>> = {
|
||||
'banner': VPHomeBanner,
|
||||
|
||||
@ -4,7 +4,7 @@ import { isLinkHttp } from 'vuepress/shared'
|
||||
import { computed } from 'vue'
|
||||
import VPButton from '@theme/VPButton.vue'
|
||||
import type { PlumeThemeHomeBanner } from '../../../shared/index.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<PlumeThemeHomeBanner>()
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import { withBase } from 'vuepress/client'
|
||||
import { computed, normalizeClass } from 'vue'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import type { PlumeHomeConfigBase } from '../../../shared/index.js'
|
||||
import { useDarkMode } from '../../composables/dark-mode.js'
|
||||
import { useDarkMode } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<PlumeHomeConfigBase & {
|
||||
containerClass?: any
|
||||
|
||||
@ -3,8 +3,7 @@ import { withBase } from 'vuepress/client'
|
||||
import { isLinkHttp } from 'vuepress/shared'
|
||||
import { computed, ref } from 'vue'
|
||||
import VPButton from '@theme/VPButton.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useHomeHeroTintPlate } from '../../composables/home.js'
|
||||
import { useData, useHomeHeroTintPlate } from '../../composables/index.js'
|
||||
import type { PlumeThemeHomeHero } from '../../../shared/index.js'
|
||||
|
||||
const props = defineProps<PlumeThemeHomeHero>()
|
||||
|
||||
@ -3,7 +3,7 @@ import { computed } from 'vue'
|
||||
import VPImage from '@theme/VPImage.vue'
|
||||
import VPHomeBox from '@theme/Home/VPHomeBox.vue'
|
||||
import type { PlumeThemeHomeProfile } from '../../../shared/index.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<PlumeThemeHomeProfile>()
|
||||
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
import { computed, provide, watchEffect } from 'vue'
|
||||
import VPNavbar from '@theme/Nav/VPNavBar.vue'
|
||||
import VPNavScreen from '@theme/Nav/VPNavScreen.vue'
|
||||
import { useNav } from '../../composables/nav.js'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useData, useNav } from '../../composables/index.js'
|
||||
import { inBrowser } from '../../utils/index.js'
|
||||
|
||||
const { page, frontmatter } = useData()
|
||||
|
||||
@ -9,8 +9,7 @@ import VPNavBarSearch from '@theme/Nav/VPNavBarSearch.vue'
|
||||
import VPNavBarSocialLinks from '@theme/Nav/VPNavBarSocialLinks.vue'
|
||||
import VPNavBarTitle from '@theme/Nav/VPNavBarTitle.vue'
|
||||
import VPNavBarTranslations from '@theme/Nav/VPNavBarTranslations.vue'
|
||||
import { useData } from '../../composables/data.js'
|
||||
import { useSidebar } from '../../composables/sidebar.js'
|
||||
import { useData, useSidebar } from '../../composables/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
isScreenOpen: boolean
|
||||
|
||||
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