nuxt-nightly 4.2.0-29333853.4751a6ac → 4.2.0-29334442.191bcb7e
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 +150 -11
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -2348,8 +2348,7 @@ async function scanComponents(dirs, srcDir) {
|
|
|
2348
2348
|
preload: Boolean(dir.preload),
|
|
2349
2349
|
// specific to the file
|
|
2350
2350
|
filePath,
|
|
2351
|
-
|
|
2352
|
-
declarationPath: dir.declarationPath || filePath,
|
|
2351
|
+
declarationPath: filePath,
|
|
2353
2352
|
pascalName,
|
|
2354
2353
|
kebabName,
|
|
2355
2354
|
chunkName,
|
|
@@ -2538,7 +2537,7 @@ function findComponent(components, name, mode) {
|
|
|
2538
2537
|
return otherModeComponent;
|
|
2539
2538
|
}
|
|
2540
2539
|
|
|
2541
|
-
const SCRIPT_RE$
|
|
2540
|
+
const SCRIPT_RE$3 = /<script[^>]*>/i;
|
|
2542
2541
|
const SCRIPT_RE_GLOBAL = /<script[^>]*>/gi;
|
|
2543
2542
|
const HAS_SLOT_OR_CLIENT_RE = /<slot[^>]*>|nuxt-client/;
|
|
2544
2543
|
const TEMPLATE_RE$1 = /<template>[\s\S]*<\/template>/;
|
|
@@ -2581,7 +2580,7 @@ const IslandsTransformPlugin = (options) => createUnplugin((_options, meta) => {
|
|
|
2581
2580
|
}
|
|
2582
2581
|
const startingIndex = template.index || 0;
|
|
2583
2582
|
const s = new MagicString(code);
|
|
2584
|
-
if (!SCRIPT_RE$
|
|
2583
|
+
if (!SCRIPT_RE$3.test(code)) {
|
|
2585
2584
|
s.prepend("<script setup>" + IMPORT_CODE + "<\/script>");
|
|
2586
2585
|
} else {
|
|
2587
2586
|
s.replace(SCRIPT_RE_GLOBAL, (full) => {
|
|
@@ -3133,7 +3132,7 @@ const ComponentNamePlugin = (options) => createUnplugin(() => {
|
|
|
3133
3132
|
};
|
|
3134
3133
|
});
|
|
3135
3134
|
|
|
3136
|
-
const SCRIPT_RE$
|
|
3135
|
+
const SCRIPT_RE$2 = /(?<=<script[^>]*>)[\s\S]*?(?=<\/script>)/gi;
|
|
3137
3136
|
const TEMPLATE_RE = /<template>([\s\S]*)<\/template>/;
|
|
3138
3137
|
const hydrationStrategyMap = {
|
|
3139
3138
|
hydrateOnIdle: "Idle",
|
|
@@ -3173,7 +3172,7 @@ const LazyHydrationTransformPlugin = (options) => createUnplugin(() => {
|
|
|
3173
3172
|
try {
|
|
3174
3173
|
const ast = parse(template);
|
|
3175
3174
|
const scopeTracker = new ScopeTracker({ preserveExitedScopes: true });
|
|
3176
|
-
for (const { 0: script } of code.matchAll(SCRIPT_RE$
|
|
3175
|
+
for (const { 0: script } of code.matchAll(SCRIPT_RE$2)) {
|
|
3177
3176
|
if (!script) {
|
|
3178
3177
|
continue;
|
|
3179
3178
|
}
|
|
@@ -3832,7 +3831,7 @@ function addDeclarationTemplates(ctx, options) {
|
|
|
3832
3831
|
});
|
|
3833
3832
|
}
|
|
3834
3833
|
|
|
3835
|
-
const version = "4.2.0-
|
|
3834
|
+
const version = "4.2.0-29334442.191bcb7e";
|
|
3836
3835
|
|
|
3837
3836
|
const createImportProtectionPatterns = (nuxt, options) => {
|
|
3838
3837
|
const patterns = [];
|
|
@@ -5064,8 +5063,8 @@ const AsyncContextInjectionPlugin = (nuxt) => createUnplugin(() => {
|
|
|
5064
5063
|
|
|
5065
5064
|
const stringTypes = ["Literal", "TemplateLiteral"];
|
|
5066
5065
|
const NUXT_LIB_RE = /node_modules\/(?:nuxt|nuxt3|nuxt-nightly)\//;
|
|
5067
|
-
const SUPPORTED_EXT_RE = /\.(?:m?[jt]sx?|vue)/;
|
|
5068
|
-
const SCRIPT_RE = /(?<=<script[^>]*>)[\s\S]*?(?=<\/script>)/i;
|
|
5066
|
+
const SUPPORTED_EXT_RE$1 = /\.(?:m?[jt]sx?|vue)/;
|
|
5067
|
+
const SCRIPT_RE$1 = /(?<=<script[^>]*>)[\s\S]*?(?=<\/script>)/i;
|
|
5069
5068
|
const ComposableKeysPlugin = (options) => createUnplugin(() => {
|
|
5070
5069
|
const composableMeta = {};
|
|
5071
5070
|
const composableLengths = /* @__PURE__ */ new Set();
|
|
@@ -5082,14 +5081,14 @@ const ComposableKeysPlugin = (options) => createUnplugin(() => {
|
|
|
5082
5081
|
enforce: "post",
|
|
5083
5082
|
transformInclude(id) {
|
|
5084
5083
|
const { pathname, search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
|
|
5085
|
-
return !NUXT_LIB_RE.test(pathname) && SUPPORTED_EXT_RE.test(pathname) && parseQuery(search).type !== "style" && !parseQuery(search).macro;
|
|
5084
|
+
return !NUXT_LIB_RE.test(pathname) && SUPPORTED_EXT_RE$1.test(pathname) && parseQuery(search).type !== "style" && !parseQuery(search).macro;
|
|
5086
5085
|
},
|
|
5087
5086
|
transform: {
|
|
5088
5087
|
filter: {
|
|
5089
5088
|
code: { include: KEYED_FUNCTIONS_RE }
|
|
5090
5089
|
},
|
|
5091
5090
|
handler(code, id) {
|
|
5092
|
-
const { 0: script = code, index: codeIndex = 0 } = code.match(SCRIPT_RE) || { index: 0, 0: code };
|
|
5091
|
+
const { 0: script = code, index: codeIndex = 0 } = code.match(SCRIPT_RE$1) || { index: 0, 0: code };
|
|
5093
5092
|
const s = new MagicString(code);
|
|
5094
5093
|
let imports;
|
|
5095
5094
|
let count = 0;
|
|
@@ -5382,6 +5381,140 @@ function PrehydrateTransformPlugin(options = {}) {
|
|
|
5382
5381
|
}));
|
|
5383
5382
|
}
|
|
5384
5383
|
|
|
5384
|
+
const functionsToExtract = /* @__PURE__ */ new Set(["useAsyncData", "useLazyAsyncData"]);
|
|
5385
|
+
const FUNCTIONS_RE = /\buse(?:Lazy)?AsyncData\b/;
|
|
5386
|
+
const SUPPORTED_EXT_RE = /\.(?:m?[jt]sx?|vue)$/;
|
|
5387
|
+
const SCRIPT_RE = /(?<=<script[^>]*>)[\s\S]*?(?=<\/script>)/i;
|
|
5388
|
+
const ExtractAsyncDataHandlersPlugin = (options) => createUnplugin(() => {
|
|
5389
|
+
const asyncDatas = {};
|
|
5390
|
+
let count = 0;
|
|
5391
|
+
return {
|
|
5392
|
+
name: "nuxt:extract-async-data-handlers",
|
|
5393
|
+
enforce: "post",
|
|
5394
|
+
resolveId(source) {
|
|
5395
|
+
if (source in asyncDatas) {
|
|
5396
|
+
return source;
|
|
5397
|
+
}
|
|
5398
|
+
},
|
|
5399
|
+
load(id) {
|
|
5400
|
+
if (id in asyncDatas) {
|
|
5401
|
+
return asyncDatas[id];
|
|
5402
|
+
}
|
|
5403
|
+
},
|
|
5404
|
+
transformInclude(id) {
|
|
5405
|
+
const { pathname, search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
|
|
5406
|
+
return SUPPORTED_EXT_RE.test(pathname) && parseQuery(search).type !== "style" && !parseQuery(search).macro;
|
|
5407
|
+
},
|
|
5408
|
+
transform: {
|
|
5409
|
+
filter: {
|
|
5410
|
+
id: {
|
|
5411
|
+
exclude: [/nuxt\/(src|dist)\/app/]
|
|
5412
|
+
},
|
|
5413
|
+
code: { include: FUNCTIONS_RE }
|
|
5414
|
+
},
|
|
5415
|
+
handler(code, id) {
|
|
5416
|
+
const { 0: script = code, index: codeIndex = 0 } = code.match(SCRIPT_RE) || { index: 0, 0: code };
|
|
5417
|
+
let s;
|
|
5418
|
+
const scopeTracker = new ScopeTracker({ preserveExitedScopes: true });
|
|
5419
|
+
const parseResult = parseAndWalk(script, id, { scopeTracker });
|
|
5420
|
+
scopeTracker.freeze();
|
|
5421
|
+
walk(parseResult.program, {
|
|
5422
|
+
scopeTracker,
|
|
5423
|
+
enter(node) {
|
|
5424
|
+
if (node.type !== "CallExpression" || node.callee.type !== "Identifier" || !functionsToExtract.has(node.callee.name)) {
|
|
5425
|
+
return;
|
|
5426
|
+
}
|
|
5427
|
+
const callExpression = node;
|
|
5428
|
+
const fetcherFunction = callExpression.arguments.find((fn) => fn.type === "ArrowFunctionExpression" || fn.type === "FunctionExpression");
|
|
5429
|
+
if (!fetcherFunction || fetcherFunction.type !== "ArrowFunctionExpression" && fetcherFunction.type !== "FunctionExpression" || !fetcherFunction.body) {
|
|
5430
|
+
return;
|
|
5431
|
+
}
|
|
5432
|
+
s ||= new MagicString(code);
|
|
5433
|
+
const referencedVariables = /* @__PURE__ */ new Set();
|
|
5434
|
+
const imports = /* @__PURE__ */ new Set();
|
|
5435
|
+
walk(fetcherFunction.body, {
|
|
5436
|
+
scopeTracker,
|
|
5437
|
+
enter(innerNode, parent) {
|
|
5438
|
+
if (innerNode.type !== "Identifier") {
|
|
5439
|
+
return;
|
|
5440
|
+
}
|
|
5441
|
+
if (parent) {
|
|
5442
|
+
if (parent.type === "MemberExpression" && parent.property === innerNode && parent.computed === false) {
|
|
5443
|
+
return;
|
|
5444
|
+
}
|
|
5445
|
+
if (parent.type === "Property" && parent.key === innerNode && parent.computed === false) {
|
|
5446
|
+
return;
|
|
5447
|
+
}
|
|
5448
|
+
if (parent.type === "MethodDefinition" && parent.key === innerNode && parent.computed === false) {
|
|
5449
|
+
return;
|
|
5450
|
+
}
|
|
5451
|
+
if (parent.type === "PropertyDefinition" && parent.key === innerNode && parent.computed === false) {
|
|
5452
|
+
return;
|
|
5453
|
+
}
|
|
5454
|
+
}
|
|
5455
|
+
const declaration = scopeTracker.getDeclaration(innerNode.name);
|
|
5456
|
+
if (!declaration) {
|
|
5457
|
+
return;
|
|
5458
|
+
}
|
|
5459
|
+
if (declaration.type === "Import") {
|
|
5460
|
+
imports.add(innerNode.name);
|
|
5461
|
+
} else if (declaration.type !== "FunctionParam") {
|
|
5462
|
+
const functionBodyStart = fetcherFunction.body.start;
|
|
5463
|
+
const functionBodyEnd = fetcherFunction.body.end;
|
|
5464
|
+
if (declaration.start < functionBodyStart || declaration.end > functionBodyEnd) {
|
|
5465
|
+
referencedVariables.add(innerNode.name);
|
|
5466
|
+
}
|
|
5467
|
+
}
|
|
5468
|
+
}
|
|
5469
|
+
});
|
|
5470
|
+
const importStatements = /* @__PURE__ */ new Set();
|
|
5471
|
+
walk(parseResult.program, {
|
|
5472
|
+
enter(importDecl) {
|
|
5473
|
+
if (importDecl.type !== "ImportDeclaration") {
|
|
5474
|
+
return;
|
|
5475
|
+
}
|
|
5476
|
+
if (importDecl.specifiers?.some((spec) => spec.local && imports.has(spec.local.name))) {
|
|
5477
|
+
importStatements.add(script.slice(importDecl.start, importDecl.end));
|
|
5478
|
+
}
|
|
5479
|
+
}
|
|
5480
|
+
});
|
|
5481
|
+
const imps = Array.from(importStatements).join("\n");
|
|
5482
|
+
const key = `${dirname(id)}/async-data-chunk-${count++}.js`;
|
|
5483
|
+
const isBlockStatement = fetcherFunction.body.type === "BlockStatement";
|
|
5484
|
+
const startOffset = codeIndex + fetcherFunction.body.start;
|
|
5485
|
+
const endOffset = codeIndex + fetcherFunction.body.end;
|
|
5486
|
+
const chunk = s.clone();
|
|
5487
|
+
const parameters = [...referencedVariables].join(", ");
|
|
5488
|
+
const returnPrefix = isBlockStatement ? "" : "return ";
|
|
5489
|
+
const preface = `${imps}
|
|
5490
|
+
export default async function (${parameters}) { ${returnPrefix}`;
|
|
5491
|
+
const suffix = ` }`;
|
|
5492
|
+
if (isBlockStatement) {
|
|
5493
|
+
chunk.overwrite(0, startOffset + 1, preface);
|
|
5494
|
+
chunk.overwrite(endOffset - 1, code.length, suffix);
|
|
5495
|
+
} else {
|
|
5496
|
+
chunk.overwrite(0, startOffset, preface);
|
|
5497
|
+
chunk.overwrite(endOffset, code.length, suffix);
|
|
5498
|
+
}
|
|
5499
|
+
asyncDatas[key] = {
|
|
5500
|
+
code: chunk.toString(),
|
|
5501
|
+
map: options.sourcemap ? chunk.generateMap({ hires: true }) : void 0
|
|
5502
|
+
};
|
|
5503
|
+
const importCall = `() => import('${key}').then(r => (r.default || r)(${parameters}))`;
|
|
5504
|
+
s.overwrite(codeIndex + fetcherFunction.start, codeIndex + fetcherFunction.end, importCall);
|
|
5505
|
+
}
|
|
5506
|
+
});
|
|
5507
|
+
if (s?.hasChanged()) {
|
|
5508
|
+
return {
|
|
5509
|
+
code: s.toString(),
|
|
5510
|
+
map: options.sourcemap ? s.generateMap({ hires: true }) : void 0
|
|
5511
|
+
};
|
|
5512
|
+
}
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
};
|
|
5516
|
+
});
|
|
5517
|
+
|
|
5385
5518
|
const PREFIX = "virtual:nuxt:";
|
|
5386
5519
|
const PREFIX_RE = /^\/?virtual:nuxt:/;
|
|
5387
5520
|
const RELATIVE_ID_RE = /^\.{1,2}[\\/]/;
|
|
@@ -5710,6 +5843,12 @@ Using \`${fallbackCompatibilityDate}\` as fallback. More info at: ${colors.under
|
|
|
5710
5843
|
addBuildPlugin(DevOnlyPlugin({
|
|
5711
5844
|
sourcemap: !!nuxt.options.sourcemap.server || !!nuxt.options.sourcemap.client
|
|
5712
5845
|
}));
|
|
5846
|
+
if (nuxt.options.experimental.extractAsyncDataHandlers) {
|
|
5847
|
+
addBuildPlugin(ExtractAsyncDataHandlersPlugin({
|
|
5848
|
+
sourcemap: !!nuxt.options.sourcemap.client,
|
|
5849
|
+
rootDir: nuxt.options.rootDir
|
|
5850
|
+
}), { server: false });
|
|
5851
|
+
}
|
|
5713
5852
|
}
|
|
5714
5853
|
if (nuxt.options.dev) {
|
|
5715
5854
|
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-29334442.191bcb7e",
|
|
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-29334442.191bcb7e",
|
|
72
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.0-29334442.191bcb7e",
|
|
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-29334442.191bcb7e",
|
|
75
75
|
"@unhead/vue": "^2.0.14",
|
|
76
76
|
"@vue/shared": "^3.5.22",
|
|
77
77
|
"c12": "^3.3.0",
|