@sveltejs/vite-plugin-svelte 6.0.0-next.0 → 6.0.0-next.1

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": "6.0.0-next.0",
3
+ "version": "6.0.0-next.1",
4
4
  "license": "MIT",
5
5
  "author": "dominikg",
6
6
  "files": [
@@ -34,12 +34,12 @@
34
34
  },
35
35
  "homepage": "https://github.com/sveltejs/vite-plugin-svelte#readme",
36
36
  "dependencies": {
37
+ "@sveltejs/vite-plugin-svelte-inspector": "^5.0.0-next.0",
37
38
  "debug": "^4.4.1",
38
39
  "deepmerge": "^4.3.1",
39
40
  "kleur": "^4.1.5",
40
41
  "magic-string": "^0.30.17",
41
- "vitefu": "^1.0.6",
42
- "@sveltejs/vite-plugin-svelte-inspector": "^5.0.0-next.0"
42
+ "vitefu": "^1.0.7"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "svelte": "^5.0.0",
@@ -47,9 +47,9 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/debug": "^4.1.12",
50
- "sass": "^1.89.1",
51
- "svelte": "^5.33.18",
52
- "vite": "^7.0.0-beta.0"
50
+ "sass": "^1.89.2",
51
+ "svelte": "^5.34.7",
52
+ "vite": "^7.0.0-beta.2"
53
53
  },
54
54
  "scripts": {
55
55
  "check:publint": "publint --strict",
package/src/index.js CHANGED
@@ -40,7 +40,11 @@ export function svelte(inlineOptions) {
40
40
  }
41
41
  if (rolldownVersion) {
42
42
  log.warn.once(
43
- `!!! Support for rolldown-vite in vite-plugin-svelte is experimental (rolldown: ${rolldownVersion}, vite: ${viteVersion}) !!!`
43
+ `!!! Support for rolldown-vite in vite-plugin-svelte is experimental (rolldown: ${rolldownVersion}, vite: ${viteVersion}) !!!
44
+ See https://github.com/sveltejs/vite-plugin-svelte/issues/1143 for a list of known issues and to report feedback.`.replace(
45
+ /\t+/g,
46
+ '\t'
47
+ )
44
48
  );
45
49
  }
46
50
 
@@ -1,21 +1,12 @@
1
- import { createRequire } from 'node:module';
2
1
  import path from 'node:path';
3
2
  import process from 'node:process';
4
3
  import fs from 'node:fs';
5
4
  import { pathToFileURL } from 'node:url';
6
5
  import { log } from './log.js';
7
6
 
8
- // used to require cjs config in esm.
9
- // NOTE dynamic import() cjs technically works, but timestamp query cache bust
10
- // have no effect, likely because it has another internal cache?
11
- /** @type {NodeRequire}*/
12
- let esmRequire;
13
-
14
- export const knownSvelteConfigNames = [
15
- 'svelte.config.js',
16
- 'svelte.config.cjs',
17
- 'svelte.config.mjs'
18
- ];
7
+ export const knownSvelteConfigNames = ['js', 'ts', 'mjs', 'mts'].map(
8
+ (ext) => `svelte.config.${ext}`
9
+ );
19
10
 
20
11
  /**
21
12
  * @param {string} filePath
@@ -36,56 +27,23 @@ export async function loadSvelteConfig(viteConfig, inlineOptions) {
36
27
  }
37
28
  const configFile = findConfigToLoad(viteConfig, inlineOptions);
38
29
  if (configFile) {
39
- let err;
40
- // try to use dynamic import for svelte.config.js first
41
- if (configFile.endsWith('.js') || configFile.endsWith('.mjs')) {
42
- try {
43
- const result = await dynamicImportDefault(
44
- pathToFileURL(configFile).href,
45
- fs.statSync(configFile).mtimeMs
46
- );
47
- if (result != null) {
48
- return {
49
- ...result,
50
- configFile
51
- };
52
- } else {
53
- throw new Error(`invalid export in ${configFile}`);
54
- }
55
- } catch (e) {
56
- log.error(`failed to import config ${configFile}`, e);
57
- err = e;
58
- }
59
- }
60
- // cjs or error with dynamic import
61
- if (!configFile.endsWith('.mjs')) {
62
- try {
63
- // identify which require function to use (esm and cjs mode)
64
- const _require = import.meta.url
65
- ? (esmRequire ?? (esmRequire = createRequire(import.meta.url)))
66
- : // eslint-disable-next-line no-undef
67
- require;
68
-
69
- // avoid loading cached version on reload
70
- delete _require.cache[_require.resolve(configFile)];
71
- const result = _require(configFile);
72
- if (result != null) {
73
- return {
74
- ...result,
75
- configFile
76
- };
77
- } else {
78
- throw new Error(`invalid export in ${configFile}`);
79
- }
80
- } catch (e) {
81
- log.error(`failed to require config ${configFile}`, e);
82
- if (!err) {
83
- err = e;
84
- }
30
+ try {
31
+ const result = await dynamicImportDefault(
32
+ pathToFileURL(configFile).href,
33
+ fs.statSync(configFile).mtimeMs
34
+ );
35
+ if (result != null) {
36
+ return {
37
+ ...result,
38
+ configFile
39
+ };
40
+ } else {
41
+ throw new Error(`invalid export in ${configFile}`);
85
42
  }
43
+ } catch (e) {
44
+ log.error(`failed to import config ${configFile}`, e);
45
+ throw e;
86
46
  }
87
- // failed to load existing config file
88
- throw err;
89
47
  }
90
48
  }
91
49
 
@@ -26,6 +26,6 @@
26
26
  null,
27
27
  null
28
28
  ],
29
- "mappings": ";;;;aAIYA,OAAOA;;WAETC,mBAAmBA;;;;;;;;;;;kBAWZC,aAAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgGbC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAiDnBC,mBAAmBA;;;;;;;;;;;;;;;;WAgBnBC,oBAAoBA;;;;;;;;;;;;;;;MAezBC,SAASA;;kBAEGC,qBAAqBA;;;;;;;;;;;;;iBC/JtBC,MAAMA;iBCXNC,cAAcA;iBCORC,gBAAgBA",
29
+ "mappings": ";;;;aAIYA,OAAOA;;WAETC,mBAAmBA;;;;;;;;;;;kBAWZC,aAAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgGbC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAiDnBC,mBAAmBA;;;;;;;;;;;;;;;;WAgBnBC,oBAAoBA;;;;;;;;;;;;;;;MAezBC,SAASA;;kBAEGC,qBAAqBA;;;;;;;;;;;;;iBC/JtBC,MAAMA;iBCXNC,cAAcA;iBCFRC,gBAAgBA",
30
30
  "ignoreList": []
31
31
  }