@uni-helper/vite-plugin-uni-pages 0.3.7 → 0.3.9
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/client.d.ts +4 -2
- package/dist/index.cjs +16 -13
- package/dist/index.mjs +16 -13
- package/package.json +1 -1
package/client.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -478,7 +478,10 @@ async function tryPageMetaFromMacro(sfc) {
|
|
|
478
478
|
code,
|
|
479
479
|
filename: sfc.filename
|
|
480
480
|
});
|
|
481
|
-
return
|
|
481
|
+
return {
|
|
482
|
+
type: "page",
|
|
483
|
+
...result
|
|
484
|
+
};
|
|
482
485
|
}
|
|
483
486
|
return void 0;
|
|
484
487
|
}
|
|
@@ -494,21 +497,21 @@ async function tryPageMetaFromCustomBlock(sfc, routeBlockLang) {
|
|
|
494
497
|
return pageMeta;
|
|
495
498
|
}
|
|
496
499
|
function findMacro(stmts, filename) {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
throw new Error(`\u6BCF\u4E2A\u6587\u4EF6\u53EA\u5141\u8BB8\u8C03\u7528\u4E00\u6B21 definePage(): ${filename}`);
|
|
500
|
+
let macro;
|
|
501
|
+
for (const stmt of stmts) {
|
|
502
|
+
let node = stmt;
|
|
503
|
+
if (stmt.type === "ExpressionStatement")
|
|
504
|
+
node = stmt.expression;
|
|
505
|
+
if (astKit.isCallOf(node, "definePage")) {
|
|
506
|
+
macro = node;
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
507
509
|
}
|
|
508
|
-
|
|
510
|
+
if (!macro)
|
|
511
|
+
return;
|
|
509
512
|
const [opt] = macro.arguments;
|
|
510
513
|
if (opt && !t__namespace.isFunctionExpression(opt) && !t__namespace.isArrowFunctionExpression(opt) && !t__namespace.isObjectExpression(opt)) {
|
|
511
|
-
debug.definePage(`definePage()
|
|
514
|
+
debug.definePage(`definePage() \u53C2\u6570\u4EC5\u652F\u6301\u51FD\u6570\u6216\u5BF9\u8C61: ${filename}`);
|
|
512
515
|
return;
|
|
513
516
|
}
|
|
514
517
|
return macro;
|
package/dist/index.mjs
CHANGED
|
@@ -444,7 +444,10 @@ async function tryPageMetaFromMacro(sfc) {
|
|
|
444
444
|
code,
|
|
445
445
|
filename: sfc.filename
|
|
446
446
|
});
|
|
447
|
-
return
|
|
447
|
+
return {
|
|
448
|
+
type: "page",
|
|
449
|
+
...result
|
|
450
|
+
};
|
|
448
451
|
}
|
|
449
452
|
return void 0;
|
|
450
453
|
}
|
|
@@ -460,21 +463,21 @@ async function tryPageMetaFromCustomBlock(sfc, routeBlockLang) {
|
|
|
460
463
|
return pageMeta;
|
|
461
464
|
}
|
|
462
465
|
function findMacro(stmts, filename) {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
throw new Error(`\u6BCF\u4E2A\u6587\u4EF6\u53EA\u5141\u8BB8\u8C03\u7528\u4E00\u6B21 definePage(): ${filename}`);
|
|
466
|
+
let macro;
|
|
467
|
+
for (const stmt of stmts) {
|
|
468
|
+
let node = stmt;
|
|
469
|
+
if (stmt.type === "ExpressionStatement")
|
|
470
|
+
node = stmt.expression;
|
|
471
|
+
if (isCallOf(node, "definePage")) {
|
|
472
|
+
macro = node;
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
473
475
|
}
|
|
474
|
-
|
|
476
|
+
if (!macro)
|
|
477
|
+
return;
|
|
475
478
|
const [opt] = macro.arguments;
|
|
476
479
|
if (opt && !t.isFunctionExpression(opt) && !t.isArrowFunctionExpression(opt) && !t.isObjectExpression(opt)) {
|
|
477
|
-
debug.definePage(`definePage()
|
|
480
|
+
debug.definePage(`definePage() \u53C2\u6570\u4EC5\u652F\u6301\u51FD\u6570\u6216\u5BF9\u8C61: ${filename}`);
|
|
478
481
|
return;
|
|
479
482
|
}
|
|
480
483
|
return macro;
|