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(nuxt): deprecate scanning directory index plugins #18418

Merged
merged 8 commits into from Mar 1, 2023
Merged

fix(nuxt): deprecate scanning directory index plugins #18418

merged 8 commits into from Mar 1, 2023

Conversation

ineshbose
Copy link
Member

Transferred from nuxt/framework#10090

#12414
#14358
(Work by nuxt/framework#6544)

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Reopens the closed PR and aims to have consistent behaviour for scanning directories.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codesandbox
Copy link

codesandbox bot commented Jan 21, 2023

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@danielroe danielroe added the 3.x label Jan 28, 2023
@danielroe danielroe marked this pull request as draft February 16, 2023 14:59
@danielroe
Copy link
Member

Marking PR as draft as I'm aware you're considering the right approach. Ping me if I can help at any point.

@ineshbose
Copy link
Member Author

ineshbose commented Feb 16, 2023

Public Notes on working through PR

Potential points of interest -

export function normalizePlugins (_plugins: Plugin[]) {

export const pluginsDeclaration: NuxtTemplate<TemplateContext> = {

export function addPluginTemplate (plugin: NuxtPluginTemplate | string, opts: AddPluginOptions = {}): NuxtPlugin {

Whoops, I think I had forgotten that config plugins aren't globs! Makes this much easier now

The smaller, less reliable solve:

if (/\/plugins\/[^/]+\/index\.[^/]+$/i.test(plugin.src) && !useNuxt().options.plugins.includes(plugin.src)) {
  console.warn(`...`)
}

@ineshbose ineshbose marked this pull request as ready for review February 17, 2023 10:06
@danielroe danielroe added this to the v3.3 milestone Feb 17, 2023
docs/2.guide/2.directory-structure/1.plugins.md Outdated Show resolved Hide resolved
packages/kit/src/plugin.ts Outdated Show resolved Hide resolved
docs/2.guide/2.directory-structure/1.plugins.md Outdated Show resolved Hide resolved
docs/2.guide/2.directory-structure/1.plugins.md Outdated Show resolved Hide resolved
ineshbose and others added 4 commits February 17, 2023 13:12
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Daniel Roe <daniel@roe.dev>
@danielroe danielroe changed the title fix: scanning top level files in plugins fix(nuxt): scanning top level files in plugins Feb 17, 2023
@danielroe danielroe changed the title fix(nuxt): scanning top level files in plugins fix(nuxt): deprecate scanning directory index plugins Feb 17, 2023
@danielroe danielroe requested review from pi0 and antfu February 17, 2023 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants