Skip to content

Commit

Permalink
fix: relative path match failure
Browse files Browse the repository at this point in the history
  • Loading branch information
zjxxxxxxxxx committed Sep 22, 2023
1 parent 7fced3c commit 39aed1d
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 138 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-taxis-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@open-editor/client': patch
---

fix the relative path match failure
2 changes: 1 addition & 1 deletion .changeset/tender-elephants-guess.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@open-editor/shared': patch
---

add type uilt 'isBol'
add type util 'isBol'
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
"@open-editor/client": "workspace:*",
"@open-editor/server": "workspace:*",
"@open-editor/shared": "workspace:*",
"@open-editor/rollup": "workspace:*",
"@open-editor/vite": "workspace:*",
"@open-editor/webpack": "workspace:*",
"@rollup/plugin-commonjs": "^25.0.4",
"@rollup/plugin-node-resolve": "^15.1.0",
"@types/minimist": "^1.2.2",
Expand Down
10 changes: 5 additions & 5 deletions packages/client/src/resolve/createVueResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function resolveVueSource<T = any>(
if (
isStr(__source) &&
isValidFileName(__file) &&
__file.endsWith(source.file)
ensureFileName(__file) === source.file
) {
push(instance);

Expand Down Expand Up @@ -75,7 +75,7 @@ function resolveVueSourceAnchor<T = any>(
let instance = debug.value;
let element = debug.originalElement;

while (element && !getElementVueSource(element)) {
while (element && !isStr(getElementVueSource(element))) {
element = element.parentElement!;
}

Expand Down Expand Up @@ -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 (isStr(getElementVueSource(element))) {
return (cacheIsVueSource = true);
}
element = element.parentElement!;
element = element.parentElement;
}

return (cacheIsVueSource = false);
Expand Down
30 changes: 18 additions & 12 deletions packages/rollup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@ export default defineConfig({

## Configuration

The following show the default values of the configuration

```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;
}
```
30 changes: 18 additions & 12 deletions packages/vite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@ export default defineConfig({

## Configuration

The following show the default values of the configuration

```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;
}
```
30 changes: 18 additions & 12 deletions packages/webpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@ module.exports = {

## Configuration

The following show the default values of the configuration

```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;
}
```
101 changes: 8 additions & 93 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 39aed1d

Please sign in to comment.