File tree 2 files changed +8
-3
lines changed
packages/vite-plugin-svelte/src/utils
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @sveltejs/vite-plugin-svelte ' : patch
3
+ ---
4
+
5
+ Allow script tags to span multiple lines
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import { enhanceCompileError } from './error.js';
14
14
// which is closer to the other regexes in at least not falling into commented script
15
15
// but ideally would be shared exactly with svelte and other tools that use it
16
16
const scriptLangRE =
17
- / < ! - - [ ^ ] * ?- - > | < s c r i p t (?: [ ^ > ] * | (?: [ ^ = > ' " / ] + = (?: " [ ^ " ] * " | ' [ ^ ' ] * ' | [ ^ > \s ] + ) \s + ) * ) l a n g = [ " ' ] ? ( [ ^ " ' > ] + ) [ " ' ] ? [ ^ > ] * > / g;
17
+ / < ! - - [ ^ ] * ?- - > | < s c r i p t \s + (?: [ ^ > ] * | (?: [ ^ = > ' " / ] + = (?: " [ ^ " ] * " | ' [ ^ ' ] * ' | [ ^ > \s ] + ) \s + ) * ) l a n g = ( [ " ' ] ) ? ( [ ^ " ' > ] + ) \1 [ ^ > ] * > / g;
18
18
19
19
/**
20
20
* @returns {import('../types/compile.d.ts').CompileSvelte }
@@ -172,8 +172,8 @@ export function createCompileSvelte() {
172
172
173
173
let lang = 'js' ;
174
174
for ( const match of code . matchAll ( scriptLangRE ) ) {
175
- if ( match [ 1 ] ) {
176
- lang = match [ 1 ] ;
175
+ if ( match [ 2 ] ) {
176
+ lang = match [ 2 ] ;
177
177
break ;
178
178
}
179
179
}
You can’t perform that action at this time.
0 commit comments