uilint 0.2.164 → 0.2.166

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/index.js CHANGED
@@ -2488,6 +2488,17 @@ function processLintResults(absolutePath, projectCwd, messages, onProgress) {
2488
2488
  }
2489
2489
  return issues;
2490
2490
  }
2491
+ async function formatRuleProfileProgress() {
2492
+ const profilerModule = await import("uilint-eslint");
2493
+ if (typeof profilerModule.buildRuleProfileSession !== "function") {
2494
+ return null;
2495
+ }
2496
+ const session = profilerModule.buildRuleProfileSession();
2497
+ const slowest = session.rules.filter((rule) => rule.totalMs > 0).sort((a, b) => b.totalMs - a.totalMs).slice(0, 3);
2498
+ if (slowest.length === 0) return null;
2499
+ const summary = slowest.map((rule) => `${rule.ruleId} ${rule.totalMs.toFixed(1)}ms`).join(", ");
2500
+ return `Profile: ${summary}`;
2501
+ }
2491
2502
  async function lintFileFast(filePath, onProgress) {
2492
2503
  const absolutePath = resolveRequestedFilePath(filePath);
2493
2504
  if (!existsSync5(absolutePath)) {
@@ -3012,6 +3023,17 @@ async function handleMessage(ws, data) {
3012
3023
  requestId,
3013
3024
  phase: `Done (${fastClientIssues.length} issues, ${fastElapsed}ms)`
3014
3025
  });
3026
+ {
3027
+ const profileSummary = await formatRuleProfileProgress();
3028
+ if (profileSummary) {
3029
+ sendMessage(ws, {
3030
+ type: "lint:progress",
3031
+ filePath,
3032
+ requestId,
3033
+ phase: profileSummary
3034
+ });
3035
+ }
3036
+ }
3015
3037
  if (isSemanticRuleEnabled()) {
3016
3038
  runSemanticAnalysisAsync(filePath, ws, requestId).catch((err) => {
3017
3039
  logServerError(
@@ -3056,6 +3078,17 @@ async function handleMessage(ws, data) {
3056
3078
  phase: `Done (${fastFiltered.length} issues, ${elapsed}ms)`
3057
3079
  });
3058
3080
  }
3081
+ {
3082
+ const profileSummary = await formatRuleProfileProgress();
3083
+ if (profileSummary) {
3084
+ sendMessage(ws, {
3085
+ type: "lint:progress",
3086
+ filePath,
3087
+ requestId,
3088
+ phase: profileSummary
3089
+ });
3090
+ }
3091
+ }
3059
3092
  if (isSemanticRuleEnabled()) {
3060
3093
  runSemanticAnalysisAsync(filePath, ws, requestId).catch((err) => {
3061
3094
  logServerError(
@@ -5995,6 +6028,21 @@ program.command("config").description("Get or set UILint configuration options")
5995
6028
  port: parseInt(options.port, 10)
5996
6029
  });
5997
6030
  });
6031
+ program.command("profile").description("Show the latest UILint rule profiling summary").option(
6032
+ "--profile-dir <path>",
6033
+ "Profile directory (default: .uilint/profile or UILINT_PROFILE_DIR)"
6034
+ ).option("-j, --json", "Print raw latest.json").option(
6035
+ "-l, --limit <number>",
6036
+ "Number of rows to show",
6037
+ (v) => parseInt(v, 10)
6038
+ ).action(async (options) => {
6039
+ const { profile } = await import("./profile-IRI5WLW7.js");
6040
+ await profile({
6041
+ profileDir: options.profileDir,
6042
+ json: options.json,
6043
+ limit: options.limit
6044
+ });
6045
+ });
5998
6046
  program.addCommand(createDuplicatesCommand());
5999
6047
  program.addCommand(createManifestCommand());
6000
6048
  program.addCommand(createSocketCommand());