@lark.js/mvc 0.0.13 → 0.0.14

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/vite.js CHANGED
@@ -27,12 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.43_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js
31
31
  import path from "path";
32
32
  import { fileURLToPath } from "url";
33
33
  var getFilename, getDirname, __dirname;
34
34
  var init_esm_shims = __esm({
35
- "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.41_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
35
+ "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.43_@swc+helpers@0.5.23__jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
36
36
  "use strict";
37
37
  getFilename = () => fileURLToPath(import.meta.url);
38
38
  getDirname = () => path.dirname(getFilename());
@@ -14529,7 +14529,7 @@ var require_lib = __commonJS({
14529
14529
  options = Object.assign({}, options);
14530
14530
  try {
14531
14531
  options.sourceType = "module";
14532
- const parser = getParser2(options, input);
14532
+ const parser = getParser(options, input);
14533
14533
  const ast = parser.parse();
14534
14534
  if (parser.sawUnambiguousESM) {
14535
14535
  return ast;
@@ -14537,7 +14537,7 @@ var require_lib = __commonJS({
14537
14537
  if (parser.ambiguousScriptDifferentAst) {
14538
14538
  try {
14539
14539
  options.sourceType = "script";
14540
- return getParser2(options, input).parse();
14540
+ return getParser(options, input).parse();
14541
14541
  } catch (_unused) {
14542
14542
  }
14543
14543
  } else {
@@ -14547,17 +14547,17 @@ var require_lib = __commonJS({
14547
14547
  } catch (moduleError) {
14548
14548
  try {
14549
14549
  options.sourceType = "script";
14550
- return getParser2(options, input).parse();
14550
+ return getParser(options, input).parse();
14551
14551
  } catch (_unused2) {
14552
14552
  }
14553
14553
  throw moduleError;
14554
14554
  }
14555
14555
  } else {
14556
- return getParser2(options, input).parse();
14556
+ return getParser(options, input).parse();
14557
14557
  }
14558
14558
  }
14559
14559
  function parseExpression(input, options) {
14560
- const parser = getParser2(options, input);
14560
+ const parser = getParser(options, input);
14561
14561
  if (parser.options.strictMode) {
14562
14562
  parser.state.strict = true;
14563
14563
  }
@@ -14571,7 +14571,7 @@ var require_lib = __commonJS({
14571
14571
  return tokenTypes2;
14572
14572
  }
14573
14573
  var tokTypes = generateExportedTokenTypes(tt);
14574
- function getParser2(options, input) {
14574
+ function getParser(options, input) {
14575
14575
  let cls = Parser;
14576
14576
  const pluginsMap = /* @__PURE__ */ new Map();
14577
14577
  if (options != null && options.plugins) {
@@ -14618,8 +14618,8 @@ var require_lib = __commonJS({
14618
14618
 
14619
14619
  // src/vite.ts
14620
14620
  init_esm_shims();
14621
- import path2 from "path";
14622
- import fs from "fs";
14621
+ import { dirname, isAbsolute, join, resolve } from "path";
14622
+ import { existsSync, readFileSync } from "fs";
14623
14623
 
14624
14624
  // src/compiler.ts
14625
14625
  init_esm_shims();
@@ -15162,336 +15162,10 @@ function compileToVDomFunction(source, debug, file) {
15162
15162
  return `($data,$viewId,$refAlt,$n,$refFn,$encUri,$encQuote)=>{${fullSource}}`;
15163
15163
  }
15164
15164
 
15165
- // src/compiler/swc/extract-global-vars.ts
15166
- init_esm_shims();
15167
- var parseSyncFn = null;
15168
- var parseSyncLoadAttempted = false;
15169
- async function getParser() {
15170
- if (!parseSyncLoadAttempted) {
15171
- parseSyncLoadAttempted = true;
15172
- try {
15173
- const swc = await import("@swc/core");
15174
- parseSyncFn = swc.parseSync;
15175
- } catch (err) {
15176
- console.error("failed to load @swc/core", err);
15177
- }
15178
- }
15179
- return parseSyncFn;
15180
- }
15181
- async function extractGlobalVars(source) {
15182
- const { protectedSource, comments: _comments } = protectComments(source);
15183
- const viewEventProcessed = processViewEvents(protectedSource);
15184
- const converted = convertArtSyntax(viewEventProcessed, false);
15185
- const template = restoreComments(converted, _comments);
15186
- const templateCmdRegExp = /<%([@=!:])?([\s\S]*?)%>|$/g;
15187
- const fnParts = [];
15188
- const htmlStore = {};
15189
- let htmlIndex = 0;
15190
- let lastIndex = 0;
15191
- const htmlKey = String.fromCharCode(5);
15192
- template.replace(
15193
- templateCmdRegExp,
15194
- (match, operate, content, offset) => {
15195
- const start = operate ? 3 : 2;
15196
- const htmlText = template.substring(lastIndex, offset + start);
15197
- const key = htmlKey + htmlIndex++ + htmlKey;
15198
- htmlStore[key] = htmlText;
15199
- lastIndex = offset + match.length - 2;
15200
- if (operate && content.trim()) {
15201
- fnParts.push(';"' + key + '";', "[" + content + "]");
15202
- } else {
15203
- fnParts.push(';"' + key + '";', content || "");
15204
- }
15205
- return match;
15206
- }
15207
- );
15208
- let fn = fnParts.join("");
15209
- fn = `(function(){${fn}})`;
15210
- const parseSync = await getParser();
15211
- if (!parseSync) {
15212
- return fallbackExtractVariables(source);
15213
- }
15214
- let ast;
15215
- try {
15216
- ast = parseSync(fn, {
15217
- syntax: "ecmascript",
15218
- target: "es2022"
15219
- });
15220
- } catch {
15221
- return fallbackExtractVariables(source);
15222
- }
15223
- const globalExists = {};
15224
- for (const name of BUILTIN_GLOBALS) globalExists[name] = 1;
15225
- const globalVars = /* @__PURE__ */ Object.create(null);
15226
- const fnNodes = [];
15227
- walkSwcAst(ast, {
15228
- VariableDeclarator(node) {
15229
- if (node.id.type === "Identifier") {
15230
- const name = node.id.value;
15231
- globalExists[name] = node.init ? 3 : 2;
15232
- }
15233
- },
15234
- FunctionDeclaration(node) {
15235
- if (node.identifier) {
15236
- globalExists[node.identifier.value] = 3;
15237
- }
15238
- fnNodes.push(node);
15239
- },
15240
- FunctionExpression(node) {
15241
- fnNodes.push(node);
15242
- },
15243
- ArrowFunctionExpression(node) {
15244
- fnNodes.push(node);
15245
- },
15246
- CallExpression(node) {
15247
- if (node.callee.type === "Identifier") {
15248
- globalExists[node.callee.value] = 1;
15249
- }
15250
- }
15251
- });
15252
- const functionParams = /* @__PURE__ */ Object.create(null);
15253
- for (const fnNode of fnNodes) {
15254
- const patterns = getParamPatterns(fnNode);
15255
- for (const pat of patterns) {
15256
- if (pat.type === "Identifier") {
15257
- functionParams[pat.value] = 1;
15258
- } else if (pat.type === "AssignmentPattern" && pat.left.type === "Identifier") {
15259
- functionParams[pat.left.value] = 1;
15260
- } else if (pat.type === "RestElement" && pat.argument.type === "Identifier") {
15261
- functionParams[pat.argument.value] = 1;
15262
- }
15263
- }
15264
- }
15265
- walkSwcAst(ast, {
15266
- Identifier(node) {
15267
- const name = node.value;
15268
- if (globalExists[name]) return;
15269
- if (functionParams[name]) return;
15270
- globalVars[name] = 1;
15271
- },
15272
- AssignmentExpression(node) {
15273
- if (node.left.type === "Identifier") {
15274
- const name = node.left.value;
15275
- if (!globalExists[name] || globalExists[name] === 1) {
15276
- globalExists[name] = (globalExists[name] || 0) + 1;
15277
- }
15278
- }
15279
- }
15280
- });
15281
- return Object.keys(globalVars);
15282
- }
15283
- function getParamPatterns(fnNode) {
15284
- if (fnNode.type === "ArrowFunctionExpression") {
15285
- return fnNode.params;
15286
- }
15287
- return fnNode.params.map((p) => p.pat);
15288
- }
15289
- function fallbackExtractVariables(source) {
15290
- const vars = /* @__PURE__ */ new Set();
15291
- const outputRegExp = /\{\{[:=!@]\s*([a-zA-Z_$][\w$]*)[^}]*\}\}/g;
15292
- let m;
15293
- while ((m = outputRegExp.exec(source)) !== null) {
15294
- vars.add(m[1]);
15295
- }
15296
- const eachRegExp = /\{\{forOf\s+([a-zA-Z_$][\w$]*)\s+as/g;
15297
- while ((m = eachRegExp.exec(source)) !== null) {
15298
- vars.add(m[1]);
15299
- }
15300
- const ifRegExp = /\{\{(?:else\s+)?if\s+([a-zA-Z_$][\w$]*)[^}]*\}\}/g;
15301
- while ((m = ifRegExp.exec(source)) !== null) {
15302
- vars.add(m[1]);
15303
- }
15304
- return Array.from(vars).filter((v) => !BUILTIN_GLOBALS.has(v));
15305
- }
15306
- function walkSwcAst(ast, visitors) {
15307
- function visit(node) {
15308
- const type = node.type;
15309
- if (visitors[type]) {
15310
- visitors[type](node);
15311
- }
15312
- for (const key of Object.keys(node)) {
15313
- if (key === "type" || key === "span" || key === "ctxt") continue;
15314
- if (type === "MemberExpression" && key === "property") {
15315
- const me = node;
15316
- if (me.property.type !== "Computed") continue;
15317
- }
15318
- if (type === "KeyValueProperty" && key === "key") {
15319
- const kv = node;
15320
- if (kv.key.type !== "Computed") continue;
15321
- }
15322
- if (type === "MethodProperty" && key === "key") {
15323
- const mp = node;
15324
- if (mp.key.type !== "Computed") continue;
15325
- }
15326
- const child = Reflect.get(node, key);
15327
- if (Array.isArray(child)) {
15328
- for (const item of child) {
15329
- if (isSwcNode(item)) visit(item);
15330
- }
15331
- } else if (isSwcNode(child)) {
15332
- visit(child);
15333
- }
15334
- }
15335
- }
15336
- visit(ast);
15337
- }
15338
- function isSwcNode(v) {
15339
- return !!v && typeof v === "object" && typeof v.type === "string";
15340
- }
15341
- var BUILTIN_GLOBALS = /* @__PURE__ */ new Set([
15342
- // ─── Template runtime helpers (injected by compileToFunction) ───────
15343
- //
15344
- // These variables appear in the generated template function signature
15345
- // or body. They must be excluded from extractGlobalVars() so that
15346
- // they are not mistaken for user data variables and destructured from $data.
15347
- // SPLITTER character constant (same as \x1e), used as namespace separator
15348
- // for refData keys, event attribute encoding, and internal data structures.
15349
- // Declared as: let $splitter='\x1e'
15350
- "$splitter",
15351
- // Data — the data object passed from Updater to the template function.
15352
- // User variables are destructured from $data at the top of the function:
15353
- // let {name, age} = $data;
15354
- // This is the first parameter of the generated arrow function.
15355
- "$data",
15356
- // Null-safe toString: v => '' + (v == null ? '' : v)
15357
- // Converts null/undefined to empty string, otherwise calls toString().
15358
- // Wraps every {{!raw}} output to prevent "null" / "undefined" rendering.
15359
- "$strSafe",
15360
- // HTML entity encoder: v => $strSafe(v).replace(/[&<>"'`]/g, entityMap)
15361
- // Encodes &, <, >, ", ', ` to HTML entities (&amp; &lt; etc.)
15362
- // Applied to all {{=escaped}} and {{:binding}} outputs.
15363
- "$encHtml",
15364
- // HTML entity map — internal object used by $encHtml:
15365
- // {'&':'amp','<':'gt','>':'gt','"':'#34','\'':'#39','`':'#96'}
15366
- // Not a standalone function; referenced inside $encHtml's closure.
15367
- "$entMap",
15368
- // HTML entity RegExp — internal regexp used by $encHtml:
15369
- // /[&<>"'`]/g
15370
- "$entReg",
15371
- // HTML entity replacer function — internal helper used by $encHtml:
15372
- // m => '&' + $entMap[m] + ';'
15373
- // Maps matched character to its entity string.
15374
- "$entFn",
15375
- // Output buffer — the string accumulator for rendered HTML.
15376
- // All template output is appended via $out += '...'.
15377
- // Declared as: let $out = ''
15378
- "$out",
15379
- // Reference lookup: (refData, value) => key
15380
- // Finds or allocates a SPLITTER-prefixed key in refData for a given
15381
- // object reference. Used by {{@ref}} operator for passing object
15382
- // references to child views via v-lark attributes.
15383
- "$refFn",
15384
- // URI encoder: v => encodeURIComponent($strSafe(v)).replace(/[!')(*]/g, extraMap)
15385
- // Extends encodeURIComponent with encoding of ! ' ( ) *.
15386
- // Applied to values in @event URL parameters and {{!uri}} contexts.
15387
- "$encUri",
15388
- // URI encode map — internal object used by $encUri:
15389
- // {'!':'%21','\'':'%27','(':'%28',')':'%29','*':'%2A'}
15390
- "$uriMap",
15391
- // URI encode replacer — internal helper used by $encUri:
15392
- // m => $uriMap[m]
15393
- "$uriFn",
15394
- // URI encode regexp — internal regexp used by $encUri:
15395
- // /[!')(*]/g
15396
- "$uriReg",
15397
- // Quote encoder: v => $strSafe(v).replace(/['"\\]/g, '\\$&')
15398
- // Escapes quotes and backslashes for safe embedding in HTML attribute
15399
- // values (e.g. data-json='...').
15400
- "$encQuote",
15401
- // Quote encode regexp — internal regexp used by $encQuote:
15402
- // /['"\\]/g
15403
- "$qReg",
15404
- // View ID — the unique identifier of the owning View instance.
15405
- // Injected into @event attribute values at render time so that
15406
- // EventDelegator can dispatch events to the correct View handler.
15407
- // The \x1f placeholder in compiled output is replaced with '+$viewId+'.
15408
- "$viewId",
15409
- // Debug: current expression text — stores the template expression being
15410
- // evaluated, for error reporting. Only present in debug mode.
15411
- // e.g. $dbgExpr='<%=user.name%>'
15412
- "$dbgExpr",
15413
- // Debug: original art syntax — stores the {{}} template syntax before
15414
- // conversion, for error reporting. Only present in debug mode.
15415
- // e.g. $dbgArt='{{=user.name}}'
15416
- "$dbgArt",
15417
- // Debug: source line number — tracks the current line in the template
15418
- // source, for error reporting. Only present in debug mode.
15419
- "$dbgLine",
15420
- // RefData alias — fallback reference lookup table.
15421
- // Defaults to $data when no explicit $refAlt is provided.
15422
- // Ensures $refFn() does not crash when @ operator is used without refData.
15423
- "$refAlt",
15424
- // Temporary variable — used by the compiler for intermediate
15425
- // expression results in generated code (e.g. loop variables,
15426
- // conditional branches). Declared as: let $tmp
15427
- "$tmp",
15428
- // JS literals
15429
- "undefined",
15430
- "null",
15431
- "true",
15432
- "false",
15433
- "NaN",
15434
- "Infinity",
15435
- // JS built-in globals
15436
- "window",
15437
- "self",
15438
- "globalThis",
15439
- "document",
15440
- "console",
15441
- "JSON",
15442
- "Math",
15443
- "Intl",
15444
- "Promise",
15445
- "Symbol",
15446
- "Number",
15447
- "String",
15448
- "Boolean",
15449
- "Array",
15450
- "Object",
15451
- "Date",
15452
- "RegExp",
15453
- "Error",
15454
- "TypeError",
15455
- "RangeError",
15456
- "SyntaxError",
15457
- "Map",
15458
- "Set",
15459
- "WeakMap",
15460
- "WeakSet",
15461
- "Proxy",
15462
- "Reflect",
15463
- "ArrayBuffer",
15464
- "DataView",
15465
- "Float32Array",
15466
- "Float64Array",
15467
- "Int8Array",
15468
- "Int16Array",
15469
- "Int32Array",
15470
- "Uint8Array",
15471
- "Uint16Array",
15472
- "Uint32Array",
15473
- "Uint8ClampedArray",
15474
- // Functions
15475
- "parseInt",
15476
- "parseFloat",
15477
- "isNaN",
15478
- "isFinite",
15479
- "encodeURIComponent",
15480
- "decodeURIComponent",
15481
- "encodeURI",
15482
- "decodeURI",
15483
- // SWC helpers
15484
- "arguments",
15485
- "this",
15486
- "require",
15487
- // Lark framework
15488
- "Lark"
15489
- ]);
15490
-
15491
15165
  // src/compiler/extract-global-vars.ts
15492
15166
  init_esm_shims();
15493
15167
  var import_parser = __toESM(require_lib(), 1);
15494
- async function extractGlobalVars2(source) {
15168
+ async function extractGlobalVars(source) {
15495
15169
  const { protectedSource, comments: _comments } = protectComments(source);
15496
15170
  const viewEventProcessed = processViewEvents(protectedSource);
15497
15171
  const converted = convertArtSyntax(viewEventProcessed, false);
@@ -15528,10 +15202,10 @@ async function extractGlobalVars2(source) {
15528
15202
  allowAwaitOutsideFunction: true
15529
15203
  });
15530
15204
  } catch {
15531
- return fallbackExtractVariables2(source);
15205
+ return fallbackExtractVariables(source);
15532
15206
  }
15533
15207
  const globalExists = {};
15534
- for (const name of BUILTIN_GLOBALS2) globalExists[name] = 1;
15208
+ for (const name of BUILTIN_GLOBALS) globalExists[name] = 1;
15535
15209
  const globalVars = /* @__PURE__ */ Object.create(null);
15536
15210
  const fnRange = [];
15537
15211
  walkAst(ast, {
@@ -15590,22 +15264,22 @@ async function extractGlobalVars2(source) {
15590
15264
  });
15591
15265
  return Object.keys(globalVars);
15592
15266
  }
15593
- function fallbackExtractVariables2(source) {
15267
+ function fallbackExtractVariables(source) {
15594
15268
  const vars = /* @__PURE__ */ new Set();
15595
15269
  const outputRegExp = /\{\{[:=!@]\s*([a-zA-Z_$][\w$]*)[^}]*\}\}/g;
15596
15270
  let m;
15597
15271
  while ((m = outputRegExp.exec(source)) !== null) {
15598
15272
  vars.add(m[1]);
15599
15273
  }
15600
- const eachRegExp = /\{\{forOf\s+([a-zA-Z_$][\w$]*)\s+as/g;
15601
- while ((m = eachRegExp.exec(source)) !== null) {
15274
+ const forOfRegExp = /\{\{forOf\s+([a-zA-Z_$][\w$]*)\s+as/g;
15275
+ while ((m = forOfRegExp.exec(source)) !== null) {
15602
15276
  vars.add(m[1]);
15603
15277
  }
15604
15278
  const ifRegExp = /\{\{(?:else\s+)?if\s+([a-zA-Z_$][\w$]*)[^}]*\}\}/g;
15605
15279
  while ((m = ifRegExp.exec(source)) !== null) {
15606
15280
  vars.add(m[1]);
15607
15281
  }
15608
- return Array.from(vars).filter((v) => !BUILTIN_GLOBALS2.has(v));
15282
+ return Array.from(vars).filter((v) => !BUILTIN_GLOBALS.has(v));
15609
15283
  }
15610
15284
  function walkAst(ast, visitors) {
15611
15285
  function visit(node) {
@@ -15643,7 +15317,7 @@ function walkAst(ast, visitors) {
15643
15317
  function isAstNode(v) {
15644
15318
  return !!v && typeof v === "object" && typeof v.type === "string";
15645
15319
  }
15646
- var BUILTIN_GLOBALS2 = /* @__PURE__ */ new Set([
15320
+ var BUILTIN_GLOBALS = /* @__PURE__ */ new Set([
15647
15321
  // ─── Template runtime helpers (injected by compileToFunction) ───────
15648
15322
  //
15649
15323
  // These variables appear in the generated template function signature
@@ -15882,8 +15556,8 @@ function compileToFunction(source, debug, file) {
15882
15556
  return `($data,$viewId,$refAlt,$encHtml,$strSafe,$encUri,$refFn,$encQuote)=>{${fullSource}}`;
15883
15557
  }
15884
15558
  async function compileTemplate(source, options = {}) {
15885
- const { debug = false, file, virtualDom = false, useSwc = false } = options;
15886
- const globalVars = options.globalVars ?? await (useSwc ? extractGlobalVars(source) : extractGlobalVars2(source));
15559
+ const { debug = false, file, virtualDom = false } = options;
15560
+ const globalVars = options.globalVars ?? await extractGlobalVars(source);
15887
15561
  const { protectedSource, comments } = protectComments(source);
15888
15562
  const converted = convertArtSyntax(protectedSource, debug);
15889
15563
  const viewEventProcessed = processViewEvents(converted);
@@ -15919,7 +15593,7 @@ export default function(data, viewId, refData) {
15919
15593
  // src/vite.ts
15920
15594
  var LARK_TEMPLATE_SUFFIX = "?lark-template";
15921
15595
  function larkMvcPlugin(options = {}) {
15922
- const { debug = false, virtualDom = false, useSwc = false } = options;
15596
+ const { debug = false, virtualDom = false } = options;
15923
15597
  let root = __dirname;
15924
15598
  return {
15925
15599
  name: "lark-template",
@@ -15931,10 +15605,13 @@ function larkMvcPlugin(options = {}) {
15931
15605
  const sourcePath = source.split("?")[0];
15932
15606
  if (sourcePath.endsWith(".html") && importer) {
15933
15607
  const importerPath = importer.split("?")[0];
15934
- let resolved = path2.resolve(path2.dirname(importerPath), sourcePath);
15935
- if (!fs.existsSync(resolved)) {
15936
- const rootResolved = path2.join(root, resolved);
15937
- if (fs.existsSync(rootResolved)) {
15608
+ let resolved = resolve(dirname(importerPath), sourcePath);
15609
+ if (resolved.startsWith("/@fs")) {
15610
+ resolved = resolved.slice("/@fs".length);
15611
+ }
15612
+ if (!isAbsolute(resolved) || !existsSync(resolved)) {
15613
+ const rootResolved = join(root, resolved);
15614
+ if (existsSync(rootResolved)) {
15938
15615
  resolved = rootResolved;
15939
15616
  }
15940
15617
  }
@@ -15947,16 +15624,19 @@ function larkMvcPlugin(options = {}) {
15947
15624
  const query = qIdx >= 0 ? id.slice(qIdx + 1) : "";
15948
15625
  if (query.split("&").includes("lark-template")) {
15949
15626
  let filePath = qIdx >= 0 ? id.slice(0, qIdx) : id;
15950
- if (!fs.existsSync(filePath)) {
15951
- const rootResolved = path2.join(root, filePath);
15952
- if (fs.existsSync(rootResolved)) {
15627
+ if (filePath.startsWith("/@fs")) {
15628
+ filePath = filePath.slice(4);
15629
+ }
15630
+ if (!isAbsolute(filePath) || !existsSync(filePath)) {
15631
+ const rootResolved = join(root, filePath);
15632
+ if (existsSync(rootResolved)) {
15953
15633
  filePath = rootResolved;
15954
15634
  }
15955
15635
  }
15956
- if (!fs.existsSync(filePath)) return void 0;
15957
- const raw = fs.readFileSync(filePath, "utf-8");
15958
- const globalVars = await extractGlobalVars2(raw);
15959
- return compileTemplate(raw, { debug, globalVars, virtualDom, useSwc });
15636
+ if (!existsSync(filePath)) return void 0;
15637
+ const raw = readFileSync(filePath, "utf-8");
15638
+ const globalVars = await extractGlobalVars(raw);
15639
+ return compileTemplate(raw, { debug, globalVars, virtualDom });
15960
15640
  }
15961
15641
  return void 0;
15962
15642
  }
@@ -15964,22 +15644,22 @@ function larkMvcPlugin(options = {}) {
15964
15644
  }
15965
15645
  var vite_default = larkMvcPlugin;
15966
15646
  function larkMvcPluginLegacy(options = {}) {
15967
- const { virtualDom = false, useSwc = false } = options;
15647
+ const { debug = false, virtualDom = false } = options;
15968
15648
  return {
15969
15649
  name: "lark-template",
15970
15650
  enforce: "pre",
15971
15651
  resolveId(source, importer) {
15972
15652
  if (source.endsWith(".html") && importer) {
15973
- return path2.resolve(path2.dirname(importer), source) + LARK_TEMPLATE_SUFFIX;
15653
+ return resolve(dirname(importer), source) + LARK_TEMPLATE_SUFFIX;
15974
15654
  }
15975
15655
  return void 0;
15976
15656
  },
15977
15657
  async load(id) {
15978
15658
  if (id.endsWith(LARK_TEMPLATE_SUFFIX)) {
15979
15659
  const filePath = id.slice(0, -LARK_TEMPLATE_SUFFIX.length);
15980
- const raw = fs.readFileSync(filePath, "utf-8");
15981
- const globalVars = await extractGlobalVars2(raw);
15982
- return compileTemplate(raw, { globalVars, virtualDom, useSwc });
15660
+ const raw = readFileSync(filePath, "utf-8");
15661
+ const globalVars = await extractGlobalVars(raw);
15662
+ return compileTemplate(raw, { debug, globalVars, virtualDom });
15983
15663
  }
15984
15664
  return void 0;
15985
15665
  }