nuxt-nightly 4.3.0-29436426.3cbdaef5 → 4.3.0-29437273.f9c092c5

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.
@@ -6,6 +6,8 @@ import { LayoutMetaSymbol, PageRouteSymbol } from "./injections.js";
6
6
  import { useRoute as useVueRouterRoute } from "#build/pages";
7
7
  import layouts from "#build/layouts";
8
8
  import { appLayoutTransition as defaultLayoutTransition } from "#build/nuxt.config.mjs";
9
+ import _routeRulesMatcher from "#build/route-rules.mjs";
10
+ const routeRulesMatcher = _routeRulesMatcher;
9
11
  const LayoutLoader = defineComponent({
10
12
  name: "LayoutLoader",
11
13
  inheritAttrs: false,
@@ -37,7 +39,7 @@ export default defineComponent({
37
39
  const shouldUseEagerRoute = !injectedRoute || injectedRoute === useRoute();
38
40
  const route = shouldUseEagerRoute ? useVueRouterRoute() : injectedRoute;
39
41
  const layout = computed(() => {
40
- let layout2 = unref(props.name) ?? route?.meta.layout ?? "default";
42
+ let layout2 = unref(props.name) ?? route?.meta.layout ?? routeRulesMatcher(route?.path).appLayout ?? "default";
41
43
  if (layout2 && !(layout2 in layouts)) {
42
44
  if (import.meta.dev && layout2 !== "default") {
43
45
  console.warn(`Invalid layout \`${layout2}\` selected.`);
@@ -112,7 +114,7 @@ const LayoutProvider = defineComponent({
112
114
  const name = props.name;
113
115
  if (props.shouldProvide) {
114
116
  provide(LayoutMetaSymbol, {
115
- isCurrent: (route) => name === (route.meta.layout ?? "default")
117
+ isCurrent: (route) => name === (route.meta.layout ?? routeRulesMatcher(route.path).appLayout ?? "default")
116
118
  });
117
119
  }
118
120
  const injectedRoute = inject(PageRouteSymbol);
@@ -1,4 +1,3 @@
1
- import { defu } from "defu";
2
1
  import { useNuxtApp, useRuntimeConfig } from "../nuxt.js";
3
2
  import { appManifest as isAppManifestEnabled } from "#build/nuxt.config.mjs";
4
3
  import { buildAssetsURL } from "#internal/nuxt/paths";
@@ -37,7 +36,7 @@ export function getAppManifest() {
37
36
  export function getRouteRules(arg) {
38
37
  const path = typeof arg === "string" ? arg : arg.path;
39
38
  try {
40
- return defu({}, ...routeRulesMatcher("", path).map((r) => r.data).reverse());
39
+ return routeRulesMatcher(path);
41
40
  } catch (e) {
42
41
  console.error("[nuxt] Error matching route rules.", e);
43
42
  return {};
package/dist/index.mjs CHANGED
@@ -3880,7 +3880,7 @@ function addDeclarationTemplates(ctx, options) {
3880
3880
  });
3881
3881
  }
3882
3882
 
3883
- const version = "4.3.0-29436426.3cbdaef5";
3883
+ const version = "4.3.0-29437273.f9c092c5";
3884
3884
  const pkg = {
3885
3885
  version: version};
3886
3886
 
@@ -5181,6 +5181,30 @@ Using \`${fallbackCompatibilityDate}\` as fallback. More info at: ${colors.under
5181
5181
  }
5182
5182
  }
5183
5183
  });
5184
+ addTypeTemplate({
5185
+ filename: "types/nitro-layouts.d.ts",
5186
+ getContents: ({ app }) => {
5187
+ return [
5188
+ `export type LayoutKey = ${Object.keys(app.layouts).map((name) => genString(name)).join(" | ") || "string"}`,
5189
+ "declare module 'nitropack' {",
5190
+ " interface NitroRouteConfig {",
5191
+ " appLayout?: LayoutKey | false",
5192
+ " }",
5193
+ " interface NitroRouteRules {",
5194
+ " appLayout?: LayoutKey | false",
5195
+ " }",
5196
+ "}",
5197
+ "declare module 'nitropack/types' {",
5198
+ " interface NitroRouteConfig {",
5199
+ " appLayout?: LayoutKey | false",
5200
+ " }",
5201
+ " interface NitroRouteRules {",
5202
+ " appLayout?: LayoutKey | false",
5203
+ " }",
5204
+ "}"
5205
+ ].join("\n");
5206
+ }
5207
+ }, { nuxt: true, nitro: true, node: true });
5184
5208
  if (nuxt.options.typescript.builder !== false) {
5185
5209
  const envMap = {
5186
5210
  // defaults from `builder` based on package name
@@ -1,5 +1,4 @@
1
1
  import { joinURL } from "ufo";
2
- import { defu } from "defu";
3
2
  import { defineNuxtPlugin } from "#app/nuxt";
4
3
  import { prerenderRoutes } from "#app/composables/ssr";
5
4
  import _routes from "#build/routes";
@@ -21,7 +20,7 @@ export default defineNuxtPlugin(async () => {
21
20
  });
22
21
  const OPTIONAL_PARAM_RE = /^\/?:.*(?:\?|\(\.\*\)\*)$/;
23
22
  function shouldPrerender(path) {
24
- return crawlLinks || defu({}, ...routeRulesMatcher("", path).map((r) => r.data).reverse()).prerender;
23
+ return crawlLinks || !!routeRulesMatcher(path).prerender;
25
24
  }
26
25
  function processRoutes(routes2, currentPath = "/", routesToPrerender = /* @__PURE__ */ new Set()) {
27
26
  for (const route of routes2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-nightly",
3
- "version": "4.3.0-29436426.3cbdaef5",
3
+ "version": "4.3.0-29437273.f9c092c5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -67,11 +67,11 @@
67
67
  "@dxup/nuxt": "^0.3.2",
68
68
  "@nuxt/cli": "npm:@nuxt/cli-nightly@latest",
69
69
  "@nuxt/devtools": "^3.1.1",
70
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-29436426.3cbdaef5",
71
- "@nuxt/nitro-server": "npm:@nuxt/nitro-server-nightly@4.3.0-29436426.3cbdaef5",
72
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29436426.3cbdaef5",
70
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-29437273.f9c092c5",
71
+ "@nuxt/nitro-server": "npm:@nuxt/nitro-server-nightly@4.3.0-29437273.f9c092c5",
72
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29437273.f9c092c5",
73
73
  "@nuxt/telemetry": "^2.6.6",
74
- "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.3.0-29436426.3cbdaef5",
74
+ "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.3.0-29437273.f9c092c5",
75
75
  "@unhead/vue": "^2.0.19",
76
76
  "@vue/shared": "^3.5.25",
77
77
  "c12": "^3.3.2",