@sveltejs/vite-plugin-svelte 4.0.0-next.7 → 4.0.0

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.0-next.7",
3
+ "version": "4.0.0",
4
4
  "license": "MIT",
5
5
  "author": "dominikg",
6
6
  "files": [
@@ -37,11 +37,11 @@
37
37
  "homepage": "https://github.com/sveltejs/vite-plugin-svelte#readme",
38
38
  "dependencies": {
39
39
  "@sveltejs/vite-plugin-svelte-inspector": "^3.0.0-next.0||^3.0.0",
40
- "debug": "^4.3.6",
40
+ "debug": "^4.3.7",
41
41
  "deepmerge": "^4.3.1",
42
42
  "kleur": "^4.1.5",
43
- "magic-string": "^0.30.11",
44
- "vitefu": "^1.0.2"
43
+ "magic-string": "^0.30.12",
44
+ "vitefu": "^1.0.3"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "svelte": "^5.0.0-next.96 || ^5.0.0",
@@ -49,10 +49,10 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/debug": "^4.1.12",
52
- "esbuild": "^0.23.1",
53
- "sass": "^1.77.8",
54
- "svelte": "^5.0.0-next.242",
55
- "vite": "^5.4.2"
52
+ "esbuild": "^0.24.0",
53
+ "sass": "^1.79.5",
54
+ "svelte": "^5.0.0-next.268",
55
+ "vite": "^5.4.9"
56
56
  },
57
57
  "scripts": {
58
58
  "check:publint": "publint --strict",
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import fs from 'node:fs';
2
+ import process from 'node:process';
2
3
  import { svelteInspector } from '@sveltejs/vite-plugin-svelte-inspector';
3
4
  import { handleHotUpdate } from './handle-hot-update.js';
4
5
  import { log, logCompilerWarnings } from './utils/log.js';
package/src/preprocess.js CHANGED
@@ -1,3 +1,4 @@
1
+ import process from 'node:process';
1
2
  import { isCSSRequest, preprocessCSS, resolveConfig, transformWithEsbuild } from 'vite';
2
3
  import { mapToRelative, removeLangSuffix } from './utils/sourcemaps.js';
3
4
 
package/src/public.d.ts CHANGED
@@ -136,6 +136,9 @@ export interface SvelteConfig {
136
136
  /**
137
137
  * Handles warning emitted from the Svelte compiler
138
138
  *
139
+ * warnings emitted for files in node_modules are logged at the debug level, to see them run
140
+ * `DEBUG=vite-plugin-svelte:node-modules-onwarn pnpm build`
141
+ *
139
142
  * @example
140
143
  * ```
141
144
  * (warning, defaultHandler) => {
@@ -145,6 +148,7 @@ export interface SvelteConfig {
145
148
  * }
146
149
  * }
147
150
  * ```
151
+ *
148
152
  */
149
153
  onwarn?: (warning: Warning, defaultHandler: (warning: Warning) => void) => void;
150
154
  /**
package/src/utils/hash.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as crypto from 'node:crypto';
1
+ import crypto from 'node:crypto';
2
2
 
3
3
  const hashes = Object.create(null);
4
4
 
package/src/utils/id.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createFilter, normalizePath } from 'vite';
2
- import * as fs from 'node:fs';
3
- import * as path from 'node:path';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import process from 'node:process';
4
5
  import { log } from './log.js';
5
6
  import { DEFAULT_SVELTE_MODULE_EXT, DEFAULT_SVELTE_MODULE_INFIX } from './constants.js';
6
7
 
@@ -1,5 +1,6 @@
1
1
  import { createRequire } from 'node:module';
2
2
  import path from 'node:path';
3
+ import process from 'node:process';
3
4
  import fs from 'node:fs';
4
5
  import { pathToFileURL } from 'node:url';
5
6
  import { log } from './log.js';
package/src/utils/log.js CHANGED
@@ -226,14 +226,26 @@ function buildExtraWarnings(warnings, isBuild) {
226
226
  * @param {import('svelte/compiler').Warning} w
227
227
  */
228
228
  function warnDev(w) {
229
- if (log.info.enabled) log.info(buildExtendedLogMessage(w));
229
+ if (w.filename?.includes('node_modules')) {
230
+ if (isDebugNamespaceEnabled('node-modules-onwarn')) {
231
+ log.debug(buildExtendedLogMessage(w), undefined, 'node-modules-onwarn');
232
+ }
233
+ } else if (log.info.enabled) {
234
+ log.info(buildExtendedLogMessage(w));
235
+ }
230
236
  }
231
237
 
232
238
  /**
233
239
  * @param {import('svelte/compiler').Warning & {frame?: string}} w
234
240
  */
235
241
  function warnBuild(w) {
236
- if (log.warn.enabled) log.warn(buildExtendedLogMessage(w), w.frame);
242
+ if (w.filename?.includes('node_modules')) {
243
+ if (isDebugNamespaceEnabled('node-modules-onwarn')) {
244
+ log.debug(buildExtendedLogMessage(w), w.frame, 'node-modules-onwarn');
245
+ }
246
+ } else if (log.warn.enabled) {
247
+ log.warn(buildExtendedLogMessage(w), w.frame);
248
+ }
237
249
  }
238
250
 
239
251
  /**
@@ -1,3 +1,4 @@
1
+ import process from 'node:process';
1
2
  import { normalizePath } from 'vite';
2
3
  import { isDebugNamespaceEnabled, log } from './log.js';
3
4
  import { loadSvelteConfig } from './load-svelte-config.js';
@@ -1,4 +1,5 @@
1
1
  import path from 'node:path';
2
+ import process from 'node:process';
2
3
 
3
4
  const IS_WINDOWS = process.platform === 'win32';
4
5
 
package/types/index.d.ts CHANGED
@@ -136,6 +136,9 @@ declare module '@sveltejs/vite-plugin-svelte' {
136
136
  /**
137
137
  * Handles warning emitted from the Svelte compiler
138
138
  *
139
+ * warnings emitted for files in node_modules are logged at the debug level, to see them run
140
+ * `DEBUG=vite-plugin-svelte:node-modules-onwarn pnpm build`
141
+ *
139
142
  * @example
140
143
  * ```
141
144
  * (warning, defaultHandler) => {
@@ -145,6 +148,7 @@ declare module '@sveltejs/vite-plugin-svelte' {
145
148
  * }
146
149
  * }
147
150
  * ```
151
+ *
148
152
  */
149
153
  onwarn?: (warning: Warning, defaultHandler: (warning: Warning) => void) => void;
150
154
  /**
@@ -22,5 +22,5 @@
22
22
  null,
23
23
  null
24
24
  ],
25
- "mappings": ";;;;aAIYA,OAAOA;;;;;;;;;;;;;kBAaFC,aAAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgGbC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8EZC,qBAAqBA;;;;;;;;;;;;;iBCvKtBC,MAAMA;iBCTNC,cAAcA;iBCgBRC,gBAAgBA"
25
+ "mappings": ";;;;aAIYA,OAAOA;;;;;;;;;;;;;kBAaFC,aAAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgGbC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAkFZC,qBAAqBA;;;;;;;;;;;;;iBC1KtBC,MAAMA;iBCTNC,cAAcA;iBCgBRC,gBAAgBA"
26
26
  }