vuepress / core

Vue-Powered Static Site Generator
https://vuepress.vuejs.org
MIT License
2.17k stars 922 forks source link

迁移@vuepress/client到vuepress/client导致三方插件未适配新版本的全部无法使用 #1502

Closed OrageKK closed 4 months ago

OrageKK commented 4 months ago

Description

Bug report

Steps to reproduce

我的blog引入了vuepress-plugin-oh-my-live2d插件,它已经有些日子不更新了,但之前还一直能用

What is expected?

版本升级应该尽量向前兼容,让一些无人维护的插件还能继续使用

What is actually happening?

import { ClientConfig } from '@vuepress/client';
export * from '@vuepress/client';

/**
 * A helper function to help you define vuepress client config file
 */
declare const defineClientConfig: (clientConfig?: ClientConfig) => ClientConfig;

export { defineClientConfig };

在之前的版本中,我不确定是哪个版本开始的变更,defineClientConfig是从@vuepress/client导出的 现版本是从vuepress/client导出的 以前的插件中的代码仍在使用@vuepress/client,但是新版的@vuepress/client已经没有了defineClientConfig的导出

Reproduction

https://stackblitz.com/edit/vuepress-typ8nz?file=package.json,docs%2F.vuepress%2Fconfig.ts

Used Package Manager

pnpm

System Info

System:
    OS: macOS 13.6.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 196.61 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.5.0 - ~/n/bin/node
    Yarn: Not Found
    npm: 10.2.4 - ~/n/bin/npm
    pnpm: 8.14.0 - ~/Library/pnpm/pnpm
    bun: Not Found
  Utilities:
    Git: 2.39.2 - /usr/bin/git
  Browsers:
    Chrome: 121.0.6167.184
    Edge: Not Found
    Safari: 17.1
  npmPackages:
    @vuepress/bundler-vite: 2.0.0-rc.7 => 2.0.0-rc.7 
    @vuepress/bundler-webpack: Not Found
    @vuepress/cli: Not Found
    @vuepress/client: Not Found
    @vuepress/core: Not Found
    @vuepress/markdown: Not Found
    @vuepress/shared: Not Found
    @vuepress/utils: Not Found
    vue: ^3.4.19 => 3.4.19 
    vue-router: ^4.2.5 => 4.2.5 
    vuepress: 2.0.0-rc.7 => 2.0.0-rc.7
meteorlxy commented 4 months ago

Fixed by 651dac5

meteorlxy commented 4 months ago

As a workaround, you may try setting alias: @vuepress/client -> vuepress/client

OrageKK commented 4 months ago

Fixed by d00e9cc

I can't modify other people's plugins, but I hope you can add them at @vuepress/client

export const defineClientConfig = (
clientConfig: ClientConfig = {},
): ClientConfig =>  clientConfig

Make a compatible support for older versions of the plugin

OrageKK commented 4 months ago

Fixed by 651dac5

This modification is the result I expected, thank you, looking forward to his release