@sveltejs/kit 2.33.0 → 2.33.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 +1 -1
- package/src/exports/vite/index.js +37 -3
- package/src/version.js +1 -1
package/package.json
CHANGED
|
@@ -1064,11 +1064,45 @@ async function kit({ svelte_config }) {
|
|
|
1064
1064
|
throw stackless(error.stack ?? error.message);
|
|
1065
1065
|
}
|
|
1066
1066
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1067
|
+
// We use `build.ssrEmitAssets` so that asset URLs created from
|
|
1068
|
+
// imports in server-only modules correspond to files in the build,
|
|
1069
|
+
// but we don't want to copy over CSS imports as these are already
|
|
1070
|
+
// accounted for in the client bundle. In most cases it would be
|
|
1071
|
+
// a no-op, but for SSR builds `url(...)` paths are handled
|
|
1072
|
+
// differently (relative for client, absolute for server)
|
|
1073
|
+
// resulting in different hashes, and thus duplication
|
|
1074
|
+
const ssr_stylesheets = new Set(
|
|
1075
|
+
Object.values(server_manifest)
|
|
1076
|
+
.map((chunk) => chunk.css ?? [])
|
|
1077
|
+
.flat()
|
|
1070
1078
|
);
|
|
1071
1079
|
|
|
1080
|
+
const assets_path = `${kit.appDir}/immutable/assets`;
|
|
1081
|
+
const server_assets = `${out}/server/${assets_path}`;
|
|
1082
|
+
const client_assets = `${out}/client/${assets_path}`;
|
|
1083
|
+
|
|
1084
|
+
if (fs.existsSync(server_assets)) {
|
|
1085
|
+
for (const file of fs.readdirSync(server_assets)) {
|
|
1086
|
+
const src = `${server_assets}/${file}`;
|
|
1087
|
+
const dest = `${client_assets}/${file}`;
|
|
1088
|
+
|
|
1089
|
+
if (fs.existsSync(dest) || ssr_stylesheets.has(`${assets_path}/${file}`)) {
|
|
1090
|
+
continue;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
if (file.endsWith('.css')) {
|
|
1094
|
+
// make absolute paths in CSS relative, for portability
|
|
1095
|
+
const content = fs
|
|
1096
|
+
.readFileSync(src, 'utf-8')
|
|
1097
|
+
.replaceAll(`${kit.paths.base}/${assets_path}`, '.');
|
|
1098
|
+
|
|
1099
|
+
fs.writeFileSync(src, content);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
copy(src, dest);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1072
1106
|
/** @type {import('vite').Manifest} */
|
|
1073
1107
|
const client_manifest = JSON.parse(read(`${out}/client/.vite/manifest.json`));
|
|
1074
1108
|
|
package/src/version.js
CHANGED