@sveltejs/vite-plugin-svelte 7.0.0 → 7.1.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/src/preprocess.js CHANGED
@@ -1,3 +1,7 @@
1
+ /** @import { VitePreprocessOptions } from './public.js' */
2
+ /** @import { Preprocessor as SveltePreprocessor, PreprocessorGroup } from 'svelte/compiler' */
3
+ /** @import { InlineConfig, ResolvedConfig } from 'vite' */
4
+
1
5
  import process from 'node:process';
2
6
  import * as vite from 'vite';
3
7
  import { mapToRelative, removeLangSuffix } from './utils/sourcemaps.js';
@@ -17,11 +21,11 @@ const supportedScriptLangs = ['ts'];
17
21
  export const lang_sep = '.vite-preprocess';
18
22
 
19
23
  /**
20
- * @param {import('./public.d.ts').VitePreprocessOptions} [opts]
21
- * @returns {import('svelte/compiler').PreprocessorGroup}
24
+ * @param {VitePreprocessOptions} [opts]
25
+ * @returns {PreprocessorGroup}
22
26
  */
23
27
  export function vitePreprocess(opts) {
24
- /** @type {import('svelte/compiler').PreprocessorGroup} */
28
+ /** @type {PreprocessorGroup} */
25
29
  const preprocessor = { name: 'vite-preprocess' };
26
30
  if (opts?.script === true) {
27
31
  preprocessor.script = viteScript().script;
@@ -34,7 +38,7 @@ export function vitePreprocess(opts) {
34
38
  }
35
39
 
36
40
  /**
37
- * @returns {{ script: import('svelte/compiler').Preprocessor }}
41
+ * @returns {{ script: SveltePreprocessor }}
38
42
  */
39
43
  function viteScript() {
40
44
  return {
@@ -45,15 +49,12 @@ function viteScript() {
45
49
  const lang = /** @type {'ts'} */ (attributes.lang);
46
50
  const { code, map } = await transformWithOxc(content, filename, {
47
51
  lang,
48
- target: 'esnext'
49
- // TODO, how to pass tsconfig compilerOptions (or not needed as config is loaded for file
50
- /*tsconfigRaw: {
51
- compilerOptions: {
52
- // svelte typescript needs this flag to work with type imports
53
- importsNotUsedAsValues: 'preserve',
54
- preserveValueImports: true
55
- }
56
- }*/
52
+ target: 'esnext',
53
+ // oxc strips value imports it considers unused, but in Svelte files
54
+ // these imports may be referenced in the template which oxc cannot see.
55
+ // onlyRemoveTypeImports tells oxc to only strip type-only imports
56
+ // (import type {...}, import { type X }) and preserve all value imports.
57
+ typescript: { onlyRemoveTypeImports: true }
57
58
  });
58
59
 
59
60
  mapToRelative(map, filename);
@@ -67,44 +68,45 @@ function viteScript() {
67
68
  }
68
69
 
69
70
  /**
70
- * @param {import('vite').ResolvedConfig | import('vite').InlineConfig} config
71
- * @returns {{ style: import('svelte/compiler').Preprocessor }}
71
+ * @param {ResolvedConfig | InlineConfig} config
72
+ * @returns {{ style: SveltePreprocessor }}
72
73
  */
73
74
  function viteStyle(config = {}) {
74
75
  /** @type {Promise<CssTransform> | CssTransform} */
75
76
  let cssTransform;
76
- /** @type {import('svelte/compiler').Preprocessor} */
77
- const style = async ({ attributes, content, filename = '' }) => {
78
- const ext = attributes.lang ? `.${attributes.lang}` : '.css';
79
- if (attributes.lang && !isCSSRequest(ext)) return;
80
- if (!cssTransform) {
81
- cssTransform = createCssTransform(style, config).then((t) => (cssTransform = t));
77
+ const style = /** @type {SveltePreprocessor} */ (
78
+ async ({ attributes, content, filename = '' }) => {
79
+ const ext = attributes.lang ? `.${attributes.lang}` : '.css';
80
+ if (attributes.lang && !isCSSRequest(ext)) return;
81
+ if (!cssTransform) {
82
+ cssTransform = createCssTransform(style, config).then((t) => (cssTransform = t));
83
+ }
84
+ const transform = await cssTransform;
85
+ const suffix = `${lang_sep}${ext}`;
86
+ const moduleId = `${filename}${suffix}`;
87
+ const { code, map, deps } = await transform(content, moduleId);
88
+ removeLangSuffix(map, suffix);
89
+ mapToRelative(map, filename);
90
+ const dependencies = deps ? Array.from(deps).filter((d) => !d.endsWith(suffix)) : undefined;
91
+ return {
92
+ code,
93
+ map: map ?? undefined,
94
+ dependencies
95
+ };
82
96
  }
83
- const transform = await cssTransform;
84
- const suffix = `${lang_sep}${ext}`;
85
- const moduleId = `${filename}${suffix}`;
86
- const { code, map, deps } = await transform(content, moduleId);
87
- removeLangSuffix(map, suffix);
88
- mapToRelative(map, filename);
89
- const dependencies = deps ? Array.from(deps).filter((d) => !d.endsWith(suffix)) : undefined;
90
- return {
91
- code,
92
- map: map ?? undefined,
93
- dependencies
94
- };
95
- };
97
+ );
96
98
  // @ts-expect-error tag so can be found by v-p-s
97
99
  style.__resolvedConfig = null;
98
100
  return { style };
99
101
  }
100
102
 
101
103
  /**
102
- * @param {import('svelte/compiler').Preprocessor} style
103
- * @param {import('vite').ResolvedConfig | import('vite').InlineConfig} config
104
+ * @param {SveltePreprocessor} style
105
+ * @param {ResolvedConfig | InlineConfig} config
104
106
  * @returns {Promise<CssTransform>}
105
107
  */
106
108
  async function createCssTransform(style, config) {
107
- /** @type {import('vite').ResolvedConfig} */
109
+ /** @type {ResolvedConfig} */
108
110
  let resolvedConfig;
109
111
  // @ts-expect-error special prop added if running in v-p-s
110
112
  if (style.__resolvedConfig) {
@@ -126,7 +128,7 @@ async function createCssTransform(style, config) {
126
128
 
127
129
  /**
128
130
  * @param {any} config
129
- * @returns {config is import('vite').ResolvedConfig}
131
+ * @returns {config is ResolvedConfig}
130
132
  */
131
133
  function isResolvedConfig(config) {
132
134
  return !!config.inlineConfig;
@@ -1,3 +1,7 @@
1
+ /** @import { CompileSvelte } from '../types/compile.js' */
2
+ /** @import { StatCollection } from '../types/vite-plugin-svelte-stats.js' */
3
+ /** @import { CompileOptions, CompileResult, Warning } from 'svelte/compiler' */
4
+
1
5
  import * as svelte from 'svelte/compiler';
2
6
  import { log } from './log.js';
3
7
 
@@ -11,16 +15,16 @@ const scriptLangRE =
11
15
  /<!--[^]*?-->|<script\s+(?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=(["'])?([^"' >]+)\1[^>]*>/g;
12
16
 
13
17
  /**
14
- * @returns {import('../types/compile.d.ts').CompileSvelte}
18
+ * @returns {CompileSvelte}
15
19
  */
16
20
  export function createCompileSvelte() {
17
- /** @type {import('../types/vite-plugin-svelte-stats.d.ts').StatCollection | undefined} */
21
+ /** @type {StatCollection | undefined} */
18
22
  let stats;
19
- /** @type {import('../types/compile.d.ts').CompileSvelte} */
23
+ /** @type {CompileSvelte} */
20
24
  return async function compileSvelte(svelteRequest, code, options, sourcemap) {
21
25
  const { filename, normalizedFilename, cssId, ssr, raw } = svelteRequest;
22
26
  const { emitCss = true } = options;
23
- /** @type {import('svelte/compiler').Warning[]} */
27
+ /** @type {Warning[]} */
24
28
  const warnings = [];
25
29
 
26
30
  if (options.stats) {
@@ -48,7 +52,7 @@ export function createCompileSvelte() {
48
52
  }
49
53
  }
50
54
 
51
- /** @type {import('svelte/compiler').CompileOptions} */
55
+ /** @type {CompileOptions} */
52
56
  const compileOptions = {
53
57
  ...options.compilerOptions,
54
58
  filename,
@@ -87,7 +91,7 @@ export function createCompileSvelte() {
87
91
  finalCompileOptions.sourcemap = sourcemap;
88
92
  }
89
93
  const endStat = stats?.start(filename);
90
- /** @type {import('svelte/compiler').CompileResult} */
94
+ /** @type {CompileResult} */
91
95
  let compiled;
92
96
  try {
93
97
  compiled = svelte.compile(finalCode, { ...finalCompileOptions, filename });
@@ -1,25 +1,47 @@
1
1
  import { createRequire } from 'node:module';
2
2
 
3
+ /** @type {import('svelte/package.json')} */
3
4
  const sveltePkg = createRequire(import.meta.url)('svelte/package.json');
4
5
 
5
6
  // list of svelte runtime dependencies to optimize together with svelte itself
6
- export const SVELTE_RUNTIME_DEPENDENCIES = [
7
+ export const SVELTE_RUNTIME_DEPENDENCIES = /** @type {const} */ ([
7
8
  'clsx' // avoids dev server restart after page load with npm + vite6 (see #1067)
8
- ].filter((dep) => !!sveltePkg.dependencies?.[dep]);
9
+ ]).filter((dep) => !!sveltePkg.dependencies?.[dep]);
9
10
 
10
11
  export const SVELTE_IMPORTS = Object.entries(sveltePkg.exports)
11
- .map(([name, config]) => {
12
- // ignore type only
13
- if (typeof config === 'object' && Object.keys(config).length === 1 && config.types) {
14
- return '';
15
- }
12
+ .filter(([name, config]) => {
16
13
  // ignore names
17
- if (name === './package.json' || name === './compiler') {
14
+ if (name === './package.json') {
18
15
  return '';
19
16
  }
20
- return name.replace(/^\./, 'svelte');
17
+
18
+ // ignore type only
19
+ return !(
20
+ typeof config === 'object' &&
21
+ Object.keys(config).length === 1 &&
22
+ 'types' in config &&
23
+ config.types
24
+ );
21
25
  })
22
- .filter((s) => s.length > 0);
26
+ .map(([name]) => {
27
+ return name.replace(/^\./, 'svelte');
28
+ });
29
+
30
+ export const SVELTE_DEDUPED_IMPORTS = SVELTE_IMPORTS.map((name) => {
31
+ if (name === 'svelte/compiler') {
32
+ return '';
33
+ }
34
+ return name;
35
+ }).filter((s) => s.length > 0);
36
+
37
+ export const SVELTE_CLIENT_IMPORTS = SVELTE_IMPORTS.map((name) => {
38
+ // ignore names
39
+ if (name === 'svelte/compiler' || name.endsWith('/server') || name.includes('/server/')) {
40
+ return '';
41
+ }
42
+
43
+ return name;
44
+ }).filter((s) => s.length > 0);
23
45
 
24
46
  export const SVELTE_EXPORT_CONDITIONS = ['svelte'];
25
47
 
@@ -1,14 +1,19 @@
1
+ /** @import { Options } from '../public.js' */
2
+ /** @import { ResolvedOptions } from '../types/options.js' */
3
+ /** @import { Warning } from 'svelte/compiler' */
4
+ /** @import { Rollup } from 'vite' */
5
+
1
6
  import { buildExtendedLogMessage } from './log.js';
2
7
 
3
8
  /**
4
9
  * convert an error thrown by svelte.compile to a RollupError so that vite displays it in a user friendly way
5
- * @param {import('svelte/compiler').Warning & Error & {frame?: string}} error a svelte compiler error, which is a mix of Warning and an error
6
- * @param {import('../types/options.d.ts').ResolvedOptions} options
7
- * @returns {import('vite').Rollup.RollupError} the converted error
10
+ * @param {Warning & Error & {frame?: string}} error a svelte compiler error, which is a mix of Warning and an error
11
+ * @param {ResolvedOptions} options
12
+ * @returns {Rollup.RollupError} the converted error
8
13
  */
9
14
  export function toRollupError(error, options) {
10
15
  const { filename, frame, start, code, name, stack } = error;
11
- /** @type {import('vite').Rollup.RollupError} */
16
+ /** @type {Rollup.RollupError} */
12
17
  const rollupError = {
13
18
  name, // needed otherwise sveltekit coalesce_to_error turns it into a string
14
19
  id: filename,
@@ -29,8 +34,8 @@ export function toRollupError(error, options) {
29
34
 
30
35
  /**
31
36
  * convert an error thrown by svelte.compile to an esbuild PartialMessage
32
- * @param {import('svelte/compiler').Warning & Error & {frame?: string}} error a svelte compiler error, which is a mix of Warning and an error
33
- * @param {import('../types/options.d.ts').ResolvedOptions} options
37
+ * @param {Warning & Error & {frame?: string}} error a svelte compiler error, which is a mix of Warning and an error
38
+ * @param {ResolvedOptions} options
34
39
  * @returns {any} the converted error as esbuild PartialMessage
35
40
  *
36
41
  * note: typed any to avoid esbuild devDependency for a single internal type import
@@ -114,9 +119,9 @@ function couldBeFixedByCssPreprocessor(code) {
114
119
  }
115
120
 
116
121
  /**
117
- * @param {import('svelte/compiler').Warning & Error} err a svelte compiler error, which is a mix of Warning and an error
122
+ * @param {Warning & Error} err a svelte compiler error, which is a mix of Warning and an error
118
123
  * @param {string} originalCode
119
- * @param {import('../public.d.ts').Options['preprocess']} [preprocessors]
124
+ * @param {Options['preprocess']} [preprocessors]
120
125
  */
121
126
  export function enhanceCompileError(err, originalCode, preprocessors) {
122
127
  preprocessors = arraify(preprocessors ?? []);
package/src/utils/id.js CHANGED
@@ -1,3 +1,6 @@
1
+ /** @import { IdFilter, IdParser, ModuleIdParser, RequestQuery, SvelteModuleRequest, SvelteQueryTypes, SvelteRequest } from '../types/id.js' */
2
+ /** @import { ResolvedOptions } from '../types/options.js' */
3
+
1
4
  import { normalizePath } from 'vite';
2
5
  import fs from 'node:fs';
3
6
  import process from 'node:process';
@@ -34,7 +37,7 @@ function splitId(id) {
34
37
  * @param {string} root
35
38
  * @param {number} timestamp
36
39
  * @param {boolean} ssr
37
- * @returns {import('../types/id.d.ts').SvelteRequest | undefined}
40
+ * @returns {SvelteRequest | undefined}
38
41
  */
39
42
  function parseToSvelteRequest(id, filename, rawQuery, root, timestamp, ssr) {
40
43
  const query = parseRequestQuery(rawQuery);
@@ -62,7 +65,7 @@ function parseToSvelteRequest(id, filename, rawQuery, root, timestamp, ssr) {
62
65
  /**
63
66
  * @param {string} filename
64
67
  * @param {string} root
65
- * @param {import('../types/id.d.ts').SvelteQueryTypes} type
68
+ * @param {SvelteQueryTypes} type
66
69
  * @returns {string}
67
70
  */
68
71
  function createVirtualImportId(filename, root, type) {
@@ -83,7 +86,7 @@ function createVirtualImportId(filename, root, type) {
83
86
 
84
87
  /**
85
88
  * @param {string} rawQuery
86
- * @returns {import('../types/id.d.ts').RequestQuery}
89
+ * @returns {RequestQuery}
87
90
  */
88
91
  function parseRequestQuery(rawQuery) {
89
92
  const query = Object.fromEntries(new URLSearchParams(rawQuery));
@@ -121,7 +124,7 @@ function parseRequestQuery(rawQuery) {
121
124
  }
122
125
  }
123
126
 
124
- return /** @type {import('../types/id.d.ts').RequestQuery}*/ query;
127
+ return /** @type {RequestQuery}*/ query;
125
128
  }
126
129
 
127
130
  /**
@@ -168,8 +171,8 @@ function escapeRE(s) {
168
171
  }
169
172
 
170
173
  /**
171
- * @param {import('../types/options.d.ts').ResolvedOptions} options
172
- * @returns {import('../types/id.d.ts').IdFilter}
174
+ * @param {ResolvedOptions} options
175
+ * @returns {IdFilter}
173
176
  */
174
177
  export function buildIdFilter(options) {
175
178
  const { include = [], exclude = [], extensions = DEFAULT_SVELTE_EXT } = options;
@@ -193,8 +196,8 @@ export function buildIdFilter(options) {
193
196
  }
194
197
 
195
198
  /**
196
- * @param {import('../types/options.d.ts').ResolvedOptions} options
197
- * @returns {import('../types/id.d.ts').IdParser}
199
+ * @param {ResolvedOptions} options
200
+ * @returns {IdParser}
198
201
  */
199
202
  export function buildIdParser(options) {
200
203
  const normalizedRoot = normalizePath(options.root);
@@ -205,8 +208,8 @@ export function buildIdParser(options) {
205
208
  }
206
209
 
207
210
  /**
208
- * @param {import('../types/options.d.ts').ResolvedOptions} options
209
- * @returns {import('../types/id.d.ts').IdFilter}
211
+ * @param {ResolvedOptions} options
212
+ * @returns {IdFilter}
210
213
  */
211
214
  export function buildModuleIdFilter(options) {
212
215
  const {
@@ -232,8 +235,8 @@ export function buildModuleIdFilter(options) {
232
235
  }
233
236
 
234
237
  /**
235
- * @param {import('../types/options.d.ts').ResolvedOptions} options
236
- * @returns {import('../types/id.d.ts').ModuleIdParser}
238
+ * @param {ResolvedOptions} options
239
+ * @returns {ModuleIdParser}
237
240
  */
238
241
  export function buildModuleIdParser(options) {
239
242
  const root = options.root;
@@ -251,7 +254,7 @@ export function buildModuleIdParser(options) {
251
254
  * @param {string} root
252
255
  * @param {number} timestamp
253
256
  * @param {boolean} ssr
254
- * @returns {import('../types/id.d.ts').SvelteModuleRequest | undefined}
257
+ * @returns {SvelteModuleRequest | undefined}
255
258
  */
256
259
  function parseToSvelteModuleRequest(id, filename, rawQuery, root, timestamp, ssr) {
257
260
  const query = parseRequestQuery(rawQuery);
@@ -1,3 +1,6 @@
1
+ /** @import { Options, SvelteConfig } from '../public.js' */
2
+ /** @import { UserConfig } from 'vite' */
3
+
1
4
  import path from 'node:path';
2
5
  import process from 'node:process';
3
6
  import fs from 'node:fs';
@@ -17,9 +20,9 @@ async function dynamicImportDefault(filePath, timestamp) {
17
20
  }
18
21
 
19
22
  /**
20
- * @param {import('vite').UserConfig} [viteConfig]
21
- * @param {Partial<import('../public.d.ts').Options>} [inlineOptions]
22
- * @returns {Promise<Partial<import('../public.d.ts').SvelteConfig> | undefined>}
23
+ * @param {UserConfig} [viteConfig]
24
+ * @param {Partial<Options>} [inlineOptions]
25
+ * @returns {Promise<Partial<SvelteConfig> | undefined>}
23
26
  */
24
27
  export async function loadSvelteConfig(viteConfig, inlineOptions) {
25
28
  if (inlineOptions?.configFile === false) {
@@ -48,8 +51,8 @@ export async function loadSvelteConfig(viteConfig, inlineOptions) {
48
51
  }
49
52
 
50
53
  /**
51
- * @param {import('vite').UserConfig | undefined} viteConfig
52
- * @param {Partial<import('../public.d.ts').Options> | undefined} inlineOptions
54
+ * @param {UserConfig | undefined} viteConfig
55
+ * @param {Partial<Options> | undefined} inlineOptions
53
56
  * @returns {string | undefined}
54
57
  */
55
58
  function findConfigToLoad(viteConfig, inlineOptions) {
package/src/utils/log.js CHANGED
@@ -1,3 +1,8 @@
1
+ /** @import { SvelteModuleRequest, SvelteRequest } from '../types/id.js' */
2
+ /** @import { LogFn, LogLevel, SimpleLogFn, SvelteWarningsMessage } from '../types/log.js' */
3
+ /** @import { ResolvedOptions } from '../types/options.js' */
4
+ /** @import { Warning } from 'svelte/compiler' */
5
+
1
6
  /* eslint-disable no-console */
2
7
 
3
8
  // eslint-disable-next-line n/no-unsupported-features/node-builtins
@@ -8,10 +13,10 @@ const red = (/** @type {string} */ txt) => styleText('red', txt);
8
13
 
9
14
  import { createDebug, enabled } from 'obug';
10
15
 
11
- /** @type {import('../types/log.d.ts').LogLevel[]} */
16
+ /** @type {LogLevel[]} */
12
17
  const levels = ['debug', 'info', 'warn', 'error', 'silent'];
13
18
  const prefix = 'vite-plugin-svelte';
14
- /** @type {Record<import('../types/log.d.ts').LogLevel, any>} */
19
+ /** @type {Record<LogLevel, any>} */
15
20
  const loggers = {
16
21
  debug: {
17
22
  log: createDebug(`${prefix}`),
@@ -38,10 +43,10 @@ const loggers = {
38
43
  }
39
44
  };
40
45
 
41
- /** @type {import('../types/log.d.ts').LogLevel} */
46
+ /** @type {LogLevel} */
42
47
  let _level = 'info';
43
48
  /**
44
- * @param {import('../types/log.d.ts').LogLevel} level
49
+ * @param {LogLevel} level
45
50
  * @returns {void}
46
51
  */
47
52
  function setLevel(level) {
@@ -98,15 +103,15 @@ function _log(logger, message, payload, namespace) {
98
103
  }
99
104
 
100
105
  /**
101
- * @param {import('../types/log.d.ts').LogLevel} level
102
- * @returns {import('../types/log.d.ts').LogFn}
106
+ * @param {LogLevel} level
107
+ * @returns {LogFn}
103
108
  */
104
109
  function createLogger(level) {
105
110
  const logger = loggers[level];
106
- const logFn = /** @type {import('../types/log.d.ts').LogFn} */ (_log.bind(null, logger));
111
+ const logFn = /** @type {LogFn} */ (_log.bind(null, logger));
107
112
  /** @type {Set<string>} */
108
113
  const logged = new Set();
109
- /** @type {import('../types/log.d.ts').SimpleLogFn} */
114
+ /** @type {SimpleLogFn} */
110
115
  const once = function (message, payload, namespace) {
111
116
  if (!logger.enabled || logged.has(message)) {
112
117
  return;
@@ -136,20 +141,20 @@ export const log = {
136
141
  };
137
142
 
138
143
  /**
139
- * @param {import('../types/id.d.ts').SvelteRequest | import('../types/id.d.ts').SvelteModuleRequest} svelteRequest
140
- * @param {import('svelte/compiler').Warning[]} warnings
141
- * @param {import('../types/options.d.ts').ResolvedOptions} options
144
+ * @param {SvelteRequest | SvelteModuleRequest} svelteRequest
145
+ * @param {Warning[]} warnings
146
+ * @param {ResolvedOptions} options
142
147
  */
143
148
  export function logCompilerWarnings(svelteRequest, warnings, options) {
144
149
  const { emitCss, onwarn, isBuild } = options;
145
150
  const sendViaWS = !isBuild && options.experimental?.sendWarningsToBrowser;
146
151
  let warn = isBuild ? warnBuild : warnDev;
147
- /** @type {import('svelte/compiler').Warning[]} */
152
+ /** @type {Warning[]} */
148
153
  const handledByDefaultWarn = [];
149
154
  const allWarnings = warnings?.filter((w) => !ignoreCompilerWarning(w, isBuild, emitCss));
150
155
  if (sendViaWS) {
151
156
  const _warn = warn;
152
- /** @type {(w: import('svelte/compiler').Warning) => void} */
157
+ /** @type {(w: Warning) => void} */
153
158
  warn = (w) => {
154
159
  handledByDefaultWarn.push(w);
155
160
  _warn(w);
@@ -163,7 +168,7 @@ export function logCompilerWarnings(svelteRequest, warnings, options) {
163
168
  }
164
169
  });
165
170
  if (sendViaWS) {
166
- /** @type {import('../types/log.d.ts').SvelteWarningsMessage} */
171
+ /** @type {SvelteWarningsMessage} */
167
172
  const message = {
168
173
  id: svelteRequest.id,
169
174
  filename: svelteRequest.filename,
@@ -179,7 +184,7 @@ export function logCompilerWarnings(svelteRequest, warnings, options) {
179
184
  }
180
185
 
181
186
  /**
182
- * @param {import('svelte/compiler').Warning} warning
187
+ * @param {Warning} warning
183
188
  * @param {boolean} isBuild
184
189
  * @param {boolean} [emitCss]
185
190
  * @returns {boolean}
@@ -193,7 +198,7 @@ function ignoreCompilerWarning(warning, isBuild, emitCss) {
193
198
 
194
199
  /**
195
200
  *
196
- * @param {import('svelte/compiler').Warning} warning
201
+ * @param {Warning} warning
197
202
  * @returns {boolean}
198
203
  */
199
204
  function isNoScopableElementWarning(warning) {
@@ -202,7 +207,7 @@ function isNoScopableElementWarning(warning) {
202
207
  }
203
208
 
204
209
  /**
205
- * @param {import('svelte/compiler').Warning} w
210
+ * @param {Warning} w
206
211
  */
207
212
  function warnDev(w) {
208
213
  if (w.filename?.includes('node_modules')) {
@@ -215,7 +220,7 @@ function warnDev(w) {
215
220
  }
216
221
 
217
222
  /**
218
- * @param {import('svelte/compiler').Warning & {frame?: string}} w
223
+ * @param {Warning & {frame?: string}} w
219
224
  */
220
225
  function warnBuild(w) {
221
226
  if (w.filename?.includes('node_modules')) {
@@ -228,7 +233,7 @@ function warnBuild(w) {
228
233
  }
229
234
 
230
235
  /**
231
- * @param {import('svelte/compiler').Warning} w
236
+ * @param {Warning} w
232
237
  */
233
238
  export function buildExtendedLogMessage(w) {
234
239
  const parts = [];