@sveltejs/vite-plugin-svelte 3.0.1 → 3.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": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "license": "MIT",
5
5
  "author": "dominikg",
6
6
  "files": [
@@ -36,13 +36,13 @@
36
36
  },
37
37
  "homepage": "https://github.com/sveltejs/vite-plugin-svelte#readme",
38
38
  "dependencies": {
39
- "@sveltejs/vite-plugin-svelte-inspector": "^2.0.0-next.0 || ^2.0.0",
40
39
  "debug": "^4.3.4",
41
40
  "deepmerge": "^4.3.1",
42
41
  "kleur": "^4.1.5",
43
42
  "magic-string": "^0.30.5",
44
43
  "svelte-hmr": "^0.15.3",
45
- "vitefu": "^0.2.5"
44
+ "vitefu": "^0.2.5",
45
+ "@sveltejs/vite-plugin-svelte-inspector": "^2.0.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "svelte": "^4.0.0 || ^5.0.0-next.0",
@@ -50,10 +50,10 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/debug": "^4.1.12",
53
- "esbuild": "^0.19.7",
54
- "sass": "^1.69.5",
55
- "svelte": "^4.2.7",
56
- "vite": "^5.0.2"
53
+ "esbuild": "^0.19.12",
54
+ "sass": "^1.70.0",
55
+ "svelte": "^4.2.9",
56
+ "vite": "^5.0.11"
57
57
  },
58
58
  "scripts": {
59
59
  "check:publint": "publint --strict",
@@ -16,7 +16,7 @@ import { isSvelte5 } from './svelte-version.js';
16
16
  // which is closer to the other regexes in at least not falling into commented script
17
17
  // but ideally would be shared exactly with svelte and other tools that use it
18
18
  const scriptLangRE =
19
- /<!--[^]*?-->|<script (?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=["']?([^"' >]+)["']?[^>]*>/;
19
+ /<!--[^]*?-->|<script (?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=["']?([^"' >]+)["']?[^>]*>/g;
20
20
 
21
21
  /**
22
22
  * @param {Function} [makeHot]
@@ -137,7 +137,7 @@ export const _createCompileSvelte = (makeHot) => {
137
137
  ? {
138
138
  ...compileOptions,
139
139
  ...dynamicCompileOptions
140
- }
140
+ }
141
141
  : compileOptions;
142
142
 
143
143
  const endStat = stats?.start(filename);
@@ -184,10 +184,18 @@ export const _createCompileSvelte = (makeHot) => {
184
184
  }
185
185
  }
186
186
 
187
+ let lang = 'js';
188
+ for (const match of code.matchAll(scriptLangRE)) {
189
+ if (match[1]) {
190
+ lang = match[1];
191
+ break;
192
+ }
193
+ }
194
+
187
195
  return {
188
196
  filename,
189
197
  normalizedFilename,
190
- lang: code.match(scriptLangRE)?.[1] || 'js',
198
+ lang,
191
199
  // @ts-ignore
192
200
  compiled,
193
201
  ssr,
@@ -120,7 +120,7 @@ async function compileSvelte(options, { filename, code }, statsCollection) {
120
120
  ? {
121
121
  ...compileOptions,
122
122
  ...dynamicCompileOptions
123
- }
123
+ }
124
124
  : compileOptions;
125
125
  const endStat = statsCollection?.start(filename);
126
126
  const compiled = svelte.compile(finalCode, finalCompileOptions);
@@ -31,7 +31,7 @@ export async function loadRaw(svelteRequest, compileSvelte, options) {
31
31
  ? {
32
32
  js: type === 'script' || type === 'all',
33
33
  css: type === 'style' || type === 'all'
34
- }
34
+ }
35
35
  : false,
36
36
  ...svelteRequest.query.compilerOptions
37
37
  },
@@ -63,7 +63,7 @@ export async function loadSvelteConfig(viteConfig, inlineOptions) {
63
63
  const _require = import.meta.url
64
64
  ? esmRequire ?? (esmRequire = createRequire(import.meta.url))
65
65
  : // eslint-disable-next-line no-undef
66
- require;
66
+ require;
67
67
 
68
68
  // avoid loading cached version on reload
69
69
  delete _require.cache[_require.resolve(configFile)];
@@ -199,7 +199,7 @@ export function resolveOptions(preResolveOptions, viteConfig, cache) {
199
199
  : {
200
200
  injectCss: css === 'injected',
201
201
  partialAccept: !!viteConfig.experimental?.hmrPartialAccept
202
- },
202
+ },
203
203
  compilerOptions: {
204
204
  css,
205
205
  dev: !viteConfig.isProduction
@@ -551,7 +551,7 @@ async function buildExtraConfigForDependencies(options, config) {
551
551
  .slice(0, -1)
552
552
  .some((d) => isDepExcluded(d.trim(), userExclude))
553
553
  );
554
- });
554
+ });
555
555
  }
556
556
  if (options.disableDependencyReinclusion === true) {
557
557
  depsConfig.optimizeDeps.include = depsConfig.optimizeDeps.include.filter(