@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/vite-plugin-svelte",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "license": "MIT",
5
5
  "author": "dominikg",
6
6
  "files": [
@@ -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 (?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=["']?([^"' >]+)["']?[^>]*>/g;
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[1]) {
176
- lang = match[1];
175
+ if (match[2]) {
176
+ lang = match[2];
177
177
  break;
178
178
  }
179
179
  }