@sveltejs/vite-plugin-svelte 4.0.0-next.4 → 4.0.0-next.6
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.
|
|
3
|
+
"version": "4.0.0-next.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "dominikg",
|
|
6
6
|
"files": [
|
|
@@ -37,10 +37,10 @@
|
|
|
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.
|
|
40
|
+
"debug": "^4.3.6",
|
|
41
41
|
"deepmerge": "^4.3.1",
|
|
42
42
|
"kleur": "^4.1.5",
|
|
43
|
-
"magic-string": "^0.30.
|
|
43
|
+
"magic-string": "^0.30.11",
|
|
44
44
|
"vitefu": "^0.2.5"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/debug": "^4.1.12",
|
|
52
52
|
"esbuild": "^0.23.0",
|
|
53
|
-
"sass": "^1.77.
|
|
54
|
-
"svelte": "^5.0.0-next.
|
|
55
|
-
"vite": "^5.3.
|
|
53
|
+
"sass": "^1.77.8",
|
|
54
|
+
"svelte": "^5.0.0-next.210",
|
|
55
|
+
"vite": "^5.3.5"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"check:publint": "publint --strict",
|
package/src/utils/esbuild.js
CHANGED
|
@@ -2,6 +2,8 @@ import { readFileSync } from 'node:fs';
|
|
|
2
2
|
import * as svelte from 'svelte/compiler';
|
|
3
3
|
import { log } from './log.js';
|
|
4
4
|
import { toESBuildError } from './error.js';
|
|
5
|
+
import { safeBase64Hash } from './hash.js';
|
|
6
|
+
import { normalize } from './id.js';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* @typedef {NonNullable<import('vite').DepOptimizationOptions['esbuildOptions']>} EsbuildOptions
|
|
@@ -49,7 +51,7 @@ export function esbuildSveltePlugin(options) {
|
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
53
|
* @param {import('../types/options.d.ts').ResolvedOptions} options
|
|
52
|
-
* @param {{ filename: string
|
|
54
|
+
* @param {{ filename: string, code: string }} input
|
|
53
55
|
* @param {import('../types/vite-plugin-svelte-stats.d.ts').StatCollection} [statsCollection]
|
|
54
56
|
* @returns {Promise<string>}
|
|
55
57
|
*/
|
|
@@ -68,6 +70,11 @@ async function compileSvelte(options, { filename, code }, statsCollection) {
|
|
|
68
70
|
generate: 'client'
|
|
69
71
|
};
|
|
70
72
|
|
|
73
|
+
if (compileOptions.hmr && options.emitCss) {
|
|
74
|
+
const hash = `s-${safeBase64Hash(normalize(filename, options.root))}`;
|
|
75
|
+
compileOptions.cssHash = () => hash;
|
|
76
|
+
}
|
|
77
|
+
|
|
71
78
|
let preprocessed;
|
|
72
79
|
|
|
73
80
|
if (options.preprocess) {
|
package/src/utils/id.js
CHANGED
|
@@ -133,7 +133,7 @@ function parseRequestQuery(rawQuery) {
|
|
|
133
133
|
* @param {string} normalizedRoot
|
|
134
134
|
* @returns {string}
|
|
135
135
|
*/
|
|
136
|
-
function normalize(filename, normalizedRoot) {
|
|
136
|
+
export function normalize(filename, normalizedRoot) {
|
|
137
137
|
return stripRoot(normalizePath(filename), normalizedRoot);
|
|
138
138
|
}
|
|
139
139
|
|
|
@@ -61,7 +61,7 @@ export async function loadSvelteConfig(viteConfig, inlineOptions) {
|
|
|
61
61
|
try {
|
|
62
62
|
// identify which require function to use (esm and cjs mode)
|
|
63
63
|
const _require = import.meta.url
|
|
64
|
-
? esmRequire ?? (esmRequire = createRequire(import.meta.url))
|
|
64
|
+
? (esmRequire ?? (esmRequire = createRequire(import.meta.url)))
|
|
65
65
|
: // eslint-disable-next-line no-undef
|
|
66
66
|
require;
|
|
67
67
|
|