weapp-vite 6.0.0-alpha.1 → 6.0.0-alpha.3
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-4P5KX3LT.mjs → chunk-645T2KR3.mjs} +344 -45
- package/dist/{chunk-EL4WI75Z.cjs → chunk-HXHJ32P4.cjs} +415 -116
- package/dist/{chunk-FB7KR7SH.cjs → chunk-TLK44FFK.cjs} +4 -4
- package/dist/{chunk-VKLSO3EM.mjs → chunk-TTGMOBMK.mjs} +1 -1
- 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
|
)]);
|
|
@@ -26822,11 +27111,11 @@ function createNpmService(ctx) {
|
|
|
26822
27111
|
const dependencies = _nullishCoalesce(targetJson.dependencies, () => ( {}));
|
|
26823
27112
|
const keys = Object.keys(dependencies);
|
|
26824
27113
|
const destOutDir = _pathe2.default.resolve(outDir, dep);
|
|
26825
|
-
if (await shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
|
|
26826
|
-
logger_default.info(`[npm] \u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
|
|
26827
|
-
return;
|
|
26828
|
-
}
|
|
26829
27114
|
if (isMiniprogramPackage(targetJson)) {
|
|
27115
|
+
if (await shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
|
|
27116
|
+
logger_default.info(`[npm] \u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
|
|
27117
|
+
return;
|
|
27118
|
+
}
|
|
26830
27119
|
await copyBuild({
|
|
26831
27120
|
from: _pathe2.default.resolve(
|
|
26832
27121
|
rootPath,
|
|
@@ -26853,6 +27142,16 @@ function createNpmService(ctx) {
|
|
|
26853
27142
|
logger_default.warn(`[npm] \u65E0\u6CD5\u89E3\u6790\u6A21\u5757 \`${dep}\`\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
|
|
26854
27143
|
return;
|
|
26855
27144
|
}
|
|
27145
|
+
if (!isDependenciesCacheOutdate && await _fsextra2.default.exists(destOutDir)) {
|
|
27146
|
+
const destEntry = _pathe2.default.resolve(destOutDir, "index.js");
|
|
27147
|
+
if (await _fsextra2.default.exists(destEntry)) {
|
|
27148
|
+
const [srcStat, destStat] = await Promise.all([_fsextra2.default.stat(index), _fsextra2.default.stat(destEntry)]);
|
|
27149
|
+
if (srcStat.mtimeMs <= destStat.mtimeMs) {
|
|
27150
|
+
logger_default.info(`[npm] \u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
|
|
27151
|
+
return;
|
|
27152
|
+
}
|
|
27153
|
+
}
|
|
27154
|
+
}
|
|
26856
27155
|
await bundleBuild({
|
|
26857
27156
|
entry: {
|
|
26858
27157
|
index
|
|
@@ -26881,7 +27180,7 @@ function createNpmService(ctx) {
|
|
|
26881
27180
|
throw new Error("configService must be initialized before resolving npm relation list");
|
|
26882
27181
|
}
|
|
26883
27182
|
let packNpmRelationList = [];
|
|
26884
|
-
if (_optionalChain([ctx, 'access',
|
|
27183
|
+
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
27184
|
packNpmRelationList = ctx.configService.projectConfig.setting.packNpmRelationList;
|
|
26886
27185
|
} else {
|
|
26887
27186
|
packNpmRelationList = [
|
|
@@ -26894,10 +27193,10 @@ function createNpmService(ctx) {
|
|
|
26894
27193
|
return packNpmRelationList;
|
|
26895
27194
|
}
|
|
26896
27195
|
async function build3(options) {
|
|
26897
|
-
if (!_optionalChain([ctx, 'access',
|
|
27196
|
+
if (!_optionalChain([ctx, 'access', _548 => _548.configService, 'optionalAccess', _549 => _549.weappViteConfig, 'optionalAccess', _550 => _550.npm, 'optionalAccess', _551 => _551.enable])) {
|
|
26898
27197
|
return;
|
|
26899
27198
|
}
|
|
26900
|
-
_optionalChain([debug, 'optionalCall',
|
|
27199
|
+
_optionalChain([debug, 'optionalCall', _552 => _552("buildNpm start")]);
|
|
26901
27200
|
const packNpmRelationList = getPackNpmRelationList();
|
|
26902
27201
|
const [mainRelation, ...subRelations] = packNpmRelationList;
|
|
26903
27202
|
const packageJsonPath = _pathe2.default.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
|
|
@@ -26972,7 +27271,7 @@ function createNpmService(ctx) {
|
|
|
26972
27271
|
}
|
|
26973
27272
|
}
|
|
26974
27273
|
}
|
|
26975
|
-
_optionalChain([debug, 'optionalCall',
|
|
27274
|
+
_optionalChain([debug, 'optionalCall', _553 => _553("buildNpm end")]);
|
|
26976
27275
|
}
|
|
26977
27276
|
return {
|
|
26978
27277
|
getDependenciesCacheFilePath,
|
|
@@ -27016,7 +27315,7 @@ var TimeoutError = (_class16 = class _TimeoutError extends Error {
|
|
|
27016
27315
|
__init36() {this.name = "TimeoutError"}
|
|
27017
27316
|
constructor(message, options) {
|
|
27018
27317
|
super(message, options);_class16.prototype.__init36.call(this);;
|
|
27019
|
-
_optionalChain([Error, 'access',
|
|
27318
|
+
_optionalChain([Error, 'access', _554 => _554.captureStackTrace, 'optionalCall', _555 => _555(this, _TimeoutError)]);
|
|
27020
27319
|
}
|
|
27021
27320
|
}, _class16);
|
|
27022
27321
|
var getAbortedReason = (signal) => _nullishCoalesce(signal.reason, () => ( new DOMException("This operation was aborted.", "AbortError")));
|
|
@@ -27034,7 +27333,7 @@ function pTimeout(promise, options) {
|
|
|
27034
27333
|
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
|
27035
27334
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
27036
27335
|
}
|
|
27037
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
27336
|
+
if (_optionalChain([signal, 'optionalAccess', _556 => _556.aborted])) {
|
|
27038
27337
|
reject(getAbortedReason(signal));
|
|
27039
27338
|
return;
|
|
27040
27339
|
}
|
|
@@ -27132,7 +27431,7 @@ var PriorityQueue = class {
|
|
|
27132
27431
|
}
|
|
27133
27432
|
dequeue() {
|
|
27134
27433
|
const item = this.#queue.shift();
|
|
27135
|
-
return _optionalChain([item, 'optionalAccess',
|
|
27434
|
+
return _optionalChain([item, 'optionalAccess', _557 => _557.run]);
|
|
27136
27435
|
}
|
|
27137
27436
|
filter(options) {
|
|
27138
27437
|
return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
@@ -27193,10 +27492,10 @@ var PQueue = class extends import_index5.default {
|
|
|
27193
27492
|
...options
|
|
27194
27493
|
};
|
|
27195
27494
|
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',
|
|
27495
|
+
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
27496
|
}
|
|
27198
27497
|
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',
|
|
27498
|
+
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
27499
|
}
|
|
27201
27500
|
this.#carryoverIntervalCount = _nullishCoalesce(_nullishCoalesce(options.carryoverIntervalCount, () => ( options.carryoverConcurrencyCount)), () => ( false));
|
|
27202
27501
|
this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;
|
|
@@ -27397,7 +27696,7 @@ var PQueue = class extends import_index5.default {
|
|
|
27397
27696
|
let eventListener;
|
|
27398
27697
|
try {
|
|
27399
27698
|
try {
|
|
27400
|
-
_optionalChain([options, 'access',
|
|
27699
|
+
_optionalChain([options, 'access', _564 => _564.signal, 'optionalAccess', _565 => _565.throwIfAborted, 'call', _566 => _566()]);
|
|
27401
27700
|
} catch (error) {
|
|
27402
27701
|
if (!this.#isIntervalIgnored) {
|
|
27403
27702
|
this.#intervalCount--;
|
|
@@ -27429,7 +27728,7 @@ var PQueue = class extends import_index5.default {
|
|
|
27429
27728
|
this.emit("error", error);
|
|
27430
27729
|
} finally {
|
|
27431
27730
|
if (eventListener) {
|
|
27432
|
-
_optionalChain([options, 'access',
|
|
27731
|
+
_optionalChain([options, 'access', _567 => _567.signal, 'optionalAccess', _568 => _568.removeEventListener, 'call', _569 => _569("abort", eventListener)]);
|
|
27433
27732
|
}
|
|
27434
27733
|
this.#runningTasks.delete(taskSymbol);
|
|
27435
27734
|
queueMicrotask(() => {
|
|
@@ -27779,7 +28078,7 @@ var FileCache = class {
|
|
|
27779
28078
|
return true;
|
|
27780
28079
|
}
|
|
27781
28080
|
const cachedMtime = this.mtimeMap.get(id);
|
|
27782
|
-
const nextSignature = _optionalChain([options, 'optionalAccess',
|
|
28081
|
+
const nextSignature = _optionalChain([options, 'optionalAccess', _570 => _570.content]) !== void 0 ? createSignature(options.content) : void 0;
|
|
27783
28082
|
const updateSignature = () => {
|
|
27784
28083
|
if (nextSignature !== void 0) {
|
|
27785
28084
|
this.signatureMap.set(id, nextSignature);
|
|
@@ -28014,7 +28313,7 @@ function coerceStyleConfig(entry) {
|
|
|
28014
28313
|
if (!entry || typeof entry !== "object") {
|
|
28015
28314
|
return void 0;
|
|
28016
28315
|
}
|
|
28017
|
-
const source = _optionalChain([entry, 'access',
|
|
28316
|
+
const source = _optionalChain([entry, 'access', _571 => _571.source, 'optionalAccess', _572 => _572.toString, 'call', _573 => _573(), 'access', _574 => _574.trim, 'call', _575 => _575()]);
|
|
28018
28317
|
if (!source) {
|
|
28019
28318
|
return void 0;
|
|
28020
28319
|
}
|
|
@@ -28190,7 +28489,7 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
|
|
|
28190
28489
|
if (!service) {
|
|
28191
28490
|
return void 0;
|
|
28192
28491
|
}
|
|
28193
|
-
const root = _optionalChain([subPackage, 'access',
|
|
28492
|
+
const root = _optionalChain([subPackage, 'access', _576 => _576.root, 'optionalAccess', _577 => _577.trim, 'call', _578 => _578()]);
|
|
28194
28493
|
if (!root) {
|
|
28195
28494
|
return void 0;
|
|
28196
28495
|
}
|
|
@@ -28316,7 +28615,7 @@ function createScanService(ctx) {
|
|
|
28316
28615
|
if (!ctx.configService) {
|
|
28317
28616
|
throw new Error("configService must be initialized before scanning subpackages");
|
|
28318
28617
|
}
|
|
28319
|
-
const json = _optionalChain([scanState, 'access',
|
|
28618
|
+
const json = _optionalChain([scanState, 'access', _579 => _579.appEntry, 'optionalAccess', _580 => _580.json]);
|
|
28320
28619
|
if (scanState.isDirty || subPackageMap.size === 0) {
|
|
28321
28620
|
subPackageMap.clear();
|
|
28322
28621
|
independentSubPackageMap.clear();
|
|
@@ -28334,16 +28633,16 @@ function createScanService(ctx) {
|
|
|
28334
28633
|
subPackage,
|
|
28335
28634
|
entries: resolveSubPackageEntries(subPackage)
|
|
28336
28635
|
};
|
|
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',
|
|
28636
|
+
const subPackageConfig = _optionalChain([ctx, 'access', _581 => _581.configService, 'access', _582 => _582.weappViteConfig, 'optionalAccess', _583 => _583.subPackages, 'optionalAccess', _584 => _584[subPackage.root]]);
|
|
28637
|
+
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess', _585 => _585.dependencies]);
|
|
28638
|
+
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess', _586 => _586.inlineConfig]);
|
|
28639
|
+
meta.autoImportComponents = _optionalChain([subPackageConfig, 'optionalAccess', _587 => _587.autoImportComponents]);
|
|
28341
28640
|
meta.styleEntries = normalizeSubPackageStyleEntries(
|
|
28342
|
-
_optionalChain([subPackageConfig, 'optionalAccess',
|
|
28641
|
+
_optionalChain([subPackageConfig, 'optionalAccess', _588 => _588.styles]),
|
|
28343
28642
|
subPackage,
|
|
28344
28643
|
ctx.configService
|
|
28345
28644
|
);
|
|
28346
|
-
meta.watchSharedStyles = _nullishCoalesce(_optionalChain([subPackageConfig, 'optionalAccess',
|
|
28645
|
+
meta.watchSharedStyles = _nullishCoalesce(_optionalChain([subPackageConfig, 'optionalAccess', _589 => _589.watchSharedStyles]), () => ( true));
|
|
28347
28646
|
metas.push(meta);
|
|
28348
28647
|
if (subPackage.root) {
|
|
28349
28648
|
subPackageMap.set(subPackage.root, meta);
|
|
@@ -28399,11 +28698,11 @@ function createScanService(ctx) {
|
|
|
28399
28698
|
loadSubPackages,
|
|
28400
28699
|
isMainPackageFileName,
|
|
28401
28700
|
get workersOptions() {
|
|
28402
|
-
return _optionalChain([scanState, 'access',
|
|
28701
|
+
return _optionalChain([scanState, 'access', _590 => _590.appEntry, 'optionalAccess', _591 => _591.json, 'optionalAccess', _592 => _592.workers]);
|
|
28403
28702
|
},
|
|
28404
28703
|
get workersDir() {
|
|
28405
|
-
const workersOptions = _optionalChain([scanState, 'access',
|
|
28406
|
-
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess',
|
|
28704
|
+
const workersOptions = _optionalChain([scanState, 'access', _593 => _593.appEntry, 'optionalAccess', _594 => _594.json, 'optionalAccess', _595 => _595.workers]);
|
|
28705
|
+
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess', _596 => _596.path]) : workersOptions;
|
|
28407
28706
|
},
|
|
28408
28707
|
markDirty() {
|
|
28409
28708
|
scanState.isDirty = true;
|
|
@@ -28450,7 +28749,7 @@ function createWatcherService(ctx) {
|
|
|
28450
28749
|
},
|
|
28451
28750
|
setRollupWatcher(watcher, root = "/") {
|
|
28452
28751
|
const oldWatcher = rollupWatcherMap.get(root);
|
|
28453
|
-
_optionalChain([oldWatcher, 'optionalAccess',
|
|
28752
|
+
_optionalChain([oldWatcher, 'optionalAccess', _597 => _597.close, 'call', _598 => _598()]);
|
|
28454
28753
|
rollupWatcherMap.set(root, watcher);
|
|
28455
28754
|
},
|
|
28456
28755
|
closeAll() {
|
|
@@ -28463,7 +28762,7 @@ function createWatcherService(ctx) {
|
|
|
28463
28762
|
});
|
|
28464
28763
|
});
|
|
28465
28764
|
sidecarWatcherMap.clear();
|
|
28466
|
-
void _optionalChain([ctx, 'access',
|
|
28765
|
+
void _optionalChain([ctx, 'access', _599 => _599.webService, 'optionalAccess', _600 => _600.close, 'call', _601 => _601(), 'access', _602 => _602.catch, 'call', _603 => _603(() => {
|
|
28467
28766
|
})]);
|
|
28468
28767
|
},
|
|
28469
28768
|
close(root = "/") {
|
|
@@ -28479,7 +28778,7 @@ function createWatcherService(ctx) {
|
|
|
28479
28778
|
sidecarWatcherMap.delete(root);
|
|
28480
28779
|
}
|
|
28481
28780
|
if (rollupWatcherMap.size === 0 && sidecarWatcherMap.size === 0) {
|
|
28482
|
-
void _optionalChain([ctx, 'access',
|
|
28781
|
+
void _optionalChain([ctx, 'access', _604 => _604.webService, 'optionalAccess', _605 => _605.close, 'call', _606 => _606(), 'access', _607 => _607.catch, 'call', _608 => _608(() => {
|
|
28483
28782
|
})]);
|
|
28484
28783
|
}
|
|
28485
28784
|
}
|
|
@@ -28492,7 +28791,7 @@ function createWatcherServicePlugin(ctx) {
|
|
|
28492
28791
|
name: "weapp-runtime:watcher-service",
|
|
28493
28792
|
closeBundle() {
|
|
28494
28793
|
const configService = ctx.configService;
|
|
28495
|
-
const isWatchMode = _optionalChain([configService, 'optionalAccess',
|
|
28794
|
+
const isWatchMode = _optionalChain([configService, 'optionalAccess', _609 => _609.isDev]) || Boolean(_optionalChain([configService, 'optionalAccess', _610 => _610.inlineConfig, 'optionalAccess', _611 => _611.build, 'optionalAccess', _612 => _612.watch]));
|
|
28496
28795
|
if (!isWatchMode) {
|
|
28497
28796
|
service.closeAll();
|
|
28498
28797
|
}
|
|
@@ -28509,10 +28808,10 @@ function createWebService(ctx) {
|
|
|
28509
28808
|
}
|
|
28510
28809
|
let devServer;
|
|
28511
28810
|
function isEnabled() {
|
|
28512
|
-
return Boolean(_optionalChain([ctx, 'access',
|
|
28811
|
+
return Boolean(_optionalChain([ctx, 'access', _613 => _613.configService, 'optionalAccess', _614 => _614.weappWebConfig, 'optionalAccess', _615 => _615.enabled]));
|
|
28513
28812
|
}
|
|
28514
28813
|
async function startDevServer() {
|
|
28515
|
-
if (!_optionalChain([ctx, 'access',
|
|
28814
|
+
if (!_optionalChain([ctx, 'access', _616 => _616.configService, 'optionalAccess', _617 => _617.isDev])) {
|
|
28516
28815
|
return void 0;
|
|
28517
28816
|
}
|
|
28518
28817
|
if (!isEnabled()) {
|
|
@@ -28521,7 +28820,7 @@ function createWebService(ctx) {
|
|
|
28521
28820
|
if (devServer) {
|
|
28522
28821
|
return devServer;
|
|
28523
28822
|
}
|
|
28524
|
-
const inlineConfig = _optionalChain([ctx, 'access',
|
|
28823
|
+
const inlineConfig = _optionalChain([ctx, 'access', _618 => _618.configService, 'optionalAccess', _619 => _619.mergeWeb, 'call', _620 => _620()]);
|
|
28525
28824
|
if (!inlineConfig) {
|
|
28526
28825
|
return void 0;
|
|
28527
28826
|
}
|
|
@@ -28534,7 +28833,7 @@ function createWebService(ctx) {
|
|
|
28534
28833
|
if (!isEnabled()) {
|
|
28535
28834
|
return void 0;
|
|
28536
28835
|
}
|
|
28537
|
-
const inlineConfig = _optionalChain([ctx, 'access',
|
|
28836
|
+
const inlineConfig = _optionalChain([ctx, 'access', _621 => _621.configService, 'optionalAccess', _622 => _622.mergeWeb, 'call', _623 => _623()]);
|
|
28538
28837
|
if (!inlineConfig) {
|
|
28539
28838
|
return void 0;
|
|
28540
28839
|
}
|
|
@@ -28564,7 +28863,7 @@ function createWebServicePlugin(ctx) {
|
|
|
28564
28863
|
return {
|
|
28565
28864
|
name: "weapp-runtime:web-service",
|
|
28566
28865
|
async closeBundle() {
|
|
28567
|
-
if (!_optionalChain([ctx, 'access',
|
|
28866
|
+
if (!_optionalChain([ctx, 'access', _624 => _624.configService, 'optionalAccess', _625 => _625.isDev])) {
|
|
28568
28867
|
await service.close();
|
|
28569
28868
|
}
|
|
28570
28869
|
}
|
|
@@ -31215,7 +31514,7 @@ function createWxmlService(ctx) {
|
|
|
31215
31514
|
return set3;
|
|
31216
31515
|
}
|
|
31217
31516
|
function clearAll() {
|
|
31218
|
-
const currentRoot = _optionalChain([ctx, 'access',
|
|
31517
|
+
const currentRoot = _optionalChain([ctx, 'access', _626 => _626.configService, 'optionalAccess', _627 => _627.currentSubPackageRoot]);
|
|
31219
31518
|
if (!currentRoot) {
|
|
31220
31519
|
depsMap.clear();
|
|
31221
31520
|
tokenMap.clear();
|
|
@@ -31274,7 +31573,7 @@ function createWxmlService(ctx) {
|
|
|
31274
31573
|
if (!ctx.configService) {
|
|
31275
31574
|
throw new Error("configService must be initialized before scanning wxml");
|
|
31276
31575
|
}
|
|
31277
|
-
const wxmlConfig = _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
31576
|
+
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
31577
|
return scanWxml(wxml, {
|
|
31279
31578
|
platform: ctx.configService.platform,
|
|
31280
31579
|
...wxmlConfig === true ? {} : wxmlConfig
|