nuxt-nightly 4.1.1-29284589.27dc1f24 → 4.1.1-29285142.e858eea6

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,7 +6,7 @@ import {
6
6
  renderResourceHeaders
7
7
  } from "vue-bundle-renderer/runtime";
8
8
  import { appendResponseHeader, createError, getQuery, getResponseStatus, getResponseStatusText, writeEarlyHints } from "h3";
9
- import { getQuery as getURLQuery, joinURL, withoutTrailingSlash } from "ufo";
9
+ import { getQuery as getURLQuery, hasProtocol, joinURL, withoutTrailingSlash } from "ufo";
10
10
  import { propsToString, renderSSRHead } from "@unhead/vue/server";
11
11
  import destr from "destr";
12
12
  import { defineRenderHandler, getRouteRules, useNitroApp } from "nitropack/runtime";
@@ -20,6 +20,7 @@ import { renderSSRHeadOptions } from "#internal/unhead.config.mjs";
20
20
  import { appHead, appTeleportAttrs, appTeleportTag, componentIslands, appManifest as isAppManifestEnabled } from "#internal/nuxt.config.mjs";
21
21
  import { entryFileName } from "#internal/entry-chunk.mjs";
22
22
  import { buildAssetsURL, publicAssetsURL } from "#internal/nuxt/paths";
23
+ import { relative } from "pathe";
23
24
  globalThis.__buildAssetsURL = buildAssetsURL;
24
25
  globalThis.__publicAssetsURL = publicAssetsURL;
25
26
  if (process.env.NUXT_ASYNC_CONTEXT && !("AsyncLocalStorage" in globalThis)) {
@@ -30,6 +31,7 @@ const APP_TELEPORT_OPEN_TAG = HAS_APP_TELEPORTS ? `<${appTeleportTag}${propsToSt
30
31
  const APP_TELEPORT_CLOSE_TAG = HAS_APP_TELEPORTS ? `</${appTeleportTag}>` : "";
31
32
  const PAYLOAD_URL_RE = process.env.NUXT_JSON_PAYLOADS ? /^[^?]*\/_payload.json(?:\?.*)?$/ : /^[^?]*\/_payload.js(?:\?.*)?$/;
32
33
  const PAYLOAD_FILENAME = process.env.NUXT_JSON_PAYLOADS ? "_payload.json" : "_payload.js";
34
+ let entryPath;
33
35
  export default defineRenderHandler(async (event) => {
34
36
  const nitroApp = useNitroApp();
35
37
  const ssrError = event.path.startsWith("/__nuxt_error") ? getQuery(event) : null;
@@ -109,12 +111,24 @@ export default defineRenderHandler(async (event) => {
109
111
  const NO_SCRIPTS = process.env.NUXT_NO_SCRIPTS || routeOptions.noScripts;
110
112
  const { styles, scripts } = getRequestDependencies(ssrContext, renderer.rendererContext);
111
113
  if (entryFileName && !NO_SCRIPTS) {
114
+ let path = entryPath;
115
+ if (!path) {
116
+ path = buildAssetsURL(entryFileName);
117
+ if (/^(?:\/|\.+\/)/.test(path) || hasProtocol(path, { acceptRelative: true })) {
118
+ entryPath = path;
119
+ } else {
120
+ path = relative(event.path.replace(/\/[^/]+$/, "/"), joinURL("/", path));
121
+ if (!/^(?:\/|\.+\/)/.test(path)) {
122
+ path = `./${path}`;
123
+ }
124
+ }
125
+ }
112
126
  ssrContext.head.push({
113
127
  script: [{
114
128
  tagPosition: "head",
115
129
  tagPriority: -2,
116
130
  type: "importmap",
117
- innerHTML: JSON.stringify({ imports: { "#entry": buildAssetsURL(entryFileName) } })
131
+ innerHTML: JSON.stringify({ imports: { "#entry": path } })
118
132
  }]
119
133
  }, headEntryOptions);
120
134
  }
package/dist/index.mjs CHANGED
@@ -1151,6 +1151,13 @@ const RouteInjectionPlugin = (nuxt) => createUnplugin(() => {
1151
1151
 
1152
1152
  const OPTIONAL_PARAM_RE = /^\/?:.*(?:\?|\(\.\*\)\*)$/;
1153
1153
  const runtimeDir = resolve(distDir, "pages/runtime");
1154
+ const pagesImportPresets = [
1155
+ { imports: ["definePageMeta"], from: resolve(runtimeDir, "composables") },
1156
+ { imports: ["useLink"], from: "vue-router" }
1157
+ ];
1158
+ const routeRulesPresets = [
1159
+ { imports: ["defineRouteRules"], from: resolve(runtimeDir, "composables") }
1160
+ ];
1154
1161
  async function resolveRouterOptions(nuxt, builtInRouterOptions) {
1155
1162
  const context = {
1156
1163
  files: []
@@ -1472,13 +1479,10 @@ const pagesModule = defineNuxtModule({
1472
1479
  }
1473
1480
  nitro.options.prerender.routes = Array.from(prerenderRoutes);
1474
1481
  });
1475
- nuxt.hook("imports:extend", (imports) => {
1476
- imports.push(
1477
- { name: "definePageMeta", as: "definePageMeta", from: resolve(runtimeDir, "composables") },
1478
- { name: "useLink", as: "useLink", from: "vue-router" }
1479
- );
1482
+ nuxt.hook("imports:sources", (sources) => {
1483
+ sources.push(...pagesImportPresets);
1480
1484
  if (nuxt.options.experimental.inlineRouteRules) {
1481
- imports.push({ name: "defineRouteRules", as: "defineRouteRules", from: resolve(runtimeDir, "composables") });
1485
+ sources.push(...routeRulesPresets);
1482
1486
  }
1483
1487
  });
1484
1488
  const componentStubPath = await resolvePath(resolve(runtimeDir, "component-stub"));
@@ -3578,6 +3582,11 @@ const TransformPlugin = ({ ctx, options, sourcemap }) => createUnplugin(() => {
3578
3582
  };
3579
3583
  });
3580
3584
 
3585
+ const allNuxtPresets = [
3586
+ ...pagesImportPresets,
3587
+ ...routeRulesPresets,
3588
+ ...defaultPresets
3589
+ ];
3581
3590
  const importsModule = defineNuxtModule({
3582
3591
  meta: {
3583
3592
  name: "nuxt:imports",
@@ -3663,8 +3672,8 @@ const importsModule = defineNuxtModule({
3663
3672
  return IMPORTS_TEMPLATE_RE.test(template.filename);
3664
3673
  }
3665
3674
  const isIgnored = createIsIgnored(nuxt);
3666
- const defaultImportSources = new Set(defaultPresets.flatMap((i) => i.from));
3667
- const defaultImports = new Set(presets.flatMap((p) => defaultImportSources.has(p.from) ? p.imports : []));
3675
+ const nuxtImportSources = new Set(allNuxtPresets.flatMap((i) => i.from));
3676
+ const nuxtImports = new Set(presets.flatMap((p) => nuxtImportSources.has(p.from) ? p.imports : []));
3668
3677
  const regenerateImports = async () => {
3669
3678
  await ctx.modifyDynamicImports(async (imports) => {
3670
3679
  imports.length = 0;
@@ -3679,9 +3688,9 @@ const importsModule = defineNuxtModule({
3679
3688
  }
3680
3689
  await nuxt.callHook("imports:extend", imports);
3681
3690
  for (const i of imports) {
3682
- if (!defaultImportSources.has(i.from)) {
3691
+ if (!nuxtImportSources.has(i.from)) {
3683
3692
  const value = i.as || i.name;
3684
- if (defaultImports.has(value) && (!i.priority || i.priority >= 0)) {
3693
+ if (nuxtImports.has(value) && (!i.priority || i.priority >= 0)) {
3685
3694
  const relativePath = isAbsolute(i.from) ? `${resolveToAlias(i.from, nuxt)}` : i.from;
3686
3695
  logger.error(`\`${value}\` is an auto-imported function that is in use by Nuxt. Overriding it will likely cause issues. Please consider renaming \`${value}\` in \`${relativePath}\`.`);
3687
3696
  }
@@ -3760,7 +3769,7 @@ function addDeclarationTemplates(ctx, options) {
3760
3769
  });
3761
3770
  }
3762
3771
 
3763
- const version = "4.1.1-29284589.27dc1f24";
3772
+ const version = "4.1.1-29285142.e858eea6";
3764
3773
 
3765
3774
  const createImportProtectionPatterns = (nuxt, options) => {
3766
3775
  const patterns = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-nightly",
3
- "version": "4.1.1-29284589.27dc1f24",
3
+ "version": "4.1.1-29285142.e858eea6",
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.1-29284589.27dc1f24",
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.1-29284589.27dc1f24",
70
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.1-29285142.e858eea6",
71
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.1-29285142.e858eea6",
72
72
  "@nuxt/telemetry": "^2.6.6",
73
- "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.1-29284589.27dc1f24",
73
+ "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.1-29285142.e858eea6",
74
74
  "@unhead/vue": "^2.0.14",
75
75
  "@vue/shared": "^3.5.20",
76
76
  "c12": "^3.2.0",