@lark.js/mvc 0.0.2 → 0.0.4

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/webpack.cjs CHANGED
@@ -14652,17 +14652,17 @@ function restoreComments(source, comments) {
14652
14652
  }
14653
14653
  function processViewEvents(source) {
14654
14654
  return source.replace(
14655
- /v-(\w+)="([^"]+)"/g,
14655
+ /@(\w+)="([^"]+)"/g,
14656
14656
  (fullAttr, eventName, attrValue) => {
14657
14657
  const eventMatch = attrValue.match(/^(\w+)\((.*)\)$/s);
14658
14658
  if (!eventMatch) return fullAttr;
14659
14659
  const handlerName = eventMatch[1];
14660
14660
  const paramsStr = eventMatch[2].trim();
14661
14661
  if (!paramsStr) {
14662
- return `v-${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER}${handlerName}()"`;
14662
+ return `@${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER}${handlerName}()"`;
14663
14663
  }
14664
14664
  const urlParams = jsObjectToUrlParams(paramsStr);
14665
- return `v-${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER}${handlerName}(${urlParams})"`;
14665
+ return `@${eventName}="${VIEW_ID_PLACEHOLDER}${SPLITTER}${handlerName}(${urlParams})"`;
14666
14666
  }
14667
14667
  );
14668
14668
  }
@@ -14735,7 +14735,7 @@ function convertArtSyntax(source, debug) {
14735
14735
  }
14736
14736
  if (blockStack.length > 0) {
14737
14737
  const unclosed = blockStack.map((b) => `"${b.ctrl}" at line ${b.line}`).join(", ");
14738
- throw new Error(`[@lark/mvc error] unclosed block(s): ${unclosed}`);
14738
+ throw new Error(`[@lark.js/mvc error] unclosed block(s): ${unclosed}`);
14739
14739
  }
14740
14740
  return result.join("");
14741
14741
  }
@@ -14829,12 +14829,12 @@ function convertArtExpression(code, debug, lineNo, blockStack = []) {
14829
14829
  }
14830
14830
  return `${debugPrefix}<%}else{%>`;
14831
14831
  }
14832
- case "each": {
14833
- blockStack.push({ ctrl: "each", line: lineNo });
14832
+ case "forOf": {
14833
+ blockStack.push({ ctrl: "forOf", line: lineNo });
14834
14834
  const object = tokens[0];
14835
14835
  if (tokens.length > 1 && tokens[1] !== "as") {
14836
14836
  throw new Error(
14837
- `[@lark/mvc error] bad each syntax: {{${code}}}. Expected "as" keyword, got "${tokens[1]}". Usage: {{each list as item [index]}}`
14837
+ `[@lark.js/mvc error] bad forOf syntax: {{${code}}}. Expected "as" keyword, got "${tokens[1]}". Usage: {{forOf list as item [index]}}`
14838
14838
  );
14839
14839
  }
14840
14840
  const restTokens = tokens.slice(2);
@@ -14856,12 +14856,12 @@ function convertArtExpression(code, debug, lineNo, blockStack = []) {
14856
14856
  }
14857
14857
  return `${debugPrefix}<%for(let ${index}=0${refExpr},${refObjCount}=${refObj}.length${lastCount};${index}<${refObjCount};${index}++){${firstAndLast}${valueDecl}%>`;
14858
14858
  }
14859
- case "parse": {
14860
- blockStack.push({ ctrl: "parse", line: lineNo });
14859
+ case "forIn": {
14860
+ blockStack.push({ ctrl: "forIn", line: lineNo });
14861
14861
  const object = tokens[0];
14862
14862
  if (tokens.length > 1 && tokens[1] !== "as") {
14863
14863
  throw new Error(
14864
- `[@lark/mvc error] bad parse syntax: {{${code}}}. Expected "as" keyword, got "${tokens[1]}". Usage: {{for-in obj as val [key]}}`
14864
+ `[@lark.js/mvc error] bad forIn syntax: {{${code}}}. Expected "as" keyword, got "${tokens[1]}". Usage: {{for-in obj as val [key]}}`
14865
14865
  );
14866
14866
  }
14867
14867
  const restTokens2 = tokens.slice(2);
@@ -14881,19 +14881,19 @@ function convertArtExpression(code, debug, lineNo, blockStack = []) {
14881
14881
  case "set":
14882
14882
  return `${debugPrefix}<%let ${tokens.join(" ")};%>`;
14883
14883
  case "/if":
14884
- case "/each":
14885
- case "/parse":
14884
+ case "/forOf":
14885
+ case "/forIn":
14886
14886
  case "/for": {
14887
14887
  const expectedCtrl = keyword.substring(1);
14888
14888
  const last = blockStack.pop();
14889
14889
  if (!last) {
14890
14890
  throw new Error(
14891
- `[@lark/mvc error(template] unexpected {{${code}}}: no matching open block`
14891
+ `[@lark.js/mvc error] unexpected {{${code}}}: no matching open block`
14892
14892
  );
14893
14893
  }
14894
14894
  if (last.ctrl !== expectedCtrl) {
14895
14895
  throw new Error(
14896
- `[@lark/mvc error(template] unexpected {{${code}}}: expected {{/${last.ctrl}}} to close block opened at line ${last.line}`
14896
+ `[@lark.js/mvc error] unexpected {{${code}}}: expected {{/${last.ctrl}}} to close block opened at line ${last.line}`
14897
14897
  );
14898
14898
  }
14899
14899
  return `${debugPrefix}<%}%>`;
@@ -14957,7 +14957,7 @@ function parseAsExpr(expr) {
14957
14957
  function compileToFunction(source, debug, file) {
14958
14958
  const matcher = /<%([@=!:])?([\s\S]*?)%>|$/g;
14959
14959
  let index = 0;
14960
- let funcSource = `$p+='`;
14960
+ let funcSource = `$out+='`;
14961
14961
  let hasAtRule = false;
14962
14962
  const escapeSlashRegExp = /\\|'/g;
14963
14963
  const escapeBreakReturnRegExp = /\r|\n/g;
@@ -14983,17 +14983,17 @@ function compileToFunction(source, debug, file) {
14983
14983
  }
14984
14984
  if (operate === "@") {
14985
14985
  hasAtRule = true;
14986
- funcSource += `'+($expr='<%${operate + expr}%>',$i($$ref,${content}))+'`;
14986
+ funcSource += `'+($dbgExpr='<%${operate + expr}%>',$refFn($refAlt,${content}))+'`;
14987
14987
  } else if (operate === "=" || operate === ":") {
14988
- funcSource += `'+($expr='<%${operate + expr}%>',$e(${content}))+'`;
14988
+ funcSource += `'+($dbgExpr='<%${operate + expr}%>',$encHtml(${content}))+'`;
14989
14989
  } else if (operate === "!") {
14990
- if (!content.startsWith("$eu(") || !content.endsWith(")")) {
14991
- content = `$n(${content})`;
14990
+ if (!content.startsWith("$encUri(") || !content.endsWith(")")) {
14991
+ content = `$strSafe(${content})`;
14992
14992
  }
14993
- funcSource += `'+($expr='<%${operate + expr}%>',${content})+'`;
14993
+ funcSource += `'+($dbgExpr='<%${operate + expr}%>',${content})+'`;
14994
14994
  } else if (content) {
14995
14995
  if (line > -1) {
14996
- funcSource += `';$line=${line};$art='${art}';`;
14996
+ funcSource += `';$dbgLine=${line};$dbgArt='${art}';`;
14997
14997
  content = "";
14998
14998
  } else {
14999
14999
  funcSource += `';`;
@@ -15002,19 +15002,19 @@ function compileToFunction(source, debug, file) {
15002
15002
  funcSource = funcSource.substring(0, funcSource.length - 4) + ";";
15003
15003
  }
15004
15004
  if (expr) {
15005
- funcSource += `$expr='<%${expr}%>';`;
15005
+ funcSource += `$dbgExpr='<%${expr}%>';`;
15006
15006
  }
15007
- funcSource += content + `;$p+='`;
15007
+ funcSource += content + `;$out+='`;
15008
15008
  }
15009
15009
  } else {
15010
15010
  if (operate === "@") {
15011
15011
  hasAtRule = true;
15012
- funcSource += `'+$i($$ref,${content})+'`;
15012
+ funcSource += `'+$refFn($refAlt,${content})+'`;
15013
15013
  } else if (operate === "=" || operate === ":") {
15014
- funcSource += `'+$e(${content})+'`;
15014
+ funcSource += `'+$encHtml(${content})+'`;
15015
15015
  } else if (operate === "!") {
15016
- if (!content.startsWith("$eu(") || !content.endsWith(")")) {
15017
- content = `$n(${content})`;
15016
+ if (!content.startsWith("$encUri(") || !content.endsWith(")")) {
15017
+ content = `$strSafe(${content})`;
15018
15018
  }
15019
15019
  funcSource += `'+${content}+'`;
15020
15020
  } else if (content) {
@@ -15022,28 +15022,28 @@ function compileToFunction(source, debug, file) {
15022
15022
  if (funcSource.endsWith(`+'';`)) {
15023
15023
  funcSource = funcSource.substring(0, funcSource.length - 4) + ";";
15024
15024
  }
15025
- funcSource += `${content};$p+='`;
15025
+ funcSource += `${content};$out+='`;
15026
15026
  }
15027
15027
  }
15028
15028
  return match;
15029
15029
  });
15030
15030
  funcSource += `';`;
15031
- funcSource = funcSource.replace(/\$p\+='';/g, "");
15032
- funcSource = funcSource.replace(/\$p\+=''\+/g, "$p+=");
15031
+ funcSource = funcSource.replace(/\$out\+='';/g, "");
15032
+ funcSource = funcSource.replace(/\$out\+=''\+/g, "$out+=");
15033
15033
  if (debug) {
15034
15034
  const filePart = file ? `\\r\\n\\tat file:${file}` : "";
15035
- funcSource = `let $expr,$art,$line;try{${funcSource}}catch(ex){let msg='render view error:'+(ex.message||ex);if($art)msg+='\\r\\n\\tsrc art:{{'+$art+'}}\\r\\n\\tat line:'+$line;msg+='\\r\\n\\t'+($art?'translate to:':'expr:');msg+=$expr+'${filePart}';throw msg;}`;
15035
+ funcSource = `let $dbgExpr,$dbgArt,$dbgLine;try{${funcSource}}catch(ex){let msg='render view error:'+(ex.message||ex);if($dbgArt)msg+='\\r\\n\\tsrc art:{{'+$dbgArt+'}}\\r\\n\\tat line:'+$dbgLine;msg+='\\r\\n\\t'+($dbgArt?'translate to:':'expr:');msg+=$dbgExpr+'${filePart}';throw msg;}`;
15036
15036
  }
15037
15037
  const viewIdRegExp = new RegExp(String.fromCharCode(31), "g");
15038
15038
  funcSource = funcSource.replace(viewIdRegExp, `'+$viewId+'`);
15039
- const atRule = hasAtRule ? `if(!$i){$i=(ref,v,k,f)=>{for(f=ref[$g];--f;)if(ref[k=$g+f]===v)return k;ref[k=$g+ref[$g]++]=v;return k;}}` : "";
15040
- const encode = `if(!$n){let $em={'&':'amp','<':'lt','>':'gt','"':'#34','\\'':'#39','\`':'#96'},$er=/[&<>"'\`]/g,$ef=m=>'&'+$em[m]+';';$n=v=>''+(v==null?'':v);$e=v=>$n(v).replace($er,$ef)}`;
15041
- const encodeURIMore = `if(!$eu){let $um={'!':'%21','\\'':'%27','(':'%28',')':'%29','*':'%2A'},$uf=m=>$um[m],$uq=/[!')(*]/g;$eu=v=>encodeURIComponent($n(v)).replace($uq,$uf)}`;
15042
- const encodeQuote = `if(!$eq){let $qr=/['"\\\\]/g;$eq=v=>$n(v).replace($qr,'\\\\$&')}`;
15043
- const refFallback = "if(!$$ref)$$ref=$$;";
15039
+ const atRule = hasAtRule ? `if(!$refFn){$refFn=(ref,v,k,f)=>{for(f=ref[$splitter];--f;)if(ref[k=$splitter+f]===v)return k;ref[k=$splitter+ref[$splitter]++]=v;return k;}}` : "";
15040
+ const encode = `if(!$strSafe){let $entMap={'&':'amp','<':'lt','>':'gt','"':'#34','\\'':'#39','\`':'#96'},$entReg=/[&<>"'\`]/g,$entFn=m=>'&'+$entMap[m]+';';$strSafe=v=>''+(v==null?'':v);$encHtml=v=>$strSafe(v).replace($entReg,$entFn)}`;
15041
+ const encodeURIMore = `if(!$encUri){let $uriMap={'!':'%21','\\'':'%27','(':'%28',')':'%29','*':'%2A'},$uriFn=m=>$uriMap[m],$uriReg=/[!')(*]/g;$encUri=v=>encodeURIComponent($strSafe(v)).replace($uriReg,$uriFn)}`;
15042
+ const encodeQuote = `if(!$encQuote){let $qReg=/['"\\\\]/g;$encQuote=v=>$strSafe(v).replace($qReg,'\\\\$&')}`;
15043
+ const refFallback = "if(!$refAlt)$refAlt=$data;";
15044
15044
  const fns = `${refFallback}${encode}${encodeURIMore}${encodeQuote}${atRule};`;
15045
- const fullSource = `${fns}let $g='\\x1e',$_temp,$p=''{{VARS}};${funcSource}return $p`;
15046
- return `($$,$viewId,$$ref,$e,$n,$eu,$i,$eq)=>{${fullSource}}`;
15045
+ const fullSource = `${fns}let $splitter='\\x1e',$tmp,$out=''{{VARS}};${funcSource}return $out`;
15046
+ return `($data,$viewId,$refAlt,$encHtml,$strSafe,$encUri,$refFn,$encQuote)=>{${fullSource}}`;
15047
15047
  }
15048
15048
  function compileTemplate(source, options = {}) {
15049
15049
  const { debug = false, globalVars = [], file } = options;
@@ -15052,17 +15052,17 @@ function compileTemplate(source, options = {}) {
15052
15052
  const viewEventProcessed = processViewEvents(converted);
15053
15053
  const finalSource = restoreComments(viewEventProcessed, comments);
15054
15054
  const funcBody = compileToFunction(finalSource, debug, file);
15055
- const varDeclarations = globalVars.map((key) => `,${key}=$$.${key}`).join("");
15055
+ const varDeclarations = globalVars.map((key) => `,${key}=$data.${key}`).join("");
15056
15056
  const funcWithVars = funcBody.replace("{{VARS}}", () => varDeclarations);
15057
15057
  return `export default function(data, selfId, refData) {
15058
- let $$ = data || {},
15058
+ let $data = data || {},
15059
15059
  $viewId = selfId || '';
15060
- return (${funcWithVars})($$, $viewId, refData,
15061
- /* $e */ v => String(v == null ? '' : v).replace(/[&<>"'\`]/g, m => '&' + ({'&':'amp','<':'lt','>':'gt','"':'#34',"'":'#39','\`':'#96'})[m] + ';'),
15062
- /* $n */ v => String(v == null ? '' : v),
15063
- /* $eu */ null,
15064
- /* $i */ null,
15065
- /* $eq */ null
15060
+ return (${funcWithVars})($data, $viewId, refData,
15061
+ /* $encHtml */ v => String(v == null ? '' : v).replace(/[&<>"'\`]/g, m => '&' + ({'&':'amp','<':'lt','>':'gt','"':'#34',"'":'#39','\`':'#96'})[m] + ';'),
15062
+ /* $strSafe */ v => String(v == null ? '' : v),
15063
+ /* $encUri */ null,
15064
+ /* $refFn */ null,
15065
+ /* $encQuote */ null
15066
15066
  );
15067
15067
  }`;
15068
15068
  }
@@ -15171,7 +15171,7 @@ function fallbackExtractVariables(source) {
15171
15171
  while ((m = outputRegExp.exec(source)) !== null) {
15172
15172
  vars.add(m[1]);
15173
15173
  }
15174
- const eachRegExp = /\{\{each\s+([a-zA-Z_$][\w$]*)\s+as/g;
15174
+ const eachRegExp = /\{\{forOf\s+([a-zA-Z_$][\w$]*)\s+as/g;
15175
15175
  while ((m = eachRegExp.exec(source)) !== null) {
15176
15176
  vars.add(m[1]);
15177
15177
  }
@@ -15217,77 +15217,88 @@ var BUILTIN_GLOBALS = {
15217
15217
  //
15218
15218
  // These variables appear in the generated template function signature
15219
15219
  // or body. They must be excluded from extractGlobalVars() so that
15220
- // they are not mistaken for user data variables and destructured from $$.
15220
+ // they are not mistaken for user data variables and destructured from $data.
15221
15221
  // SPLITTER character constant (same as \x1e), used as namespace separator
15222
15222
  // for refData keys, event attribute encoding, and internal data structures.
15223
- // Declared as: let $g='\x1e'
15224
- $g: 1,
15225
- // refData — the data object passed from Updater to the template function.
15226
- // User variables are destructured from $$ at the top of the function:
15227
- // let {name, age} = $$;
15223
+ // Declared as: let $splitter='\x1e'
15224
+ $splitter: 1,
15225
+ // Data — the data object passed from Updater to the template function.
15226
+ // User variables are destructured from $data at the top of the function:
15227
+ // let {name, age} = $data;
15228
15228
  // This is the first parameter of the generated arrow function.
15229
- $$: 1,
15229
+ $data: 1,
15230
15230
  // Null-safe toString: v => '' + (v == null ? '' : v)
15231
15231
  // Converts null/undefined to empty string, otherwise calls toString().
15232
15232
  // Wraps every {{!raw}} output to prevent "null" / "undefined" rendering.
15233
- $n: 1,
15234
- // HTML entity encoder: v => $n(v).replace(/[&<>"'`]/g, entityMap)
15233
+ $strSafe: 1,
15234
+ // HTML entity encoder: v => $strSafe(v).replace(/[&<>"'`]/g, entityMap)
15235
15235
  // Encodes &, <, >, ", ', ` to HTML entities (&amp; &lt; etc.)
15236
15236
  // Applied to all {{=escaped}} and {{:binding}} outputs.
15237
- $e: 1,
15238
- // HTML entity map — internal object used by $e:
15237
+ $encHtml: 1,
15238
+ // HTML entity map — internal object used by $encHtml:
15239
15239
  // {'&':'amp','<':'gt','>':'gt','"':'#34','\'':'#39','`':'#96'}
15240
- // Not a standalone function; referenced inside $e's closure.
15241
- $em: 1,
15242
- // HTML entity RegExp — internal regexp used by $e:
15240
+ // Not a standalone function; referenced inside $encHtml's closure.
15241
+ $entMap: 1,
15242
+ // HTML entity RegExp — internal regexp used by $encHtml:
15243
15243
  // /[&<>"'`]/g
15244
- $er: 1,
15245
- // HTML entity replacer function — internal helper used by $e:
15246
- // m => '&' + $em[m] + ';'
15247
- // Maps each matched character to its entity string.
15248
- $ef: 1,
15244
+ $entReg: 1,
15245
+ // HTML entity replacer function — internal helper used by $encHtml:
15246
+ // m => '&' + $entMap[m] + ';'
15247
+ // Maps matched character to its entity string.
15248
+ $entFn: 1,
15249
15249
  // Output buffer — the string accumulator for rendered HTML.
15250
- // All template output is appended via $p += '...'.
15251
- // Declared as: let $p = ''
15252
- $p: 1,
15250
+ // All template output is appended via $out += '...'.
15251
+ // Declared as: let $out = ''
15252
+ $out: 1,
15253
15253
  // Reference lookup: (refData, value) => key
15254
15254
  // Finds or allocates a SPLITTER-prefixed key in refData for a given
15255
15255
  // object reference. Used by {{@ref}} operator for passing object
15256
- // references to child views via lark-view attributes.
15257
- // Aligned with mx.js Updater_Ref.
15258
- $i: 1,
15259
- // URI encoder: v => encodeURIComponent($n(v)).replace(/[!')(*]/g, extraMap)
15256
+ // references to child views via v-lark attributes.
15257
+ $refFn: 1,
15258
+ // URI encoder: v => encodeURIComponent($strSafe(v)).replace(/[!')(*]/g, extraMap)
15260
15259
  // Extends encodeURIComponent with encoding of ! ' ( ) *.
15261
- // Applied to values in v-event URL parameters and {{!uri}} contexts.
15262
- $eu: 1,
15263
- // Quote encoder: v => $n(v).replace(/['"\\]/g, '\\$&')
15260
+ // Applied to values in @event URL parameters and {{!uri}} contexts.
15261
+ $encUri: 1,
15262
+ // URI encode map internal object used by $encUri:
15263
+ // {'!':'%21','\'':'%27','(':'%28',')':'%29','*':'%2A'}
15264
+ $uriMap: 1,
15265
+ // URI encode replacer — internal helper used by $encUri:
15266
+ // m => $uriMap[m]
15267
+ $uriFn: 1,
15268
+ // URI encode regexp — internal regexp used by $encUri:
15269
+ // /[!')(*]/g
15270
+ $uriReg: 1,
15271
+ // Quote encoder: v => $strSafe(v).replace(/['"\\]/g, '\\$&')
15264
15272
  // Escapes quotes and backslashes for safe embedding in HTML attribute
15265
15273
  // values (e.g. data-json='...').
15266
- $eq: 1,
15274
+ $encQuote: 1,
15275
+ // Quote encode regexp — internal regexp used by $encQuote:
15276
+ // /['"\\]/g
15277
+ $qReg: 1,
15267
15278
  // View ID — the unique identifier of the owning View instance.
15268
- // Injected into v-event attribute values at render time so that
15279
+ // Injected into @event attribute values at render time so that
15269
15280
  // EventDelegator can dispatch events to the correct View handler.
15270
15281
  // The \x1f placeholder in compiled output is replaced with '+$viewId+'.
15271
15282
  $viewId: 1,
15272
15283
  // Debug: current expression text — stores the template expression being
15273
15284
  // evaluated, for error reporting. Only present in debug mode.
15274
- // e.g. $expr='<%=user.name%>'
15275
- $expr: 1,
15285
+ // e.g. $dbgExpr='<%=user.name%>'
15286
+ $dbgExpr: 1,
15276
15287
  // Debug: original art syntax — stores the {{}} template syntax before
15277
15288
  // conversion, for error reporting. Only present in debug mode.
15278
- // e.g. $art='{{=user.name}}'
15279
- $art: 1,
15289
+ // e.g. $dbgArt='{{=user.name}}'
15290
+ $dbgArt: 1,
15280
15291
  // Debug: source line number — tracks the current line in the template
15281
15292
  // source, for error reporting. Only present in debug mode.
15282
- $line: 1,
15283
- // refData alias — fallback reference lookup table.
15284
- // Defaults to $$ when no explicit $$ref is provided.
15285
- // Ensures $i() does not crash when @ operator is used without refData.
15286
- $$ref: 1,
15293
+ $dbgLine: 1,
15294
+ // RefData alias — fallback reference lookup table.
15295
+ // Defaults to $data when no explicit $refAlt is provided.
15296
+ // Ensures $refFn() does not crash when @ operator is used without refData.
15297
+ $refAlt: 1,
15287
15298
  // Temporary variable — used by the compiler for intermediate
15288
15299
  // expression results in generated code (e.g. loop variables,
15289
- // conditional branches). Declared as: let $_temp
15290
- $_temp: 1,
15300
+ // conditional branches). Declared as: let $tmp
15301
+ $tmp: 1,
15291
15302
  // JS literals
15292
15303
  undefined: 1,
15293
15304
  null: 1,
package/dist/webpack.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  compileTemplate,
3
3
  extractGlobalVars
4
- } from "./chunk-5OEHRF3U.js";
4
+ } from "./chunk-ANWA22AX.js";
5
5
 
6
6
  // src/webpack.ts
7
7
  function larkMvcLoader(source) {
package/package.json CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
2
  "name": "@lark.js/mvc",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Lark - TypeScript MVC framework",
5
5
  "files": [
6
- "dist",
7
- "lark.d.ts",
8
- "README.md"
6
+ "dist"
9
7
  ],
10
8
  "exports": {
11
9
  ".": {
@@ -48,7 +46,10 @@
48
46
  "build:tsup": "tsup",
49
47
  "clean": "rm -rf dist",
50
48
  "format": "prettier -w ./",
51
- "typecheck": "tsc -p tsconfig.build.json --noEmit"
49
+ "typecheck": "tsc -p tsconfig.build.json --noEmit",
50
+ "test": "vitest run",
51
+ "test:watch": "vitest",
52
+ "test:coverage": "vitest run --coverage"
52
53
  },
53
54
  "keywords": [
54
55
  "lark",
@@ -62,11 +63,13 @@
62
63
  "@rollup/plugin-commonjs": "^29.0.2",
63
64
  "@rollup/plugin-node-resolve": "^16.0.3",
64
65
  "@rollup/plugin-typescript": "^12.3.0",
66
+ "@vitest/coverage-v8": "4.1.6",
65
67
  "rollup": "^4.60.3",
66
68
  "rollup-plugin-dts": "^6.4.1",
67
69
  "tsup": "^8.5.1",
68
70
  "typescript": "^5.8.3",
69
- "vite": "^8.0.14"
71
+ "vite": "^8.0.14",
72
+ "vitest": "^4.1.6"
70
73
  },
71
74
  "lint-staged": {
72
75
  "*.{json,jsonc,js,cjs,mjs,jsx,ts,cts,mts,tsx,html,vue,css,scss,md,mdx}": [