From 0b43bfbeadc7e24bfeebae3fd1078c364ac1d10e Mon Sep 17 00:00:00 2001 From: zjxxxxxxxxx <954270063@qq.com> Date: Fri, 22 Sep 2023 15:48:49 +0800 Subject: [PATCH] chore: update readme --- .changeset/tender-elephants-guess.md | 2 +- .../client/src/resolve/createVueResolver.ts | 6 ++-- packages/rollup/README.md | 32 +++++++++++-------- packages/vite/README.md | 32 +++++++++++-------- packages/webpack/README.md | 32 +++++++++++-------- 5 files changed, 61 insertions(+), 43 deletions(-) diff --git a/.changeset/tender-elephants-guess.md b/.changeset/tender-elephants-guess.md index a461c9ee..a6a05356 100644 --- a/.changeset/tender-elephants-guess.md +++ b/.changeset/tender-elephants-guess.md @@ -2,4 +2,4 @@ '@open-editor/shared': patch --- -add type uilt 'isBol' +add type util 'isBol' diff --git a/packages/client/src/resolve/createVueResolver.ts b/packages/client/src/resolve/createVueResolver.ts index a768d9c7..21fe5c8e 100644 --- a/packages/client/src/resolve/createVueResolver.ts +++ b/packages/client/src/resolve/createVueResolver.ts @@ -129,16 +129,16 @@ function parseVueSource(__source: string) { } let cacheIsVueSource: boolean | undefined; -function isVueSource(element: HTMLElement) { +function isVueSource(element?: HTMLElement | null) { if (isBol(cacheIsVueSource)) { return cacheIsVueSource; } while (element) { - if (getElementVueSource(element) != null) { + if (getElementVueSource(element)) { return (cacheIsVueSource = true); } - element = element.parentElement!; + element = element.parentElement; } return (cacheIsVueSource = false); diff --git a/packages/rollup/README.md b/packages/rollup/README.md index 4d5bd1c2..16dd46aa 100644 --- a/packages/rollup/README.md +++ b/packages/rollup/README.md @@ -29,19 +29,25 @@ export default defineConfig({ }); ``` -## Configuration - -The following show the default values of the configuration +## Options ```ts -OpenEditor({ - // source root path - rootDir: process.cwd(), - - // render the toggle into the browser - displayToggle: false, - - // custom openEditor handler - onOpenEditor: undefined, -}); +interface Options { + /** + * source rootDir path + * + * @default process.cwd() + */ + rootDir?: string; + /** + * render the toggle into the browser + * + * @default false + */ + displayToggle?: boolean; + /** + * custom openEditor handler + */ + onOpenEditor?(file: string): void; +} ``` diff --git a/packages/vite/README.md b/packages/vite/README.md index 301a43f5..34eeac93 100644 --- a/packages/vite/README.md +++ b/packages/vite/README.md @@ -29,19 +29,25 @@ export default defineConfig({ }); ``` -## Configuration - -The following show the default values of the configuration +## Options ```ts -OpenEditor({ - // source root path - rootDir: process.cwd(), - - // render the toggle into the browser - displayToggle: false, - - // custom openEditor handler - onOpenEditor: undefined, -}); +interface Options { + /** + * source rootDir path + * + * @default process.cwd() + */ + rootDir?: string; + /** + * render the toggle into the browser + * + * @default false + */ + displayToggle?: boolean; + /** + * custom openEditor handler + */ + onOpenEditor?(file: string): void; +} ``` diff --git a/packages/webpack/README.md b/packages/webpack/README.md index b023f534..b82ea6bd 100644 --- a/packages/webpack/README.md +++ b/packages/webpack/README.md @@ -29,19 +29,25 @@ module.exports = { }; ``` -## Configuration - -The following show the default values of the configuration +## Options ```ts -OpenEditor({ - // source root path - rootDir: process.cwd(), - - // render the toggle into the browser - displayToggle: false, - - // custom openEditor handler - onOpenEditor: undefined, -}); +interface Options { + /** + * source rootDir path + * + * @default process.cwd() + */ + rootDir?: string; + /** + * render the toggle into the browser + * + * @default false + */ + displayToggle?: boolean; + /** + * custom openEditor handler + */ + onOpenEditor?(file: string): void; +} ```