@uni-helper/vite-plugin-uni-pages 0.3.8 → 0.3.10
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 +20 -13
- package/dist/index.mjs +20 -13
- package/package.json +1 -1
package/client.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -81,8 +81,11 @@ function getDeclaration(ctx) {
|
|
|
81
81
|
// @ts-nocheck
|
|
82
82
|
// Generated by vite-plugin-uni-pages
|
|
83
83
|
|
|
84
|
+
type _LocationUrl =
|
|
85
|
+
${allPagesPath.join(" |\n ")};
|
|
86
|
+
|
|
84
87
|
interface NavigateToOptions {
|
|
85
|
-
url:
|
|
88
|
+
url: _LocationUrl;
|
|
86
89
|
}
|
|
87
90
|
interface RedirectToOptions extends NavigateToOptions {}
|
|
88
91
|
|
|
@@ -98,6 +101,10 @@ declare interface Uni {
|
|
|
98
101
|
switchTab(options: UniNamespace.SwitchTabOptions & SwitchTabOptions): void;
|
|
99
102
|
reLaunch(options: UniNamespace.ReLaunchOptions & ReLaunchOptions): void;
|
|
100
103
|
}
|
|
104
|
+
|
|
105
|
+
declare module "virtual:uni-pages" {
|
|
106
|
+
export type LocationUrl = _LocationUrl;
|
|
107
|
+
}
|
|
101
108
|
`;
|
|
102
109
|
return code;
|
|
103
110
|
}
|
|
@@ -497,21 +504,21 @@ async function tryPageMetaFromCustomBlock(sfc, routeBlockLang) {
|
|
|
497
504
|
return pageMeta;
|
|
498
505
|
}
|
|
499
506
|
function findMacro(stmts, filename) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
throw new Error(`\u6BCF\u4E2A\u6587\u4EF6\u53EA\u5141\u8BB8\u8C03\u7528\u4E00\u6B21 definePage(): ${filename}`);
|
|
507
|
+
let macro;
|
|
508
|
+
for (const stmt of stmts) {
|
|
509
|
+
let node = stmt;
|
|
510
|
+
if (stmt.type === "ExpressionStatement")
|
|
511
|
+
node = stmt.expression;
|
|
512
|
+
if (astKit.isCallOf(node, "definePage")) {
|
|
513
|
+
macro = node;
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
510
516
|
}
|
|
511
|
-
|
|
517
|
+
if (!macro)
|
|
518
|
+
return;
|
|
512
519
|
const [opt] = macro.arguments;
|
|
513
520
|
if (opt && !t__namespace.isFunctionExpression(opt) && !t__namespace.isArrowFunctionExpression(opt) && !t__namespace.isObjectExpression(opt)) {
|
|
514
|
-
debug.definePage(`definePage()
|
|
521
|
+
debug.definePage(`definePage() \u53C2\u6570\u4EC5\u652F\u6301\u51FD\u6570\u6216\u5BF9\u8C61\uFF1A${filename}`);
|
|
515
522
|
return;
|
|
516
523
|
}
|
|
517
524
|
return macro;
|
package/dist/index.mjs
CHANGED
|
@@ -47,8 +47,11 @@ function getDeclaration(ctx) {
|
|
|
47
47
|
// @ts-nocheck
|
|
48
48
|
// Generated by vite-plugin-uni-pages
|
|
49
49
|
|
|
50
|
+
type _LocationUrl =
|
|
51
|
+
${allPagesPath.join(" |\n ")};
|
|
52
|
+
|
|
50
53
|
interface NavigateToOptions {
|
|
51
|
-
url:
|
|
54
|
+
url: _LocationUrl;
|
|
52
55
|
}
|
|
53
56
|
interface RedirectToOptions extends NavigateToOptions {}
|
|
54
57
|
|
|
@@ -64,6 +67,10 @@ declare interface Uni {
|
|
|
64
67
|
switchTab(options: UniNamespace.SwitchTabOptions & SwitchTabOptions): void;
|
|
65
68
|
reLaunch(options: UniNamespace.ReLaunchOptions & ReLaunchOptions): void;
|
|
66
69
|
}
|
|
70
|
+
|
|
71
|
+
declare module "virtual:uni-pages" {
|
|
72
|
+
export type LocationUrl = _LocationUrl;
|
|
73
|
+
}
|
|
67
74
|
`;
|
|
68
75
|
return code;
|
|
69
76
|
}
|
|
@@ -463,21 +470,21 @@ async function tryPageMetaFromCustomBlock(sfc, routeBlockLang) {
|
|
|
463
470
|
return pageMeta;
|
|
464
471
|
}
|
|
465
472
|
function findMacro(stmts, filename) {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
throw new Error(`\u6BCF\u4E2A\u6587\u4EF6\u53EA\u5141\u8BB8\u8C03\u7528\u4E00\u6B21 definePage(): ${filename}`);
|
|
473
|
+
let macro;
|
|
474
|
+
for (const stmt of stmts) {
|
|
475
|
+
let node = stmt;
|
|
476
|
+
if (stmt.type === "ExpressionStatement")
|
|
477
|
+
node = stmt.expression;
|
|
478
|
+
if (isCallOf(node, "definePage")) {
|
|
479
|
+
macro = node;
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
476
482
|
}
|
|
477
|
-
|
|
483
|
+
if (!macro)
|
|
484
|
+
return;
|
|
478
485
|
const [opt] = macro.arguments;
|
|
479
486
|
if (opt && !t.isFunctionExpression(opt) && !t.isArrowFunctionExpression(opt) && !t.isObjectExpression(opt)) {
|
|
480
|
-
debug.definePage(`definePage()
|
|
487
|
+
debug.definePage(`definePage() \u53C2\u6570\u4EC5\u652F\u6301\u51FD\u6570\u6216\u5BF9\u8C61\uFF1A${filename}`);
|
|
481
488
|
return;
|
|
482
489
|
}
|
|
483
490
|
return macro;
|