nuxt-nightly 4.2.0-29333825.6cbfa2c8 → 4.2.0-29334440.d083e066
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/app/components/nuxt-link.d.ts +2 -2
- package/dist/index.mjs +153 -11
- package/package.json +4 -4
|
@@ -96,6 +96,6 @@ type NuxtLinkDefaultSlotProps<CustomProp extends boolean = false> = CustomProp e
|
|
|
96
96
|
type NuxtLinkSlots<CustomProp extends boolean = false> = {
|
|
97
97
|
default?: (props: NuxtLinkDefaultSlotProps<CustomProp>) => VNode[];
|
|
98
98
|
};
|
|
99
|
-
export declare function defineNuxtLink(options: NuxtLinkOptions): (new <CustomProp extends boolean = false>(props: NuxtLinkProps<CustomProp> & VNodeProps & AllowedComponentProps & AnchorHTMLAttributes) => InstanceType<DefineSetupFnComponent<NuxtLinkProps<CustomProp> & VNodeProps & AllowedComponentProps & Omit<AnchorHTMLAttributes,
|
|
100
|
-
declare const _default: (new <CustomProp extends boolean = false>(props: NuxtLinkProps<CustomProp> & VNodeProps & AllowedComponentProps & AnchorHTMLAttributes) => InstanceType<DefineSetupFnComponent<NuxtLinkProps<CustomProp> & VNodeProps & AllowedComponentProps & Omit<AnchorHTMLAttributes,
|
|
99
|
+
export declare function defineNuxtLink(options: NuxtLinkOptions): (new <CustomProp extends boolean = false>(props: NuxtLinkProps<CustomProp> & VNodeProps & AllowedComponentProps & Omit<AnchorHTMLAttributes, keyof NuxtLinkProps<CustomProp>>) => InstanceType<DefineSetupFnComponent<NuxtLinkProps<CustomProp> & VNodeProps & AllowedComponentProps & Omit<AnchorHTMLAttributes, keyof NuxtLinkProps<CustomProp>>, [], SlotsType<NuxtLinkSlots<CustomProp>>>>) & Record<string, any>;
|
|
100
|
+
declare const _default: (new <CustomProp extends boolean = false>(props: NuxtLinkProps<CustomProp> & VNodeProps & AllowedComponentProps & Omit<AnchorHTMLAttributes, keyof NuxtLinkProps<CustomProp>>) => InstanceType<DefineSetupFnComponent<NuxtLinkProps<CustomProp> & VNodeProps & AllowedComponentProps & Omit<AnchorHTMLAttributes, keyof NuxtLinkProps<CustomProp>>, [], SlotsType<NuxtLinkSlots<CustomProp>>>>) & Record<string, any>;
|
|
101
101
|
export default _default;
|
package/dist/index.mjs
CHANGED
|
@@ -2281,7 +2281,7 @@ const ISLAND_RE = /\.island(?:\.global)?$/;
|
|
|
2281
2281
|
const GLOBAL_RE = /\.global(?:\.island)?$/;
|
|
2282
2282
|
const COMPONENT_MODE_RE = /(?<=\.)(client|server)(?:\.global|\.island)*$/;
|
|
2283
2283
|
const MODE_REPLACEMENT_RE = /(?:\.(?:client|server))?(?:\.global|\.island)*$/;
|
|
2284
|
-
async function scanComponents(dirs) {
|
|
2284
|
+
async function scanComponents(dirs, srcDir) {
|
|
2285
2285
|
const components = [];
|
|
2286
2286
|
const filePaths = /* @__PURE__ */ new Set();
|
|
2287
2287
|
const scannedPaths = [];
|
|
@@ -2337,6 +2337,7 @@ async function scanComponents(dirs) {
|
|
|
2337
2337
|
}
|
|
2338
2338
|
resolvedNames.set(pascalName + suffix, filePath);
|
|
2339
2339
|
const kebabName = kebabCase(componentNameSegments);
|
|
2340
|
+
const shortPath = relative(srcDir, filePath);
|
|
2340
2341
|
const chunkName = "components/" + kebabName + suffix;
|
|
2341
2342
|
let component = {
|
|
2342
2343
|
// inheritable from directory configuration
|
|
@@ -2352,6 +2353,7 @@ async function scanComponents(dirs) {
|
|
|
2352
2353
|
pascalName,
|
|
2353
2354
|
kebabName,
|
|
2354
2355
|
chunkName,
|
|
2356
|
+
shortPath,
|
|
2355
2357
|
export: "default",
|
|
2356
2358
|
// by default, give priority to scanned components
|
|
2357
2359
|
priority: dir.priority ?? 1,
|
|
@@ -2536,7 +2538,7 @@ function findComponent(components, name, mode) {
|
|
|
2536
2538
|
return otherModeComponent;
|
|
2537
2539
|
}
|
|
2538
2540
|
|
|
2539
|
-
const SCRIPT_RE$
|
|
2541
|
+
const SCRIPT_RE$3 = /<script[^>]*>/i;
|
|
2540
2542
|
const SCRIPT_RE_GLOBAL = /<script[^>]*>/gi;
|
|
2541
2543
|
const HAS_SLOT_OR_CLIENT_RE = /<slot[^>]*>|nuxt-client/;
|
|
2542
2544
|
const TEMPLATE_RE$1 = /<template>[\s\S]*<\/template>/;
|
|
@@ -2579,7 +2581,7 @@ const IslandsTransformPlugin = (options) => createUnplugin((_options, meta) => {
|
|
|
2579
2581
|
}
|
|
2580
2582
|
const startingIndex = template.index || 0;
|
|
2581
2583
|
const s = new MagicString(code);
|
|
2582
|
-
if (!SCRIPT_RE$
|
|
2584
|
+
if (!SCRIPT_RE$3.test(code)) {
|
|
2583
2585
|
s.prepend("<script setup>" + IMPORT_CODE + "<\/script>");
|
|
2584
2586
|
} else {
|
|
2585
2587
|
s.replace(SCRIPT_RE_GLOBAL, (full) => {
|
|
@@ -3131,7 +3133,7 @@ const ComponentNamePlugin = (options) => createUnplugin(() => {
|
|
|
3131
3133
|
};
|
|
3132
3134
|
});
|
|
3133
3135
|
|
|
3134
|
-
const SCRIPT_RE$
|
|
3136
|
+
const SCRIPT_RE$2 = /(?<=<script[^>]*>)[\s\S]*?(?=<\/script>)/gi;
|
|
3135
3137
|
const TEMPLATE_RE = /<template>([\s\S]*)<\/template>/;
|
|
3136
3138
|
const hydrationStrategyMap = {
|
|
3137
3139
|
hydrateOnIdle: "Idle",
|
|
@@ -3171,7 +3173,7 @@ const LazyHydrationTransformPlugin = (options) => createUnplugin(() => {
|
|
|
3171
3173
|
try {
|
|
3172
3174
|
const ast = parse(template);
|
|
3173
3175
|
const scopeTracker = new ScopeTracker({ preserveExitedScopes: true });
|
|
3174
|
-
for (const { 0: script } of code.matchAll(SCRIPT_RE$
|
|
3176
|
+
for (const { 0: script } of code.matchAll(SCRIPT_RE$2)) {
|
|
3175
3177
|
if (!script) {
|
|
3176
3178
|
continue;
|
|
3177
3179
|
}
|
|
@@ -3483,7 +3485,7 @@ const componentsModule = defineNuxtModule({
|
|
|
3483
3485
|
});
|
|
3484
3486
|
const serverPlaceholderPath = await findPath(join(distDir, "app/components/server-placeholder")) ?? join(distDir, "app/components/server-placeholder");
|
|
3485
3487
|
nuxt.hook("app:templates", async (app) => {
|
|
3486
|
-
const newComponents = await scanComponents(componentDirs);
|
|
3488
|
+
const newComponents = await scanComponents(componentDirs, nuxt.options.srcDir);
|
|
3487
3489
|
await nuxt.callHook("components:extend", newComponents);
|
|
3488
3490
|
for (const component of newComponents) {
|
|
3489
3491
|
if (!component._scanned && !(component.filePath in nuxt.vfs) && isAbsolute(component.filePath) && !existsSync(component.filePath)) {
|
|
@@ -3830,7 +3832,7 @@ function addDeclarationTemplates(ctx, options) {
|
|
|
3830
3832
|
});
|
|
3831
3833
|
}
|
|
3832
3834
|
|
|
3833
|
-
const version = "4.2.0-
|
|
3835
|
+
const version = "4.2.0-29334440.d083e066";
|
|
3834
3836
|
|
|
3835
3837
|
const createImportProtectionPatterns = (nuxt, options) => {
|
|
3836
3838
|
const patterns = [];
|
|
@@ -5062,8 +5064,8 @@ const AsyncContextInjectionPlugin = (nuxt) => createUnplugin(() => {
|
|
|
5062
5064
|
|
|
5063
5065
|
const stringTypes = ["Literal", "TemplateLiteral"];
|
|
5064
5066
|
const NUXT_LIB_RE = /node_modules\/(?:nuxt|nuxt3|nuxt-nightly)\//;
|
|
5065
|
-
const SUPPORTED_EXT_RE = /\.(?:m?[jt]sx?|vue)/;
|
|
5066
|
-
const SCRIPT_RE = /(?<=<script[^>]*>)[\s\S]*?(?=<\/script>)/i;
|
|
5067
|
+
const SUPPORTED_EXT_RE$1 = /\.(?:m?[jt]sx?|vue)/;
|
|
5068
|
+
const SCRIPT_RE$1 = /(?<=<script[^>]*>)[\s\S]*?(?=<\/script>)/i;
|
|
5067
5069
|
const ComposableKeysPlugin = (options) => createUnplugin(() => {
|
|
5068
5070
|
const composableMeta = {};
|
|
5069
5071
|
const composableLengths = /* @__PURE__ */ new Set();
|
|
@@ -5080,14 +5082,14 @@ const ComposableKeysPlugin = (options) => createUnplugin(() => {
|
|
|
5080
5082
|
enforce: "post",
|
|
5081
5083
|
transformInclude(id) {
|
|
5082
5084
|
const { pathname, search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
|
|
5083
|
-
return !NUXT_LIB_RE.test(pathname) && SUPPORTED_EXT_RE.test(pathname) && parseQuery(search).type !== "style" && !parseQuery(search).macro;
|
|
5085
|
+
return !NUXT_LIB_RE.test(pathname) && SUPPORTED_EXT_RE$1.test(pathname) && parseQuery(search).type !== "style" && !parseQuery(search).macro;
|
|
5084
5086
|
},
|
|
5085
5087
|
transform: {
|
|
5086
5088
|
filter: {
|
|
5087
5089
|
code: { include: KEYED_FUNCTIONS_RE }
|
|
5088
5090
|
},
|
|
5089
5091
|
handler(code, id) {
|
|
5090
|
-
const { 0: script = code, index: codeIndex = 0 } = code.match(SCRIPT_RE) || { index: 0, 0: code };
|
|
5092
|
+
const { 0: script = code, index: codeIndex = 0 } = code.match(SCRIPT_RE$1) || { index: 0, 0: code };
|
|
5091
5093
|
const s = new MagicString(code);
|
|
5092
5094
|
let imports;
|
|
5093
5095
|
let count = 0;
|
|
@@ -5380,6 +5382,140 @@ function PrehydrateTransformPlugin(options = {}) {
|
|
|
5380
5382
|
}));
|
|
5381
5383
|
}
|
|
5382
5384
|
|
|
5385
|
+
const functionsToExtract = /* @__PURE__ */ new Set(["useAsyncData", "useLazyAsyncData"]);
|
|
5386
|
+
const FUNCTIONS_RE = /\buse(?:Lazy)?AsyncData\b/;
|
|
5387
|
+
const SUPPORTED_EXT_RE = /\.(?:m?[jt]sx?|vue)$/;
|
|
5388
|
+
const SCRIPT_RE = /(?<=<script[^>]*>)[\s\S]*?(?=<\/script>)/i;
|
|
5389
|
+
const ExtractAsyncDataHandlersPlugin = (options) => createUnplugin(() => {
|
|
5390
|
+
const asyncDatas = {};
|
|
5391
|
+
let count = 0;
|
|
5392
|
+
return {
|
|
5393
|
+
name: "nuxt:extract-async-data-handlers",
|
|
5394
|
+
enforce: "post",
|
|
5395
|
+
resolveId(source) {
|
|
5396
|
+
if (source in asyncDatas) {
|
|
5397
|
+
return source;
|
|
5398
|
+
}
|
|
5399
|
+
},
|
|
5400
|
+
load(id) {
|
|
5401
|
+
if (id in asyncDatas) {
|
|
5402
|
+
return asyncDatas[id];
|
|
5403
|
+
}
|
|
5404
|
+
},
|
|
5405
|
+
transformInclude(id) {
|
|
5406
|
+
const { pathname, search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
|
|
5407
|
+
return SUPPORTED_EXT_RE.test(pathname) && parseQuery(search).type !== "style" && !parseQuery(search).macro;
|
|
5408
|
+
},
|
|
5409
|
+
transform: {
|
|
5410
|
+
filter: {
|
|
5411
|
+
id: {
|
|
5412
|
+
exclude: [/nuxt\/(src|dist)\/app/]
|
|
5413
|
+
},
|
|
5414
|
+
code: { include: FUNCTIONS_RE }
|
|
5415
|
+
},
|
|
5416
|
+
handler(code, id) {
|
|
5417
|
+
const { 0: script = code, index: codeIndex = 0 } = code.match(SCRIPT_RE) || { index: 0, 0: code };
|
|
5418
|
+
let s;
|
|
5419
|
+
const scopeTracker = new ScopeTracker({ preserveExitedScopes: true });
|
|
5420
|
+
const parseResult = parseAndWalk(script, id, { scopeTracker });
|
|
5421
|
+
scopeTracker.freeze();
|
|
5422
|
+
walk(parseResult.program, {
|
|
5423
|
+
scopeTracker,
|
|
5424
|
+
enter(node) {
|
|
5425
|
+
if (node.type !== "CallExpression" || node.callee.type !== "Identifier" || !functionsToExtract.has(node.callee.name)) {
|
|
5426
|
+
return;
|
|
5427
|
+
}
|
|
5428
|
+
const callExpression = node;
|
|
5429
|
+
const fetcherFunction = callExpression.arguments.find((fn) => fn.type === "ArrowFunctionExpression" || fn.type === "FunctionExpression");
|
|
5430
|
+
if (!fetcherFunction || fetcherFunction.type !== "ArrowFunctionExpression" && fetcherFunction.type !== "FunctionExpression" || !fetcherFunction.body) {
|
|
5431
|
+
return;
|
|
5432
|
+
}
|
|
5433
|
+
s ||= new MagicString(code);
|
|
5434
|
+
const referencedVariables = /* @__PURE__ */ new Set();
|
|
5435
|
+
const imports = /* @__PURE__ */ new Set();
|
|
5436
|
+
walk(fetcherFunction.body, {
|
|
5437
|
+
scopeTracker,
|
|
5438
|
+
enter(innerNode, parent) {
|
|
5439
|
+
if (innerNode.type !== "Identifier") {
|
|
5440
|
+
return;
|
|
5441
|
+
}
|
|
5442
|
+
if (parent) {
|
|
5443
|
+
if (parent.type === "MemberExpression" && parent.property === innerNode && parent.computed === false) {
|
|
5444
|
+
return;
|
|
5445
|
+
}
|
|
5446
|
+
if (parent.type === "Property" && parent.key === innerNode && parent.computed === false) {
|
|
5447
|
+
return;
|
|
5448
|
+
}
|
|
5449
|
+
if (parent.type === "MethodDefinition" && parent.key === innerNode && parent.computed === false) {
|
|
5450
|
+
return;
|
|
5451
|
+
}
|
|
5452
|
+
if (parent.type === "PropertyDefinition" && parent.key === innerNode && parent.computed === false) {
|
|
5453
|
+
return;
|
|
5454
|
+
}
|
|
5455
|
+
}
|
|
5456
|
+
const declaration = scopeTracker.getDeclaration(innerNode.name);
|
|
5457
|
+
if (!declaration) {
|
|
5458
|
+
return;
|
|
5459
|
+
}
|
|
5460
|
+
if (declaration.type === "Import") {
|
|
5461
|
+
imports.add(innerNode.name);
|
|
5462
|
+
} else if (declaration.type !== "FunctionParam") {
|
|
5463
|
+
const functionBodyStart = fetcherFunction.body.start;
|
|
5464
|
+
const functionBodyEnd = fetcherFunction.body.end;
|
|
5465
|
+
if (declaration.start < functionBodyStart || declaration.end > functionBodyEnd) {
|
|
5466
|
+
referencedVariables.add(innerNode.name);
|
|
5467
|
+
}
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
});
|
|
5471
|
+
const importStatements = /* @__PURE__ */ new Set();
|
|
5472
|
+
walk(parseResult.program, {
|
|
5473
|
+
enter(importDecl) {
|
|
5474
|
+
if (importDecl.type !== "ImportDeclaration") {
|
|
5475
|
+
return;
|
|
5476
|
+
}
|
|
5477
|
+
if (importDecl.specifiers?.some((spec) => spec.local && imports.has(spec.local.name))) {
|
|
5478
|
+
importStatements.add(script.slice(importDecl.start, importDecl.end));
|
|
5479
|
+
}
|
|
5480
|
+
}
|
|
5481
|
+
});
|
|
5482
|
+
const imps = Array.from(importStatements).join("\n");
|
|
5483
|
+
const key = `${dirname(id)}/async-data-chunk-${count++}.js`;
|
|
5484
|
+
const isBlockStatement = fetcherFunction.body.type === "BlockStatement";
|
|
5485
|
+
const startOffset = codeIndex + fetcherFunction.body.start;
|
|
5486
|
+
const endOffset = codeIndex + fetcherFunction.body.end;
|
|
5487
|
+
const chunk = s.clone();
|
|
5488
|
+
const parameters = [...referencedVariables].join(", ");
|
|
5489
|
+
const returnPrefix = isBlockStatement ? "" : "return ";
|
|
5490
|
+
const preface = `${imps}
|
|
5491
|
+
export default async function (${parameters}) { ${returnPrefix}`;
|
|
5492
|
+
const suffix = ` }`;
|
|
5493
|
+
if (isBlockStatement) {
|
|
5494
|
+
chunk.overwrite(0, startOffset + 1, preface);
|
|
5495
|
+
chunk.overwrite(endOffset - 1, code.length, suffix);
|
|
5496
|
+
} else {
|
|
5497
|
+
chunk.overwrite(0, startOffset, preface);
|
|
5498
|
+
chunk.overwrite(endOffset, code.length, suffix);
|
|
5499
|
+
}
|
|
5500
|
+
asyncDatas[key] = {
|
|
5501
|
+
code: chunk.toString(),
|
|
5502
|
+
map: options.sourcemap ? chunk.generateMap({ hires: true }) : void 0
|
|
5503
|
+
};
|
|
5504
|
+
const importCall = `() => import('${key}').then(r => (r.default || r)(${parameters}))`;
|
|
5505
|
+
s.overwrite(codeIndex + fetcherFunction.start, codeIndex + fetcherFunction.end, importCall);
|
|
5506
|
+
}
|
|
5507
|
+
});
|
|
5508
|
+
if (s?.hasChanged()) {
|
|
5509
|
+
return {
|
|
5510
|
+
code: s.toString(),
|
|
5511
|
+
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0
|
|
5512
|
+
};
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
}
|
|
5516
|
+
};
|
|
5517
|
+
});
|
|
5518
|
+
|
|
5383
5519
|
const PREFIX = "virtual:nuxt:";
|
|
5384
5520
|
const PREFIX_RE = /^\/?virtual:nuxt:/;
|
|
5385
5521
|
const RELATIVE_ID_RE = /^\.{1,2}[\\/]/;
|
|
@@ -5708,6 +5844,12 @@ Using \`${fallbackCompatibilityDate}\` as fallback. More info at: ${colors.under
|
|
|
5708
5844
|
addBuildPlugin(DevOnlyPlugin({
|
|
5709
5845
|
sourcemap: !!nuxt.options.sourcemap.server || !!nuxt.options.sourcemap.client
|
|
5710
5846
|
}));
|
|
5847
|
+
if (nuxt.options.experimental.extractAsyncDataHandlers) {
|
|
5848
|
+
addBuildPlugin(ExtractAsyncDataHandlersPlugin({
|
|
5849
|
+
sourcemap: !!nuxt.options.sourcemap.client,
|
|
5850
|
+
rootDir: nuxt.options.rootDir
|
|
5851
|
+
}), { server: false });
|
|
5852
|
+
}
|
|
5711
5853
|
}
|
|
5712
5854
|
if (nuxt.options.dev) {
|
|
5713
5855
|
addPlugin(resolve(nuxt.options.appDir, "plugins/check-if-layout-used"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-nightly",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-29334440.d083e066",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
"@nuxt/cli": "npm:@nuxt/cli-nightly@latest",
|
|
69
69
|
"@nuxt/devalue": "^2.0.2",
|
|
70
70
|
"@nuxt/devtools": "^2.6.5",
|
|
71
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.0-
|
|
72
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.0-
|
|
71
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.0-29334440.d083e066",
|
|
72
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.0-29334440.d083e066",
|
|
73
73
|
"@nuxt/telemetry": "^2.6.6",
|
|
74
|
-
"@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.2.0-
|
|
74
|
+
"@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.2.0-29334440.d083e066",
|
|
75
75
|
"@unhead/vue": "^2.0.14",
|
|
76
76
|
"@vue/shared": "^3.5.22",
|
|
77
77
|
"c12": "^3.3.0",
|