weapp-vite 6.0.0-alpha.1 → 6.0.0-alpha.2
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/auto-routes.cjs +2 -2
- package/dist/auto-routes.mjs +1 -1
- package/dist/{chunk-FB7KR7SH.cjs → chunk-CBPLMYFL.cjs} +4 -4
- package/dist/{chunk-VKLSO3EM.mjs → chunk-GGB7MGZY.mjs} +1 -1
- package/dist/{chunk-4P5KX3LT.mjs → chunk-IHHBS4DF.mjs} +330 -41
- package/dist/{chunk-EL4WI75Z.cjs → chunk-KBGC6ODZ.cjs} +401 -112
- package/dist/cli.cjs +54 -54
- package/dist/cli.mjs +2 -2
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +2 -2
- package/package.json +4 -4
|
@@ -16311,9 +16311,9 @@ pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
|
16311
16311
|
return this.finishNode(node, "ArrowFunctionExpression");
|
|
16312
16312
|
};
|
|
16313
16313
|
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
16314
|
-
var
|
|
16314
|
+
var isExpression2 = isArrowFunction && this.type !== types$1.braceL;
|
|
16315
16315
|
var oldStrict = this.strict, useStrict = false;
|
|
16316
|
-
if (
|
|
16316
|
+
if (isExpression2) {
|
|
16317
16317
|
node.body = this.parseMaybeAssign(forInit);
|
|
16318
16318
|
node.expression = true;
|
|
16319
16319
|
this.checkParams(node, false);
|
|
@@ -24545,6 +24545,156 @@ _chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
|
|
|
24545
24545
|
|
|
24546
24546
|
|
|
24547
24547
|
var _compilercore = require('@vue/compiler-core');
|
|
24548
|
+
var generate = _nullishCoalesce(_generator2.default.default, () => ( _generator2.default));
|
|
24549
|
+
function generateExpression(node) {
|
|
24550
|
+
const { code } = generate(node, {
|
|
24551
|
+
compact: true,
|
|
24552
|
+
jsescOption: { quotes: "single" }
|
|
24553
|
+
});
|
|
24554
|
+
return code;
|
|
24555
|
+
}
|
|
24556
|
+
function parseBabelExpression(exp) {
|
|
24557
|
+
try {
|
|
24558
|
+
const ast = _parser.parse.call(void 0, `(${exp})`, {
|
|
24559
|
+
sourceType: "module",
|
|
24560
|
+
plugins: ["typescript"]
|
|
24561
|
+
});
|
|
24562
|
+
const stmt = ast.program.body[0];
|
|
24563
|
+
if (!stmt || !("expression" in stmt)) {
|
|
24564
|
+
return null;
|
|
24565
|
+
}
|
|
24566
|
+
return stmt.expression;
|
|
24567
|
+
} catch (e33) {
|
|
24568
|
+
return null;
|
|
24569
|
+
}
|
|
24570
|
+
}
|
|
24571
|
+
function normalizeClassBindingExpression(exp, context) {
|
|
24572
|
+
const ast = parseBabelExpression(exp);
|
|
24573
|
+
if (!ast) {
|
|
24574
|
+
return [normalizeWxmlExpression(exp)];
|
|
24575
|
+
}
|
|
24576
|
+
const out = [];
|
|
24577
|
+
const pushExpr = (node) => {
|
|
24578
|
+
out.push(normalizeWxmlExpression(generateExpression(node)));
|
|
24579
|
+
};
|
|
24580
|
+
const visit = (node) => {
|
|
24581
|
+
if (!node) {
|
|
24582
|
+
return;
|
|
24583
|
+
}
|
|
24584
|
+
if (t2.isArrayExpression(node)) {
|
|
24585
|
+
for (const el of node.elements) {
|
|
24586
|
+
if (!el) {
|
|
24587
|
+
continue;
|
|
24588
|
+
}
|
|
24589
|
+
if (t2.isSpreadElement(el)) {
|
|
24590
|
+
context.warnings.push("Spread syntax in :class is not supported in mini-programs, ignoring it");
|
|
24591
|
+
continue;
|
|
24592
|
+
}
|
|
24593
|
+
if (t2.isExpression(el)) {
|
|
24594
|
+
visit(el);
|
|
24595
|
+
}
|
|
24596
|
+
}
|
|
24597
|
+
return;
|
|
24598
|
+
}
|
|
24599
|
+
if (t2.isObjectExpression(node)) {
|
|
24600
|
+
for (const prop of node.properties) {
|
|
24601
|
+
if (t2.isSpreadElement(prop)) {
|
|
24602
|
+
context.warnings.push("Spread syntax in :class object is not supported in mini-programs, ignoring it");
|
|
24603
|
+
continue;
|
|
24604
|
+
}
|
|
24605
|
+
if (!t2.isObjectProperty(prop)) {
|
|
24606
|
+
continue;
|
|
24607
|
+
}
|
|
24608
|
+
const value = prop.value;
|
|
24609
|
+
if (!t2.isExpression(value)) {
|
|
24610
|
+
continue;
|
|
24611
|
+
}
|
|
24612
|
+
const test = value;
|
|
24613
|
+
if (prop.computed) {
|
|
24614
|
+
const keyExpr = prop.key;
|
|
24615
|
+
if (!t2.isExpression(keyExpr)) {
|
|
24616
|
+
continue;
|
|
24617
|
+
}
|
|
24618
|
+
pushExpr(t2.conditionalExpression(test, keyExpr, t2.stringLiteral("")));
|
|
24619
|
+
} else if (t2.isIdentifier(prop.key)) {
|
|
24620
|
+
pushExpr(t2.conditionalExpression(test, t2.stringLiteral(prop.key.name), t2.stringLiteral("")));
|
|
24621
|
+
} else if (t2.isStringLiteral(prop.key)) {
|
|
24622
|
+
pushExpr(t2.conditionalExpression(test, t2.stringLiteral(prop.key.value), t2.stringLiteral("")));
|
|
24623
|
+
}
|
|
24624
|
+
}
|
|
24625
|
+
return;
|
|
24626
|
+
}
|
|
24627
|
+
pushExpr(node);
|
|
24628
|
+
};
|
|
24629
|
+
visit(ast);
|
|
24630
|
+
if (!out.length) {
|
|
24631
|
+
return [normalizeWxmlExpression(exp)];
|
|
24632
|
+
}
|
|
24633
|
+
return out;
|
|
24634
|
+
}
|
|
24635
|
+
function renderClassAttribute(staticClass, classExpressions) {
|
|
24636
|
+
const parts = [];
|
|
24637
|
+
if (_optionalChain([staticClass, 'optionalAccess', _452 => _452.trim, 'call', _453 => _453()])) {
|
|
24638
|
+
parts.push(staticClass.trim());
|
|
24639
|
+
}
|
|
24640
|
+
for (const exp of _nullishCoalesce(classExpressions, () => ( []))) {
|
|
24641
|
+
if (!exp) {
|
|
24642
|
+
continue;
|
|
24643
|
+
}
|
|
24644
|
+
parts.push(`{{${exp}}}`);
|
|
24645
|
+
}
|
|
24646
|
+
return `class="${parts.join(" ")}"`;
|
|
24647
|
+
}
|
|
24648
|
+
function renderStyleAttribute(staticStyle, dynamicStyleExp, vShowExp) {
|
|
24649
|
+
let merged = "";
|
|
24650
|
+
if (_optionalChain([staticStyle, 'optionalAccess', _454 => _454.trim, 'call', _455 => _455()])) {
|
|
24651
|
+
merged += staticStyle.trim();
|
|
24652
|
+
}
|
|
24653
|
+
if (merged && !/;\s*$/.test(merged)) {
|
|
24654
|
+
merged += ";";
|
|
24655
|
+
}
|
|
24656
|
+
if (dynamicStyleExp) {
|
|
24657
|
+
const expValue = normalizeWxmlExpression(dynamicStyleExp);
|
|
24658
|
+
merged += `{{${expValue}}}`;
|
|
24659
|
+
}
|
|
24660
|
+
if (vShowExp) {
|
|
24661
|
+
const hiddenStyle = merged ? ";display: none" : "display: none";
|
|
24662
|
+
merged += `{{${vShowExp} ? '' : '${hiddenStyle}'}}`;
|
|
24663
|
+
}
|
|
24664
|
+
return `style="${merged}"`;
|
|
24665
|
+
}
|
|
24666
|
+
function parseInlineHandler(exp) {
|
|
24667
|
+
try {
|
|
24668
|
+
const ast = _parser.parse.call(void 0, `(${exp})`, {
|
|
24669
|
+
sourceType: "module",
|
|
24670
|
+
plugins: ["typescript"]
|
|
24671
|
+
});
|
|
24672
|
+
const stmt = ast.program.body[0];
|
|
24673
|
+
if (!stmt || !("expression" in stmt)) {
|
|
24674
|
+
return null;
|
|
24675
|
+
}
|
|
24676
|
+
const expression = stmt.expression;
|
|
24677
|
+
if (!t2.isCallExpression(expression) || !t2.isIdentifier(expression.callee)) {
|
|
24678
|
+
return null;
|
|
24679
|
+
}
|
|
24680
|
+
const name = expression.callee.name;
|
|
24681
|
+
const args = [];
|
|
24682
|
+
for (const arg of expression.arguments) {
|
|
24683
|
+
if (t2.isIdentifier(arg) && arg.name === "$event") {
|
|
24684
|
+
args.push("$event");
|
|
24685
|
+
} else if (t2.isStringLiteral(arg) || t2.isNumericLiteral(arg) || t2.isBooleanLiteral(arg)) {
|
|
24686
|
+
args.push(arg.value);
|
|
24687
|
+
} else if (t2.isNullLiteral(arg)) {
|
|
24688
|
+
args.push(null);
|
|
24689
|
+
} else {
|
|
24690
|
+
return null;
|
|
24691
|
+
}
|
|
24692
|
+
}
|
|
24693
|
+
return { name, args };
|
|
24694
|
+
} catch (e34) {
|
|
24695
|
+
return null;
|
|
24696
|
+
}
|
|
24697
|
+
}
|
|
24548
24698
|
function templateLiteralToConcat(node) {
|
|
24549
24699
|
const segments = [];
|
|
24550
24700
|
node.quasis.forEach((quasi, index) => {
|
|
@@ -24583,12 +24733,12 @@ function normalizeWxmlExpression(exp) {
|
|
|
24583
24733
|
}
|
|
24584
24734
|
const expression = stmt.expression;
|
|
24585
24735
|
const normalized = t2.isTemplateLiteral(expression) ? templateLiteralToConcat(expression) : expression;
|
|
24586
|
-
const { code } =
|
|
24736
|
+
const { code } = generate(normalized, {
|
|
24587
24737
|
compact: true,
|
|
24588
24738
|
jsescOption: { quotes: "single" }
|
|
24589
24739
|
});
|
|
24590
24740
|
return code;
|
|
24591
|
-
} catch (
|
|
24741
|
+
} catch (e35) {
|
|
24592
24742
|
if (exp.startsWith("`") && exp.endsWith("`")) {
|
|
24593
24743
|
const inner = exp.slice(1, -1);
|
|
24594
24744
|
let rewritten = `'${inner.replace(/\$\{([^}]+)\}/g, "' + ($1) + '")}'`;
|
|
@@ -24641,23 +24791,63 @@ function transformElement(node, context) {
|
|
|
24641
24791
|
function transformNormalElement(node, context) {
|
|
24642
24792
|
const { tag, props } = node;
|
|
24643
24793
|
const attrs = [];
|
|
24794
|
+
let staticClass;
|
|
24795
|
+
let dynamicClassExp;
|
|
24796
|
+
let staticStyle;
|
|
24797
|
+
let dynamicStyleExp;
|
|
24798
|
+
let vShowExp;
|
|
24799
|
+
let vTextExp;
|
|
24644
24800
|
for (const prop of props) {
|
|
24645
24801
|
if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
|
|
24802
|
+
if (prop.name === "class" && _optionalChain([prop, 'access', _456 => _456.value, 'optionalAccess', _457 => _457.type]) === _compilercore.NodeTypes.TEXT) {
|
|
24803
|
+
staticClass = prop.value.content;
|
|
24804
|
+
continue;
|
|
24805
|
+
}
|
|
24806
|
+
if (prop.name === "style" && _optionalChain([prop, 'access', _458 => _458.value, 'optionalAccess', _459 => _459.type]) === _compilercore.NodeTypes.TEXT) {
|
|
24807
|
+
staticStyle = prop.value.content;
|
|
24808
|
+
continue;
|
|
24809
|
+
}
|
|
24646
24810
|
const attr = transformAttribute(prop, context);
|
|
24647
24811
|
if (attr) {
|
|
24648
24812
|
attrs.push(attr);
|
|
24649
24813
|
}
|
|
24650
24814
|
} else if (prop.type === _compilercore.NodeTypes.DIRECTIVE) {
|
|
24815
|
+
if (prop.name === "bind" && _optionalChain([prop, 'access', _460 => _460.arg, 'optionalAccess', _461 => _461.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class" && _optionalChain([prop, 'access', _462 => _462.exp, 'optionalAccess', _463 => _463.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
|
|
24816
|
+
dynamicClassExp = prop.exp.content;
|
|
24817
|
+
continue;
|
|
24818
|
+
}
|
|
24819
|
+
if (prop.name === "bind" && _optionalChain([prop, 'access', _464 => _464.arg, 'optionalAccess', _465 => _465.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "style" && _optionalChain([prop, 'access', _466 => _466.exp, 'optionalAccess', _467 => _467.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
|
|
24820
|
+
dynamicStyleExp = prop.exp.content;
|
|
24821
|
+
continue;
|
|
24822
|
+
}
|
|
24823
|
+
if (prop.name === "show" && _optionalChain([prop, 'access', _468 => _468.exp, 'optionalAccess', _469 => _469.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
|
|
24824
|
+
vShowExp = normalizeWxmlExpression(prop.exp.content);
|
|
24825
|
+
continue;
|
|
24826
|
+
}
|
|
24827
|
+
if (prop.name === "text" && _optionalChain([prop, 'access', _470 => _470.exp, 'optionalAccess', _471 => _471.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
|
|
24828
|
+
vTextExp = normalizeWxmlExpression(prop.exp.content);
|
|
24829
|
+
continue;
|
|
24830
|
+
}
|
|
24651
24831
|
const dir = transformDirective(prop, context, node);
|
|
24652
24832
|
if (dir) {
|
|
24653
24833
|
attrs.push(dir);
|
|
24654
24834
|
}
|
|
24655
24835
|
}
|
|
24656
24836
|
}
|
|
24837
|
+
if (staticClass || dynamicClassExp) {
|
|
24838
|
+
const expressions = dynamicClassExp ? normalizeClassBindingExpression(dynamicClassExp, context) : void 0;
|
|
24839
|
+
attrs.unshift(renderClassAttribute(staticClass, expressions));
|
|
24840
|
+
}
|
|
24841
|
+
if (staticStyle || dynamicStyleExp || vShowExp) {
|
|
24842
|
+
attrs.unshift(renderStyleAttribute(staticStyle, dynamicStyleExp, vShowExp));
|
|
24843
|
+
}
|
|
24657
24844
|
let children = "";
|
|
24658
24845
|
if (node.children.length > 0) {
|
|
24659
24846
|
children = node.children.map((child) => transformNode(child, context)).join("");
|
|
24660
24847
|
}
|
|
24848
|
+
if (vTextExp !== void 0) {
|
|
24849
|
+
children = `{{${vTextExp}}}`;
|
|
24850
|
+
}
|
|
24661
24851
|
const attrString = attrs.length ? ` ${attrs.join(" ")}` : "";
|
|
24662
24852
|
return children ? `<${tag}${attrString}>${children}</${tag}>` : `<${tag}${attrString} />`;
|
|
24663
24853
|
}
|
|
@@ -24673,6 +24863,7 @@ function transformAttribute(node, _context) {
|
|
|
24673
24863
|
}
|
|
24674
24864
|
function transformDirective(node, context, elementNode, forInfo) {
|
|
24675
24865
|
const { name, exp, arg } = node;
|
|
24866
|
+
const isSimpleHandler = (value) => /^[A-Z_$][\w$]*$/i.test(value);
|
|
24676
24867
|
if (name === "bind") {
|
|
24677
24868
|
if (!arg) {
|
|
24678
24869
|
return null;
|
|
@@ -24685,13 +24876,13 @@ function transformDirective(node, context, elementNode, forInfo) {
|
|
|
24685
24876
|
const expValue = normalizeWxmlExpression(rawExpValue);
|
|
24686
24877
|
if (argValue === "key") {
|
|
24687
24878
|
const trimmed = expValue.trim();
|
|
24688
|
-
if (_optionalChain([forInfo, 'optionalAccess',
|
|
24879
|
+
if (_optionalChain([forInfo, 'optionalAccess', _472 => _472.item]) && trimmed === forInfo.item) {
|
|
24689
24880
|
return 'wx:key="*this"';
|
|
24690
24881
|
}
|
|
24691
|
-
if (_optionalChain([forInfo, 'optionalAccess',
|
|
24882
|
+
if (_optionalChain([forInfo, 'optionalAccess', _473 => _473.key]) && trimmed === forInfo.key) {
|
|
24692
24883
|
return 'wx:key="*this"';
|
|
24693
24884
|
}
|
|
24694
|
-
if (_optionalChain([forInfo, 'optionalAccess',
|
|
24885
|
+
if (_optionalChain([forInfo, 'optionalAccess', _474 => _474.item]) && trimmed.startsWith(`${forInfo.item}.`)) {
|
|
24695
24886
|
const remainder = trimmed.slice(forInfo.item.length + 1);
|
|
24696
24887
|
const firstSegment = remainder.split(".")[0] || remainder;
|
|
24697
24888
|
return `wx:key="${firstSegment}"`;
|
|
@@ -24710,6 +24901,8 @@ function transformDirective(node, context, elementNode, forInfo) {
|
|
|
24710
24901
|
}
|
|
24711
24902
|
const rawExpValue = exp.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION ? exp.content : "";
|
|
24712
24903
|
const expValue = normalizeWxmlExpression(rawExpValue);
|
|
24904
|
+
const isInlineExpression = rawExpValue && !isSimpleHandler(rawExpValue);
|
|
24905
|
+
const inlineHandler = isInlineExpression ? parseInlineHandler(rawExpValue) : null;
|
|
24713
24906
|
const eventMap = {
|
|
24714
24907
|
click: "tap",
|
|
24715
24908
|
dblclick: "tap",
|
|
@@ -24733,6 +24926,19 @@ function transformDirective(node, context, elementNode, forInfo) {
|
|
|
24733
24926
|
longpress: "longpress"
|
|
24734
24927
|
};
|
|
24735
24928
|
const wxEvent = eventMap[argValue] || argValue;
|
|
24929
|
+
if (inlineHandler) {
|
|
24930
|
+
const argsJson = JSON.stringify(inlineHandler.args);
|
|
24931
|
+
const escapedArgs = argsJson.replace(/"/g, """);
|
|
24932
|
+
return [
|
|
24933
|
+
`data-wv-handler="${inlineHandler.name}"`,
|
|
24934
|
+
`data-wv-args="${escapedArgs}"`,
|
|
24935
|
+
`bind${wxEvent}="__weapp_vite_inline"`
|
|
24936
|
+
].join(" ");
|
|
24937
|
+
}
|
|
24938
|
+
if (isInlineExpression) {
|
|
24939
|
+
const escaped = rawExpValue.replace(/"/g, """);
|
|
24940
|
+
return `data-wv-inline="${escaped}" bind${wxEvent}="__weapp_vite_inline"`;
|
|
24941
|
+
}
|
|
24736
24942
|
return `bind${wxEvent}="${expValue}"`;
|
|
24737
24943
|
}
|
|
24738
24944
|
if (name === "model") {
|
|
@@ -24749,20 +24955,12 @@ function transformDirective(node, context, elementNode, forInfo) {
|
|
|
24749
24955
|
}
|
|
24750
24956
|
const rawExpValue = exp.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION ? exp.content : "";
|
|
24751
24957
|
const expValue = normalizeWxmlExpression(rawExpValue);
|
|
24752
|
-
return `style="{{
|
|
24958
|
+
return `style="{{${expValue} ? '' : 'display: none'}}"`;
|
|
24753
24959
|
}
|
|
24754
24960
|
if (name === "html") {
|
|
24755
24961
|
context.warnings.push("v-html is not supported in mini-programs, use rich-text component instead");
|
|
24756
24962
|
return null;
|
|
24757
24963
|
}
|
|
24758
|
-
if (name === "text") {
|
|
24759
|
-
if (!exp) {
|
|
24760
|
-
return null;
|
|
24761
|
-
}
|
|
24762
|
-
const rawExpValue = exp.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION ? exp.content : "";
|
|
24763
|
-
const expValue = normalizeWxmlExpression(rawExpValue);
|
|
24764
|
-
return `>{{${expValue}}`;
|
|
24765
|
-
}
|
|
24766
24964
|
if (name === "cloak") {
|
|
24767
24965
|
return null;
|
|
24768
24966
|
}
|
|
@@ -24895,7 +25093,7 @@ function transformComponentElement(node, context) {
|
|
|
24895
25093
|
let isDirective;
|
|
24896
25094
|
for (const prop of node.props) {
|
|
24897
25095
|
if (prop.type === _compilercore.NodeTypes.DIRECTIVE) {
|
|
24898
|
-
if (prop.name === "bind" && _optionalChain([prop, 'access',
|
|
25096
|
+
if (prop.name === "bind" && _optionalChain([prop, 'access', _475 => _475.arg, 'optionalAccess', _476 => _476.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "is") {
|
|
24899
25097
|
isDirective = prop;
|
|
24900
25098
|
break;
|
|
24901
25099
|
}
|
|
@@ -24947,35 +25145,92 @@ function transformKeepAliveElement(node, context) {
|
|
|
24947
25145
|
}
|
|
24948
25146
|
function transformTemplateElement(node, context) {
|
|
24949
25147
|
let slotDirective;
|
|
25148
|
+
let nameAttr = "";
|
|
25149
|
+
let isAttr = "";
|
|
25150
|
+
let dataAttr = "";
|
|
25151
|
+
let hasOtherDirective = false;
|
|
25152
|
+
let structuralDirective;
|
|
24950
25153
|
for (const prop of node.props) {
|
|
24951
25154
|
if (prop.type === _compilercore.NodeTypes.DIRECTIVE && prop.name === "slot") {
|
|
24952
25155
|
slotDirective = prop;
|
|
24953
25156
|
break;
|
|
24954
25157
|
}
|
|
25158
|
+
if (prop.type === _compilercore.NodeTypes.DIRECTIVE) {
|
|
25159
|
+
hasOtherDirective = true;
|
|
25160
|
+
if (!structuralDirective && (prop.name === "if" || prop.name === "else-if" || prop.name === "else" || prop.name === "for")) {
|
|
25161
|
+
structuralDirective = prop;
|
|
25162
|
+
}
|
|
25163
|
+
}
|
|
25164
|
+
if (prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "name") {
|
|
25165
|
+
nameAttr = prop.value && prop.value.type === _compilercore.NodeTypes.TEXT ? prop.value.content : "";
|
|
25166
|
+
}
|
|
25167
|
+
if (prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "is") {
|
|
25168
|
+
isAttr = prop.value && prop.value.type === _compilercore.NodeTypes.TEXT ? prop.value.content : "";
|
|
25169
|
+
}
|
|
25170
|
+
if (prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "data") {
|
|
25171
|
+
dataAttr = prop.value && prop.value.type === _compilercore.NodeTypes.TEXT ? prop.value.content : "";
|
|
25172
|
+
}
|
|
24955
25173
|
}
|
|
24956
|
-
if (!slotDirective) {
|
|
24957
|
-
context.warnings.push(
|
|
24958
|
-
"<template> element without v-slot is not supported in mini-programs, converting to <block>"
|
|
24959
|
-
);
|
|
24960
|
-
return transformNormalElement(node, context).replace(/<template/g, "<block").replace(/<\/template>/g, "</block>");
|
|
24961
|
-
}
|
|
24962
|
-
const slotName = slotDirective.arg ? slotDirective.arg.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION ? slotDirective.arg.content : "" : "";
|
|
24963
|
-
const slotProps = slotDirective.exp ? slotDirective.exp.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION ? slotDirective.exp.content : "" : "";
|
|
24964
25174
|
const children = node.children.map((child) => transformNode(child, context)).join("");
|
|
25175
|
+
if (!slotDirective && !nameAttr && !isAttr && !dataAttr) {
|
|
25176
|
+
if (_optionalChain([structuralDirective, 'optionalAccess', _477 => _477.name]) === "for") {
|
|
25177
|
+
return transformForElement({ ...node, tag: "block" }, context);
|
|
25178
|
+
}
|
|
25179
|
+
if (structuralDirective && (structuralDirective.name === "if" || structuralDirective.name === "else-if" || structuralDirective.name === "else")) {
|
|
25180
|
+
const dir = structuralDirective;
|
|
25181
|
+
const base = node.props.filter((prop) => prop !== dir);
|
|
25182
|
+
const fakeNode = { ...node, tag: "block", props: base };
|
|
25183
|
+
if (dir.name === "if" && dir.exp) {
|
|
25184
|
+
const rawExpValue = dir.exp.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION ? dir.exp.content : "";
|
|
25185
|
+
const expValue = normalizeWxmlExpression(rawExpValue);
|
|
25186
|
+
return `<block wx:if="{{${expValue}}}">${children}</block>`;
|
|
25187
|
+
}
|
|
25188
|
+
if (dir.name === "else-if" && dir.exp) {
|
|
25189
|
+
const rawExpValue = dir.exp.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION ? dir.exp.content : "";
|
|
25190
|
+
const expValue = normalizeWxmlExpression(rawExpValue);
|
|
25191
|
+
return `<block wx:elif="{{${expValue}}}">${children}</block>`;
|
|
25192
|
+
}
|
|
25193
|
+
if (dir.name === "else") {
|
|
25194
|
+
return `<block wx:else>${children}</block>`;
|
|
25195
|
+
}
|
|
25196
|
+
return transformIfElement(fakeNode, context);
|
|
25197
|
+
}
|
|
25198
|
+
if (hasOtherDirective) {
|
|
25199
|
+
return transformNormalElement(node, context).replace(/<template/g, "<block").replace(/<\/template>/g, "</block>");
|
|
25200
|
+
}
|
|
25201
|
+
return children;
|
|
25202
|
+
}
|
|
24965
25203
|
const attrs = [];
|
|
24966
|
-
if (
|
|
24967
|
-
attrs.push(`
|
|
24968
|
-
} else {
|
|
24969
|
-
attrs.push('slot=""');
|
|
25204
|
+
if (nameAttr) {
|
|
25205
|
+
attrs.push(`name="${nameAttr}"`);
|
|
24970
25206
|
}
|
|
24971
|
-
if (
|
|
24972
|
-
|
|
24973
|
-
|
|
24974
|
-
|
|
24975
|
-
attrs.push(`data="${
|
|
25207
|
+
if (isAttr) {
|
|
25208
|
+
attrs.push(`is="${isAttr}"`);
|
|
25209
|
+
}
|
|
25210
|
+
if (dataAttr) {
|
|
25211
|
+
attrs.push(`data="${dataAttr}"`);
|
|
25212
|
+
}
|
|
25213
|
+
if (slotDirective) {
|
|
25214
|
+
const slotName = slotDirective.arg ? slotDirective.arg.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION ? slotDirective.arg.content : "" : "";
|
|
25215
|
+
const slotProps = slotDirective.exp ? slotDirective.exp.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION ? slotDirective.exp.content : "" : "";
|
|
25216
|
+
if (slotName) {
|
|
25217
|
+
attrs.push(`slot="${slotName}"`);
|
|
25218
|
+
} else {
|
|
25219
|
+
attrs.push('slot=""');
|
|
25220
|
+
}
|
|
25221
|
+
if (slotProps) {
|
|
25222
|
+
context.warnings.push(
|
|
25223
|
+
`Scoped slots with v-slot="${slotProps}" require runtime support. Generated code may need adjustment.`
|
|
25224
|
+
);
|
|
25225
|
+
attrs.push(`data="${slotProps}"`);
|
|
25226
|
+
}
|
|
25227
|
+
}
|
|
25228
|
+
if (!slotDirective && !nameAttr && !isAttr && !dataAttr) {
|
|
25229
|
+
return children;
|
|
24976
25230
|
}
|
|
24977
25231
|
const attrString = attrs.length ? ` ${attrs.join(" ")}` : "";
|
|
24978
|
-
|
|
25232
|
+
const tagName = slotDirective ? "block" : "template";
|
|
25233
|
+
return `<${tagName}${attrString}>${children}</${tagName}>`;
|
|
24979
25234
|
}
|
|
24980
25235
|
function parseForExpression(exp) {
|
|
24981
25236
|
const match2 = exp.match(/^\(([^,]+),\s*([^,]+),\s*([^)]+)\)\s+in\s+(.+)$/);
|
|
@@ -25189,7 +25444,7 @@ async function collectVuePages(root) {
|
|
|
25189
25444
|
results.push(full);
|
|
25190
25445
|
}
|
|
25191
25446
|
}
|
|
25192
|
-
} catch (
|
|
25447
|
+
} catch (e36) {
|
|
25193
25448
|
}
|
|
25194
25449
|
return results;
|
|
25195
25450
|
}
|
|
@@ -25302,7 +25557,7 @@ function transformScript(source, options) {
|
|
|
25302
25557
|
path38.remove();
|
|
25303
25558
|
return;
|
|
25304
25559
|
}
|
|
25305
|
-
if (_optionalChain([path38, 'access',
|
|
25560
|
+
if (_optionalChain([path38, 'access', _478 => _478.node, 'access', _479 => _479.specifiers, 'optionalAccess', _480 => _480.length])) {
|
|
25306
25561
|
const remaining = path38.node.specifiers.filter((spec) => {
|
|
25307
25562
|
if (t3.isExportSpecifier(spec)) {
|
|
25308
25563
|
return spec.exportKind !== "type";
|
|
@@ -25337,7 +25592,7 @@ function transformScript(source, options) {
|
|
|
25337
25592
|
defaultExportPath = path38;
|
|
25338
25593
|
},
|
|
25339
25594
|
CallExpression(path38) {
|
|
25340
|
-
if (t3.isIdentifier(path38.node.callee, { name: "__expose" }) && _optionalChain([path38, 'access',
|
|
25595
|
+
if (t3.isIdentifier(path38.node.callee, { name: "__expose" }) && _optionalChain([path38, 'access', _481 => _481.parentPath, 'optionalAccess', _482 => _482.isExpressionStatement, 'call', _483 => _483()])) {
|
|
25341
25596
|
path38.parentPath.remove();
|
|
25342
25597
|
transformed = true;
|
|
25343
25598
|
return;
|
|
@@ -25429,7 +25684,7 @@ function transformScript(source, options) {
|
|
|
25429
25684
|
defineComponentDecls,
|
|
25430
25685
|
defineComponentAliases
|
|
25431
25686
|
);
|
|
25432
|
-
if (componentExpr && _optionalChain([options, 'optionalAccess',
|
|
25687
|
+
if (componentExpr && _optionalChain([options, 'optionalAccess', _484 => _484.skipComponentTransform])) {
|
|
25433
25688
|
exportPath.replaceWith(t3.exportDefaultDeclaration(componentExpr));
|
|
25434
25689
|
transformed = true;
|
|
25435
25690
|
} else if (componentExpr) {
|
|
@@ -25496,7 +25751,7 @@ async function evaluateJsLikeConfig(source, filename, lang) {
|
|
|
25496
25751
|
filepath: tempFile,
|
|
25497
25752
|
cwd: dir
|
|
25498
25753
|
});
|
|
25499
|
-
let resolved = _nullishCoalesce(_optionalChain([mod, 'optionalAccess',
|
|
25754
|
+
let resolved = _nullishCoalesce(_optionalChain([mod, 'optionalAccess', _485 => _485.default]), () => ( mod));
|
|
25500
25755
|
if (typeof resolved === "function") {
|
|
25501
25756
|
resolved = resolved();
|
|
25502
25757
|
}
|
|
@@ -25510,14 +25765,14 @@ async function evaluateJsLikeConfig(source, filename, lang) {
|
|
|
25510
25765
|
} finally {
|
|
25511
25766
|
try {
|
|
25512
25767
|
await _fsextra2.default.remove(tempFile);
|
|
25513
|
-
} catch (
|
|
25768
|
+
} catch (e37) {
|
|
25514
25769
|
}
|
|
25515
25770
|
try {
|
|
25516
25771
|
const remains = await _fsextra2.default.readdir(tempDir);
|
|
25517
25772
|
if (remains.length === 0) {
|
|
25518
25773
|
await _fsextra2.default.remove(tempDir);
|
|
25519
25774
|
}
|
|
25520
|
-
} catch (
|
|
25775
|
+
} catch (e38) {
|
|
25521
25776
|
}
|
|
25522
25777
|
}
|
|
25523
25778
|
}
|
|
@@ -25557,6 +25812,10 @@ async function compileVueFile(source, filename) {
|
|
|
25557
25812
|
throw new Error(`Failed to parse ${filename}: ${error.message}`);
|
|
25558
25813
|
}
|
|
25559
25814
|
const result = {};
|
|
25815
|
+
result.meta = {
|
|
25816
|
+
hasScriptSetup: !!descriptor.scriptSetup,
|
|
25817
|
+
hasSetupOption: !!descriptor.script && /\bsetup\s*\(/.test(descriptor.script.content)
|
|
25818
|
+
};
|
|
25560
25819
|
const isAppFile = /[\\/]app\.vue$/.test(filename);
|
|
25561
25820
|
if (descriptor.script || descriptor.scriptSetup) {
|
|
25562
25821
|
const scriptCompiled = _compilersfc.compileScript.call(void 0, descriptor, {
|
|
@@ -25650,7 +25909,7 @@ function createVueTransformPlugin(ctx) {
|
|
|
25650
25909
|
};
|
|
25651
25910
|
} catch (error) {
|
|
25652
25911
|
const message = error instanceof Error ? error.message : String(error);
|
|
25653
|
-
|
|
25912
|
+
logger_default.error(`[Vue transform] Error transforming ${filename}: ${message}`);
|
|
25654
25913
|
throw error;
|
|
25655
25914
|
}
|
|
25656
25915
|
},
|
|
@@ -25666,6 +25925,8 @@ function createVueTransformPlugin(ctx) {
|
|
|
25666
25925
|
if (!relativeBase) {
|
|
25667
25926
|
continue;
|
|
25668
25927
|
}
|
|
25928
|
+
const isAppVue = /[\\/]app\.vue$/.test(filename);
|
|
25929
|
+
const shouldEmitComponentJson = !isAppVue;
|
|
25669
25930
|
if (result.template) {
|
|
25670
25931
|
const wxmlFileName = `${relativeBase}.wxml`;
|
|
25671
25932
|
if (!bundle[wxmlFileName]) {
|
|
@@ -25686,37 +25947,55 @@ function createVueTransformPlugin(ctx) {
|
|
|
25686
25947
|
});
|
|
25687
25948
|
}
|
|
25688
25949
|
}
|
|
25689
|
-
if (result.config) {
|
|
25950
|
+
if (result.config || shouldEmitComponentJson) {
|
|
25690
25951
|
const jsonFileName = `${relativeBase}.json`;
|
|
25691
25952
|
const existing = bundle[jsonFileName];
|
|
25953
|
+
const defaultConfig = shouldEmitComponentJson ? { component: true } : void 0;
|
|
25954
|
+
let nextConfig;
|
|
25955
|
+
if (result.config) {
|
|
25956
|
+
try {
|
|
25957
|
+
nextConfig = JSON.parse(result.config);
|
|
25958
|
+
} catch (e39) {
|
|
25959
|
+
nextConfig = void 0;
|
|
25960
|
+
}
|
|
25961
|
+
}
|
|
25962
|
+
if (defaultConfig) {
|
|
25963
|
+
nextConfig = { ...defaultConfig, ..._nullishCoalesce(nextConfig, () => ( {})) };
|
|
25964
|
+
nextConfig.component = true;
|
|
25965
|
+
}
|
|
25966
|
+
if (!nextConfig && defaultConfig) {
|
|
25967
|
+
nextConfig = defaultConfig;
|
|
25968
|
+
}
|
|
25969
|
+
if (!nextConfig) {
|
|
25970
|
+
continue;
|
|
25971
|
+
}
|
|
25692
25972
|
if (existing && existing.type === "asset") {
|
|
25693
25973
|
try {
|
|
25694
25974
|
const existingConfig = JSON.parse(existing.source.toString());
|
|
25695
|
-
const
|
|
25696
|
-
const merged = { ...existingConfig, ...newConfig };
|
|
25975
|
+
const merged = { ...existingConfig, ...nextConfig };
|
|
25697
25976
|
this.emitFile({
|
|
25698
25977
|
type: "asset",
|
|
25699
25978
|
fileName: jsonFileName,
|
|
25700
25979
|
source: JSON.stringify(merged, null, 2)
|
|
25701
25980
|
});
|
|
25702
|
-
} catch (
|
|
25981
|
+
} catch (e40) {
|
|
25703
25982
|
this.emitFile({
|
|
25704
25983
|
type: "asset",
|
|
25705
25984
|
fileName: jsonFileName,
|
|
25706
|
-
source:
|
|
25985
|
+
source: JSON.stringify(nextConfig, null, 2)
|
|
25707
25986
|
});
|
|
25708
25987
|
}
|
|
25709
25988
|
} else if (!bundle[jsonFileName]) {
|
|
25710
25989
|
this.emitFile({
|
|
25711
25990
|
type: "asset",
|
|
25712
25991
|
fileName: jsonFileName,
|
|
25713
|
-
source:
|
|
25992
|
+
source: JSON.stringify(nextConfig, null, 2)
|
|
25714
25993
|
});
|
|
25715
25994
|
}
|
|
25716
25995
|
}
|
|
25717
25996
|
}
|
|
25718
25997
|
let pageList = [];
|
|
25719
|
-
if (_optionalChain([scanService, 'optionalAccess',
|
|
25998
|
+
if (_optionalChain([scanService, 'optionalAccess', _486 => _486.appEntry, 'optionalAccess', _487 => _487.json, 'optionalAccess', _488 => _488.pages, 'optionalAccess', _489 => _489.length])) {
|
|
25720
25999
|
pageList = scanService.appEntry.json.pages;
|
|
25721
26000
|
} else {
|
|
25722
26001
|
const appJsonPath = _pathe2.default.join(configService.cwd, "dist", "app.json");
|
|
@@ -25724,7 +26003,7 @@ function createVueTransformPlugin(ctx) {
|
|
|
25724
26003
|
const appJsonContent = await _fsextra2.default.readFile(appJsonPath, "utf-8");
|
|
25725
26004
|
const appJson = JSON.parse(appJsonContent);
|
|
25726
26005
|
pageList = appJson.pages || [];
|
|
25727
|
-
} catch (
|
|
26006
|
+
} catch (e41) {
|
|
25728
26007
|
}
|
|
25729
26008
|
}
|
|
25730
26009
|
const collectedEntries = /* @__PURE__ */ new Set();
|
|
@@ -25771,16 +26050,26 @@ function createVueTransformPlugin(ctx) {
|
|
|
25771
26050
|
source: result.style
|
|
25772
26051
|
});
|
|
25773
26052
|
}
|
|
25774
|
-
if (
|
|
26053
|
+
if (!bundle[`${relativeBase}.json`]) {
|
|
26054
|
+
let nextConfig;
|
|
26055
|
+
if (result.config) {
|
|
26056
|
+
try {
|
|
26057
|
+
nextConfig = JSON.parse(result.config);
|
|
26058
|
+
} catch (e42) {
|
|
26059
|
+
nextConfig = void 0;
|
|
26060
|
+
}
|
|
26061
|
+
}
|
|
26062
|
+
nextConfig = { component: true, ..._nullishCoalesce(nextConfig, () => ( {})) };
|
|
26063
|
+
nextConfig.component = true;
|
|
25775
26064
|
this.emitFile({
|
|
25776
26065
|
type: "asset",
|
|
25777
26066
|
fileName: `${relativeBase}.json`,
|
|
25778
|
-
source:
|
|
26067
|
+
source: JSON.stringify(nextConfig, null, 2)
|
|
25779
26068
|
});
|
|
25780
26069
|
}
|
|
25781
26070
|
} catch (error) {
|
|
25782
26071
|
const message = error instanceof Error ? error.message : String(error);
|
|
25783
|
-
|
|
26072
|
+
logger_default.error(`[Vue transform] Error compiling ${vuePath}: ${message}`);
|
|
25784
26073
|
}
|
|
25785
26074
|
}
|
|
25786
26075
|
},
|
|
@@ -25826,7 +26115,7 @@ function createVueWatchPlugin(_ctx) {
|
|
|
25826
26115
|
// src/plugins/vue/index.ts
|
|
25827
26116
|
var VUE_PLUGIN_NAME = "weapp-vite:vue";
|
|
25828
26117
|
function vuePlugin(ctx, options) {
|
|
25829
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
26118
|
+
if (_optionalChain([options, 'optionalAccess', _490 => _490.enable]) === false) {
|
|
25830
26119
|
return [];
|
|
25831
26120
|
}
|
|
25832
26121
|
return [
|
|
@@ -25869,8 +26158,8 @@ function createWorkerBuildPlugin(ctx) {
|
|
|
25869
26158
|
name: "weapp-vite:workers",
|
|
25870
26159
|
enforce: "pre",
|
|
25871
26160
|
async options(options) {
|
|
25872
|
-
const workerConfig = _optionalChain([configService, 'access',
|
|
25873
|
-
const entries = Array.isArray(_optionalChain([workerConfig, 'optionalAccess',
|
|
26161
|
+
const workerConfig = _optionalChain([configService, 'access', _491 => _491.weappViteConfig, 'optionalAccess', _492 => _492.worker]);
|
|
26162
|
+
const entries = Array.isArray(_optionalChain([workerConfig, 'optionalAccess', _493 => _493.entry])) ? workerConfig.entry : [_optionalChain([workerConfig, 'optionalAccess', _494 => _494.entry])];
|
|
25874
26163
|
const normalized = (await Promise.all(entries.filter(Boolean).map((entry) => resolveWorkerEntry(ctx, entry)))).filter((result) => Boolean(result.value)).reduce((acc, cur) => {
|
|
25875
26164
|
acc[cur.key] = cur.value;
|
|
25876
26165
|
return acc;
|
|
@@ -25927,7 +26216,7 @@ async function transformWxsFile(state, wxsPath) {
|
|
|
25927
26216
|
const { result, importees } = transformWxsCode(rawCode, {
|
|
25928
26217
|
filename: wxsPath
|
|
25929
26218
|
});
|
|
25930
|
-
if (typeof _optionalChain([result, 'optionalAccess',
|
|
26219
|
+
if (typeof _optionalChain([result, 'optionalAccess', _495 => _495.code]) === "string") {
|
|
25931
26220
|
code = result.code;
|
|
25932
26221
|
}
|
|
25933
26222
|
const dirname5 = _pathe2.default.dirname(wxsPath);
|
|
@@ -26016,13 +26305,13 @@ function createContextPlugin(ctx) {
|
|
|
26016
26305
|
}
|
|
26017
26306
|
function attachRuntimePlugins(ctx, plugins) {
|
|
26018
26307
|
const runtimePlugins = ctx[RUNTIME_PLUGINS_SYMBOL];
|
|
26019
|
-
if (!_optionalChain([runtimePlugins, 'optionalAccess',
|
|
26308
|
+
if (!_optionalChain([runtimePlugins, 'optionalAccess', _496 => _496.length])) {
|
|
26020
26309
|
return plugins;
|
|
26021
26310
|
}
|
|
26022
26311
|
return [...runtimePlugins, ...plugins];
|
|
26023
26312
|
}
|
|
26024
26313
|
function applyInspect(ctx, plugins) {
|
|
26025
|
-
const inspectOptions = _optionalChain([ctx, 'access',
|
|
26314
|
+
const inspectOptions = _optionalChain([ctx, 'access', _497 => _497.configService, 'access', _498 => _498.weappViteConfig, 'optionalAccess', _499 => _499.debug, 'optionalAccess', _500 => _500.inspect]);
|
|
26026
26315
|
if (!inspectOptions) {
|
|
26027
26316
|
return plugins;
|
|
26028
26317
|
}
|
|
@@ -26036,7 +26325,7 @@ function flatten(groups) {
|
|
|
26036
26325
|
}
|
|
26037
26326
|
function vitePluginWeapp(ctx, subPackageMeta) {
|
|
26038
26327
|
const groups = [[createContextPlugin(ctx)], preflight(ctx), vue(ctx)];
|
|
26039
|
-
const autoRoutesEnabled = _optionalChain([ctx, 'access',
|
|
26328
|
+
const autoRoutesEnabled = _optionalChain([ctx, 'access', _501 => _501.configService, 'optionalAccess', _502 => _502.weappViteConfig, 'optionalAccess', _503 => _503.autoRoutes]) === true;
|
|
26040
26329
|
if (!subPackageMeta) {
|
|
26041
26330
|
groups.push(asset(ctx));
|
|
26042
26331
|
if (autoRoutesEnabled) {
|
|
@@ -26158,7 +26447,7 @@ function createMergeFactories(options) {
|
|
|
26158
26447
|
const currentOptions = getOptions2();
|
|
26159
26448
|
applyRuntimePlatform("miniprogram");
|
|
26160
26449
|
const external = [];
|
|
26161
|
-
if (_optionalChain([currentOptions, 'access',
|
|
26450
|
+
if (_optionalChain([currentOptions, 'access', _504 => _504.packageJson, 'optionalAccess', _505 => _505.dependencies])) {
|
|
26162
26451
|
external.push(
|
|
26163
26452
|
...Object.keys(currentOptions.packageJson.dependencies).map((pkg) => {
|
|
26164
26453
|
return new RegExp(`^${pkg.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}(\\/|$)`);
|
|
@@ -26173,7 +26462,7 @@ function createMergeFactories(options) {
|
|
|
26173
26462
|
const watchInclude = [
|
|
26174
26463
|
_pathe2.default.join(currentOptions.cwd, currentOptions.srcRoot, "**")
|
|
26175
26464
|
];
|
|
26176
|
-
const pluginRootConfig = _optionalChain([currentOptions, 'access',
|
|
26465
|
+
const pluginRootConfig = _optionalChain([currentOptions, 'access', _506 => _506.config, 'access', _507 => _507.weapp, 'optionalAccess', _508 => _508.pluginRoot]);
|
|
26177
26466
|
if (pluginRootConfig) {
|
|
26178
26467
|
const absolutePluginRoot = _pathe2.default.resolve(currentOptions.cwd, pluginRootConfig);
|
|
26179
26468
|
const relativeToSrc = _pathe2.default.relative(
|
|
@@ -26231,7 +26520,7 @@ function createMergeFactories(options) {
|
|
|
26231
26520
|
arrangePlugins(inlineConfig, subPackageMeta);
|
|
26232
26521
|
inlineConfig.logLevel = "info";
|
|
26233
26522
|
injectBuiltinAliases(inlineConfig);
|
|
26234
|
-
const currentRoot = _optionalChain([subPackageMeta, 'optionalAccess',
|
|
26523
|
+
const currentRoot = _optionalChain([subPackageMeta, 'optionalAccess', _509 => _509.subPackage, 'access', _510 => _510.root]);
|
|
26235
26524
|
setOptions({
|
|
26236
26525
|
...currentOptions,
|
|
26237
26526
|
currentSubPackageRoot: currentRoot
|
|
@@ -26242,7 +26531,7 @@ function createMergeFactories(options) {
|
|
|
26242
26531
|
ensureConfigService();
|
|
26243
26532
|
const currentOptions = getOptions2();
|
|
26244
26533
|
const web = currentOptions.weappWeb;
|
|
26245
|
-
if (!_optionalChain([web, 'optionalAccess',
|
|
26534
|
+
if (!_optionalChain([web, 'optionalAccess', _511 => _511.enabled])) {
|
|
26246
26535
|
return void 0;
|
|
26247
26536
|
}
|
|
26248
26537
|
applyRuntimePlatform("web");
|
|
@@ -26327,7 +26616,7 @@ function createConfigService(ctx) {
|
|
|
26327
26616
|
const toPosix3 = (value) => value.replace(/\\/g, "/");
|
|
26328
26617
|
const fromPosix = (value) => _pathe2.default.sep === "/" ? value : value.split("/").join(_pathe2.default.sep);
|
|
26329
26618
|
const resolveAbsolutePluginRoot = () => {
|
|
26330
|
-
const pluginRootConfig = _optionalChain([options, 'access',
|
|
26619
|
+
const pluginRootConfig = _optionalChain([options, 'access', _512 => _512.config, 'access', _513 => _513.weapp, 'optionalAccess', _514 => _514.pluginRoot]);
|
|
26331
26620
|
if (!pluginRootConfig) {
|
|
26332
26621
|
return void 0;
|
|
26333
26622
|
}
|
|
@@ -26345,7 +26634,7 @@ function createConfigService(ctx) {
|
|
|
26345
26634
|
if (!absolutePluginRoot) {
|
|
26346
26635
|
return void 0;
|
|
26347
26636
|
}
|
|
26348
|
-
const configured = _optionalChain([options, 'access',
|
|
26637
|
+
const configured = _optionalChain([options, 'access', _515 => _515.projectConfig, 'optionalAccess', _516 => _516.pluginRoot]);
|
|
26349
26638
|
if (configured) {
|
|
26350
26639
|
return _pathe2.default.resolve(options.cwd, configured);
|
|
26351
26640
|
}
|
|
@@ -26389,7 +26678,7 @@ function createConfigService(ctx) {
|
|
|
26389
26678
|
defineEnv[key] = value;
|
|
26390
26679
|
}
|
|
26391
26680
|
function getDefineImportMetaEnv() {
|
|
26392
|
-
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
26681
|
+
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _517 => _517.platform]), () => ( DEFAULT_MP_PLATFORM));
|
|
26393
26682
|
const resolvedPlatform = _nullishCoalesce(defineEnv.PLATFORM, () => ( mpPlatform));
|
|
26394
26683
|
const env = {
|
|
26395
26684
|
PLATFORM: resolvedPlatform,
|
|
@@ -26405,7 +26694,7 @@ function createConfigService(ctx) {
|
|
|
26405
26694
|
}
|
|
26406
26695
|
function applyRuntimePlatform(runtime) {
|
|
26407
26696
|
const isWeb = runtime === "web";
|
|
26408
|
-
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
26697
|
+
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _518 => _518.platform]), () => ( DEFAULT_MP_PLATFORM));
|
|
26409
26698
|
const resolvedPlatform = isWeb ? "web" : mpPlatform;
|
|
26410
26699
|
setDefineEnv("PLATFORM", resolvedPlatform);
|
|
26411
26700
|
setDefineEnv("IS_WEB", isWeb);
|
|
@@ -26516,7 +26805,7 @@ function createConfigService(ctx) {
|
|
|
26516
26805
|
return options.srcRoot;
|
|
26517
26806
|
},
|
|
26518
26807
|
get pluginRoot() {
|
|
26519
|
-
return _optionalChain([options, 'access',
|
|
26808
|
+
return _optionalChain([options, 'access', _519 => _519.config, 'access', _520 => _520.weapp, 'optionalAccess', _521 => _521.pluginRoot]);
|
|
26520
26809
|
},
|
|
26521
26810
|
get absolutePluginRoot() {
|
|
26522
26811
|
return resolveAbsolutePluginRoot();
|
|
@@ -26608,10 +26897,10 @@ function createJsonService(ctx) {
|
|
|
26608
26897
|
}
|
|
26609
26898
|
let resultJson;
|
|
26610
26899
|
if (/app\.json(?:\.[jt]s)?$/.test(filepath)) {
|
|
26611
|
-
await _optionalChain([ctx, 'access',
|
|
26900
|
+
await _optionalChain([ctx, 'access', _522 => _522.autoRoutesService, 'optionalAccess', _523 => _523.ensureFresh, 'call', _524 => _524()]);
|
|
26612
26901
|
}
|
|
26613
26902
|
if (/\.json\.[jt]s$/.test(filepath)) {
|
|
26614
|
-
const routesReference = _optionalChain([ctx, 'access',
|
|
26903
|
+
const routesReference = _optionalChain([ctx, 'access', _525 => _525.autoRoutesService, 'optionalAccess', _526 => _526.getReference, 'call', _527 => _527()]);
|
|
26615
26904
|
const fallbackRoutes = _nullishCoalesce(routesReference, () => ( { pages: [], entries: [], subPackages: [] }));
|
|
26616
26905
|
const routesModule = {
|
|
26617
26906
|
routes: fallbackRoutes,
|
|
@@ -26661,7 +26950,7 @@ function createJsonService(ctx) {
|
|
|
26661
26950
|
return resultJson;
|
|
26662
26951
|
} catch (error) {
|
|
26663
26952
|
logger_default.error(`\u6B8B\u7834\u7684JSON\u6587\u4EF6: ${filepath}`);
|
|
26664
|
-
_optionalChain([debug, 'optionalCall',
|
|
26953
|
+
_optionalChain([debug, 'optionalCall', _528 => _528(error)]);
|
|
26665
26954
|
}
|
|
26666
26955
|
}
|
|
26667
26956
|
function resolve8(entry) {
|
|
@@ -26717,7 +27006,7 @@ function createNpmService(ctx) {
|
|
|
26717
27006
|
if (!ctx.configService) {
|
|
26718
27007
|
throw new Error("configService must be initialized before writing npm cache");
|
|
26719
27008
|
}
|
|
26720
|
-
if (_optionalChain([ctx, 'access',
|
|
27009
|
+
if (_optionalChain([ctx, 'access', _529 => _529.configService, 'access', _530 => _530.weappViteConfig, 'optionalAccess', _531 => _531.npm, 'optionalAccess', _532 => _532.cache])) {
|
|
26721
27010
|
await _fsextra2.default.outputJSON(getDependenciesCacheFilePath(root), {
|
|
26722
27011
|
hash: dependenciesCacheHash()
|
|
26723
27012
|
});
|
|
@@ -26730,7 +27019,7 @@ function createNpmService(ctx) {
|
|
|
26730
27019
|
}
|
|
26731
27020
|
}
|
|
26732
27021
|
async function checkDependenciesCacheOutdate(root) {
|
|
26733
|
-
if (_optionalChain([ctx, 'access',
|
|
27022
|
+
if (_optionalChain([ctx, 'access', _533 => _533.configService, 'optionalAccess', _534 => _534.weappViteConfig, 'optionalAccess', _535 => _535.npm, 'optionalAccess', _536 => _536.cache])) {
|
|
26734
27023
|
const json = await readDependenciesCache(root);
|
|
26735
27024
|
if (_shared.isObject.call(void 0, json)) {
|
|
26736
27025
|
return dependenciesCacheHash() !== json.hash;
|
|
@@ -26744,7 +27033,7 @@ function createNpmService(ctx) {
|
|
|
26744
27033
|
configFile: false,
|
|
26745
27034
|
publicDir: false,
|
|
26746
27035
|
logLevel: "silent",
|
|
26747
|
-
root: _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
27036
|
+
root: _nullishCoalesce(_optionalChain([ctx, 'access', _537 => _537.configService, 'optionalAccess', _538 => _538.cwd]), () => ( _process2.default.cwd())),
|
|
26748
27037
|
define: {
|
|
26749
27038
|
"process.env.NODE_ENV": JSON.stringify("production")
|
|
26750
27039
|
},
|
|
@@ -26768,7 +27057,7 @@ function createNpmService(ctx) {
|
|
|
26768
27057
|
}
|
|
26769
27058
|
}
|
|
26770
27059
|
});
|
|
26771
|
-
const resolvedOptions = _optionalChain([ctx, 'access',
|
|
27060
|
+
const resolvedOptions = _optionalChain([ctx, 'access', _539 => _539.configService, 'optionalAccess', _540 => _540.weappViteConfig, 'optionalAccess', _541 => _541.npm, 'optionalAccess', _542 => _542.buildOptions, 'optionalCall', _543 => _543(
|
|
26772
27061
|
mergedOptions,
|
|
26773
27062
|
{ name, entry }
|
|
26774
27063
|
)]);
|
|
@@ -26881,7 +27170,7 @@ function createNpmService(ctx) {
|
|
|
26881
27170
|
throw new Error("configService must be initialized before resolving npm relation list");
|
|
26882
27171
|
}
|
|
26883
27172
|
let packNpmRelationList = [];
|
|
26884
|
-
if (_optionalChain([ctx, 'access',
|
|
27173
|
+
if (_optionalChain([ctx, 'access', _544 => _544.configService, 'access', _545 => _545.projectConfig, 'access', _546 => _546.setting, 'optionalAccess', _547 => _547.packNpmManually]) && Array.isArray(ctx.configService.projectConfig.setting.packNpmRelationList)) {
|
|
26885
27174
|
packNpmRelationList = ctx.configService.projectConfig.setting.packNpmRelationList;
|
|
26886
27175
|
} else {
|
|
26887
27176
|
packNpmRelationList = [
|
|
@@ -26894,10 +27183,10 @@ function createNpmService(ctx) {
|
|
|
26894
27183
|
return packNpmRelationList;
|
|
26895
27184
|
}
|
|
26896
27185
|
async function build3(options) {
|
|
26897
|
-
if (!_optionalChain([ctx, 'access',
|
|
27186
|
+
if (!_optionalChain([ctx, 'access', _548 => _548.configService, 'optionalAccess', _549 => _549.weappViteConfig, 'optionalAccess', _550 => _550.npm, 'optionalAccess', _551 => _551.enable])) {
|
|
26898
27187
|
return;
|
|
26899
27188
|
}
|
|
26900
|
-
_optionalChain([debug, 'optionalCall',
|
|
27189
|
+
_optionalChain([debug, 'optionalCall', _552 => _552("buildNpm start")]);
|
|
26901
27190
|
const packNpmRelationList = getPackNpmRelationList();
|
|
26902
27191
|
const [mainRelation, ...subRelations] = packNpmRelationList;
|
|
26903
27192
|
const packageJsonPath = _pathe2.default.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
|
|
@@ -26972,7 +27261,7 @@ function createNpmService(ctx) {
|
|
|
26972
27261
|
}
|
|
26973
27262
|
}
|
|
26974
27263
|
}
|
|
26975
|
-
_optionalChain([debug, 'optionalCall',
|
|
27264
|
+
_optionalChain([debug, 'optionalCall', _553 => _553("buildNpm end")]);
|
|
26976
27265
|
}
|
|
26977
27266
|
return {
|
|
26978
27267
|
getDependenciesCacheFilePath,
|
|
@@ -27016,7 +27305,7 @@ var TimeoutError = (_class16 = class _TimeoutError extends Error {
|
|
|
27016
27305
|
__init36() {this.name = "TimeoutError"}
|
|
27017
27306
|
constructor(message, options) {
|
|
27018
27307
|
super(message, options);_class16.prototype.__init36.call(this);;
|
|
27019
|
-
_optionalChain([Error, 'access',
|
|
27308
|
+
_optionalChain([Error, 'access', _554 => _554.captureStackTrace, 'optionalCall', _555 => _555(this, _TimeoutError)]);
|
|
27020
27309
|
}
|
|
27021
27310
|
}, _class16);
|
|
27022
27311
|
var getAbortedReason = (signal) => _nullishCoalesce(signal.reason, () => ( new DOMException("This operation was aborted.", "AbortError")));
|
|
@@ -27034,7 +27323,7 @@ function pTimeout(promise, options) {
|
|
|
27034
27323
|
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
|
27035
27324
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
27036
27325
|
}
|
|
27037
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
27326
|
+
if (_optionalChain([signal, 'optionalAccess', _556 => _556.aborted])) {
|
|
27038
27327
|
reject(getAbortedReason(signal));
|
|
27039
27328
|
return;
|
|
27040
27329
|
}
|
|
@@ -27132,7 +27421,7 @@ var PriorityQueue = class {
|
|
|
27132
27421
|
}
|
|
27133
27422
|
dequeue() {
|
|
27134
27423
|
const item = this.#queue.shift();
|
|
27135
|
-
return _optionalChain([item, 'optionalAccess',
|
|
27424
|
+
return _optionalChain([item, 'optionalAccess', _557 => _557.run]);
|
|
27136
27425
|
}
|
|
27137
27426
|
filter(options) {
|
|
27138
27427
|
return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
@@ -27193,10 +27482,10 @@ var PQueue = class extends import_index5.default {
|
|
|
27193
27482
|
...options
|
|
27194
27483
|
};
|
|
27195
27484
|
if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
|
|
27196
|
-
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access',
|
|
27485
|
+
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access', _558 => _558.intervalCap, 'optionalAccess', _559 => _559.toString, 'call', _560 => _560()]), () => ( ""))}\` (${typeof options.intervalCap})`);
|
|
27197
27486
|
}
|
|
27198
27487
|
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
|
|
27199
|
-
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access',
|
|
27488
|
+
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access', _561 => _561.interval, 'optionalAccess', _562 => _562.toString, 'call', _563 => _563()]), () => ( ""))}\` (${typeof options.interval})`);
|
|
27200
27489
|
}
|
|
27201
27490
|
this.#carryoverIntervalCount = _nullishCoalesce(_nullishCoalesce(options.carryoverIntervalCount, () => ( options.carryoverConcurrencyCount)), () => ( false));
|
|
27202
27491
|
this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;
|
|
@@ -27397,7 +27686,7 @@ var PQueue = class extends import_index5.default {
|
|
|
27397
27686
|
let eventListener;
|
|
27398
27687
|
try {
|
|
27399
27688
|
try {
|
|
27400
|
-
_optionalChain([options, 'access',
|
|
27689
|
+
_optionalChain([options, 'access', _564 => _564.signal, 'optionalAccess', _565 => _565.throwIfAborted, 'call', _566 => _566()]);
|
|
27401
27690
|
} catch (error) {
|
|
27402
27691
|
if (!this.#isIntervalIgnored) {
|
|
27403
27692
|
this.#intervalCount--;
|
|
@@ -27429,7 +27718,7 @@ var PQueue = class extends import_index5.default {
|
|
|
27429
27718
|
this.emit("error", error);
|
|
27430
27719
|
} finally {
|
|
27431
27720
|
if (eventListener) {
|
|
27432
|
-
_optionalChain([options, 'access',
|
|
27721
|
+
_optionalChain([options, 'access', _567 => _567.signal, 'optionalAccess', _568 => _568.removeEventListener, 'call', _569 => _569("abort", eventListener)]);
|
|
27433
27722
|
}
|
|
27434
27723
|
this.#runningTasks.delete(taskSymbol);
|
|
27435
27724
|
queueMicrotask(() => {
|
|
@@ -27779,7 +28068,7 @@ var FileCache = class {
|
|
|
27779
28068
|
return true;
|
|
27780
28069
|
}
|
|
27781
28070
|
const cachedMtime = this.mtimeMap.get(id);
|
|
27782
|
-
const nextSignature = _optionalChain([options, 'optionalAccess',
|
|
28071
|
+
const nextSignature = _optionalChain([options, 'optionalAccess', _570 => _570.content]) !== void 0 ? createSignature(options.content) : void 0;
|
|
27783
28072
|
const updateSignature = () => {
|
|
27784
28073
|
if (nextSignature !== void 0) {
|
|
27785
28074
|
this.signatureMap.set(id, nextSignature);
|
|
@@ -28014,7 +28303,7 @@ function coerceStyleConfig(entry) {
|
|
|
28014
28303
|
if (!entry || typeof entry !== "object") {
|
|
28015
28304
|
return void 0;
|
|
28016
28305
|
}
|
|
28017
|
-
const source = _optionalChain([entry, 'access',
|
|
28306
|
+
const source = _optionalChain([entry, 'access', _571 => _571.source, 'optionalAccess', _572 => _572.toString, 'call', _573 => _573(), 'access', _574 => _574.trim, 'call', _575 => _575()]);
|
|
28018
28307
|
if (!source) {
|
|
28019
28308
|
return void 0;
|
|
28020
28309
|
}
|
|
@@ -28190,7 +28479,7 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
|
|
|
28190
28479
|
if (!service) {
|
|
28191
28480
|
return void 0;
|
|
28192
28481
|
}
|
|
28193
|
-
const root = _optionalChain([subPackage, 'access',
|
|
28482
|
+
const root = _optionalChain([subPackage, 'access', _576 => _576.root, 'optionalAccess', _577 => _577.trim, 'call', _578 => _578()]);
|
|
28194
28483
|
if (!root) {
|
|
28195
28484
|
return void 0;
|
|
28196
28485
|
}
|
|
@@ -28316,7 +28605,7 @@ function createScanService(ctx) {
|
|
|
28316
28605
|
if (!ctx.configService) {
|
|
28317
28606
|
throw new Error("configService must be initialized before scanning subpackages");
|
|
28318
28607
|
}
|
|
28319
|
-
const json = _optionalChain([scanState, 'access',
|
|
28608
|
+
const json = _optionalChain([scanState, 'access', _579 => _579.appEntry, 'optionalAccess', _580 => _580.json]);
|
|
28320
28609
|
if (scanState.isDirty || subPackageMap.size === 0) {
|
|
28321
28610
|
subPackageMap.clear();
|
|
28322
28611
|
independentSubPackageMap.clear();
|
|
@@ -28334,16 +28623,16 @@ function createScanService(ctx) {
|
|
|
28334
28623
|
subPackage,
|
|
28335
28624
|
entries: resolveSubPackageEntries(subPackage)
|
|
28336
28625
|
};
|
|
28337
|
-
const subPackageConfig = _optionalChain([ctx, 'access',
|
|
28338
|
-
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
28339
|
-
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
28340
|
-
meta.autoImportComponents = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
28626
|
+
const subPackageConfig = _optionalChain([ctx, 'access', _581 => _581.configService, 'access', _582 => _582.weappViteConfig, 'optionalAccess', _583 => _583.subPackages, 'optionalAccess', _584 => _584[subPackage.root]]);
|
|
28627
|
+
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess', _585 => _585.dependencies]);
|
|
28628
|
+
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess', _586 => _586.inlineConfig]);
|
|
28629
|
+
meta.autoImportComponents = _optionalChain([subPackageConfig, 'optionalAccess', _587 => _587.autoImportComponents]);
|
|
28341
28630
|
meta.styleEntries = normalizeSubPackageStyleEntries(
|
|
28342
|
-
_optionalChain([subPackageConfig, 'optionalAccess',
|
|
28631
|
+
_optionalChain([subPackageConfig, 'optionalAccess', _588 => _588.styles]),
|
|
28343
28632
|
subPackage,
|
|
28344
28633
|
ctx.configService
|
|
28345
28634
|
);
|
|
28346
|
-
meta.watchSharedStyles = _nullishCoalesce(_optionalChain([subPackageConfig, 'optionalAccess',
|
|
28635
|
+
meta.watchSharedStyles = _nullishCoalesce(_optionalChain([subPackageConfig, 'optionalAccess', _589 => _589.watchSharedStyles]), () => ( true));
|
|
28347
28636
|
metas.push(meta);
|
|
28348
28637
|
if (subPackage.root) {
|
|
28349
28638
|
subPackageMap.set(subPackage.root, meta);
|
|
@@ -28399,11 +28688,11 @@ function createScanService(ctx) {
|
|
|
28399
28688
|
loadSubPackages,
|
|
28400
28689
|
isMainPackageFileName,
|
|
28401
28690
|
get workersOptions() {
|
|
28402
|
-
return _optionalChain([scanState, 'access',
|
|
28691
|
+
return _optionalChain([scanState, 'access', _590 => _590.appEntry, 'optionalAccess', _591 => _591.json, 'optionalAccess', _592 => _592.workers]);
|
|
28403
28692
|
},
|
|
28404
28693
|
get workersDir() {
|
|
28405
|
-
const workersOptions = _optionalChain([scanState, 'access',
|
|
28406
|
-
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess',
|
|
28694
|
+
const workersOptions = _optionalChain([scanState, 'access', _593 => _593.appEntry, 'optionalAccess', _594 => _594.json, 'optionalAccess', _595 => _595.workers]);
|
|
28695
|
+
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess', _596 => _596.path]) : workersOptions;
|
|
28407
28696
|
},
|
|
28408
28697
|
markDirty() {
|
|
28409
28698
|
scanState.isDirty = true;
|
|
@@ -28450,7 +28739,7 @@ function createWatcherService(ctx) {
|
|
|
28450
28739
|
},
|
|
28451
28740
|
setRollupWatcher(watcher, root = "/") {
|
|
28452
28741
|
const oldWatcher = rollupWatcherMap.get(root);
|
|
28453
|
-
_optionalChain([oldWatcher, 'optionalAccess',
|
|
28742
|
+
_optionalChain([oldWatcher, 'optionalAccess', _597 => _597.close, 'call', _598 => _598()]);
|
|
28454
28743
|
rollupWatcherMap.set(root, watcher);
|
|
28455
28744
|
},
|
|
28456
28745
|
closeAll() {
|
|
@@ -28463,7 +28752,7 @@ function createWatcherService(ctx) {
|
|
|
28463
28752
|
});
|
|
28464
28753
|
});
|
|
28465
28754
|
sidecarWatcherMap.clear();
|
|
28466
|
-
void _optionalChain([ctx, 'access',
|
|
28755
|
+
void _optionalChain([ctx, 'access', _599 => _599.webService, 'optionalAccess', _600 => _600.close, 'call', _601 => _601(), 'access', _602 => _602.catch, 'call', _603 => _603(() => {
|
|
28467
28756
|
})]);
|
|
28468
28757
|
},
|
|
28469
28758
|
close(root = "/") {
|
|
@@ -28479,7 +28768,7 @@ function createWatcherService(ctx) {
|
|
|
28479
28768
|
sidecarWatcherMap.delete(root);
|
|
28480
28769
|
}
|
|
28481
28770
|
if (rollupWatcherMap.size === 0 && sidecarWatcherMap.size === 0) {
|
|
28482
|
-
void _optionalChain([ctx, 'access',
|
|
28771
|
+
void _optionalChain([ctx, 'access', _604 => _604.webService, 'optionalAccess', _605 => _605.close, 'call', _606 => _606(), 'access', _607 => _607.catch, 'call', _608 => _608(() => {
|
|
28483
28772
|
})]);
|
|
28484
28773
|
}
|
|
28485
28774
|
}
|
|
@@ -28492,7 +28781,7 @@ function createWatcherServicePlugin(ctx) {
|
|
|
28492
28781
|
name: "weapp-runtime:watcher-service",
|
|
28493
28782
|
closeBundle() {
|
|
28494
28783
|
const configService = ctx.configService;
|
|
28495
|
-
const isWatchMode = _optionalChain([configService, 'optionalAccess',
|
|
28784
|
+
const isWatchMode = _optionalChain([configService, 'optionalAccess', _609 => _609.isDev]) || Boolean(_optionalChain([configService, 'optionalAccess', _610 => _610.inlineConfig, 'optionalAccess', _611 => _611.build, 'optionalAccess', _612 => _612.watch]));
|
|
28496
28785
|
if (!isWatchMode) {
|
|
28497
28786
|
service.closeAll();
|
|
28498
28787
|
}
|
|
@@ -28509,10 +28798,10 @@ function createWebService(ctx) {
|
|
|
28509
28798
|
}
|
|
28510
28799
|
let devServer;
|
|
28511
28800
|
function isEnabled() {
|
|
28512
|
-
return Boolean(_optionalChain([ctx, 'access',
|
|
28801
|
+
return Boolean(_optionalChain([ctx, 'access', _613 => _613.configService, 'optionalAccess', _614 => _614.weappWebConfig, 'optionalAccess', _615 => _615.enabled]));
|
|
28513
28802
|
}
|
|
28514
28803
|
async function startDevServer() {
|
|
28515
|
-
if (!_optionalChain([ctx, 'access',
|
|
28804
|
+
if (!_optionalChain([ctx, 'access', _616 => _616.configService, 'optionalAccess', _617 => _617.isDev])) {
|
|
28516
28805
|
return void 0;
|
|
28517
28806
|
}
|
|
28518
28807
|
if (!isEnabled()) {
|
|
@@ -28521,7 +28810,7 @@ function createWebService(ctx) {
|
|
|
28521
28810
|
if (devServer) {
|
|
28522
28811
|
return devServer;
|
|
28523
28812
|
}
|
|
28524
|
-
const inlineConfig = _optionalChain([ctx, 'access',
|
|
28813
|
+
const inlineConfig = _optionalChain([ctx, 'access', _618 => _618.configService, 'optionalAccess', _619 => _619.mergeWeb, 'call', _620 => _620()]);
|
|
28525
28814
|
if (!inlineConfig) {
|
|
28526
28815
|
return void 0;
|
|
28527
28816
|
}
|
|
@@ -28534,7 +28823,7 @@ function createWebService(ctx) {
|
|
|
28534
28823
|
if (!isEnabled()) {
|
|
28535
28824
|
return void 0;
|
|
28536
28825
|
}
|
|
28537
|
-
const inlineConfig = _optionalChain([ctx, 'access',
|
|
28826
|
+
const inlineConfig = _optionalChain([ctx, 'access', _621 => _621.configService, 'optionalAccess', _622 => _622.mergeWeb, 'call', _623 => _623()]);
|
|
28538
28827
|
if (!inlineConfig) {
|
|
28539
28828
|
return void 0;
|
|
28540
28829
|
}
|
|
@@ -28564,7 +28853,7 @@ function createWebServicePlugin(ctx) {
|
|
|
28564
28853
|
return {
|
|
28565
28854
|
name: "weapp-runtime:web-service",
|
|
28566
28855
|
async closeBundle() {
|
|
28567
|
-
if (!_optionalChain([ctx, 'access',
|
|
28856
|
+
if (!_optionalChain([ctx, 'access', _624 => _624.configService, 'optionalAccess', _625 => _625.isDev])) {
|
|
28568
28857
|
await service.close();
|
|
28569
28858
|
}
|
|
28570
28859
|
}
|
|
@@ -31215,7 +31504,7 @@ function createWxmlService(ctx) {
|
|
|
31215
31504
|
return set3;
|
|
31216
31505
|
}
|
|
31217
31506
|
function clearAll() {
|
|
31218
|
-
const currentRoot = _optionalChain([ctx, 'access',
|
|
31507
|
+
const currentRoot = _optionalChain([ctx, 'access', _626 => _626.configService, 'optionalAccess', _627 => _627.currentSubPackageRoot]);
|
|
31219
31508
|
if (!currentRoot) {
|
|
31220
31509
|
depsMap.clear();
|
|
31221
31510
|
tokenMap.clear();
|
|
@@ -31274,7 +31563,7 @@ function createWxmlService(ctx) {
|
|
|
31274
31563
|
if (!ctx.configService) {
|
|
31275
31564
|
throw new Error("configService must be initialized before scanning wxml");
|
|
31276
31565
|
}
|
|
31277
|
-
const wxmlConfig = _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
31566
|
+
const wxmlConfig = _nullishCoalesce(_optionalChain([ctx, 'access', _628 => _628.configService, 'access', _629 => _629.weappViteConfig, 'optionalAccess', _630 => _630.wxml]), () => ( _optionalChain([ctx, 'access', _631 => _631.configService, 'access', _632 => _632.weappViteConfig, 'optionalAccess', _633 => _633.enhance, 'optionalAccess', _634 => _634.wxml])));
|
|
31278
31567
|
return scanWxml(wxml, {
|
|
31279
31568
|
platform: ctx.configService.platform,
|
|
31280
31569
|
...wxmlConfig === true ? {} : wxmlConfig
|