Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(collapseSamePrefixes): missing collapse when prefix did not match from beginning #563

Merged
merged 2 commits into from Dec 21, 2022

Conversation

DrJume
Copy link
Contributor

@DrJume DrJume commented Dec 1, 2022

Description

The previous implementation only compared prefixes of files/folders with all previous names at once.
Now, the algorithm walks incrementally from the previous folder name to try to find a prefix match.

Prefix matcher implementation:

Previous:
A/B/C/X -> X.startsWith("ABC")?

New:
A/B/C/X -> X.startsWith("C"), X.startsWith("BC"), X.startsWith("ABC)?

Also updated and added missing docs in README.

Linked Issues

Fixes #546

Additional context

The algorithm is now O(n^2) but folder depths of components are not as deep as to cause trouble (hopefully).

@DrJume DrJume requested a review from antfu as a code owner December 1, 2022 23:12
@DrJume
Copy link
Contributor Author

DrJume commented Dec 1, 2022

Will add a perf optimization:

Only try to find prefix if parentFolder is matched inside current fileOrFolderName.

@DrJume
Copy link
Contributor Author

DrJume commented Dec 4, 2022

My perf optimization didn't make sense.
This PR should be good to go.

@antfu antfu merged commit a6e700c into unplugin:main Dec 21, 2022
@DrJume DrJume deleted the DrJume/issue546 branch January 11, 2023 02:28
MaloLebrin added a commit to MaloLebrin/naturopathe-camion-nuxt3 that referenced this pull request Jan 29, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[unplugin-vue-components](https://togithub.com/antfu/unplugin-vue-components)
| [`^0.22.9` ->
`^0.23.0`](https://renovatebot.com/diffs/npm/unplugin-vue-components/0.22.9/0.23.0)
|
[![age](https://badges.renovateapi.com/packages/npm/unplugin-vue-components/0.23.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/unplugin-vue-components/0.23.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/unplugin-vue-components/0.23.0/compatibility-slim/0.22.9)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/unplugin-vue-components/0.23.0/confidence-slim/0.22.9)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>antfu/unplugin-vue-components</summary>

###
[`v0.23.0`](https://togithub.com/antfu/unplugin-vue-components/releases/tag/v0.23.0)

[Compare
Source](https://togithub.com/antfu/unplugin-vue-components/compare/v0.22.12...v0.23.0)

#####    🚀 Features

- Support nuxt@3.0.0  -  by
[@&#8203;NexZhu](https://togithub.com/NexZhu) in
[unplugin/unplugin-vue-components#569
[<samp>(05196)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/05196ec)
- Add types fields  -  by [@&#8203;sxzz](https://togithub.com/sxzz) in
[unplugin/unplugin-vue-components#592
[<samp>(d8a54)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/d8a54a5)

#####    🐞 Bug Fixes

- Generator dts (no such file or directory)  -  by
[@&#8203;lishaobos](https://togithub.com/lishaobos) in
[unplugin/unplugin-vue-components#585
[<samp>(5db2b)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/5db2b6e)
- **collapseSamePrefixes**: Missing collapse when prefix did not match
from beginning  -  by [@&#8203;DrJume](https://togithub.com/DrJume) in
[unplugin/unplugin-vue-components#563
[<samp>(a6e70)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/a6e700c)
- **tdesign**: Add pagination-mini resolver  -  by
[@&#8203;uyarn](https://togithub.com/uyarn) in
[unplugin/unplugin-vue-components#575
[<samp>(d997e)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/d997e55)
- **varlet-ui**: Side effects use full path  -  by
[@&#8203;haoziqaq](https://togithub.com/haoziqaq) in
[unplugin/unplugin-vue-components#581
[<samp>(74c11)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/74c1118)

#####     [View changes on
GitHub](https://togithub.com/antfu/unplugin-vue-components/compare/v0.22.12...v0.23.0)

###
[`v0.22.12`](https://togithub.com/antfu/unplugin-vue-components/releases/tag/v0.22.12)

[Compare
Source](https://togithub.com/antfu/unplugin-vue-components/compare/v0.22.11...v0.22.12)

#####    🚀 Features

- Compatible with
[@&#8203;vitejs/plugin-vue2-jsx](https://togithub.com/vitejs/plugin-vue2-jsx)
 -  by [@&#8203;windsonR](https://togithub.com/windsonR) and
[@&#8203;antfu](https://togithub.com/antfu) in
[unplugin/unplugin-vue-components#557
[<samp>(383b1)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/383b11a)
- **tdesign**: Add exclude option  -  by
[@&#8203;Sight-wcg](https://togithub.com/Sight-wcg) in
[unplugin/unplugin-vue-components#554
[<samp>(48c33)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/48c3374)
- **varlet-ui**: Support loading-bar  -  by
[@&#8203;haoziqaq](https://togithub.com/haoziqaq) in
[unplugin/unplugin-vue-components#566
[<samp>(1735b)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/1735b6f)

#####    🐞 Bug Fixes

- Use `globs` option cannot resolve index.vue  -  by
[@&#8203;satrong](https://togithub.com/satrong) and
[@&#8203;antfu](https://togithub.com/antfu) in
[unplugin/unplugin-vue-components#536
[<samp>(f8918)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/f891820)

#####     [View changes on
GitHub](https://togithub.com/antfu/unplugin-vue-components/compare/v0.22.11...v0.22.12)

###
[`v0.22.11`](https://togithub.com/antfu/unplugin-vue-components/releases/tag/v0.22.11)

[Compare
Source](https://togithub.com/antfu/unplugin-vue-components/compare/v0.22.9...v0.22.11)

*No significant changes*

#####     [View changes on
GitHub](https://togithub.com/antfu/unplugin-vue-components/compare/v0.22.10...v0.22.11)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/MaloLebrin/naturopathe-camion-nuxt3).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMTEuMSIsInVwZGF0ZWRJblZlciI6IjM0LjExMS4xIn0=-->
MaloLebrin added a commit to MaloLebrin/be-right-nuxt that referenced this pull request Jan 29, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[unplugin-vue-components](https://togithub.com/antfu/unplugin-vue-components)
| [`^0.22.12` ->
`^0.23.0`](https://renovatebot.com/diffs/npm/unplugin-vue-components/0.22.12/0.23.0)
|
[![age](https://badges.renovateapi.com/packages/npm/unplugin-vue-components/0.23.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/unplugin-vue-components/0.23.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/unplugin-vue-components/0.23.0/compatibility-slim/0.22.12)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/unplugin-vue-components/0.23.0/confidence-slim/0.22.12)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>antfu/unplugin-vue-components</summary>

###
[`v0.23.0`](https://togithub.com/antfu/unplugin-vue-components/releases/tag/v0.23.0)

[Compare
Source](https://togithub.com/antfu/unplugin-vue-components/compare/v0.22.12...v0.23.0)

#####    🚀 Features

- Support nuxt@3.0.0  -  by
[@&#8203;NexZhu](https://togithub.com/NexZhu) in
[unplugin/unplugin-vue-components#569
[<samp>(05196)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/05196ec)
- Add types fields  -  by [@&#8203;sxzz](https://togithub.com/sxzz) in
[unplugin/unplugin-vue-components#592
[<samp>(d8a54)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/d8a54a5)

#####    🐞 Bug Fixes

- Generator dts (no such file or directory)  -  by
[@&#8203;lishaobos](https://togithub.com/lishaobos) in
[unplugin/unplugin-vue-components#585
[<samp>(5db2b)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/5db2b6e)
- **collapseSamePrefixes**: Missing collapse when prefix did not match
from beginning  -  by [@&#8203;DrJume](https://togithub.com/DrJume) in
[unplugin/unplugin-vue-components#563
[<samp>(a6e70)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/a6e700c)
- **tdesign**: Add pagination-mini resolver  -  by
[@&#8203;uyarn](https://togithub.com/uyarn) in
[unplugin/unplugin-vue-components#575
[<samp>(d997e)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/d997e55)
- **varlet-ui**: Side effects use full path  -  by
[@&#8203;haoziqaq](https://togithub.com/haoziqaq) in
[unplugin/unplugin-vue-components#581
[<samp>(74c11)</samp>](https://togithub.com/antfu/unplugin-vue-components/commit/74c1118)

#####     [View changes on
GitHub](https://togithub.com/antfu/unplugin-vue-components/compare/v0.22.12...v0.23.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/MaloLebrin/be-right-nuxt).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMTEuMSIsInVwZGF0ZWRJblZlciI6IjM0LjExMS4xIn0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

collapseSamePrefixes option does not work
2 participants