nitro-nightly 3.0.1-20251110-125717-ef372c1d → 3.0.1-20251110-164346-0ea04a3c
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/dist/_build/vite.plugin.mjs +11 -14
- package/package.json +1 -1
|
@@ -173,6 +173,16 @@ async function buildEnvironments(ctx, builder) {
|
|
|
173
173
|
const buildInfo = [["preset", nitro$1.options.preset], ["compatibility", formatCompatibilityDate(nitro$1.options.compatibilityDate)]].filter((e) => e[1]);
|
|
174
174
|
nitro$1.logger.start(`Building [${BuilderNames.nitro}] ${colors.dim(`(${buildInfo.map(([k, v]) => `${k}: \`${v}\``).join(", ")})`)}`);
|
|
175
175
|
await copyPublicAssets(nitro$1);
|
|
176
|
+
const assetDirs = new Set(Object.values(builder.environments).filter((env) => env.config.consumer === "client").map((env) => env.config.build.assetsDir).filter(Boolean));
|
|
177
|
+
for (const assetsDir of assetDirs) {
|
|
178
|
+
if (!existsSync(resolve$1(nitro$1.options.output.publicDir, assetsDir))) continue;
|
|
179
|
+
const rule = ctx.nitro.options.routeRules[`/${assetsDir}/**`] ??= {};
|
|
180
|
+
if (!rule.headers?.["cache-control"]) rule.headers = {
|
|
181
|
+
...rule.headers,
|
|
182
|
+
"cache-control": `public, max-age=31536000, immutable`
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
ctx.nitro.routing.sync();
|
|
176
186
|
await builder.build(builder.environments.nitro);
|
|
177
187
|
await nitro$1.close();
|
|
178
188
|
await nitro$1.hooks.callHook("compiled", nitro$1);
|
|
@@ -596,20 +606,6 @@ function nitroMain(ctx) {
|
|
|
596
606
|
}
|
|
597
607
|
};
|
|
598
608
|
},
|
|
599
|
-
configResolved(config) {
|
|
600
|
-
if (config.command === "build") {
|
|
601
|
-
debug("[main] Inferring caching routes");
|
|
602
|
-
for (const env of Object.values(config.environments)) if (env.consumer === "client") {
|
|
603
|
-
const rule = ctx.nitro.options.routeRules[`/${env.build.assetsDir}/**`] ??= {};
|
|
604
|
-
if (!rule.headers?.["cache-control"]) rule.headers = {
|
|
605
|
-
...rule.headers,
|
|
606
|
-
"cache-control": `public, max-age=31536000, immutable`
|
|
607
|
-
};
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
debug("[main] Syncing nitro routes");
|
|
611
|
-
ctx.nitro.routing.sync();
|
|
612
|
-
},
|
|
613
609
|
buildApp: {
|
|
614
610
|
order: "post",
|
|
615
611
|
handler(builder) {
|
|
@@ -737,6 +733,7 @@ async function setupNitroContext(ctx, configEnv, userConfig) {
|
|
|
737
733
|
if (!ctx.nitro.options.renderer?.handler && !ctx.nitro.options.renderer?.template && ctx.services.ssr?.entry) {
|
|
738
734
|
ctx.nitro.options.renderer ??= {};
|
|
739
735
|
ctx.nitro.options.renderer.handler = resolve$1(runtimeDir, "internal/vite/ssr-renderer");
|
|
736
|
+
ctx.nitro.routing.sync();
|
|
740
737
|
}
|
|
741
738
|
const publicDistDir = ctx._publicDistDir = userConfig.build?.outDir || resolve$1(ctx.nitro.options.buildDir, "vite/public");
|
|
742
739
|
ctx.nitro.options.publicAssets.push({
|
package/package.json
CHANGED