nuxt-nightly 4.3.0-29356103.2f7957ac → 4.3.0-29430616.754c35a4

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/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import process from 'node:process';
1
2
  import fs, { promises, existsSync, readdirSync, statSync, mkdirSync, writeFileSync } from 'node:fs';
2
3
  import { mkdir, readFile, readdir, writeFile, rm, stat, unlink, open } from 'node:fs/promises';
3
4
  import { randomUUID } from 'node:crypto';
@@ -18,7 +19,7 @@ import { ImpoundPlugin } from 'impound';
18
19
  import defu$1, { defu } from 'defu';
19
20
  import { satisfies, coerce } from 'semver';
20
21
  import { isCI, provider, hasTTY } from 'std-env';
21
- import { genArrayFromRaw, genSafeVariableName, genImport, genDynamicImport, genObjectFromRawEntries, genString, genExport } from 'knitwork';
22
+ import { genArrayFromRaw, genSafeVariableName, genImport, genDynamicImport, genObjectFromRawEntries, genString, genDynamicTypeImport, genExport } from 'knitwork';
22
23
  import { resolveModulePath } from 'exsolve';
23
24
  import { addDependency } from 'nypm';
24
25
  import { reverseResolveAlias, filename, resolveAlias } from 'pathe/utils';
@@ -30,7 +31,7 @@ import { runInNewContext } from 'node:vm';
30
31
  import { klona } from 'klona';
31
32
  import { parseAndWalk, ScopeTracker, walk, isBindingIdentifier, getUndeclaredIdentifiersInFunction } from 'oxc-walker';
32
33
  import { parseSync } from 'oxc-parser';
33
- import { transform } from 'oxc-transform';
34
+ import { transformSync } from 'oxc-transform';
34
35
  import { splitByCase, kebabCase, pascalCase, camelCase } from 'scule';
35
36
  import { createUnplugin } from 'unplugin';
36
37
  import { findStaticImports, findExports, parseStaticImport, parseNodeModulePath, lookupNodeModuleSubpath } from 'mlly';
@@ -47,7 +48,8 @@ import { debounce } from 'perfect-debounce';
47
48
  import { resolveSchema, generateTypes } from 'untyped';
48
49
  import untypedPlugin from 'untyped/babel-plugin';
49
50
  import { createJiti } from 'jiti';
50
- import { minify } from 'oxc-minify';
51
+ import { minifySync } from 'oxc-minify';
52
+ import { performance } from 'node:perf_hooks';
51
53
  import { resolve as resolve$1 } from 'node:path';
52
54
  import { parseTar, createTar } from 'nanotar';
53
55
 
@@ -415,7 +417,7 @@ function getRouteMeta(contents, absolutePath, extraExtractionKeys = /* @__PURE__
415
417
  let code = script.code;
416
418
  let pageExtractArgument = node.expression.arguments[0];
417
419
  if (/tsx?/.test(script.loader)) {
418
- const transformed = transform(absolutePath, script.code.slice(node.start, node.end), { lang: script.loader });
420
+ const transformed = transformSync(absolutePath, script.code.slice(node.start, node.end), { lang: script.loader });
419
421
  if (transformed.errors.length) {
420
422
  for (const error of transformed.errors) {
421
423
  logger.warn(`Error while transforming \`${fnName}()\`` + error.codeframe);
@@ -1442,7 +1444,7 @@ const pagesModule = defineNuxtModule({
1442
1444
  }
1443
1445
  }
1444
1446
  }
1445
- nuxt.hook("pages:extend", (pages) => {
1447
+ nuxt.hook("pages:resolved", (pages) => {
1446
1448
  if (nuxt.options.dev) {
1447
1449
  return;
1448
1450
  }
@@ -2203,7 +2205,7 @@ function resolveComponentTypes(app, baseDir) {
2203
2205
  continue;
2204
2206
  }
2205
2207
  const filePath = c.declarationPath || c.filePath;
2206
- let type = `typeof ${genDynamicImport(isAbsolute(filePath) ? relative(baseDir, filePath).replace(NON_VUE_RE, "") : filePath.replace(NON_VUE_RE, ""), { wrapper: false })}['${c.export}']`;
2208
+ let type = genDynamicTypeImport(isAbsolute(filePath) ? relative(baseDir, filePath).replace(NON_VUE_RE, "") : filePath.replace(NON_VUE_RE, ""), c.export);
2207
2209
  if (c.mode === "server") {
2208
2210
  if (app.components.some((other) => other.pascalName === c.pascalName && other.mode === "client")) {
2209
2211
  if (c.filePath.startsWith(serverPlaceholderPath)) {
@@ -3402,8 +3404,10 @@ const componentsModule = defineNuxtModule({
3402
3404
  }
3403
3405
  nuxt.hook("app:resolve", async () => {
3404
3406
  const allDirs = [];
3405
- for (const layer of nuxt.options._layers) {
3406
- const layerDirs = normalizeDirs(layer.config.components, layer.config.srcDir, { priority: layer.config.srcDir === nuxt.options.srcDir ? 1 : 0 });
3407
+ const layerCount = nuxt.options._layers.length;
3408
+ for (const [i, layer] of nuxt.options._layers.entries()) {
3409
+ const priority = layerCount - i;
3410
+ const layerDirs = normalizeDirs(layer.config.components, layer.config.srcDir, { priority });
3407
3411
  allDirs.push(...layerDirs);
3408
3412
  }
3409
3413
  await nuxt.callHook("components:dirs", allDirs);
@@ -3437,6 +3441,8 @@ const componentsModule = defineNuxtModule({
3437
3441
  // ignore mixins
3438
3442
  "**/*.d.{cts,mts,ts}",
3439
3443
  // .d.ts files
3444
+ "**/*.d.vue.{cts,mts,ts}",
3445
+ // .d.vue.ts files
3440
3446
  ...dirOptions.ignore || []
3441
3447
  ],
3442
3448
  transpile
@@ -3831,7 +3837,7 @@ function addDeclarationTemplates(ctx, options) {
3831
3837
  });
3832
3838
  }
3833
3839
 
3834
- const version = "4.3.0-29356103.2f7957ac";
3840
+ const version = "4.3.0-29430616.754c35a4";
3835
3841
 
3836
3842
  function createImportProtectionPatterns(nuxt, options) {
3837
3843
  const patterns = [];
@@ -3845,11 +3851,13 @@ function createImportProtectionPatterns(nuxt, options) {
3845
3851
  "Importing directly from a `nuxt.config` file is not allowed. Instead, use runtime config or a module."
3846
3852
  ]);
3847
3853
  patterns.push([/(^|node_modules\/)@vue\/composition-api/]);
3848
- for (const mod of nuxt.options.modules.filter((m) => typeof m === "string")) {
3849
- patterns.push([
3850
- new RegExp(`^${escapeRE(mod)}$`),
3851
- "Importing directly from module entry-points is not allowed."
3852
- ]);
3854
+ for (const mod of nuxt.options._installedModules) {
3855
+ if (mod.entryPath) {
3856
+ patterns.push([
3857
+ new RegExp(`^${escapeRE(mod.entryPath)}$`),
3858
+ "Importing directly from module entry-points is not allowed."
3859
+ ]);
3860
+ }
3853
3861
  }
3854
3862
  for (const i of [/(^|node_modules\/)@nuxt\/(cli|kit|test-utils)/, /(^|node_modules\/)nuxi/, /(^|node_modules\/)nitro(?:pack)?(?:-nightly)?(?:$|\/)(?!(?:dist\/)?(?:node_modules|presets|runtime|types))/, /(^|node_modules\/)nuxt\/(config|kit|schema)/]) {
3855
3863
  patterns.push([i, `This module cannot be imported in ${context}.`]);
@@ -4005,6 +4013,7 @@ const DevOnlyPlugin = (options) => createUnplugin(() => {
4005
4013
 
4006
4014
  const ALIAS_RE = /(?<=['"])[~@]{1,2}(?=\/)/g;
4007
4015
  const ALIAS_RE_SINGLE = /(?<=['"])[~@]{1,2}(?=\/)/;
4016
+ const ALIAS_ID_RE = /^[~@]{1,2}\//;
4008
4017
  const LayerAliasingPlugin = (options) => createUnplugin((_options, meta) => {
4009
4018
  const aliases = {};
4010
4019
  for (const layer of options.layers) {
@@ -4018,12 +4027,39 @@ const LayerAliasingPlugin = (options) => createUnplugin((_options, meta) => {
4018
4027
  };
4019
4028
  }
4020
4029
  const layers = Object.keys(aliases).sort((a, b) => b.length - a.length);
4030
+ const nonViteTransformIncludes = (id) => {
4031
+ const _id = normalize(id);
4032
+ return layers.some((dir) => _id.startsWith(dir));
4033
+ };
4034
+ const nonViteTransform = {
4035
+ filter: {
4036
+ code: { include: ALIAS_RE_SINGLE }
4037
+ },
4038
+ handler(code, id) {
4039
+ const _id = normalize(id);
4040
+ const layer = layers.find((l) => _id.startsWith(l));
4041
+ if (!layer) {
4042
+ return;
4043
+ }
4044
+ const s = new MagicString(code);
4045
+ s.replace(ALIAS_RE, (r) => aliases[layer]?.[r] || r);
4046
+ if (s.hasChanged()) {
4047
+ return {
4048
+ code: s.toString(),
4049
+ map: options.sourcemap ? s.generateMap({ hires: true }) : void 0
4050
+ };
4051
+ }
4052
+ }
4053
+ };
4021
4054
  return {
4022
4055
  name: "nuxt:layer-aliasing",
4023
4056
  enforce: "pre",
4024
4057
  vite: {
4025
4058
  resolveId: {
4026
4059
  order: "pre",
4060
+ filter: {
4061
+ id: ALIAS_ID_RE
4062
+ },
4027
4063
  async handler(id, importer) {
4028
4064
  if (!importer) {
4029
4065
  return;
@@ -4040,36 +4076,8 @@ const LayerAliasingPlugin = (options) => createUnplugin((_options, meta) => {
4040
4076
  }
4041
4077
  },
4042
4078
  // webpack-only transform
4043
- transformInclude: (id) => {
4044
- if (meta.framework === "vite") {
4045
- return false;
4046
- }
4047
- const _id = normalize(id);
4048
- return layers.some((dir) => _id.startsWith(dir));
4049
- },
4050
- transform: {
4051
- filter: {
4052
- code: { include: ALIAS_RE_SINGLE }
4053
- },
4054
- handler(code, id) {
4055
- if (meta.framework === "vite") {
4056
- return;
4057
- }
4058
- const _id = normalize(id);
4059
- const layer = layers.find((l) => _id.startsWith(l));
4060
- if (!layer) {
4061
- return;
4062
- }
4063
- const s = new MagicString(code);
4064
- s.replace(ALIAS_RE, (r) => aliases[layer]?.[r] || r);
4065
- if (s.hasChanged()) {
4066
- return {
4067
- code: s.toString(),
4068
- map: options.sourcemap ? s.generateMap({ hires: true }) : void 0
4069
- };
4070
- }
4071
- }
4072
- }
4079
+ transformInclude: meta.framework !== "vite" ? nonViteTransformIncludes : void 0,
4080
+ transform: meta.framework !== "vite" ? nonViteTransform : void 0
4073
4081
  };
4074
4082
  });
4075
4083
 
@@ -4350,8 +4358,8 @@ const RemovePluginMetadataPlugin = (nuxt) => createUnplugin(() => {
4350
4358
  map: null
4351
4359
  };
4352
4360
  }
4353
- const exports = findExports(code);
4354
- const defaultExport = exports.find((e) => e.type === "default" || e.name === "default");
4361
+ const exports$1 = findExports(code);
4362
+ const defaultExport = exports$1.find((e) => e.type === "default" || e.name === "default");
4355
4363
  if (!defaultExport) {
4356
4364
  logger.warn(`Plugin \`${plugin.src}\` has no default export and will be ignored at build time. Add \`export default defineNuxtPlugin(() => {})\` to your plugin.`);
4357
4365
  return {
@@ -4591,39 +4599,50 @@ function ResolveDeepImportsPlugin(nuxt) {
4591
4599
  return {
4592
4600
  name: "nuxt:resolve-bare-imports",
4593
4601
  enforce: "post",
4594
- async resolveId(id, importer) {
4595
- if (!importer || isAbsolute(id) || !isAbsolute(importer) && !VIRTUAL_RE.test(importer) || exclude.some((e) => id.startsWith(e))) {
4596
- return;
4597
- }
4598
- const normalisedId = resolveAlias$1(normalize(id), nuxt.options.alias);
4599
- const isNuxtTemplate = importer.startsWith("virtual:nuxt");
4600
- const normalisedImporter = (isNuxtTemplate ? decodeURIComponent(importer) : importer).replace(VIRTUAL_RE, "");
4601
- if (nuxt.options.experimental.templateImportResolution !== false && isNuxtTemplate) {
4602
- const template = nuxt.options.build.templates.find((t) => resolve(nuxt.options.buildDir, t.filename) === normalisedImporter);
4603
- if (template?._path) {
4604
- const res2 = await this.resolve?.(normalisedId, template._path, { skipSelf: true });
4605
- if (res2 !== void 0 && res2 !== null) {
4606
- return res2;
4602
+ resolveId: {
4603
+ filter: {
4604
+ id: {
4605
+ exclude: [
4606
+ // absolute path
4607
+ /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,
4608
+ ...exclude.map((e) => new RegExp("^" + escapeRE(e)))
4609
+ ]
4610
+ }
4611
+ },
4612
+ async handler(id, importer) {
4613
+ if (!importer || !isAbsolute(importer) && !VIRTUAL_RE.test(importer)) {
4614
+ return;
4615
+ }
4616
+ const normalisedId = resolveAlias$1(normalize(id), nuxt.options.alias);
4617
+ const isNuxtTemplate = importer.startsWith("virtual:nuxt");
4618
+ const normalisedImporter = (isNuxtTemplate ? decodeURIComponent(importer) : importer).replace(VIRTUAL_RE, "");
4619
+ if (nuxt.options.experimental.templateImportResolution !== false && isNuxtTemplate) {
4620
+ const template = nuxt.options.build.templates.find((t) => resolve(nuxt.options.buildDir, t.filename) === normalisedImporter);
4621
+ if (template?._path) {
4622
+ const res2 = await this.resolve?.(normalisedId, template._path, { skipSelf: true });
4623
+ if (res2 !== void 0 && res2 !== null) {
4624
+ return res2;
4625
+ }
4607
4626
  }
4608
4627
  }
4628
+ const dir = parseNodeModulePath(normalisedImporter).dir || pkgDir;
4629
+ const res = await this.resolve?.(normalisedId, dir, { skipSelf: true });
4630
+ if (res !== void 0 && res !== null) {
4631
+ return res;
4632
+ }
4633
+ const environmentConditions = conditions[this.environment.name] ||= resolveConditions(this.environment);
4634
+ const path = resolveModulePath(id, {
4635
+ from: [dir, ...nuxt.options.modulesDir].map((d) => directoryToURL(d)),
4636
+ suffixes: ["", "index"],
4637
+ conditions: environmentConditions,
4638
+ try: true
4639
+ });
4640
+ if (!path) {
4641
+ logger.debug("Could not resolve id", id, importer);
4642
+ return null;
4643
+ }
4644
+ return normalize(path);
4609
4645
  }
4610
- const dir = parseNodeModulePath(normalisedImporter).dir || pkgDir;
4611
- const res = await this.resolve?.(normalisedId, dir, { skipSelf: true });
4612
- if (res !== void 0 && res !== null) {
4613
- return res;
4614
- }
4615
- const environmentConditions = conditions[this.environment.name] ||= resolveConditions(this.environment);
4616
- const path = resolveModulePath(id, {
4617
- from: [dir, ...nuxt.options.modulesDir].map((d) => directoryToURL(d)),
4618
- suffixes: ["", "index"],
4619
- conditions: environmentConditions,
4620
- try: true
4621
- });
4622
- if (!path) {
4623
- logger.debug("Could not resolve id", id, importer);
4624
- return null;
4625
- }
4626
- return normalize(path);
4627
4646
  }
4628
4647
  };
4629
4648
  }
@@ -4709,8 +4728,8 @@ function ResolveExternalsPlugin(nuxt) {
4709
4728
 
4710
4729
  function transformAndMinify(input, options) {
4711
4730
  const oxcOptions = tryUseNuxt()?.options.oxc;
4712
- const transformResult = transform("", input, { ...oxcOptions?.transform.options, ...options });
4713
- const minifyResult = minify("", transformResult.code, { compress: { target: oxcOptions?.transform.options.target || "esnext" } });
4731
+ const transformResult = transformSync("", input, { ...oxcOptions?.transform.options, ...options });
4732
+ const minifyResult = minifySync("", transformResult.code, { compress: { target: oxcOptions?.transform.options.target || "esnext" } });
4714
4733
  return {
4715
4734
  ...transformResult,
4716
4735
  ...minifyResult
@@ -4742,17 +4761,13 @@ function PrehydrateTransformPlugin(options = {}) {
4742
4761
  return;
4743
4762
  }
4744
4763
  const needsAttr = callback.params.length > 0;
4745
- try {
4746
- const { code: result } = transformAndMinify(`forEach(${code.slice(callback.start, callback.end)})`, { lang: "ts" });
4747
- const cleaned = result.slice("forEach".length).replace(/;$/, "");
4748
- const args = [JSON.stringify(cleaned)];
4749
- if (needsAttr) {
4750
- args.push(JSON.stringify(hash(result).slice(0, 10)));
4751
- }
4752
- s.overwrite(callback.start, callback.end, args.join(", "));
4753
- } catch (e) {
4754
- console.error(`[nuxt] Could not transform onPrehydrate in \`${id}\`:`, e);
4764
+ const { code: result } = transformAndMinify(`forEach(${code.slice(callback.start, callback.end)})`, { lang: "ts" });
4765
+ const cleaned = result.slice("forEach".length).replace(/;$/, "");
4766
+ const args = [JSON.stringify(cleaned)];
4767
+ if (needsAttr) {
4768
+ args.push(JSON.stringify(hash(result).slice(0, 10)));
4755
4769
  }
4770
+ s.overwrite(callback.start, callback.end, args.join(", "));
4756
4771
  }
4757
4772
  });
4758
4773
  if (s.hasChanged()) {
@@ -4955,15 +4970,17 @@ const VirtualFSPlugin = (nuxt, options) => createUnplugin((_, meta) => {
4955
4970
  }
4956
4971
  }
4957
4972
  },
4958
- loadInclude(id) {
4959
- return PREFIX_RE.test(id) && withoutQuery(withoutPrefix(decodeURIComponent(id))) in nuxt.vfs;
4960
- },
4961
- load(id) {
4962
- const key = withoutQuery(withoutPrefix(decodeURIComponent(id)));
4963
- return {
4964
- code: nuxt.vfs[key] || "",
4965
- map: null
4966
- };
4973
+ load: {
4974
+ filter: {
4975
+ id: PREFIX_RE
4976
+ },
4977
+ handler(id) {
4978
+ const key = withoutQuery(withoutPrefix(decodeURIComponent(id)));
4979
+ return {
4980
+ code: nuxt.vfs[key] || "",
4981
+ map: null
4982
+ };
4983
+ }
4967
4984
  }
4968
4985
  };
4969
4986
  });
@@ -5180,25 +5197,6 @@ Using \`${fallbackCompatibilityDate}\` as fallback. More info at: ${colors.under
5180
5197
  rootDir: nuxt.options.rootDir,
5181
5198
  composables: nuxt.options.optimization.keyedComposables
5182
5199
  }));
5183
- const sharedDir = withTrailingSlash(resolve(nuxt.options.rootDir, nuxt.options.dir.shared));
5184
- const relativeSharedDir = withTrailingSlash(relative(nuxt.options.rootDir, resolve(nuxt.options.rootDir, nuxt.options.dir.shared)));
5185
- const sharedPatterns = [/^#shared\//, new RegExp("^" + escapeRE(sharedDir)), new RegExp("^" + escapeRE(relativeSharedDir))];
5186
- const sharedProtectionConfig = {
5187
- cwd: nuxt.options.rootDir,
5188
- include: sharedPatterns,
5189
- patterns: createImportProtectionPatterns(nuxt, { context: "shared" })
5190
- };
5191
- addVitePlugin(() => ImpoundPlugin.vite(sharedProtectionConfig), { server: false });
5192
- addWebpackPlugin(() => ImpoundPlugin.webpack(sharedProtectionConfig), { server: false });
5193
- const nuxtProtectionConfig = {
5194
- cwd: nuxt.options.rootDir,
5195
- // Exclude top-level resolutions by plugins
5196
- exclude: [relative(nuxt.options.rootDir, join(nuxt.options.srcDir, "index.html")), ...sharedPatterns],
5197
- patterns: createImportProtectionPatterns(nuxt, { context: "nuxt-app" })
5198
- };
5199
- addVitePlugin(() => Object.assign(ImpoundPlugin.vite({ ...nuxtProtectionConfig, error: false }), { name: "nuxt:import-protection" }), { client: false });
5200
- addVitePlugin(() => Object.assign(ImpoundPlugin.vite({ ...nuxtProtectionConfig, error: true }), { name: "nuxt:import-protection" }), { server: false });
5201
- addWebpackPlugin(() => ImpoundPlugin.webpack(nuxtProtectionConfig));
5202
5200
  addVitePlugin(() => ResolveDeepImportsPlugin(nuxt));
5203
5201
  addVitePlugin(() => ResolveExternalsPlugin(nuxt), { prepend: true });
5204
5202
  addBuildPlugin(PrehydrateTransformPlugin({ sourcemap: !!nuxt.options.sourcemap.server || !!nuxt.options.sourcemap.client }));
@@ -5231,6 +5229,25 @@ Using \`${fallbackCompatibilityDate}\` as fallback. More info at: ${colors.under
5231
5229
  composables: nuxt.options.optimization.treeShake.composables.client
5232
5230
  }), { server: false });
5233
5231
  }
5232
+ const sharedDir = withTrailingSlash(resolve(nuxt.options.rootDir, nuxt.options.dir.shared));
5233
+ const relativeSharedDir = withTrailingSlash(relative(nuxt.options.rootDir, resolve(nuxt.options.rootDir, nuxt.options.dir.shared)));
5234
+ const sharedPatterns = [/^#shared\//, new RegExp("^" + escapeRE(sharedDir)), new RegExp("^" + escapeRE(relativeSharedDir))];
5235
+ const sharedProtectionConfig = {
5236
+ cwd: nuxt.options.rootDir,
5237
+ include: sharedPatterns,
5238
+ patterns: createImportProtectionPatterns(nuxt, { context: "shared" })
5239
+ };
5240
+ addVitePlugin(() => ImpoundPlugin.vite(sharedProtectionConfig), { server: false });
5241
+ addWebpackPlugin(() => ImpoundPlugin.webpack(sharedProtectionConfig), { server: false });
5242
+ const nuxtProtectionConfig = {
5243
+ cwd: nuxt.options.rootDir,
5244
+ // Exclude top-level resolutions by plugins
5245
+ exclude: [relative(nuxt.options.rootDir, join(nuxt.options.srcDir, "index.html")), ...sharedPatterns],
5246
+ patterns: createImportProtectionPatterns(nuxt, { context: "nuxt-app" })
5247
+ };
5248
+ addVitePlugin(() => Object.assign(ImpoundPlugin.vite({ ...nuxtProtectionConfig, error: false }), { name: "nuxt:import-protection" }), { client: false });
5249
+ addVitePlugin(() => Object.assign(ImpoundPlugin.vite({ ...nuxtProtectionConfig, error: true }), { name: "nuxt:import-protection" }), { server: false });
5250
+ addWebpackPlugin(() => ImpoundPlugin.webpack(nuxtProtectionConfig));
5234
5251
  });
5235
5252
  if (!nuxt.options.dev) {
5236
5253
  addBuildPlugin(DevOnlyPlugin({
@@ -5743,17 +5760,17 @@ const clientPluginTemplate = {
5743
5760
  async getContents(ctx) {
5744
5761
  const clientPlugins = await annotatePlugins(ctx.nuxt, ctx.app.plugins.filter((p) => !p.mode || p.mode !== "server"));
5745
5762
  checkForCircularDependencies(clientPlugins);
5746
- const exports = [];
5763
+ const exports$1 = [];
5747
5764
  const imports = [];
5748
5765
  for (const plugin of clientPlugins) {
5749
5766
  const path = relative(ctx.nuxt.options.rootDir, plugin.src);
5750
5767
  const variable = genSafeVariableName(filename(plugin.src) || path).replace(PLUGIN_TEMPLATE_RE, "_") + "_" + hash(path).replace(/-/g, "_");
5751
- exports.push(variable);
5768
+ exports$1.push(variable);
5752
5769
  imports.push(genImport(plugin.src, variable));
5753
5770
  }
5754
5771
  return [
5755
5772
  ...imports,
5756
- `export default ${genArrayFromRaw(exports)}`
5773
+ `export default ${genArrayFromRaw(exports$1)}`
5757
5774
  ].join("\n");
5758
5775
  }
5759
5776
  };
@@ -5762,17 +5779,17 @@ const serverPluginTemplate = {
5762
5779
  async getContents(ctx) {
5763
5780
  const serverPlugins = await annotatePlugins(ctx.nuxt, ctx.app.plugins.filter((p) => !p.mode || p.mode !== "client"));
5764
5781
  checkForCircularDependencies(serverPlugins);
5765
- const exports = [];
5782
+ const exports$1 = [];
5766
5783
  const imports = [];
5767
5784
  for (const plugin of serverPlugins) {
5768
5785
  const path = relative(ctx.nuxt.options.rootDir, plugin.src);
5769
5786
  const variable = genSafeVariableName(filename(plugin.src) || path).replace(PLUGIN_TEMPLATE_RE, "_") + "_" + hash(path).replace(/-/g, "_");
5770
- exports.push(variable);
5787
+ exports$1.push(variable);
5771
5788
  imports.push(genImport(plugin.src, variable));
5772
5789
  }
5773
5790
  return [
5774
5791
  ...imports,
5775
- `export default ${genArrayFromRaw(exports)}`
5792
+ `export default ${genArrayFromRaw(exports$1)}`
5776
5793
  ].join("\n");
5777
5794
  }
5778
5795
  };
@@ -5937,8 +5954,8 @@ const schemaNodeTemplate = {
5937
5954
  }),
5938
5955
  modules.length > 0 && options.unresolved ? ` modules?: (undefined | null | false | NuxtModule<any> | string | [NuxtModule | string, Record<string, any>] | ${modules.map(([configKey, importName, mod]) => `[${genString(mod.meta?.rawPath || importName)}, Exclude<NuxtConfig[${configKey}], boolean>]`).join(" | ")})[],` : ""
5939
5956
  ].filter(Boolean);
5940
- const moduleDependencies = modules.flatMap(([_configKey, importName]) => [
5941
- ` [${genString(importName)}]?: ModuleDependencyMeta<typeof ${genDynamicImport(importName, { wrapper: false })}.default extends NuxtModule<infer O> ? O : Record<string, unknown>>`
5957
+ const moduleDependencies = modules.flatMap(([_configKey, importName, mod]) => [
5958
+ ` [${genString(mod.meta.name || importName)}]?: ModuleDependencyMeta<typeof ${genDynamicImport(importName, { wrapper: false })}.default extends NuxtModule<infer O> ? O : Record<string, unknown>>`
5942
5959
  ]).join("\n");
5943
5960
  return [
5944
5961
  "import { NuxtModule, ModuleDependencyMeta } from '@nuxt/schema'",
@@ -6417,7 +6434,7 @@ async function annotatePlugins(nuxt, plugins) {
6417
6434
  } catch (e) {
6418
6435
  const relativePluginSrc = relative(nuxt.options.rootDir, plugin.src);
6419
6436
  if (e.message === "Invalid plugin metadata") {
6420
- logger.warn(`Failed to parse static properties from plugin \`${relativePluginSrc}\`, falling back to non-optimized runtime meta. Learn more: https://nuxt.com/docs/4.x/guide/directory-structure/plugins#object-syntax-plugins`);
6437
+ logger.warn(`Failed to parse static properties from plugin \`${relativePluginSrc}\`, falling back to non-optimized runtime meta. Learn more: https://nuxt.com/docs/4.x/directory-structure/app/plugins#object-syntax-plugins`);
6421
6438
  } else {
6422
6439
  logger.warn(`Failed to parse static properties from plugin \`${relativePluginSrc}\`.`, e);
6423
6440
  }
@@ -129,14 +129,19 @@ export default defineComponent({
129
129
  }
130
130
  nuxtApp.callHook("page:start", routeProps.Component);
131
131
  },
132
- onResolve: () => {
133
- nextTick(() => nuxtApp.callHook("page:finish", routeProps.Component).then(() => {
132
+ onResolve: async () => {
133
+ await nextTick();
134
+ try {
135
+ nuxtApp._route.sync?.();
136
+ await nuxtApp.callHook("page:finish", routeProps.Component);
134
137
  delete nuxtApp._runningTransition;
135
138
  if (!pageLoadingEndHookAlreadyCalled && !willRenderAnotherChild) {
136
139
  pageLoadingEndHookAlreadyCalled = true;
137
- return nuxtApp.callHook("page:loading:end");
140
+ await nuxtApp.callHook("page:loading:end");
138
141
  }
139
- }).finally(done));
142
+ } finally {
143
+ done();
144
+ }
140
145
  }
141
146
  }, {
142
147
  default: () => {
@@ -76,13 +76,12 @@ const plugin = defineNuxtPlugin({
76
76
  const syncCurrentRoute = () => {
77
77
  _route.value = router.currentRoute.value;
78
78
  };
79
- nuxtApp.hook("page:finish", syncCurrentRoute);
80
79
  router.afterEach((to, from) => {
81
- if (to.matched[to.matched.length - 1]?.components?.default === from.matched[from.matched.length - 1]?.components?.default) {
80
+ if (to.matched.at(-1)?.components?.default === from.matched.at(-1)?.components?.default) {
82
81
  syncCurrentRoute();
83
82
  }
84
83
  });
85
- const route = {};
84
+ const route = { sync: syncCurrentRoute };
86
85
  for (const key in _route.value) {
87
86
  Object.defineProperty(route, key, {
88
87
  get: () => _route.value[key],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-nightly",
3
- "version": "4.3.0-29356103.2f7957ac",
3
+ "version": "4.3.0-29430616.754c35a4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -64,45 +64,45 @@
64
64
  "schema.*"
65
65
  ],
66
66
  "dependencies": {
67
- "@dxup/nuxt": "^0.2.0",
67
+ "@dxup/nuxt": "^0.2.2",
68
68
  "@nuxt/cli": "npm:@nuxt/cli-nightly@latest",
69
- "@nuxt/devtools": "^2.6.5",
70
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-29356103.2f7957ac",
71
- "@nuxt/nitro-server": "npm:@nuxt/nitro-server-nightly@4.3.0-29356103.2f7957ac",
72
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29356103.2f7957ac",
69
+ "@nuxt/devtools": "^3.1.1",
70
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-29430616.754c35a4",
71
+ "@nuxt/nitro-server": "npm:@nuxt/nitro-server-nightly@4.3.0-29430616.754c35a4",
72
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29430616.754c35a4",
73
73
  "@nuxt/telemetry": "^2.6.6",
74
- "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.3.0-29356103.2f7957ac",
74
+ "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.3.0-29430616.754c35a4",
75
75
  "@unhead/vue": "^2.0.19",
76
- "@vue/shared": "^3.5.22",
77
- "c12": "^3.3.1",
78
- "chokidar": "^4.0.3",
76
+ "@vue/shared": "^3.5.25",
77
+ "c12": "^3.3.2",
78
+ "chokidar": "^5.0.0",
79
79
  "compatx": "^0.2.0",
80
80
  "consola": "^3.4.2",
81
81
  "cookie-es": "^2.0.0",
82
82
  "defu": "^6.1.4",
83
83
  "destr": "^2.0.5",
84
- "devalue": "^5.4.2",
84
+ "devalue": "^5.6.0",
85
85
  "errx": "^0.1.0",
86
86
  "escape-string-regexp": "^5.0.0",
87
- "exsolve": "^1.0.7",
87
+ "exsolve": "^1.0.8",
88
88
  "h3": "^1.15.4",
89
89
  "hookable": "^5.5.3",
90
90
  "ignore": "^7.0.5",
91
91
  "impound": "^1.0.0",
92
92
  "jiti": "^2.6.1",
93
93
  "klona": "^2.0.6",
94
- "knitwork": "^1.2.0",
94
+ "knitwork": "^1.3.0",
95
95
  "magic-string": "^0.30.21",
96
96
  "mlly": "^1.8.0",
97
97
  "nanotar": "^0.2.0",
98
98
  "nypm": "^0.6.2",
99
- "ofetch": "^1.4.1",
99
+ "ofetch": "^1.5.1",
100
100
  "ohash": "^2.0.11",
101
- "on-change": "^6.0.0",
102
- "oxc-minify": "^0.95.0",
103
- "oxc-parser": "^0.95.0",
104
- "oxc-transform": "^0.95.0",
105
- "oxc-walker": "^0.5.2",
101
+ "on-change": "^6.0.1",
102
+ "oxc-minify": "^0.102.0",
103
+ "oxc-parser": "^0.102.0",
104
+ "oxc-transform": "^0.102.0",
105
+ "oxc-walker": "^0.6.0",
106
106
  "pathe": "^2.0.3",
107
107
  "perfect-debounce": "^2.0.0",
108
108
  "pkg-types": "^2.3.0",
@@ -116,21 +116,21 @@
116
116
  "uncrypto": "^0.1.3",
117
117
  "unctx": "^2.4.1",
118
118
  "unimport": "^5.5.0",
119
- "unplugin": "^2.3.10",
120
- "unplugin-vue-router": "^0.16.0",
119
+ "unplugin": "^2.3.11",
120
+ "unplugin-vue-router": "^0.19.0",
121
121
  "untyped": "^2.0.0",
122
- "vue": "^3.5.22",
122
+ "vue": "^3.5.25",
123
123
  "vue-router": "^4.6.3"
124
124
  },
125
125
  "devDependencies": {
126
126
  "@nuxt/scripts": "0.13.0",
127
127
  "@parcel/watcher": "2.5.1",
128
128
  "@types/estree": "1.0.8",
129
- "@vitejs/plugin-vue": "6.0.1",
130
- "@vitejs/plugin-vue-jsx": "5.1.1",
131
- "@vue/compiler-sfc": "3.5.22",
129
+ "@vitejs/plugin-vue": "6.0.2",
130
+ "@vitejs/plugin-vue-jsx": "5.1.2",
131
+ "@vue/compiler-sfc": "3.5.25",
132
132
  "unbuild": "3.6.1",
133
- "vite": "7.1.12",
133
+ "vite": "7.2.7",
134
134
  "vitest": "3.2.4",
135
135
  "vue-bundle-renderer": "2.2.0",
136
136
  "vue-sfc-transformer": "0.1.17"
@@ -152,6 +152,7 @@
152
152
  },
153
153
  "_name": "nuxt",
154
154
  "scripts": {
155
+ "build:stub": "unbuild --stub",
155
156
  "test:attw": "attw --pack"
156
157
  }
157
158
  }