nuxt-nightly 4.1.1-29283391.911ce76c → 4.1.1-29285117.56aa16c3
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.
|
@@ -179,7 +179,7 @@ export default defineNuxtPlugin({
|
|
|
179
179
|
}
|
|
180
180
|
for (const middleware of middlewareEntries) {
|
|
181
181
|
if (import.meta.dev) {
|
|
182
|
-
nuxtApp._processingMiddleware = middleware.
|
|
182
|
+
nuxtApp._processingMiddleware = middleware._path || true;
|
|
183
183
|
}
|
|
184
184
|
const result = await nuxtApp.runWithContext(() => middleware(to, from));
|
|
185
185
|
if (import.meta.server) {
|
package/dist/index.mjs
CHANGED
|
@@ -62,9 +62,9 @@ async function isDirectory$1(path) {
|
|
|
62
62
|
}
|
|
63
63
|
const logger = useLogger("nuxt");
|
|
64
64
|
function resolveToAlias(path, nuxt = tryUseNuxt()) {
|
|
65
|
-
return reverseResolveAlias(path, { ...nuxt?.options.alias || {}, ...strippedAtAliases }).pop() || path;
|
|
65
|
+
return reverseResolveAlias(path, { ...nuxt?.options.alias || {}, ...strippedAtAliases$1 }).pop() || path;
|
|
66
66
|
}
|
|
67
|
-
const strippedAtAliases = {
|
|
67
|
+
const strippedAtAliases$1 = {
|
|
68
68
|
"@": "",
|
|
69
69
|
"@@": ""
|
|
70
70
|
};
|
|
@@ -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:
|
|
1476
|
-
|
|
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
|
-
|
|
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
|
|
3667
|
-
const
|
|
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 (!
|
|
3691
|
+
if (!nuxtImportSources.has(i.from)) {
|
|
3683
3692
|
const value = i.as || i.name;
|
|
3684
|
-
if (
|
|
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-
|
|
3772
|
+
const version = "4.1.1-29285117.56aa16c3";
|
|
3764
3773
|
|
|
3765
3774
|
const createImportProtectionPatterns = (nuxt, options) => {
|
|
3766
3775
|
const patterns = [];
|
|
@@ -6365,14 +6374,35 @@ const layoutTemplate = {
|
|
|
6365
6374
|
};
|
|
6366
6375
|
const middlewareTemplate = {
|
|
6367
6376
|
filename: "middleware.mjs",
|
|
6368
|
-
getContents({ app }) {
|
|
6377
|
+
getContents({ app, nuxt }) {
|
|
6369
6378
|
const globalMiddleware = app.middleware.filter((mw) => mw.global);
|
|
6370
6379
|
const namedMiddleware = app.middleware.filter((mw) => !mw.global);
|
|
6371
|
-
const
|
|
6380
|
+
const alias = nuxt.options.dev ? { ...nuxt?.options.alias || {}, ...strippedAtAliases } : {};
|
|
6372
6381
|
return [
|
|
6373
6382
|
...globalMiddleware.map((mw) => genImport(mw.path, genSafeVariableName(mw.name))),
|
|
6374
|
-
|
|
6375
|
-
|
|
6383
|
+
...!nuxt.options.dev ? [
|
|
6384
|
+
`export const globalMiddleware = ${genArrayFromRaw(globalMiddleware.map((mw) => genSafeVariableName(mw.name)))}`,
|
|
6385
|
+
`export const namedMiddleware = ${genObjectFromRawEntries(namedMiddleware.map((mw) => [mw.name, genDynamicImport(mw.path)]))}`
|
|
6386
|
+
] : [
|
|
6387
|
+
`const _globalMiddleware = ${genObjectFromRawEntries(globalMiddleware.map((mw) => [reverseResolveAlias(mw.path, alias).pop() || mw.path, genSafeVariableName(mw.name)]))}`,
|
|
6388
|
+
`for (const path in _globalMiddleware) {`,
|
|
6389
|
+
` Object.defineProperty(_globalMiddleware[path], '_path', { value: path })`,
|
|
6390
|
+
`}`,
|
|
6391
|
+
`export const globalMiddleware = Object.values(_globalMiddleware)`,
|
|
6392
|
+
`const _namedMiddleware = ${genArrayFromRaw(namedMiddleware.map((mw) => ({
|
|
6393
|
+
name: genString(mw.name),
|
|
6394
|
+
path: genString(reverseResolveAlias(mw.path, alias).pop() || mw.path),
|
|
6395
|
+
import: genDynamicImport(mw.path)
|
|
6396
|
+
})))}`,
|
|
6397
|
+
`for (const mw of _namedMiddleware) {`,
|
|
6398
|
+
` const i = mw.import`,
|
|
6399
|
+
` mw.import = () => i().then(r => {`,
|
|
6400
|
+
` Object.defineProperty(r.default || r, '_path', { value: mw.path })`,
|
|
6401
|
+
` return r`,
|
|
6402
|
+
` })`,
|
|
6403
|
+
`}`,
|
|
6404
|
+
`export const namedMiddleware = Object.fromEntries(_namedMiddleware.map(mw => [mw.name, mw.import]))`
|
|
6405
|
+
]
|
|
6376
6406
|
].join("\n");
|
|
6377
6407
|
}
|
|
6378
6408
|
};
|
|
@@ -6654,6 +6684,10 @@ const buildTypeTemplate = {
|
|
|
6654
6684
|
return declarations;
|
|
6655
6685
|
}
|
|
6656
6686
|
};
|
|
6687
|
+
const strippedAtAliases = {
|
|
6688
|
+
"@": "",
|
|
6689
|
+
"@@": ""
|
|
6690
|
+
};
|
|
6657
6691
|
|
|
6658
6692
|
const defaultTemplates = {
|
|
6659
6693
|
__proto__: null,
|
|
@@ -166,7 +166,7 @@ const plugin = defineNuxtPlugin({
|
|
|
166
166
|
}
|
|
167
167
|
try {
|
|
168
168
|
if (import.meta.dev) {
|
|
169
|
-
nuxtApp._processingMiddleware = (typeof entry === "string" ? entry :
|
|
169
|
+
nuxtApp._processingMiddleware = middleware._path || (typeof entry === "string" ? entry : true);
|
|
170
170
|
}
|
|
171
171
|
const result = await nuxtApp.runWithContext(() => middleware(to, from));
|
|
172
172
|
if (import.meta.server || !nuxtApp.payload.serverRendered && nuxtApp.isHydrating) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-nightly",
|
|
3
|
-
"version": "4.1.1-
|
|
3
|
+
"version": "4.1.1-29285117.56aa16c3",
|
|
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-
|
|
71
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.1-
|
|
70
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.1-29285117.56aa16c3",
|
|
71
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.1-29285117.56aa16c3",
|
|
72
72
|
"@nuxt/telemetry": "^2.6.6",
|
|
73
|
-
"@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.1-
|
|
73
|
+
"@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.1-29285117.56aa16c3",
|
|
74
74
|
"@unhead/vue": "^2.0.14",
|
|
75
75
|
"@vue/shared": "^3.5.20",
|
|
76
76
|
"c12": "^3.2.0",
|