svelte-vitals 0.54.0 → 0.54.1

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.
@@ -1,6 +1,7 @@
1
- import { c as findUnknownRuleIds, h as readPackageVersion, i as run, l as knownRuleIds, m as readCoreVersion, p as isReporterName } from "./src-YdyHF4je.js";
1
+ import { c as findUnknownRuleIds, h as readPackageVersion, i as run, l as knownRuleIds, m as readCoreVersion, p as isReporterName } from "./src-JNLD6nw2.js";
2
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { dirname, resolve } from "node:path";
4
+ import { terminalSafe } from "@svelte-vitals/core/internal";
4
5
  import { spawnSync } from "node:child_process";
5
6
  import { parseArgs } from "node:util";
6
7
  import * as p from "@clack/prompts";
@@ -25,8 +26,8 @@ function realIO() {
25
26
  },
26
27
  cwd: process.cwd(),
27
28
  isTTY: Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY),
28
- log: (line) => console.log(line),
29
- errorLog: (line) => console.error(line),
29
+ log: (line) => console.log(terminalSafe(line)),
30
+ errorLog: (line) => console.error(terminalSafe(line)),
30
31
  runCommand: (command, args, cwd) => {
31
32
  const result = spawnSync(command, args, {
32
33
  cwd,
@@ -35,11 +36,11 @@ function realIO() {
35
36
  timeout: 12e4
36
37
  });
37
38
  if (result.error) {
38
- console.error(`svelte-vitals: ${command} failed to start: ${result.error.message}`);
39
+ console.error(terminalSafe(`svelte-vitals: ${command} failed to start: ${result.error.message}`));
39
40
  return 1;
40
41
  }
41
42
  if (result.signal) {
42
- console.error(`svelte-vitals: ${command} was terminated (${result.signal}) — it may have timed out.`);
43
+ console.error(terminalSafe(`svelte-vitals: ${command} was terminated (${result.signal}) — it may have timed out.`));
43
44
  return 1;
44
45
  }
45
46
  return result.status ?? 1;
@@ -85,7 +86,7 @@ function clackPrompts() {
85
86
  //#region src/cli-io.ts
86
87
  const consoleIO = {
87
88
  log: (line) => console.log(line),
88
- errorLog: (line) => console.error(line)
89
+ errorLog: (line) => console.error(terminalSafe(line))
89
90
  };
90
91
  //#endregion
91
92
  //#region src/resolve-args.ts
@@ -377,15 +378,16 @@ function guardArgs(argv, valueFlags, booleanFlags) {
377
378
  }
378
379
  }
379
380
  }
381
+ const isTokenOf = (flag, token) => token === `--${flag}` || token.startsWith(`--${flag}=`);
380
382
  const offFlags = new Set(booleanFlags.filter((flag) => {
381
383
  let lastToken;
382
- for (const t of argv) if (t === `--${flag}` || t === `--${flag}=false`) lastToken = t;
384
+ for (const t of argv) if (isTokenOf(flag, t)) lastToken = t;
383
385
  return lastToken === `--${flag}=false`;
384
386
  }));
385
387
  return {
386
388
  errors,
387
389
  argv: argv.filter((token) => {
388
- for (const flag of booleanFlags) if (token === `--${flag}=false` || offFlags.has(flag) && token === `--${flag}`) return false;
390
+ for (const flag of booleanFlags) if (offFlags.has(flag) ? isTokenOf(flag, token) : token === `--${flag}=false`) return false;
389
391
  return true;
390
392
  })
391
393
  };
package/dist/bin.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { g as realIO, i as resolveLocale, m as consoleIO, n as runAnalyzeCliGunshi } from "./analyze-BMmHtlXw.js";
2
+ import { g as realIO, i as resolveLocale, m as consoleIO, n as runAnalyzeCliGunshi } from "./analyze-xZ-eAUSd.js";
3
+ import { terminalSafe } from "@svelte-vitals/core/internal";
3
4
  //#region src/cli.ts
4
5
  /**
5
6
  * CLI dispatch: routes `docs`/`explain`/`install`/`ci` subcommands, otherwise hands off to the
@@ -16,35 +17,35 @@ async function runCli(argv, io = consoleIO, env = process.env) {
16
17
  try {
17
18
  const locale = resolveLocale(env);
18
19
  if (argv[0] === "complete") {
19
- const { runCompleteCliGunshi } = await import("./complete-Ch90r0sl.js");
20
+ const { runCompleteCliGunshi } = await import("./complete-CBdQRaK6.js");
20
21
  return {
21
22
  code: await runCompleteCliGunshi(argv, io),
22
23
  exit: "natural"
23
24
  };
24
25
  }
25
26
  if (argv[0] === "docs") {
26
- const { runDocsCliGunshi } = await import("./docs-d-yH1BK6.js");
27
+ const { runDocsCliGunshi } = await import("./docs-CagAi2wo.js");
27
28
  return {
28
29
  code: await runDocsCliGunshi(argv.slice(1), io, locale),
29
30
  exit: "natural"
30
31
  };
31
32
  }
32
33
  if (argv[0] === "explain") {
33
- const { runExplainCliGunshi } = await import("./explain-CibqNEff.js");
34
+ const { runExplainCliGunshi } = await import("./explain-CSxloUqF.js");
34
35
  return {
35
36
  code: await runExplainCliGunshi(argv.slice(1), io, locale),
36
37
  exit: "natural"
37
38
  };
38
39
  }
39
40
  if (argv[0] === "install") {
40
- const { runInstallCliGunshi } = await import("./install-BrrV4ATR.js").then((n) => n.n);
41
+ const { runInstallCliGunshi } = await import("./install-B8pNiZ0Q.js").then((n) => n.n);
41
42
  return {
42
43
  code: await runInstallCliGunshi(argv.slice(1), io, locale),
43
44
  exit: "immediate"
44
45
  };
45
46
  }
46
47
  if (argv[0] === "ci") {
47
- const { runCiCliGunshi } = await import("./ci-BDOPcOtr.js");
48
+ const { runCiCliGunshi } = await import("./ci-Dl7hgbGa.js");
48
49
  return {
49
50
  code: await runCiCliGunshi(argv.slice(1), {
50
51
  ...realIO(),
@@ -72,7 +73,7 @@ async function main() {
72
73
  else process.exitCode = code;
73
74
  }
74
75
  main().catch((err) => {
75
- console.error(`svelte-vitals: ${err instanceof Error ? err.message : String(err)}`);
76
+ console.error(terminalSafe(`svelte-vitals: ${err instanceof Error ? err.message : String(err)}`));
76
77
  process.exit(2);
77
78
  });
78
79
  //#endregion
@@ -1,4 +1,4 @@
1
- import { a as guardArgs, c as stripUnknownFlags, g as realIO, l as suggestClosest, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-BMmHtlXw.js";
1
+ import { a as guardArgs, c as stripUnknownFlags, g as realIO, l as suggestClosest, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-xZ-eAUSd.js";
2
2
  import { a as planWorkflowWrite, i as buildWorkflowYaml, n as ACTION_VERSION, r as WORKFLOW_PATH, t as ACTION_SHA } from "./action-pin.generated-C2XJJ3NW.js";
3
3
  import { join } from "node:path";
4
4
  import { cli } from "gunshi/bone";
@@ -1,9 +1,9 @@
1
- import { f as REPORTER_NAMES } from "./src-YdyHF4je.js";
2
- import { d as FAIL_ON_VALUES, f as TREAT_DYNAMIC_AS_VALUES, m as consoleIO, t as ROOT_ARGS, u as CATEGORIES } from "./analyze-BMmHtlXw.js";
3
- import { t as INSTALL_ARGS } from "./install-BrrV4ATR.js";
4
- import { CI_ARGS, CI_UPGRADE_ARGS } from "./ci-BDOPcOtr.js";
5
- import { DOCS_LIST_ARGS, DOCS_ROOT_ARGS, DOCS_SHOW_ARGS } from "./docs-d-yH1BK6.js";
6
- import { EXPLAIN_ARGS } from "./explain-CibqNEff.js";
1
+ import { f as REPORTER_NAMES } from "./src-JNLD6nw2.js";
2
+ import { d as FAIL_ON_VALUES, f as TREAT_DYNAMIC_AS_VALUES, m as consoleIO, t as ROOT_ARGS, u as CATEGORIES } from "./analyze-xZ-eAUSd.js";
3
+ import { t as INSTALL_ARGS } from "./install-B8pNiZ0Q.js";
4
+ import { CI_ARGS, CI_UPGRADE_ARGS } from "./ci-Dl7hgbGa.js";
5
+ import { DOCS_LIST_ARGS, DOCS_ROOT_ARGS, DOCS_SHOW_ARGS } from "./docs-CagAi2wo.js";
6
+ import { EXPLAIN_ARGS } from "./explain-CSxloUqF.js";
7
7
  import { cli } from "gunshi/bone";
8
8
  import { define } from "gunshi/definition";
9
9
  import { kebabnize } from "gunshi/utils";
@@ -1,5 +1,5 @@
1
- import { l as knownRuleIds } from "./src-YdyHF4je.js";
2
- import { a as guardArgs, c as stripUnknownFlags, l as suggestClosest, m as consoleIO, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-BMmHtlXw.js";
1
+ import { l as knownRuleIds } from "./src-JNLD6nw2.js";
2
+ import { a as guardArgs, c as stripUnknownFlags, l as suggestClosest, m as consoleIO, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-xZ-eAUSd.js";
3
3
  import { docsUrlFor } from "@svelte-vitals/core/internal";
4
4
  import { cli } from "gunshi/bone";
5
5
  import { define } from "gunshi/definition";
@@ -1,5 +1,5 @@
1
- import { l as knownRuleIds } from "./src-YdyHF4je.js";
2
- import { a as guardArgs, c as stripUnknownFlags, l as suggestClosest, m as consoleIO, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-BMmHtlXw.js";
1
+ import { l as knownRuleIds } from "./src-JNLD6nw2.js";
2
+ import { a as guardArgs, c as stripUnknownFlags, l as suggestClosest, m as consoleIO, o as splitAtTerminator, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-xZ-eAUSd.js";
3
3
  import { CATEGORIES } from "@svelte-vitals/core";
4
4
  import { allRules, explainRule } from "@svelte-vitals/core/internal";
5
5
  import { cli } from "gunshi/bone";
@@ -1,4 +1,4 @@
1
- import { t as ROOT_ARGS } from "./analyze-BMmHtlXw.js";
2
- import { t as INSTALL_ARGS } from "./install-BrrV4ATR.js";
1
+ import { t as ROOT_ARGS } from "./analyze-xZ-eAUSd.js";
2
+ import { t as INSTALL_ARGS } from "./install-B8pNiZ0Q.js";
3
3
  import { t as JA_ARG_DESCRIPTIONS } from "./ja-BDLP3KLG.js";
4
4
  export { INSTALL_ARGS, JA_ARG_DESCRIPTIONS, ROOT_ARGS };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as spinnerEnabled, b as ProjectError, c as findUnknownRuleIds, d as ruleOptionsSpec, i as run, l as knownRuleIds, n as applyScope, o as CONFIG_FILENAMES, r as defineConfig, s as loadConfigFile, t as analyzeProject, u as registryTag, y as routeMatcher } from "./src-YdyHF4je.js";
1
+ import { a as spinnerEnabled, b as ProjectError, c as findUnknownRuleIds, d as ruleOptionsSpec, i as run, l as knownRuleIds, n as applyScope, o as CONFIG_FILENAMES, r as defineConfig, s as loadConfigFile, t as analyzeProject, u as registryTag, y as routeMatcher } from "./src-JNLD6nw2.js";
2
2
  export { CONFIG_FILENAMES, ProjectError, analyzeProject, applyScope, defineConfig, findUnknownRuleIds, knownRuleIds, loadConfigFile, registryTag, routeMatcher, ruleOptionsSpec, run, spinnerEnabled };
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { _ as hasDep, g as discoverApps, h as readPackageVersion, o as CONFIG_FILENAMES, v as readPkg } from "./src-YdyHF4je.js";
3
- import { a as guardArgs, c as stripUnknownFlags, g as realIO, h as clackPrompts, m as consoleIO, o as splitAtTerminator, p as toList, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-BMmHtlXw.js";
2
+ import { _ as hasDep, g as discoverApps, h as readPackageVersion, o as CONFIG_FILENAMES, v as readPkg } from "./src-JNLD6nw2.js";
3
+ import { a as guardArgs, c as stripUnknownFlags, g as realIO, h as clackPrompts, m as consoleIO, o as splitAtTerminator, p as toList, r as localizedOptionsSection, s as stripAutoVersionLine } from "./analyze-xZ-eAUSd.js";
4
4
  import { a as planWorkflowWrite, i as buildWorkflowYaml, n as ACTION_VERSION, r as WORKFLOW_PATH, t as ACTION_SHA } from "./action-pin.generated-C2XJJ3NW.js";
5
5
  import { buildCursorRules, installHeader } from "./install/skill-content.js";
6
6
  import { join } from "node:path";
@@ -1,7 +1,7 @@
1
1
  import { existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
2
2
  import { dirname, join, resolve } from "node:path";
3
3
  import { CATEGORIES, defineConfig, defineConfig as defineConfig$1 } from "@svelte-vitals/core";
4
- import { CHILD_NODE_KEYS, IDREF_ATTRS, LANDMARK_ROLES, ROBOTS_SOURCE_PATHS, SITEMAP_SOURCE_PATHS, SVELTE_CONFIG_FILES, VITE_CONFIG_FILES, allRules, applyInlineDirectives, applyOverrides, applyRuleSeverities, attrText, attrTextOf, attrValue, attrValueOf, collectComponentFacts, collectKitModuleFacts, collectSourceFiles, collectSuppressions, compileOverrides, computeHealth, decodeFragmentId, defaultConfig, docsUrlFor, findAttr, findMinifyDisabled, foldOccurrences, formatAgentReport, formatConsoleReport, formatFailedRuleWarning, formatGithubReport, formatHtmlReport, formatJsonReport, formatMarkdownReport, formatSarifReport, hasFailureAtOrAbove, isPenalized, isTopFragment, lineOf, noColorPalette, parseSvelte, resolveKitAliases, resolveKitPathsBase, resolveRepoLocalPath, resolveRuleOptions, runRules, scoreColor, selectRules, settingSeverity, shouldSkipRangeCheck, skippedFileWarnings, splitTokens, stripTextDirective, summarize, terminalSafe, textFromNodes, unknownDirectiveIds, validateRuleSetting, valueFromNodes, withFailedRulesOff, withReadLimit } from "@svelte-vitals/core/internal";
4
+ import { CHILD_NODE_KEYS, IDREF_ATTRS, LANDMARK_ROLES, ROBOTS_SOURCE_PATHS, SITEMAP_SOURCE_PATHS, SVELTE_CONFIG_FILES, VITE_CONFIG_FILES, allRules, applyInlineDirectives, applyOverrides, applyRuleSeverities, attrText, attrTextOf, attrValue, attrValueOf, collectComponentFacts, collectKitModuleFacts, collectSourceFiles, collectSuppressions, compileOverrides, computeHealth, decodeFragmentId, defaultConfig, docsUrlFor, findAttr, findMinifyDisabled, foldOccurrences, formatAgentReport, formatConsoleReport, formatFailedRuleWarning, formatGithubReport, formatHtmlReport, formatJsonReport, formatMarkdownReport, formatSarifReport, hasFailureAtOrAbove, isPenalized, isTopFragment, lineOf, noColorPalette, parseSvelte, resolveKitAliases, resolveKitPathsBase, resolveRepoLocalPath, resolveRole, resolveRuleOptions, runRules, scoreColor, selectRules, settingSeverity, shouldSkipRangeCheck, skippedFileWarnings, splitTokens, stripTextDirective, summarize, terminalSafe, textFromNodes, unknownDirectiveIds, validateRuleSetting, valueFromNodes, withFailedRulesOff, withReadLimit } from "@svelte-vitals/core/internal";
5
5
  import { access, readFile } from "node:fs/promises";
6
6
  import { glob } from "tinyglobby";
7
7
  import { getAgentProfile } from "gunshi/agent";
@@ -900,7 +900,7 @@ function collectA11y(fragment, source) {
900
900
  const line = lineOf(source, node.start);
901
901
  const attrs = node.attributes;
902
902
  const roleAttr = findAttr(attrs, "role");
903
- const role = roleAttr ? splitTokens(attrTextOf(roleAttr))[0] : void 0;
903
+ const role = roleAttr ? resolveRole(splitTokens(attrTextOf(roleAttr))) : void 0;
904
904
  let landmark = roleAttr ? role && LANDMARK_ROLES.has(role) ? role : void 0 : LANDMARK_TAGS.get(node.name);
905
905
  if (!roleAttr && node.name === "aside") landmark = ctx.asideDemoting === 0 || hasAccessibleName(attrs) ? "complementary" : void 0;
906
906
  if (landmark) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-vitals",
3
- "version": "0.54.0",
3
+ "version": "0.54.1",
4
4
  "description": "A deterministic SvelteKit code-health scanner (SEO, performance, correctness, security, architecture, accessibility).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "dist"
44
44
  ],
45
45
  "dependencies": {
46
- "@svelte-vitals/core": "0.50.0",
46
+ "@svelte-vitals/core": "0.50.1",
47
47
  "@clack/prompts": "^1.7.0",
48
48
  "@gunshi/plugin-completion": "0.37.1",
49
49
  "@gunshi/plugin-i18n": "0.37.1",