nuxt-nightly 4.1.2-29293231.4568e845 → 4.1.2-29293741.3f7624b3

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.
@@ -42,8 +42,11 @@ export async function preloadRouteComponents(to, router = useRouter()) {
42
42
  return Promise.all(promises).then(() => preloadRouteComponents(to, router));
43
43
  }
44
44
  router._routePreloaded.add(path);
45
- const components = matched.map((component) => component.components?.default).filter((component) => typeof component === "function");
46
- for (const component of components) {
45
+ for (const route of matched) {
46
+ const component = route.components?.default;
47
+ if (typeof component !== "function") {
48
+ continue;
49
+ }
47
50
  const promise = Promise.resolve(component()).catch(() => {
48
51
  }).finally(() => promises.splice(promises.indexOf(promise)));
49
52
  promises.push(promise);
@@ -66,8 +66,13 @@ export const navigateTo = (to, options) => {
66
66
  const toPath = typeof to === "string" ? to : "path" in to ? resolveRouteObject(to) : useRouter().resolve(to).href;
67
67
  if (import.meta.client && options?.open) {
68
68
  const { target = "_blank", windowFeatures = {} } = options.open;
69
- const features = Object.entries(windowFeatures).filter(([_, value]) => value !== void 0).map(([feature, value]) => `${feature.toLowerCase()}=${value}`).join(", ");
70
- open(toPath, target, features);
69
+ const features = [];
70
+ for (const [feature, value] of Object.entries(windowFeatures)) {
71
+ if (value !== void 0) {
72
+ features.push(`${feature.toLowerCase()}=${value}`);
73
+ }
74
+ }
75
+ open(toPath, target, features.join(", "));
71
76
  return Promise.resolve();
72
77
  }
73
78
  const isExternalHost = hasProtocol(toPath, { acceptRelative: true });
package/dist/app/nuxt.js CHANGED
@@ -260,7 +260,10 @@ function wrappedConfig(runtimeConfig) {
260
260
  if (!import.meta.dev || import.meta.server) {
261
261
  return runtimeConfig;
262
262
  }
263
- const keys = Object.keys(runtimeConfig).map((key) => `\`${key}\``);
263
+ const keys = [];
264
+ for (const key in runtimeConfig) {
265
+ keys.push(`\`${key}\``);
266
+ }
264
267
  const lastKey = keys.pop();
265
268
  return new Proxy(runtimeConfig, {
266
269
  get(target, p, receiver) {
@@ -213,7 +213,14 @@ export default defineRenderHandler(async (event) => {
213
213
  };
214
214
  });
215
215
  function normalizeChunks(chunks) {
216
- return chunks.filter(Boolean).map((i) => i.trim());
216
+ const result = [];
217
+ for (const _chunk of chunks) {
218
+ const chunk = _chunk?.trim();
219
+ if (chunk) {
220
+ result.push(chunk);
221
+ }
222
+ }
223
+ return result;
217
224
  }
218
225
  function joinTags(tags) {
219
226
  return tags.join("");
@@ -86,9 +86,12 @@ export function getRenderer(ssrContext) {
86
86
  return process.env.NUXT_NO_SSR || ssrContext.noSSR ? getSPARenderer() : getSSRRenderer();
87
87
  }
88
88
  export const getSSRStyles = lazyCachedFunction(() => import("#build/dist/server/styles.mjs").then((r) => r.default || r));
89
- export const getEntryIds = () => getClientManifest().then((r) => Object.values(r).filter(
90
- (r2) => (
91
- // @ts-expect-error internal key set by CSS inlining configuration
92
- r2._globalCSS
93
- )
94
- ).map((r2) => r2.src));
89
+ export const getEntryIds = () => getClientManifest().then((r) => {
90
+ const entryIds = [];
91
+ for (const entry of Object.values(r)) {
92
+ if (entry._globalCSS) {
93
+ entryIds.push(entry.src);
94
+ }
95
+ }
96
+ return entryIds;
97
+ });
@@ -103,9 +103,16 @@ export const NoScript = defineComponent({
103
103
  return () => {
104
104
  const noscript = normalizeProps(props);
105
105
  const slotVnodes = slots.default?.();
106
- const textContent = slotVnodes ? slotVnodes.filter(({ children }) => children).map(({ children }) => children).join("") : "";
107
- if (textContent) {
108
- noscript.innerHTML = textContent;
106
+ const textContent = [];
107
+ if (slotVnodes) {
108
+ for (const vnode of slotVnodes) {
109
+ if (vnode.children) {
110
+ textContent.push(vnode.children);
111
+ }
112
+ }
113
+ }
114
+ if (textContent.length > 0) {
115
+ noscript.innerHTML = textContent.join("");
109
116
  }
110
117
  input.noscript[idx] = noscript;
111
118
  return null;
package/dist/index.mjs CHANGED
@@ -1325,7 +1325,9 @@ const pagesModule = defineNuxtModule({
1325
1325
  dts: resolve(nuxt.options.buildDir, declarationFile),
1326
1326
  logs: nuxt.options.debug && nuxt.options.debug.router,
1327
1327
  async beforeWriteFiles(rootPage) {
1328
- rootPage.children.forEach((child) => child.delete());
1328
+ for (const child of rootPage.children) {
1329
+ child.delete();
1330
+ }
1329
1331
  const pages = nuxt.apps.default?.pages || await resolvePagesRoutes$1(options.pattern, nuxt);
1330
1332
  if (nuxt.apps.default) {
1331
1333
  nuxt.apps.default.pages = pages;
@@ -1345,7 +1347,9 @@ const pagesModule = defineNuxtModule({
1345
1347
  route.name = page.name;
1346
1348
  }
1347
1349
  if (page.children) {
1348
- page.children.forEach((child) => addPage(route, child, absolutePagePath));
1350
+ for (const child of page.children) {
1351
+ addPage(route, child, absolutePagePath);
1352
+ }
1349
1353
  }
1350
1354
  }
1351
1355
  for (const page of pages) {
@@ -1580,10 +1584,20 @@ const pagesModule = defineNuxtModule({
1580
1584
  getContents: async ({ nuxt: nuxt2 }) => {
1581
1585
  const routerOptionsFiles = await resolveRouterOptions(nuxt2, builtInRouterOptions);
1582
1586
  const configRouterOptions = genObjectFromRawEntries(Object.entries(nuxt2.options.router.options).map(([key, value]) => [key, genString(value)]));
1587
+ const hashModes = [];
1588
+ for (let index = 0; index < routerOptionsFiles.length; index++) {
1589
+ const file = routerOptionsFiles[index];
1590
+ if (file.path !== builtInRouterOptions) {
1591
+ hashModes.unshift(`routerOptions${index}.hashMode`);
1592
+ }
1593
+ }
1583
1594
  return [
1584
1595
  ...routerOptionsFiles.map((file, index) => genImport(file.path, `routerOptions${index}`)),
1585
1596
  `const configRouterOptions = ${configRouterOptions}`,
1586
- `export const hashMode = ${[...routerOptionsFiles.filter((o) => o.path !== builtInRouterOptions).map((_, index) => `routerOptions${index}.hashMode`).reverse(), nuxt2.options.router.options.hashMode].join(" ?? ")}`,
1597
+ `export const hashMode = ${[
1598
+ ...hashModes,
1599
+ nuxt2.options.router.options.hashMode
1600
+ ].join(" ?? ")}`,
1587
1601
  "export default {",
1588
1602
  "...configRouterOptions,",
1589
1603
  ...routerOptionsFiles.map((_, index) => `...routerOptions${index},`),
@@ -2144,7 +2158,13 @@ export default defineNuxtPlugin({
2144
2158
  const componentNamesTemplate = {
2145
2159
  filename: "component-names.mjs",
2146
2160
  getContents({ app }) {
2147
- return `export const componentNames = ${JSON.stringify(app.components.filter((c) => !c.island).map((c) => c.pascalName))}`;
2161
+ const componentNames = [];
2162
+ for (const c of app.components) {
2163
+ if (!c.island) {
2164
+ componentNames.push(c.pascalName);
2165
+ }
2166
+ }
2167
+ return `export const componentNames = ${JSON.stringify(componentNames)}`;
2148
2168
  }
2149
2169
  };
2150
2170
  const componentsIslandsTemplate = {
@@ -2179,14 +2199,17 @@ const componentsIslandsTemplate = {
2179
2199
  const NON_VUE_RE = /\b\.(?!vue)\w+$/g;
2180
2200
  function resolveComponentTypes(app, baseDir) {
2181
2201
  const serverPlaceholderPath = resolve(distDir, "app/components/server-placeholder");
2182
- const componentTypes = app.components.filter((c) => !c.island).map((c) => {
2183
- const type = `typeof ${genDynamicImport(isAbsolute(c.filePath) ? relative(baseDir, c.filePath).replace(NON_VUE_RE, "") : c.filePath.replace(NON_VUE_RE, ""), { wrapper: false })}['${c.export}']`;
2184
- const isServerOnly = c.mode === "server" && c.filePath !== serverPlaceholderPath && !app.components.some((other) => other.pascalName === c.pascalName && other.mode === "client");
2185
- return [
2186
- c.pascalName,
2187
- isServerOnly ? `IslandComponent<${type}>` : type
2188
- ];
2189
- });
2202
+ const componentTypes = [];
2203
+ for (const c of app.components) {
2204
+ if (!c.island) {
2205
+ const type = `typeof ${genDynamicImport(isAbsolute(c.filePath) ? relative(baseDir, c.filePath).replace(NON_VUE_RE, "") : c.filePath.replace(NON_VUE_RE, ""), { wrapper: false })}['${c.export}']`;
2206
+ const isServerOnly = c.mode === "server" && c.filePath !== serverPlaceholderPath && !app.components.some((other) => other.pascalName === c.pascalName && other.mode === "client");
2207
+ componentTypes.push([
2208
+ c.pascalName,
2209
+ isServerOnly ? `IslandComponent<${type}>` : type
2210
+ ]);
2211
+ }
2212
+ }
2190
2213
  return componentTypes;
2191
2214
  }
2192
2215
  const islandType = "type IslandComponent<T extends DefineComponent> = T & DefineComponent<{}, {refresh: () => Promise<void>}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, SlotsType<{ fallback: { error: unknown } }>>";
@@ -2642,7 +2665,13 @@ function getPropsToString(bindings) {
2642
2665
  if (Object.keys(bindings).length === 0) {
2643
2666
  return "undefined";
2644
2667
  }
2645
- const content = Object.entries(bindings).filter((b) => b[0] && (b[0] !== "_bind" && b[0] !== "v-for")).map(([name, value]) => isBinding(name) ? `[\`${name.slice(1)}\`]: ${value}` : `[\`${name}\`]: \`${value}\``).join(",");
2668
+ const contentParts = [];
2669
+ for (const [name, value] of Object.entries(bindings)) {
2670
+ if (name && (name !== "_bind" && name !== "v-for")) {
2671
+ contentParts.push(isBinding(name) ? `[\`${name.slice(1)}\`]: ${value}` : `[\`${name}\`]: \`${value}\``);
2672
+ }
2673
+ }
2674
+ const content = contentParts.join(",");
2646
2675
  const data = bindings._bind ? `__mergeProps(${bindings._bind}, { ${content} })` : `{ ${content} }`;
2647
2676
  if (!vfor) {
2648
2677
  return `[${data}]`;
@@ -3355,7 +3384,7 @@ const componentsModule = defineNuxtModule({
3355
3384
  defaults: {
3356
3385
  dirs: []
3357
3386
  },
3358
- async setup(componentOptions, nuxt) {
3387
+ async setup(moduleOptions, nuxt) {
3359
3388
  let componentDirs = [];
3360
3389
  const context = {
3361
3390
  components: []
@@ -3367,52 +3396,40 @@ const componentsModule = defineNuxtModule({
3367
3396
  addBuildPlugin(ComponentNamePlugin({ sourcemap: !!nuxt.options.sourcemap.client, getComponents }), { server: false });
3368
3397
  addBuildPlugin(ComponentNamePlugin({ sourcemap: !!nuxt.options.sourcemap.server, getComponents }), { client: false });
3369
3398
  }
3370
- const normalizeDirs = (dir, cwd, options) => {
3371
- if (Array.isArray(dir)) {
3372
- return dir.map((dir2) => normalizeDirs(dir2, cwd, options)).flat().sort(compareDirByPathLength);
3373
- }
3374
- if (dir === true || dir === void 0) {
3375
- return [
3376
- { priority: options?.priority || 0, path: resolve(cwd, "components/islands"), island: true },
3377
- { priority: options?.priority || 0, path: resolve(cwd, "components/global"), global: true },
3378
- { priority: options?.priority || 0, path: resolve(cwd, "components") }
3379
- ];
3380
- }
3381
- if (typeof dir === "string") {
3382
- return [
3383
- { priority: options?.priority || 0, path: resolve(cwd, resolveAlias$1(dir)) }
3384
- ];
3385
- }
3386
- if (!dir) {
3387
- return [];
3388
- }
3389
- const dirs = (dir.dirs || [dir]).map((dir2) => typeof dir2 === "string" ? { path: dir2 } : dir2).filter((_dir) => _dir.path);
3390
- return dirs.map((_dir) => ({
3391
- priority: options?.priority || 0,
3392
- ..._dir,
3393
- path: resolve(cwd, resolveAlias$1(_dir.path))
3394
- }));
3395
- };
3396
3399
  nuxt.hook("app:resolve", async () => {
3397
- const allDirs = nuxt.options._layers.map((layer) => normalizeDirs(layer.config.components, layer.config.srcDir, { priority: layer.config.srcDir === nuxt.options.srcDir ? 1 : 0 })).flat();
3400
+ const allDirs = [];
3401
+ for (const layer of nuxt.options._layers) {
3402
+ const layerDirs = normalizeDirs(layer.config.components, layer.config.srcDir, { priority: layer.config.srcDir === nuxt.options.srcDir ? 1 : 0 });
3403
+ allDirs.push(...layerDirs);
3404
+ }
3398
3405
  await nuxt.callHook("components:dirs", allDirs);
3399
- componentDirs = allDirs.filter(isPureObjectOrString).map((dir) => {
3406
+ const userComponentDirs = [];
3407
+ const libraryComponentDirs = [];
3408
+ for (const dir of allDirs) {
3409
+ if (!isPureObjectOrString(dir)) {
3410
+ continue;
3411
+ }
3400
3412
  const dirOptions = typeof dir === "object" ? dir : { path: dir };
3401
3413
  const dirPath = resolveAlias$1(dirOptions.path);
3402
- const transpile = typeof dirOptions.transpile === "boolean" ? dirOptions.transpile : "auto";
3403
3414
  const extensions = (dirOptions.extensions || nuxt.options.extensions).map((e) => e.replace(STARTER_DOT_RE, ""));
3415
+ const _transpile = typeof dirOptions.transpile === "boolean" ? dirOptions.transpile : "auto";
3416
+ const transpile = _transpile === "auto" ? dirPath.includes("node_modules") : _transpile;
3417
+ if (transpile) {
3418
+ nuxt.options.build.transpile.push(dirPath);
3419
+ }
3404
3420
  const present = isDirectory(dirPath);
3405
3421
  if (!present && !DEFAULT_COMPONENTS_DIRS_RE.test(dirOptions.path)) {
3406
3422
  logger.warn("Components directory not found: `" + dirPath + "`");
3407
3423
  }
3408
- return {
3409
- global: componentOptions.global,
3424
+ const dirs = dirPath.includes("node_modules") ? libraryComponentDirs : userComponentDirs;
3425
+ dirs.push({
3426
+ global: moduleOptions.global,
3410
3427
  ...dirOptions,
3411
3428
  // TODO: https://github.com/nuxt/framework/pull/251
3412
3429
  enabled: true,
3413
3430
  path: dirPath,
3414
3431
  extensions,
3415
- pattern: dirOptions.pattern || `**/*.{${extensions.join(",")},}`,
3432
+ pattern: dirOptions.pattern || (extensions.length > 1 ? `**/*.{${extensions.join(",")}}` : `**/*.${extensions[0] || "*"}`),
3416
3433
  ignore: [
3417
3434
  "**/*{M,.m,-m}ixin.{js,ts,jsx,tsx}",
3418
3435
  // ignore mixins
@@ -3420,21 +3437,20 @@ const componentsModule = defineNuxtModule({
3420
3437
  // .d.ts files
3421
3438
  ...dirOptions.ignore || []
3422
3439
  ],
3423
- transpile: transpile === "auto" ? dirPath.includes("node_modules") : transpile
3424
- };
3425
- }).filter((d) => d.enabled);
3440
+ transpile
3441
+ });
3442
+ }
3426
3443
  componentDirs = [
3427
- ...componentDirs.filter((dir) => !dir.path.includes("node_modules")),
3428
- ...componentDirs.filter((dir) => dir.path.includes("node_modules"))
3444
+ ...userComponentDirs,
3445
+ ...libraryComponentDirs
3429
3446
  ];
3430
- nuxt.options.build.transpile.push(...componentDirs.filter((dir) => dir.transpile).map((dir) => dir.path));
3431
3447
  });
3432
3448
  addTemplate(componentsDeclarationTemplate);
3433
3449
  addTypeTemplate(componentsTypeTemplate);
3434
3450
  addPluginTemplate(componentsPluginTemplate);
3435
3451
  addTemplate(componentNamesTemplate);
3436
3452
  addTemplate({ ...componentsIslandsTemplate, filename: "components.islands.mjs" });
3437
- if (componentOptions.generateMetadata) {
3453
+ if (moduleOptions.generateMetadata) {
3438
3454
  addTemplate(componentsMetadataTemplate);
3439
3455
  }
3440
3456
  const serverComponentRuntime = await findPath(join(distDir, "components/runtime/server-component")) ?? join(distDir, "components/runtime/server-component");
@@ -3543,6 +3559,39 @@ const componentsModule = defineNuxtModule({
3543
3559
  }
3544
3560
  }
3545
3561
  });
3562
+ function normalizeDirs(dir, cwd, options) {
3563
+ if (Array.isArray(dir)) {
3564
+ return dir.map((dir2) => normalizeDirs(dir2, cwd, options)).flat().sort(compareDirByPathLength);
3565
+ }
3566
+ if (dir === true || dir === void 0) {
3567
+ return [
3568
+ { priority: options?.priority || 0, path: resolve(cwd, "components/islands"), island: true },
3569
+ { priority: options?.priority || 0, path: resolve(cwd, "components/global"), global: true },
3570
+ { priority: options?.priority || 0, path: resolve(cwd, "components") }
3571
+ ];
3572
+ }
3573
+ if (typeof dir === "string") {
3574
+ return [
3575
+ { priority: options?.priority || 0, path: resolve(cwd, resolveAlias$1(dir)) }
3576
+ ];
3577
+ }
3578
+ if (!dir) {
3579
+ return [];
3580
+ }
3581
+ const normalizedDirs = [];
3582
+ for (const d of "dirs" in dir ? dir.dirs || [] : [dir]) {
3583
+ const normalizedDir = typeof d === "string" ? { path: d } : d;
3584
+ if (!normalizedDir.path) {
3585
+ continue;
3586
+ }
3587
+ normalizedDirs.push({
3588
+ priority: options?.priority || 0,
3589
+ ...normalizedDir,
3590
+ path: resolve(cwd, resolveAlias$1(normalizedDir.path))
3591
+ });
3592
+ }
3593
+ return normalizedDirs.sort(compareDirByPathLength);
3594
+ }
3546
3595
 
3547
3596
  const NODE_MODULES_RE$1 = /[\\/]node_modules[\\/]/;
3548
3597
  const IMPORTS_RE = /(['"])#imports\1/;
@@ -3769,7 +3818,7 @@ function addDeclarationTemplates(ctx, options) {
3769
3818
  });
3770
3819
  }
3771
3820
 
3772
- const version = "4.1.2-29293231.4568e845";
3821
+ const version = "4.1.2-29293741.3f7624b3";
3773
3822
 
3774
3823
  const createImportProtectionPatterns = (nuxt, options) => {
3775
3824
  const patterns = [];
@@ -4011,20 +4060,26 @@ const LayerAliasingPlugin = (options) => createUnplugin((_options, meta) => {
4011
4060
  };
4012
4061
  });
4013
4062
 
4014
- const addModuleTranspiles = (opts = {}) => {
4015
- const nuxt = useNuxt();
4016
- const modules = [
4017
- ...opts.additionalModules || [],
4018
- ...nuxt.options.modules,
4019
- ...nuxt.options._modules
4020
- ].map((m) => typeof m === "string" ? m : Array.isArray(m) ? m[0] : m.src).filter((m) => typeof m === "string").map(normalizeModuleTranspilePath);
4021
- nuxt.options.build.transpile = nuxt.options.build.transpile.map((m) => typeof m === "string" ? m.split("node_modules/").pop() : m).filter((x) => !!x);
4022
- function isTranspilePresent(mod) {
4023
- return nuxt.options.build.transpile.some((t) => !(t instanceof Function) && (t instanceof RegExp ? t.test(mod) : new RegExp(t).test(mod)));
4063
+ const addModuleTranspiles = (nuxt) => {
4064
+ const transpile = [];
4065
+ for (const t of nuxt.options.build.transpile) {
4066
+ if (t instanceof Function) {
4067
+ continue;
4068
+ }
4069
+ if (typeof t === "string") {
4070
+ transpile.push(new RegExp(escapeRE(t)));
4071
+ } else {
4072
+ transpile.push(t);
4073
+ }
4024
4074
  }
4025
- for (const module of modules) {
4026
- if (!isTranspilePresent(module)) {
4027
- nuxt.options.build.transpile.push(module);
4075
+ for (const m of [...nuxt.options.modules, ...nuxt.options._modules]) {
4076
+ const mod = typeof m === "string" ? m : Array.isArray(m) ? m[0] : m.src;
4077
+ if (typeof mod !== "string") {
4078
+ continue;
4079
+ }
4080
+ const path = normalizeModuleTranspilePath(mod);
4081
+ if (!transpile.some((t) => t.test(path))) {
4082
+ nuxt.options.build.transpile.push(path);
4028
4083
  }
4029
4084
  }
4030
4085
  };
@@ -4042,10 +4097,24 @@ const NODE_MODULES_RE = /(?<=\/)node_modules\/(.+)$/;
4042
4097
  const PNPM_NODE_MODULES_RE = /\.pnpm\/.+\/node_modules\/(.+)$/;
4043
4098
  async function initNitro(nuxt) {
4044
4099
  const layerDirs = getLayerDirectories(nuxt);
4045
- const excludePaths = layerDirs.flatMap((dirs) => [
4046
- dirs.root.match(NODE_MODULES_RE)?.[1]?.replace(/\/$/, ""),
4047
- dirs.root.match(PNPM_NODE_MODULES_RE)?.[1]?.replace(/\/$/, "")
4048
- ].filter((dir) => Boolean(dir)).map((dir) => escapeRE(dir)));
4100
+ const excludePaths = [];
4101
+ for (const dirs of layerDirs) {
4102
+ const paths = [
4103
+ dirs.root.match(NODE_MODULES_RE)?.[1]?.replace(/\/$/, ""),
4104
+ dirs.root.match(PNPM_NODE_MODULES_RE)?.[1]?.replace(/\/$/, "")
4105
+ ];
4106
+ for (const dir of paths) {
4107
+ if (dir) {
4108
+ excludePaths.push(escapeRE(dir));
4109
+ }
4110
+ }
4111
+ }
4112
+ const layerPublicAssetsDirs = [];
4113
+ for (const dirs of layerDirs) {
4114
+ if (existsSync(dirs.public)) {
4115
+ layerPublicAssetsDirs.push({ dir: dirs.public });
4116
+ }
4117
+ }
4049
4118
  const excludePattern = excludePaths.length ? [new RegExp(`node_modules\\/(?!${excludePaths.join("|")})`)] : [/node_modules/];
4050
4119
  const rootDirWithSlash = withTrailingSlash$1(nuxt.options.rootDir);
4051
4120
  const moduleEntryPaths = [];
@@ -4150,7 +4219,7 @@ async function initNitro(nuxt) {
4150
4219
  join(moduleDir, "dist/runtime/server")
4151
4220
  ];
4152
4221
  }),
4153
- ...getLayerDirectories(nuxt).map((dirs) => relativeWithDot(nuxt.options.buildDir, join(dirs.shared, "**/*.d.ts")))
4222
+ ...layerDirs.map((dirs) => relativeWithDot(nuxt.options.buildDir, join(dirs.shared, "**/*.d.ts")))
4154
4223
  ],
4155
4224
  exclude: [
4156
4225
  ...nuxt.options.modulesDir.map((m) => relativeWithDot(nuxt.options.buildDir, m)),
@@ -4165,7 +4234,7 @@ async function initNitro(nuxt) {
4165
4234
  maxAge: 31536e3,
4166
4235
  baseURL: nuxt.options.app.buildAssetsDir
4167
4236
  },
4168
- ...getLayerDirectories(nuxt).filter((dirs) => existsSync(dirs.public)).map((dirs) => ({ dir: dirs.public }))
4237
+ ...layerPublicAssetsDirs
4169
4238
  ],
4170
4239
  prerender: {
4171
4240
  ignoreUnprefixedPublicAssets: true,
@@ -4187,7 +4256,7 @@ async function initNitro(nuxt) {
4187
4256
  "nuxt-nightly/dist",
4188
4257
  distDir,
4189
4258
  // Ensure app config files have auto-imports injected even if they are pure .js files
4190
- ...getLayerDirectories(nuxt).map((dirs) => join(dirs.app, "app.config"))
4259
+ ...layerDirs.map((dirs) => join(dirs.app, "app.config"))
4191
4260
  ],
4192
4261
  traceInclude: [
4193
4262
  // force include files used in generated code from the runtime-compiler
@@ -5651,9 +5720,11 @@ Using \`${fallbackCompatibilityDate}\` as fallback. More info at: ${colors.under
5651
5720
  });
5652
5721
  }
5653
5722
  nuxt.options.build.transpile.push("nuxt/app");
5654
- nuxt.options.build.transpile.push(
5655
- ...layerDirs.filter((i) => i.root.includes("node_modules")).map((i) => i.root.replace(/\/$/, ""))
5656
- );
5723
+ for (const layer of layerDirs) {
5724
+ if (layer.root.includes("node_modules")) {
5725
+ nuxt.options.build.transpile.push(layer.root.replace(/\/$/, ""));
5726
+ }
5727
+ }
5657
5728
  const locallyScannedLayersDirs = layerDirs.map((l) => join(l.root, "layers/"));
5658
5729
  const rootWithTrailingSlash = withTrailingSlash(nuxt.options.rootDir);
5659
5730
  for (const dirs of layerDirs) {
@@ -5879,8 +5950,13 @@ export default defineNuxtPlugin({
5879
5950
  return nuxt.callHook("restart");
5880
5951
  }
5881
5952
  });
5882
- nuxt.options.build.transpile = nuxt.options.build.transpile.map((t) => typeof t === "string" ? normalize(t) : t);
5883
- addModuleTranspiles();
5953
+ nuxt.options.build.transpile = nuxt.options.build.transpile.map((t) => {
5954
+ if (typeof t !== "string") {
5955
+ return t;
5956
+ }
5957
+ return normalize(t).split("node_modules/").pop();
5958
+ });
5959
+ addModuleTranspiles(nuxt);
5884
5960
  await initNitro(nuxt);
5885
5961
  const nitro = useNitro();
5886
5962
  if (nitro.options.static && nuxt.options.experimental.payloadExtraction === void 0) {
@@ -5926,9 +6002,15 @@ async function loadNuxt(opts) {
5926
6002
  }
5927
6003
  }
5928
6004
  options._modules.push(pagesModule, metaModule, componentsModule);
6005
+ const importIncludes = [];
6006
+ for (const layer of options._layers) {
6007
+ if (layer.cwd && layer.cwd.includes("node_modules")) {
6008
+ importIncludes.push(new RegExp(`(^|\\/)${escapeRE(layer.cwd.split("node_modules/").pop())}(\\/|$)(?!node_modules\\/)`));
6009
+ }
6010
+ }
5929
6011
  options._modules.push([importsModule, {
5930
6012
  transform: {
5931
- include: options._layers.filter((i) => i.cwd && i.cwd.includes("node_modules")).map((i) => new RegExp(`(^|\\/)${escapeRE(i.cwd.split("node_modules/").pop())}(\\/|$)(?!node_modules\\/)`))
6013
+ include: importIncludes
5932
6014
  }
5933
6015
  }]);
5934
6016
  options._modules.push(schemaModule);
@@ -170,10 +170,16 @@ export default defineComponent({
170
170
  }
171
171
  });
172
172
  function _mergeTransitionProps(routeProps) {
173
- const _props = routeProps.filter(Boolean).map((prop) => ({
174
- ...prop,
175
- onAfterLeave: prop.onAfterLeave ? toArray(prop.onAfterLeave) : void 0
176
- }));
173
+ const _props = [];
174
+ for (const prop of routeProps) {
175
+ if (!prop) {
176
+ continue;
177
+ }
178
+ _props.push({
179
+ ...prop,
180
+ onAfterLeave: prop.onAfterLeave ? toArray(prop.onAfterLeave) : void 0
181
+ });
182
+ }
177
183
  return defu(..._props);
178
184
  }
179
185
  function haveParentRoutesRendered(fork, newRoute, Component) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-nightly",
3
- "version": "4.1.2-29293231.4568e845",
3
+ "version": "4.1.2-29293741.3f7624b3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -67,10 +67,10 @@
67
67
  "@nuxt/cli": "npm:@nuxt/cli-nightly@latest",
68
68
  "@nuxt/devalue": "^2.0.2",
69
69
  "@nuxt/devtools": "^2.6.3",
70
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.2-29293231.4568e845",
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.2-29293231.4568e845",
70
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.2-29293741.3f7624b3",
71
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.2-29293741.3f7624b3",
72
72
  "@nuxt/telemetry": "^2.6.6",
73
- "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.2-29293231.4568e845",
73
+ "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.2-29293741.3f7624b3",
74
74
  "@unhead/vue": "^2.0.14",
75
75
  "@vue/shared": "^3.5.21",
76
76
  "c12": "^3.2.0",