From 90628e447322334c31492c2a4b707644922f7ced Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Fri, 6 Dec 2024 13:21:09 +0800 Subject: [PATCH] chore(highlighter-helper): tweaks exports --- .../plugin-prismjs/src/node/prepareClientConfigFile.ts | 2 +- .../plugin-shiki/src/node/prepareClientConfigFile.ts | 2 +- tools/highlighter-helper/package.json | 2 +- tools/highlighter-helper/rollup.config.ts | 8 +------- tools/highlighter-helper/src/client/composables/index.ts | 1 + .../{collapsedLines.ts => setupCollapsedLines.ts} | 0 tools/highlighter-helper/src/client/index.ts | 1 + 7 files changed, 6 insertions(+), 10 deletions(-) create mode 100644 tools/highlighter-helper/src/client/composables/index.ts rename tools/highlighter-helper/src/client/composables/{collapsedLines.ts => setupCollapsedLines.ts} (100%) create mode 100644 tools/highlighter-helper/src/client/index.ts diff --git a/plugins/markdown/plugin-prismjs/src/node/prepareClientConfigFile.ts b/plugins/markdown/plugin-prismjs/src/node/prepareClientConfigFile.ts index 99d1020f2b..fb87683348 100644 --- a/plugins/markdown/plugin-prismjs/src/node/prepareClientConfigFile.ts +++ b/plugins/markdown/plugin-prismjs/src/node/prepareClientConfigFile.ts @@ -85,7 +85,7 @@ export const prepareClientConfigFile = ( if (collapsedLines !== 'disable') { imports.push( `import "${getRealPath('@vuepress/highlighter-helper/styles/collapsed-lines.css', url)}"`, - `import { setupCollapsedLines } from "${getRealPath('@vuepress/highlighter-helper/composables/collapsedLines.js', url)}"`, + `import { setupCollapsedLines } from "${getRealPath('@vuepress/highlighter-helper/client', url)}"`, ) setups.push('setupCollapsedLines()') } diff --git a/plugins/markdown/plugin-shiki/src/node/prepareClientConfigFile.ts b/plugins/markdown/plugin-shiki/src/node/prepareClientConfigFile.ts index c9298c526d..58f9d01d39 100644 --- a/plugins/markdown/plugin-shiki/src/node/prepareClientConfigFile.ts +++ b/plugins/markdown/plugin-shiki/src/node/prepareClientConfigFile.ts @@ -77,7 +77,7 @@ export const prepareClientConfigFile = ( if (collapsedLines !== 'disable') { imports.push( `import "${getRealPath('@vuepress/highlighter-helper/styles/collapsed-lines.css', url)}"`, - `import { setupCollapsedLines } from "${getRealPath('@vuepress/highlighter-helper/composables/collapsedLines.js', url)}"`, + `import { setupCollapsedLines } from "${getRealPath('@vuepress/highlighter-helper/client', url)}"`, ) setups.push('setupCollapsedLines()') } diff --git a/tools/highlighter-helper/package.json b/tools/highlighter-helper/package.json index d65db101ef..092b1a085e 100644 --- a/tools/highlighter-helper/package.json +++ b/tools/highlighter-helper/package.json @@ -25,7 +25,7 @@ "type": "module", "exports": { ".": "./lib/node/index.js", - "./composables/*": "./lib/client/composables/*", + "./client": "./lib/client/index.js", "./styles/*": "./lib/client/styles/*", "./package.json": "./package.json" }, diff --git a/tools/highlighter-helper/rollup.config.ts b/tools/highlighter-helper/rollup.config.ts index 8a1e65b952..b54d83bbcd 100644 --- a/tools/highlighter-helper/rollup.config.ts +++ b/tools/highlighter-helper/rollup.config.ts @@ -1,9 +1,3 @@ import { rollupBundle } from '../../scripts/rollup.js' -export default [ - ...rollupBundle('node/index'), - ...rollupBundle({ - base: 'client', - files: ['composables/collapsedLines'], - }), -] +export default [...rollupBundle('node/index'), ...rollupBundle('client/index')] diff --git a/tools/highlighter-helper/src/client/composables/index.ts b/tools/highlighter-helper/src/client/composables/index.ts new file mode 100644 index 0000000000..8ccfbbbfd2 --- /dev/null +++ b/tools/highlighter-helper/src/client/composables/index.ts @@ -0,0 +1 @@ +export * from './setupCollapsedLines.js' diff --git a/tools/highlighter-helper/src/client/composables/collapsedLines.ts b/tools/highlighter-helper/src/client/composables/setupCollapsedLines.ts similarity index 100% rename from tools/highlighter-helper/src/client/composables/collapsedLines.ts rename to tools/highlighter-helper/src/client/composables/setupCollapsedLines.ts diff --git a/tools/highlighter-helper/src/client/index.ts b/tools/highlighter-helper/src/client/index.ts new file mode 100644 index 0000000000..14f996097e --- /dev/null +++ b/tools/highlighter-helper/src/client/index.ts @@ -0,0 +1 @@ +export * from './composables/index.js'