Skip to content

Commit

Permalink
fix(ContentSlot): detect multiline usage (#2508)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Jan 17, 2024
1 parent e6a1b06 commit 58f96db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export default defineNuxtModule<ModuleOptions>({
enforce: 'pre',
transform (code) {
if (code.includes('ContentSlot')) {
code = code.replace(/<ContentSlot (.*)(:use=['"](\$slots.)?([a-zA-Z0-9_-]*)['"]|use=['"]([a-zA-Z0-9_-]*)['"])/g, '<MDCSlot $1 name="$4"')
code = code.replace(/<ContentSlot(\s)+([.]*)(:use=['"](\$slots.)?([a-zA-Z0-9_-]*)['"]|use=['"]([a-zA-Z0-9_-]*)['"])/g, '<MDCSlot$1$2 name="$5"')
code = code.replace(/<\/ContentSlot>/g, '</MDCSlot>')
code = code.replace(/<ContentSlot/g, '<MDCSlot')
code = code.replace(/(['"])ContentSlot['"]/g, '$1MDCSlot$1')
Expand Down

0 comments on commit 58f96db

Please sign in to comment.