@unhead/cli 3.4.2 → 3.5.0

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.d.mts CHANGED
@@ -57,6 +57,61 @@ declare const validateUrlCommand: citty.CommandDef<{
57
57
  };
58
58
  }>;
59
59
 
60
+ type Mode = 'audit' | 'migrate';
61
+ interface FileDiagnostic {
62
+ ruleId: string;
63
+ message: string;
64
+ /** 1-based line in the original file source. */
65
+ line: number;
66
+ /** 1-based column in the original file source. */
67
+ column: number;
68
+ severity: 'error' | 'warning' | 'info';
69
+ }
70
+ interface HeadCallSite {
71
+ /** Identifier the call resolved to (`useHead`, `useSeoMeta`, `defineLink`, …). */
72
+ name: string;
73
+ /** 1-based line in the original file source. */
74
+ line: number;
75
+ /** 1-based column in the original file source. */
76
+ column: number;
77
+ }
78
+ interface TitleObservation {
79
+ /** Statically-resolved title or titleTemplate string. */
80
+ value: string;
81
+ /** 1-based line in the original file source. */
82
+ line: number;
83
+ /** 1-based column in the original file source. */
84
+ column: number;
85
+ /** Composable that emitted it (`useHead`, `useSeoMeta`, `defineNuxtConfig`). */
86
+ callee: string;
87
+ }
88
+ interface AuditFileResult {
89
+ filePath: string;
90
+ diagnostics: FileDiagnostic[];
91
+ /** Head/SEO calls found in the file — useful so users can confirm coverage. */
92
+ headCalls: HeadCallSite[];
93
+ /** Resolvable `title:` literals found in the file. */
94
+ titles: TitleObservation[];
95
+ /** Resolvable `titleTemplate:` literals found in the file. */
96
+ titleTemplates: TitleObservation[];
97
+ /** Migrated source if any fixes were applied. */
98
+ output?: string;
99
+ }
100
+ interface RunOptions {
101
+ patterns: string[];
102
+ mode: Mode;
103
+ cwd: string;
104
+ ignore?: string[];
105
+ }
106
+ declare function runAudit(opts: RunOptions): Promise<AuditFileResult[]>;
107
+ declare function summarise(results: AuditFileResult[]): {
108
+ errorCount: number;
109
+ warningCount: number;
110
+ infoCount: number;
111
+ fileCount: number;
112
+ };
113
+
60
114
  declare function run(): Promise<void>;
61
115
 
62
- export { audit, migrate, run, validateHtmlCommand, validateUrlCommand };
116
+ export { audit, migrate, run, runAudit, summarise, validateHtmlCommand, validateUrlCommand };
117
+ export type { AuditFileResult, FileDiagnostic, Mode, RunOptions };
package/dist/index.d.ts CHANGED
@@ -57,6 +57,61 @@ declare const validateUrlCommand: citty.CommandDef<{
57
57
  };
58
58
  }>;
59
59
 
60
+ type Mode = 'audit' | 'migrate';
61
+ interface FileDiagnostic {
62
+ ruleId: string;
63
+ message: string;
64
+ /** 1-based line in the original file source. */
65
+ line: number;
66
+ /** 1-based column in the original file source. */
67
+ column: number;
68
+ severity: 'error' | 'warning' | 'info';
69
+ }
70
+ interface HeadCallSite {
71
+ /** Identifier the call resolved to (`useHead`, `useSeoMeta`, `defineLink`, …). */
72
+ name: string;
73
+ /** 1-based line in the original file source. */
74
+ line: number;
75
+ /** 1-based column in the original file source. */
76
+ column: number;
77
+ }
78
+ interface TitleObservation {
79
+ /** Statically-resolved title or titleTemplate string. */
80
+ value: string;
81
+ /** 1-based line in the original file source. */
82
+ line: number;
83
+ /** 1-based column in the original file source. */
84
+ column: number;
85
+ /** Composable that emitted it (`useHead`, `useSeoMeta`, `defineNuxtConfig`). */
86
+ callee: string;
87
+ }
88
+ interface AuditFileResult {
89
+ filePath: string;
90
+ diagnostics: FileDiagnostic[];
91
+ /** Head/SEO calls found in the file — useful so users can confirm coverage. */
92
+ headCalls: HeadCallSite[];
93
+ /** Resolvable `title:` literals found in the file. */
94
+ titles: TitleObservation[];
95
+ /** Resolvable `titleTemplate:` literals found in the file. */
96
+ titleTemplates: TitleObservation[];
97
+ /** Migrated source if any fixes were applied. */
98
+ output?: string;
99
+ }
100
+ interface RunOptions {
101
+ patterns: string[];
102
+ mode: Mode;
103
+ cwd: string;
104
+ ignore?: string[];
105
+ }
106
+ declare function runAudit(opts: RunOptions): Promise<AuditFileResult[]>;
107
+ declare function summarise(results: AuditFileResult[]): {
108
+ errorCount: number;
109
+ warningCount: number;
110
+ infoCount: number;
111
+ fileCount: number;
112
+ };
113
+
60
114
  declare function run(): Promise<void>;
61
115
 
62
- export { audit, migrate, run, validateHtmlCommand, validateUrlCommand };
116
+ export { audit, migrate, run, runAudit, summarise, validateHtmlCommand, validateUrlCommand };
117
+ export type { AuditFileResult, FileDiagnostic, Mode, RunOptions };
package/dist/index.mjs CHANGED
@@ -1270,7 +1270,11 @@ function validateHtml(html, source) {
1270
1270
  const { input } = parseHtmlForUnheadExtraction(html);
1271
1271
  const captured = [];
1272
1272
  const head = createHead({
1273
- plugins: [ValidatePlugin({ onReport: (rs) => captured.push(...rs) })]
1273
+ plugins: [ValidatePlugin({
1274
+ // Rendered HTML carries data-hid but cannot establish the client entry's key.
1275
+ rules: { "large-inline-content-without-key": "off" },
1276
+ onReport: (rs) => captured.push(...rs)
1277
+ })]
1274
1278
  });
1275
1279
  head.push(input);
1276
1280
  renderSSRHead(head);
@@ -1431,4 +1435,4 @@ function run() {
1431
1435
  return runMain(main);
1432
1436
  }
1433
1437
 
1434
- export { audit, migrate, run, validateHtmlCommand, validateUrlCommand };
1438
+ export { audit, migrate, run, runAudit, summarise, validateHtmlCommand, validateUrlCommand };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/cli",
3
3
  "type": "module",
4
- "version": "3.4.2",
4
+ "version": "3.5.0",
5
5
  "description": "CLI for auditing and migrating unhead head usage in your codebase.",
6
6
  "author": "Harlan Wilton <harlan@harlanzw.com>",
7
7
  "license": "MIT",
@@ -51,7 +51,7 @@
51
51
  "oxc-walker": "^1.1.1",
52
52
  "pathe": "^2.0.3",
53
53
  "tinyglobby": "^0.2.17",
54
- "unhead": "3.4.2"
54
+ "unhead": "3.5.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "vitest": "^5.0.0"