@sveltejs/vite-plugin-svelte 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/compile.js +3 -3
package/package.json
CHANGED
package/src/utils/compile.js
CHANGED
|
@@ -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
|
-
/<!--[^]*?-->|<script
|
|
17
|
+
/<!--[^]*?-->|<script\s+(?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=(["'])?([^"' >]+)\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[
|
|
176
|
-
lang = match[
|
|
175
|
+
if (match[2]) {
|
|
176
|
+
lang = match[2];
|
|
177
177
|
break;
|
|
178
178
|
}
|
|
179
179
|
}
|