@lark.js/mvc 0.0.14 → 0.0.16
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/README.md +324 -215
- package/dist/{chunk-66OZBBSP.js → chunk-OGPBFCIK.js} +1 -4
- package/dist/client.d.cts +63 -0
- package/dist/client.d.ts +63 -0
- package/dist/compiler.cjs +93 -48
- package/dist/compiler.js +93 -48
- package/dist/devtool.cjs +885 -1465
- package/dist/devtool.js +885 -1462
- package/dist/index.cjs +1785 -2195
- package/dist/index.d.cts +568 -1287
- package/dist/index.d.ts +568 -1287
- package/dist/index.js +1764 -2187
- package/dist/rspack.cjs +142 -51
- package/dist/rspack.js +142 -51
- package/dist/runtime.cjs +1 -4
- package/dist/runtime.js +1 -1
- package/dist/vite.cjs +298 -52
- package/dist/vite.js +298 -52
- package/dist/webpack.cjs +142 -51
- package/dist/webpack.js +142 -51
- package/package.json +3 -4
package/dist/webpack.cjs
CHANGED
|
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@8.5.
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var init_cjs_shims = __esm({
|
|
38
|
-
"../../node_modules/.pnpm/tsup@8.5.
|
|
38
|
+
"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js"() {
|
|
39
39
|
"use strict";
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -14743,12 +14743,7 @@ function convertArtSyntax(source, debug) {
|
|
|
14743
14743
|
} else {
|
|
14744
14744
|
cleanCode = code.trim();
|
|
14745
14745
|
}
|
|
14746
|
-
const converted = convertArtExpression(
|
|
14747
|
-
cleanCode,
|
|
14748
|
-
debug,
|
|
14749
|
-
lineNo,
|
|
14750
|
-
blockStack
|
|
14751
|
-
);
|
|
14746
|
+
const converted = convertArtExpression(cleanCode, debug, lineNo, blockStack);
|
|
14752
14747
|
result.push(converted);
|
|
14753
14748
|
result.push(rest);
|
|
14754
14749
|
}
|
|
@@ -14994,12 +14989,74 @@ var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
|
14994
14989
|
function vdomEscapeStr(s) {
|
|
14995
14990
|
return s.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\x1e/g, "\\x1e");
|
|
14996
14991
|
}
|
|
14992
|
+
function vdomResolveAttrValueIIFE(rawValue, exprStore) {
|
|
14993
|
+
const stmts = [];
|
|
14994
|
+
let remaining = rawValue;
|
|
14995
|
+
while (remaining.length > 0) {
|
|
14996
|
+
const phIdx = remaining.indexOf("\0");
|
|
14997
|
+
const viIdx = remaining.indexOf("");
|
|
14998
|
+
let nextSpecial = -1;
|
|
14999
|
+
let specialType = null;
|
|
15000
|
+
if (phIdx >= 0 && (viIdx < 0 || phIdx <= viIdx)) {
|
|
15001
|
+
nextSpecial = phIdx;
|
|
15002
|
+
specialType = "ph";
|
|
15003
|
+
} else if (viIdx >= 0) {
|
|
15004
|
+
nextSpecial = viIdx;
|
|
15005
|
+
specialType = "vi";
|
|
15006
|
+
}
|
|
15007
|
+
if (nextSpecial === -1) {
|
|
15008
|
+
if (remaining) stmts.push(`$s+='${vdomEscapeStr(remaining)}'`);
|
|
15009
|
+
break;
|
|
15010
|
+
}
|
|
15011
|
+
if (nextSpecial > 0) {
|
|
15012
|
+
stmts.push(`$s+='${vdomEscapeStr(remaining.substring(0, nextSpecial))}'`);
|
|
15013
|
+
}
|
|
15014
|
+
if (specialType === "vi") {
|
|
15015
|
+
stmts.push(`$s+=$viewId`);
|
|
15016
|
+
remaining = remaining.substring(nextSpecial + 1);
|
|
15017
|
+
} else {
|
|
15018
|
+
const closeIdx = remaining.indexOf("\0", nextSpecial + 1);
|
|
15019
|
+
if (closeIdx === -1) {
|
|
15020
|
+
stmts.push(`$s+='${vdomEscapeStr(remaining.substring(nextSpecial))}'`);
|
|
15021
|
+
break;
|
|
15022
|
+
}
|
|
15023
|
+
const idx = parseInt(remaining.substring(nextSpecial + 1, closeIdx), 10);
|
|
15024
|
+
const expr = exprStore[idx];
|
|
15025
|
+
if (expr.op === "=" || expr.op === ":") {
|
|
15026
|
+
stmts.push(`$s+=$strSafe(${expr.content})`);
|
|
15027
|
+
} else if (expr.op === "!") {
|
|
15028
|
+
if (expr.content.startsWith("$encUri(") && expr.content.endsWith(")")) {
|
|
15029
|
+
stmts.push(`$s+=${expr.content}`);
|
|
15030
|
+
} else {
|
|
15031
|
+
stmts.push(`$s+=$strSafe(${expr.content})`);
|
|
15032
|
+
}
|
|
15033
|
+
} else if (expr.op === "@") {
|
|
15034
|
+
stmts.push(`$s+=$refFn($refAlt,${expr.content})`);
|
|
15035
|
+
} else {
|
|
15036
|
+
stmts.push(expr.content);
|
|
15037
|
+
}
|
|
15038
|
+
remaining = remaining.substring(closeIdx + 1);
|
|
15039
|
+
}
|
|
15040
|
+
}
|
|
15041
|
+
const body = stmts.join(";");
|
|
15042
|
+
return `(()=>{let $s='';${body};return $s;})()`;
|
|
15043
|
+
}
|
|
14997
15044
|
function vdomResolveAttrValue(rawValue, exprStore) {
|
|
14998
15045
|
const hasPlaceholders = rawValue.includes("\0");
|
|
14999
15046
|
const hasViewId = rawValue.includes("");
|
|
15000
15047
|
if (!hasPlaceholders && !hasViewId) {
|
|
15001
15048
|
return `'${vdomEscapeStr(rawValue)}'`;
|
|
15002
15049
|
}
|
|
15050
|
+
if (hasPlaceholders) {
|
|
15051
|
+
const codeBlockRegExp = /\x00(\d+)\x00/g;
|
|
15052
|
+
let m;
|
|
15053
|
+
while ((m = codeBlockRegExp.exec(rawValue)) !== null) {
|
|
15054
|
+
const idx = parseInt(m[1], 10);
|
|
15055
|
+
if (exprStore[idx] && exprStore[idx].op === "") {
|
|
15056
|
+
return vdomResolveAttrValueIIFE(rawValue, exprStore);
|
|
15057
|
+
}
|
|
15058
|
+
}
|
|
15059
|
+
}
|
|
15003
15060
|
const segments = [];
|
|
15004
15061
|
let remaining = rawValue;
|
|
15005
15062
|
while (remaining.length > 0) {
|
|
@@ -15033,17 +15090,17 @@ function vdomResolveAttrValue(rawValue, exprStore) {
|
|
|
15033
15090
|
const idx = parseInt(remaining.substring(nextSpecial + 1, closeIdx));
|
|
15034
15091
|
const expr = exprStore[idx];
|
|
15035
15092
|
if (expr.op === "=" || expr.op === ":") {
|
|
15036
|
-
segments.push(`$
|
|
15093
|
+
segments.push(`$strSafe(${expr.content})`);
|
|
15037
15094
|
} else if (expr.op === "!") {
|
|
15038
15095
|
if (expr.content.startsWith("$encUri(") && expr.content.endsWith(")")) {
|
|
15039
15096
|
segments.push(expr.content);
|
|
15040
15097
|
} else {
|
|
15041
|
-
segments.push(`$
|
|
15098
|
+
segments.push(`$strSafe(${expr.content})`);
|
|
15042
15099
|
}
|
|
15043
15100
|
} else if (expr.op === "@") {
|
|
15044
15101
|
segments.push(`$refFn($refAlt,${expr.content})`);
|
|
15045
15102
|
} else {
|
|
15046
|
-
segments.push(`$
|
|
15103
|
+
segments.push(`$strSafe(${expr.content})`);
|
|
15047
15104
|
}
|
|
15048
15105
|
remaining = remaining.substring(closeIdx + 1);
|
|
15049
15106
|
}
|
|
@@ -15085,14 +15142,7 @@ function compileToVDomFunction(source, debug, file) {
|
|
|
15085
15142
|
});
|
|
15086
15143
|
const rootVar = `$v${varCounter++}`;
|
|
15087
15144
|
lines.push(`let ${rootVar}=[]`);
|
|
15088
|
-
const maxVars = 30;
|
|
15089
|
-
const varDecls = [];
|
|
15090
|
-
for (let i = 1; i < maxVars; i++) {
|
|
15091
|
-
varDecls.push(`$v${i}`);
|
|
15092
|
-
}
|
|
15093
|
-
lines.push(`let ${varDecls.join(",")}`);
|
|
15094
15145
|
function allocVar() {
|
|
15095
|
-
if (varCounter >= maxVars) return `$v${maxVars - 1}`;
|
|
15096
15146
|
return `$v${varCounter++}`;
|
|
15097
15147
|
}
|
|
15098
15148
|
function emitNode(node, parentVar) {
|
|
@@ -15109,7 +15159,7 @@ function compileToVDomFunction(source, debug, file) {
|
|
|
15109
15159
|
if (i % 2 === 0) {
|
|
15110
15160
|
const trimmed = parts[i];
|
|
15111
15161
|
if (trimmed.trim()) {
|
|
15112
|
-
lines.push(`${parentVar}.push($
|
|
15162
|
+
lines.push(`${parentVar}.push($vdomCreate(0,'${vdomEscapeStr(trimmed)}'))`);
|
|
15113
15163
|
}
|
|
15114
15164
|
} else {
|
|
15115
15165
|
const idx = parseInt(parts[i]);
|
|
@@ -15120,15 +15170,15 @@ function compileToVDomFunction(source, debug, file) {
|
|
|
15120
15170
|
}
|
|
15121
15171
|
function emitExpr(expr, parentVar) {
|
|
15122
15172
|
if (expr.op === "=" || expr.op === ":") {
|
|
15123
|
-
lines.push(`${parentVar}.push($
|
|
15173
|
+
lines.push(`${parentVar}.push($vdomCreate(0,$strSafe(${expr.content})))`);
|
|
15124
15174
|
} else if (expr.op === "!") {
|
|
15125
15175
|
if (expr.content.startsWith("$encUri(") && expr.content.endsWith(")")) {
|
|
15126
|
-
lines.push(`${parentVar}.push($
|
|
15176
|
+
lines.push(`${parentVar}.push($vdomCreate(0,${expr.content},1))`);
|
|
15127
15177
|
} else {
|
|
15128
|
-
lines.push(`${parentVar}.push($
|
|
15178
|
+
lines.push(`${parentVar}.push($vdomCreate(0,$strSafe(${expr.content}),1))`);
|
|
15129
15179
|
}
|
|
15130
15180
|
} else if (expr.op === "@") {
|
|
15131
|
-
lines.push(`${parentVar}.push($
|
|
15181
|
+
lines.push(`${parentVar}.push($vdomCreate(0,$refFn($refAlt,${expr.content})))`);
|
|
15132
15182
|
} else if (expr.content) {
|
|
15133
15183
|
lines.push(expr.content);
|
|
15134
15184
|
}
|
|
@@ -15146,25 +15196,26 @@ function compileToVDomFunction(source, debug, file) {
|
|
|
15146
15196
|
}
|
|
15147
15197
|
const isVoid = VOID_ELEMENTS.has(tagName) && children.length === 0;
|
|
15148
15198
|
const childrenArg = isVoid ? "1" : childVar;
|
|
15149
|
-
lines.push(
|
|
15150
|
-
`${parentVar}.push($c('${tagName}',${propsKey},${childrenArg}))`
|
|
15151
|
-
);
|
|
15199
|
+
lines.push(`${parentVar}.push($vdomCreate('${tagName}',${propsKey},${childrenArg}))`);
|
|
15152
15200
|
}
|
|
15153
15201
|
for (const child of doc.children) {
|
|
15154
15202
|
emitNode(child, rootVar);
|
|
15155
15203
|
}
|
|
15156
|
-
lines.push(`return $
|
|
15157
|
-
const
|
|
15204
|
+
lines.push(`return $vdomCreate($viewId,0,${rootVar})`);
|
|
15205
|
+
const varDeclStmts = [];
|
|
15206
|
+
for (let i = 1; i < varCounter; i++) varDeclStmts.push(`$v${i}`);
|
|
15207
|
+
const varDecl = varDeclStmts.length ? `let ${varDeclStmts.join(",")};` : "";
|
|
15208
|
+
const body = varDecl + lines.join(";");
|
|
15158
15209
|
let funcBody = body;
|
|
15159
15210
|
if (debug) {
|
|
15160
15211
|
const filePart = file ? `\\r\\n\\tat file:${file}` : "";
|
|
15161
|
-
funcBody = `let $dbgExpr,$dbgArt
|
|
15212
|
+
funcBody = `let $dbgExpr,$dbgArt;try{${body}}catch(e){let msg='render error:'+(e.message||e);msg+='${filePart}';throw msg;}`;
|
|
15162
15213
|
}
|
|
15163
15214
|
const viewIdRegExp = new RegExp(String.fromCharCode(31), "g");
|
|
15164
15215
|
funcBody = funcBody.replace(viewIdRegExp, `'+$viewId+'`);
|
|
15165
15216
|
const refFallback = "if(!$refAlt)$refAlt=$data;";
|
|
15166
15217
|
const fullSource = `${refFallback}let $splitter='\\x1e'{{VARS}};${funcBody}`;
|
|
15167
|
-
return `($data,$viewId,$refAlt,$
|
|
15218
|
+
return `($data,$viewId,$refAlt,$strSafe,$refFn,$encUri,$encQuote)=>{${fullSource}}`;
|
|
15168
15219
|
}
|
|
15169
15220
|
|
|
15170
15221
|
// src/compiler/extract-global-vars.ts
|
|
@@ -15398,9 +15449,6 @@ var BUILTIN_GLOBALS = /* @__PURE__ */ new Set([
|
|
|
15398
15449
|
// conversion, for error reporting. Only present in debug mode.
|
|
15399
15450
|
// e.g. $dbgArt='{{=user.name}}'
|
|
15400
15451
|
"$dbgArt",
|
|
15401
|
-
// Debug: source line number — tracks the current line in the template
|
|
15402
|
-
// source, for error reporting. Only present in debug mode.
|
|
15403
|
-
"$dbgLine",
|
|
15404
15452
|
// RefData alias — fallback reference lookup table.
|
|
15405
15453
|
// Defaults to $data when no explicit $refAlt is provided.
|
|
15406
15454
|
// Ensures $refFn() does not crash when @ operator is used without refData.
|
|
@@ -15484,19 +15532,14 @@ function compileToFunction(source, debug, file) {
|
|
|
15484
15532
|
funcSource += source.substring(index, offset).replace(escapeSlashRegExp, "\\$&").replace(escapeBreakReturnRegExp, "\\n");
|
|
15485
15533
|
index = offset + match.length;
|
|
15486
15534
|
if (debug) {
|
|
15487
|
-
let expr = source.substring(
|
|
15488
|
-
index - match.length + 2 + (operate ? 1 : 0),
|
|
15489
|
-
index - 2
|
|
15490
|
-
);
|
|
15535
|
+
let expr = source.substring(index - match.length + 2 + (operate ? 1 : 0), index - 2);
|
|
15491
15536
|
const x11 = String.fromCharCode(17);
|
|
15492
15537
|
const artRegExp = new RegExp(`^'(\\d+)${x11}([^${x11}]+)${x11}'$`);
|
|
15493
15538
|
const artM = expr.match(artRegExp);
|
|
15494
15539
|
let art = "";
|
|
15495
|
-
let line = -1;
|
|
15496
15540
|
if (artM) {
|
|
15497
15541
|
expr = expr.replace(artRegExp, "");
|
|
15498
15542
|
art = artM[2];
|
|
15499
|
-
line = parseInt(artM[1], 10);
|
|
15500
15543
|
} else {
|
|
15501
15544
|
expr = expr.replace(escapeSlashRegExp, "\\$&").replace(escapeBreakReturnRegExp, "\\n");
|
|
15502
15545
|
}
|
|
@@ -15511,8 +15554,8 @@ function compileToFunction(source, debug, file) {
|
|
|
15511
15554
|
}
|
|
15512
15555
|
funcSource += `'+($dbgExpr='<%${operate + expr}%>',${content})+'`;
|
|
15513
15556
|
} else if (content) {
|
|
15514
|
-
if (
|
|
15515
|
-
funcSource += `';$
|
|
15557
|
+
if (artM) {
|
|
15558
|
+
funcSource += `';$dbgArt='${art}';`;
|
|
15516
15559
|
content = "";
|
|
15517
15560
|
} else {
|
|
15518
15561
|
funcSource += `';`;
|
|
@@ -15551,7 +15594,7 @@ function compileToFunction(source, debug, file) {
|
|
|
15551
15594
|
funcSource = funcSource.replace(/\$out\+=''\+/g, "$out+=");
|
|
15552
15595
|
if (debug) {
|
|
15553
15596
|
const filePart = file ? `\\r\\n\\tat file:${file}` : "";
|
|
15554
|
-
funcSource = `let $dbgExpr,$dbgArt
|
|
15597
|
+
funcSource = `let $dbgExpr,$dbgArt;try{${funcSource}}catch(e){let msg='render error:'+(e.message||e);if($dbgArt)msg+='\\r\\n\\tsrc art:{{'+$dbgArt+'}};msg+='\\r\\n\\t'+($dbgArt?'translate to:':'expr:');msg+=$dbgExpr+'${filePart}';throw msg;}`;
|
|
15555
15598
|
}
|
|
15556
15599
|
const viewIdRegExp = new RegExp(String.fromCharCode(31), "g");
|
|
15557
15600
|
funcSource = funcSource.replace(viewIdRegExp, `'+$viewId+'`);
|
|
@@ -15571,28 +15614,75 @@ async function compileTemplate(source, options = {}) {
|
|
|
15571
15614
|
if (virtualDom) {
|
|
15572
15615
|
const funcBody2 = compileToVDomFunction(finalSource, debug, file);
|
|
15573
15616
|
const funcWithVars2 = funcBody2.replace("{{VARS}}", () => varDeclarations);
|
|
15574
|
-
return `import { vdomCreate as
|
|
15617
|
+
return `import { vdomCreate as __larkVdomCreate } from "@lark.js/mvc";
|
|
15575
15618
|
import { strSafe as __larkStrSafe, encUri as __larkEncUri, encQuote as __larkEncQuote, refFn as __larkRefFn } from "@lark.js/mvc/runtime";
|
|
15576
|
-
|
|
15619
|
+
function __larkTemplate(data, viewId, refData) {
|
|
15577
15620
|
let $data = data || {},
|
|
15578
15621
|
$viewId = viewId || '',
|
|
15579
|
-
$
|
|
15580
|
-
$
|
|
15622
|
+
$vdomCreate = __larkVdomCreate,
|
|
15623
|
+
$strSafe = __larkStrSafe;
|
|
15581
15624
|
return (${funcWithVars2})($data, $viewId, refData,
|
|
15582
|
-
$
|
|
15625
|
+
$strSafe, __larkRefFn, __larkEncUri, __larkEncQuote
|
|
15583
15626
|
);
|
|
15584
|
-
}
|
|
15627
|
+
}
|
|
15628
|
+
export default __larkTemplate;`;
|
|
15585
15629
|
}
|
|
15586
15630
|
const funcBody = compileToFunction(finalSource, debug, file);
|
|
15587
15631
|
const funcWithVars = funcBody.replace("{{VARS}}", () => varDeclarations);
|
|
15588
15632
|
return `import { encHtml as __larkEncHtml, strSafe as __larkStrSafe, encUri as __larkEncUri, encQuote as __larkEncQuote, refFn as __larkRefFn } from "@lark.js/mvc/runtime";
|
|
15589
|
-
|
|
15633
|
+
function __larkTemplate(data, viewId, refData) {
|
|
15590
15634
|
let $data = data || {},
|
|
15591
15635
|
$viewId = viewId || '';
|
|
15592
15636
|
return (${funcWithVars})($data, $viewId, refData,
|
|
15593
15637
|
__larkEncHtml, __larkStrSafe, __larkEncUri, __larkRefFn, __larkEncQuote
|
|
15594
15638
|
);
|
|
15595
|
-
}
|
|
15639
|
+
}
|
|
15640
|
+
export default __larkTemplate;`;
|
|
15641
|
+
}
|
|
15642
|
+
|
|
15643
|
+
// src/hmr-inject.ts
|
|
15644
|
+
init_cjs_shims();
|
|
15645
|
+
var TEMPLATE_VAR = "__larkTemplate";
|
|
15646
|
+
function getTemplateHmrSnippet(bundler) {
|
|
15647
|
+
if (bundler === "vite") {
|
|
15648
|
+
return `
|
|
15649
|
+
// \u2500\u2500 Lark template HMR (auto-injected by larkMvcPlugin \u2014 Vite) \u2500\u2500
|
|
15650
|
+
if (import.meta.hot) {
|
|
15651
|
+
import.meta.hot.dispose(function(__larkData) {
|
|
15652
|
+
__larkData.oldTemplate = ${TEMPLATE_VAR};
|
|
15653
|
+
});
|
|
15654
|
+
import.meta.hot.accept(function(__larkNewModule) {
|
|
15655
|
+
var __larkNew = __larkNewModule && __larkNewModule.default;
|
|
15656
|
+
var __larkOld = import.meta.hot.data && import.meta.hot.data.oldTemplate;
|
|
15657
|
+
if (__larkOld && __larkNew && __larkOld !== __larkNew) {
|
|
15658
|
+
import("@lark.js/mvc").then(function(m) {
|
|
15659
|
+
if (m && m.hotSwapByTemplate) m.hotSwapByTemplate(__larkOld, __larkNew);
|
|
15660
|
+
});
|
|
15661
|
+
}
|
|
15662
|
+
});
|
|
15663
|
+
}
|
|
15664
|
+
`;
|
|
15665
|
+
}
|
|
15666
|
+
return `
|
|
15667
|
+
// \u2500\u2500 Lark template HMR (auto-injected by larkMvcPlugin \u2014 ${bundler}) \u2500\u2500
|
|
15668
|
+
if (typeof module !== "undefined" && module.hot) {
|
|
15669
|
+
module.hot.dispose(function(__larkData) {
|
|
15670
|
+
__larkData.oldTemplate = ${TEMPLATE_VAR};
|
|
15671
|
+
});
|
|
15672
|
+
module.hot.accept(function() {
|
|
15673
|
+
var __larkNew = ${TEMPLATE_VAR};
|
|
15674
|
+
var __larkOld = module.hot && module.hot.data && module.hot.data.oldTemplate;
|
|
15675
|
+
if (__larkOld && __larkNew && __larkOld !== __larkNew) {
|
|
15676
|
+
import("@lark.js/mvc").then(function(m) {
|
|
15677
|
+
if (m && m.hotSwapByTemplate) m.hotSwapByTemplate(__larkOld, __larkNew);
|
|
15678
|
+
});
|
|
15679
|
+
}
|
|
15680
|
+
});
|
|
15681
|
+
}
|
|
15682
|
+
`;
|
|
15683
|
+
}
|
|
15684
|
+
function injectTemplateHmrSnippet(source, bundler) {
|
|
15685
|
+
return source + "\n" + getTemplateHmrSnippet(bundler);
|
|
15596
15686
|
}
|
|
15597
15687
|
|
|
15598
15688
|
// src/webpack.ts
|
|
@@ -15601,11 +15691,12 @@ async function larkMvcLoader(source) {
|
|
|
15601
15691
|
const options = this.getOptions() || {};
|
|
15602
15692
|
const { debug = false, virtualDom = false } = options;
|
|
15603
15693
|
const globalVars = await extractGlobalVars(source);
|
|
15604
|
-
|
|
15694
|
+
const compiled = await compileTemplate(source, {
|
|
15605
15695
|
debug,
|
|
15606
15696
|
globalVars,
|
|
15607
15697
|
virtualDom
|
|
15608
15698
|
});
|
|
15699
|
+
return injectTemplateHmrSnippet(compiled, "webpack");
|
|
15609
15700
|
} catch (err) {
|
|
15610
15701
|
console.error(err);
|
|
15611
15702
|
return "";
|