Merge pull request #126 from pengzhanbo/perf-bundle

optimize package bundle
This commit is contained in:
pengzhanbo 2024-07-20 00:51:55 +08:00 committed by GitHub
commit 55010d644b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
166 changed files with 1891 additions and 841 deletions

View File

@ -29,5 +29,5 @@ jobs:
- name: Linter
run: |
pnpm run lint
pnpm run lint:check
pnpm run lint:css

View File

@ -1,6 +1,8 @@
{
"recommendations": [
"vue.volar",
"dbaeumer.vscode-eslint"
"dbaeumer.vscode-eslint",
"stylelint.vscode-stylelint",
"DavidAnson.vscode-markdownlint"
]
}

2
.vscode/launch.json vendored
View File

@ -11,7 +11,7 @@
"name": "docs:dev",
"type": "node-terminal",
"request": "launch",
"command": "pnpm run docs"
"command": "pnpm run docs:dev"
},
{
"name": "docs:build",

View File

@ -82,8 +82,6 @@
"twoslash",
"vite",
"vuepress",
"vueuse",
"Windi",
"Windicss"
"vueuse"
]
}

View File

@ -16,7 +16,7 @@ sticky: 3
- 移除 `@vuepress-plume/plugin-notes-data` 插件
- 移除 `@vuepress-plume/plugin-auto-frontmatter` 插件
以上插件的功能全部移动到 `vuepress-theme-plugin` 主题包内部重新实现。原因是,单独的主题配置文件,
以上插件的功能全部移动到 `vuepress-theme-plume` 主题包内部重新实现。原因是,单独的主题配置文件,
在异步加载完配置、以及配置热更新时,需要对这些插件所实现的功能进行重载,为了使流程更加清晰可控,
在主题内重新实现了这些功能,并移除了相关插件。

View File

@ -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"

View File

@ -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',

View File

@ -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"

View File

@ -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.

View File

@ -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
})
]
// ...
}
```

View File

@ -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"
]
}

View File

@ -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])
},
)
}

View File

@ -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

View File

@ -1,5 +0,0 @@
import { baiduTongjiPlugin } from './plugin.js'
export * from './plugin.js'
export default baiduTongjiPlugin

View File

@ -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 },
])
},
}
}
}

View File

@ -1,10 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "./src",
"outDir": "./lib"
},
"files": [],
"include": ["./src"]
}

View File

@ -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"

View File

@ -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'),
}
}

View File

@ -1,8 +0,0 @@
{
"extends": "../tsconfig.build.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib"
},
"include": ["./src"]
}

View 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'],
},
]
})

View File

@ -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"

View File

@ -1,8 +0,0 @@
{
"extends": "../tsconfig.build.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib"
},
"include": ["./src"]
}

View 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,
},
]
})

View File

@ -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"

View File

@ -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>

View File

@ -0,0 +1 @@
export * from './iconify.js'

View File

@ -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

View File

@ -1,2 +0,0 @@
export * from './composables/iconify.js'
export * from '../shared/index.js'

View File

@ -1,6 +1,6 @@
import { iconifyPlugin } from './plugin.js'
export * from './plugin.js'
export * from '../shared/index.js'
/** @deprecated 请使用 具名导出 替代 默认导出 */
export default iconifyPlugin

View File

@ -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'),
}
}

View File

@ -1,5 +0,0 @@
export interface IconifyOptions {
componentName?: string
color?: string
size?: string | number
}

View File

@ -1,8 +0,0 @@
{
"extends": "../tsconfig.build.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib"
},
"include": ["./src"]
}

View 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,
},
]
})

View File

@ -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",

View File

@ -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>()

View File

@ -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'

View File

@ -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'>>()

View File

@ -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>()

View File

@ -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'

View File

@ -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>

View File

@ -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())

View File

@ -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('#')

View File

@ -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('/')

View File

@ -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> {

View File

@ -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('/')

View File

@ -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`

View File

@ -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 {

View File

@ -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 {

View File

@ -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+/)

View File

@ -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)

View File

@ -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',
`\

View File

@ -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>

View File

@ -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'

View File

@ -1,14 +0,0 @@
{
"extends": "../tsconfig.build.json",
"compilerOptions": {
"rootDir": "./src",
"types": [
"vuepress/client-types",
"vite/client",
"webpack-env"
],
"outDir": "./lib"
},
"files": [],
"include": ["./src"]
}

View 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),
]
})

View File

@ -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",

View File

@ -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'

View File

@ -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

View File

@ -1 +1,2 @@
export * from './searchIndex.js'
export * from './locale.js'

View File

@ -0,0 +1 @@
export * from './lru.js'

View File

@ -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
/**

View File

@ -1,14 +0,0 @@
{
"extends": "../tsconfig.build.json",
"compilerOptions": {
"baseUrl": ".",
"rootDir": "./src",
"types": [
"vuepress/client-types",
"vite/client",
"webpack-env"
],
"outDir": "./lib"
},
"include": ["./src"]
}

View 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',
],
},
]
})

View File

@ -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",

View File

@ -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 {

View File

@ -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, '&#123;')
s = s.replace(/\{/g, '&#123;')
return `${s}\n`
}

View File

@ -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!

View File

@ -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
}

View File

@ -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
}

View File

@ -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()] },
)

View File

@ -60,7 +60,7 @@ export function transformerTwoslash(options: VitePressPluginTwoslashOptions = {}
},
postprocess(html) {
if (this.meta.twoslash)
return html.replace(/{/g, '&#123;')
return html.replace(/\{/g, '&#123;')
return html
},

View File

@ -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[] = []

View File

@ -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>

View File

@ -1,9 +0,0 @@
{
"extends": "../tsconfig.build.json",
"compilerOptions": {
"rootDir": "./src",
"types": ["vuepress/client-types"],
"outDir": "./lib"
},
"include": ["./src"]
}

View 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$/],
},
]
})

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -76,21 +76,3 @@ __options__ : `PlumeThemeOptions`
## 贡献指南
查看 [[贡献指南]](/CONTRIBUTING.md) 了解更多
### 效果图
#### home page
![home](/preview/preview-home.jpeg?1)
#### blog page
![blog](/preview/preview-blog.jpeg?1)
#### post page
![post](/preview/preview-post.jpeg?1)
#### note page
![note](/preview/preview-note.jpeg?1)

View File

@ -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:*"
}
}

View File

@ -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>

View File

@ -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()

View File

@ -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>

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -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')

View File

@ -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)[]

View File

@ -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

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { useData } from '../../composables/data.js'
import { useData } from '../../composables/index.js'
defineProps<{
page: number

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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>()

View File

@ -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

View File

@ -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>()

View File

@ -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>()

View File

@ -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()

View File

@ -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