@vue-html-bridge/cli 0.1.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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +81 -0
  3. package/dist/adapters.d.ts +29 -0
  4. package/dist/adapters.d.ts.map +1 -0
  5. package/dist/adapters.js +55 -0
  6. package/dist/adapters.js.map +1 -0
  7. package/dist/bin.d.ts +3 -0
  8. package/dist/bin.d.ts.map +1 -0
  9. package/dist/bin.js +54 -0
  10. package/dist/bin.js.map +1 -0
  11. package/dist/cli.d.ts +27 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +93 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/diagnostics.d.ts +22 -0
  16. package/dist/diagnostics.d.ts.map +1 -0
  17. package/dist/diagnostics.js +71 -0
  18. package/dist/diagnostics.js.map +1 -0
  19. package/dist/enumerate.d.ts +18 -0
  20. package/dist/enumerate.d.ts.map +1 -0
  21. package/dist/enumerate.js +182 -0
  22. package/dist/enumerate.js.map +1 -0
  23. package/dist/exit-codes.d.ts +23 -0
  24. package/dist/exit-codes.d.ts.map +1 -0
  25. package/dist/exit-codes.js +38 -0
  26. package/dist/exit-codes.js.map +1 -0
  27. package/dist/index.d.ts +9 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +12 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/line-index.d.ts +34 -0
  32. package/dist/line-index.d.ts.map +1 -0
  33. package/dist/line-index.js +82 -0
  34. package/dist/line-index.js.map +1 -0
  35. package/dist/options.d.ts +79 -0
  36. package/dist/options.d.ts.map +1 -0
  37. package/dist/options.js +465 -0
  38. package/dist/options.js.map +1 -0
  39. package/dist/output/ndjson.d.ts +80 -0
  40. package/dist/output/ndjson.d.ts.map +1 -0
  41. package/dist/output/ndjson.js +61 -0
  42. package/dist/output/ndjson.js.map +1 -0
  43. package/dist/output/text.d.ts +12 -0
  44. package/dist/output/text.d.ts.map +1 -0
  45. package/dist/output/text.js +76 -0
  46. package/dist/output/text.js.map +1 -0
  47. package/dist/runner.d.ts +38 -0
  48. package/dist/runner.d.ts.map +1 -0
  49. package/dist/runner.js +221 -0
  50. package/dist/runner.js.map +1 -0
  51. package/dist/settings-resolution.d.ts +27 -0
  52. package/dist/settings-resolution.d.ts.map +1 -0
  53. package/dist/settings-resolution.js +48 -0
  54. package/dist/settings-resolution.js.map +1 -0
  55. package/dist/types.d.ts +74 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/dist/types.js +6 -0
  58. package/dist/types.js.map +1 -0
  59. package/package.json +43 -0
@@ -0,0 +1,182 @@
1
+ // File enumeration (cli.md §6 step 2): positional args replace `include`;
2
+ // directories expand to `<dir>/**/*.vue`; `exclude` always applies; globs
3
+ // follow "standard" semantics (`*` does not match dotfiles, unlike the
4
+ // `{ dot: true }` matching language-server's own didOpen-time
5
+ // include/exclude check uses for a different purpose — cli.md §7 states this
6
+ // explicitly for the CLI); symlinked/duplicate arguments dedupe to one
7
+ // analysis by real path; a resolved file outside the workspace root is a
8
+ // run-level error, isolated to that one argument; the final list is sorted
9
+ // by workspace-relative path.
10
+ import { readdir, realpath, stat } from "node:fs/promises";
11
+ import { isAbsolute, join, parse, relative, resolve, sep } from "node:path";
12
+ import { minimatch } from "minimatch";
13
+ const CASE_INSENSITIVE_PLATFORM = process.platform === "darwin" || process.platform === "win32";
14
+ const GLOB_META = /[*?[\]{}]/;
15
+ function toPosixRelative(base, target) {
16
+ return relative(base, target).split(sep).join("/");
17
+ }
18
+ function posixJoin(...segments) {
19
+ return segments
20
+ .filter((segment) => segment.length > 0)
21
+ .join("/")
22
+ .replace(/\/+/g, "/");
23
+ }
24
+ /**
25
+ * A targeted (not general-purpose) directory-pruning optimization: an
26
+ * exclude pattern shaped exactly like the default `**\/node_modules/**`
27
+ * (a plain literal name wrapped in `**\/…/**`) lets the walk skip descending
28
+ * into any directory with that basename outright, instead of walking
29
+ * potentially huge trees (node_modules) just to filter every file back out
30
+ * afterward. Final correctness never depends on this — every candidate path
31
+ * is still matched against the full pattern set below regardless.
32
+ */
33
+ function buildDirectoryPrune(excludePatterns) {
34
+ const prunableNames = new Set();
35
+ for (const pattern of excludePatterns) {
36
+ const match = /^\*\*\/([^*?[\]{}!/]+)\/\*\*$/.exec(pattern);
37
+ if (match)
38
+ prunableNames.add(match[1]);
39
+ }
40
+ if (prunableNames.size === 0)
41
+ return () => false;
42
+ return (relDirPosix) => {
43
+ const base = relDirPosix.split("/").pop() ?? relDirPosix;
44
+ return prunableNames.has(base);
45
+ };
46
+ }
47
+ async function walk(root, prune) {
48
+ const results = [];
49
+ async function recurse(dirAbs, relDirPosix) {
50
+ let entries;
51
+ try {
52
+ entries = await readdir(dirAbs, { withFileTypes: true });
53
+ }
54
+ catch {
55
+ return; // unreadable directory: skip silently
56
+ }
57
+ for (const entry of entries) {
58
+ const entryRelPosix = relDirPosix === "" ? entry.name : `${relDirPosix}/${entry.name}`;
59
+ const entryAbs = join(dirAbs, entry.name);
60
+ if (entry.isDirectory()) {
61
+ if (prune(entryRelPosix))
62
+ continue;
63
+ await recurse(entryAbs, entryRelPosix);
64
+ }
65
+ else if (entry.isFile()) {
66
+ results.push({ abs: entryAbs, rel: entryRelPosix });
67
+ }
68
+ else if (entry.isSymbolicLink()) {
69
+ // Symlinked directories are intentionally not traversed (avoids
70
+ // cycle-detection complexity); symlinked files are included, and
71
+ // resolved to their real path later during dedup.
72
+ try {
73
+ const target = await stat(entryAbs);
74
+ if (target.isFile())
75
+ results.push({ abs: entryAbs, rel: entryRelPosix });
76
+ }
77
+ catch {
78
+ // Broken symlink: skip.
79
+ }
80
+ }
81
+ }
82
+ }
83
+ await recurse(root, "");
84
+ return results;
85
+ }
86
+ function matchesAny(relPosix, patterns) {
87
+ return patterns.some((pattern) => minimatch(relPosix, pattern, { dot: false }));
88
+ }
89
+ /** The longest literal (non-glob-metacharacter) path prefix of an absolute path or pattern. */
90
+ function staticBaseDir(absPath) {
91
+ const root = parse(absPath).root;
92
+ const rest = absPath.slice(root.length);
93
+ const segments = rest.split(sep).filter((segment) => segment.length > 0);
94
+ const baseSegments = [];
95
+ for (const segment of segments) {
96
+ if (GLOB_META.test(segment))
97
+ break;
98
+ baseSegments.push(segment);
99
+ }
100
+ return baseSegments.length === 0 ? root : join(root, ...baseSegments);
101
+ }
102
+ function isWithinRoot(candidate, root) {
103
+ if (candidate === root)
104
+ return true;
105
+ const rel = relative(root, candidate);
106
+ return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
107
+ }
108
+ async function safeStat(path) {
109
+ try {
110
+ return await stat(path);
111
+ }
112
+ catch {
113
+ return undefined;
114
+ }
115
+ }
116
+ export async function enumerateFiles(options) {
117
+ const { workspaceRoot, cwd, positionalArgs, include, exclude } = options;
118
+ const prune = buildDirectoryPrune(exclude);
119
+ const walked = await walk(workspaceRoot, prune);
120
+ const errors = [];
121
+ const matched = new Set();
122
+ if (positionalArgs.length > 0) {
123
+ for (const arg of positionalArgs) {
124
+ // path.resolve() is a pure string operation; it never touches the
125
+ // filesystem, so glob metacharacters (`*`, `**`) survive untouched as
126
+ // literal path segments — safe to use even on a pattern, not just a
127
+ // concrete path.
128
+ const absArgPath = resolve(cwd, arg);
129
+ const base = staticBaseDir(absArgPath);
130
+ if (!isWithinRoot(base, workspaceRoot)) {
131
+ errors.push({
132
+ code: "path-outside-workspace",
133
+ message: `Argument "${arg}" resolves outside the workspace root "${workspaceRoot}".`,
134
+ });
135
+ continue;
136
+ }
137
+ const stats = await safeStat(absArgPath);
138
+ const effectivePattern = stats?.isDirectory() === true
139
+ ? posixJoin(toPosixRelative(workspaceRoot, absArgPath), "**/*.vue")
140
+ : toPosixRelative(workspaceRoot, absArgPath);
141
+ for (const entry of walked) {
142
+ if (minimatch(entry.rel, effectivePattern, { dot: false })) {
143
+ matched.add(entry.abs);
144
+ }
145
+ }
146
+ }
147
+ }
148
+ else {
149
+ for (const entry of walked) {
150
+ if (matchesAny(entry.rel, include))
151
+ matched.add(entry.abs);
152
+ }
153
+ }
154
+ const relByAbs = new Map(walked.map((entry) => [entry.abs, entry.rel]));
155
+ const survivors = [...matched].filter((abs) => {
156
+ const rel = relByAbs.get(abs) ?? toPosixRelative(workspaceRoot, abs);
157
+ return !matchesAny(rel, exclude);
158
+ });
159
+ // Identity and dedup: normalize to the real path, case-folded on a
160
+ // case-insensitive platform (cli.md §6). Two arguments reaching the same
161
+ // real path analyze it once.
162
+ const deduped = new Map();
163
+ for (const abs of survivors) {
164
+ let real;
165
+ try {
166
+ real = await realpath(abs);
167
+ }
168
+ catch {
169
+ real = abs;
170
+ }
171
+ const key = CASE_INSENSITIVE_PLATFORM ? real.toLowerCase() : real;
172
+ if (!deduped.has(key))
173
+ deduped.set(key, real);
174
+ }
175
+ const files = [...deduped.values()].sort((a, b) => {
176
+ const relA = toPosixRelative(workspaceRoot, a);
177
+ const relB = toPosixRelative(workspaceRoot, b);
178
+ return relA < relB ? -1 : relA > relB ? 1 : 0;
179
+ });
180
+ return { files, errors };
181
+ }
182
+ //# sourceMappingURL=enumerate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enumerate.js","sourceRoot":"","sources":["../src/enumerate.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,8DAA8D;AAC9D,6EAA6E;AAC7E,uEAAuE;AACvE,yEAAyE;AACzE,2EAA2E;AAC3E,8BAA8B;AAC9B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAoBtC,MAAM,yBAAyB,GAC7B,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,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,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,GAAG,GAAG,CAAC;QACb,CAAC;QACD,MAAM,GAAG,GAAG,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAClE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAChD,MAAM,IAAI,GAAG,eAAe,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,eAAe,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QAC/C,OAAO,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,23 @@
1
+ export declare const EXIT_SUCCESS = 0;
2
+ export declare const EXIT_THRESHOLD = 1;
3
+ export declare const EXIT_RUN_ERROR = 2;
4
+ export declare const EXIT_SIGINT = 130;
5
+ export declare const EXIT_SIGTERM = 143;
6
+ export type FailOnThreshold = "error" | "warning" | "info" | "hint" | "never";
7
+ /**
8
+ * cli.md §8: the lowest severity that counts toward exit code 1, per
9
+ * `--fail-on`. `"never"` means no diagnostic ever triggers the threshold
10
+ * exit code (the run can still exit 2 via a run-level error, or with a
11
+ * signal code).
12
+ */
13
+ export declare function severityMeetsThreshold(severity: "error" | "warning" | "info" | "hint", threshold: FailOnThreshold): boolean;
14
+ /**
15
+ * cli.md §8 exit code table, precedence signal > 2 > 1 > 0. `signalExitCode`
16
+ * is set only when the run was interrupted (130/143); it always wins.
17
+ */
18
+ export declare function computeExitCode(outcome: {
19
+ signalExitCode?: number;
20
+ hasRunLevelError: boolean;
21
+ hasThresholdDiagnostic: boolean;
22
+ }): number;
23
+ //# sourceMappingURL=exit-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAS9E;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,EAC/C,SAAS,EAAE,eAAe,GACzB,OAAO,CAGT;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,sBAAsB,EAAE,OAAO,CAAC;CACjC,GAAG,MAAM,CAKT"}
@@ -0,0 +1,38 @@
1
+ // The run-outcome/exit-code model (cli.md §8). Exit code precedence is
2
+ // signal > run-level error (2) > threshold hit (1) > clean (0).
3
+ export const EXIT_SUCCESS = 0;
4
+ export const EXIT_THRESHOLD = 1;
5
+ export const EXIT_RUN_ERROR = 2;
6
+ export const EXIT_SIGINT = 130;
7
+ export const EXIT_SIGTERM = 143;
8
+ const SEVERITY_RANK = {
9
+ error: 0,
10
+ warning: 1,
11
+ info: 2,
12
+ hint: 3,
13
+ };
14
+ /**
15
+ * cli.md §8: the lowest severity that counts toward exit code 1, per
16
+ * `--fail-on`. `"never"` means no diagnostic ever triggers the threshold
17
+ * exit code (the run can still exit 2 via a run-level error, or with a
18
+ * signal code).
19
+ */
20
+ export function severityMeetsThreshold(severity, threshold) {
21
+ if (threshold === "never")
22
+ return false;
23
+ return SEVERITY_RANK[severity] <= SEVERITY_RANK[threshold];
24
+ }
25
+ /**
26
+ * cli.md §8 exit code table, precedence signal > 2 > 1 > 0. `signalExitCode`
27
+ * is set only when the run was interrupted (130/143); it always wins.
28
+ */
29
+ export function computeExitCode(outcome) {
30
+ if (outcome.signalExitCode !== undefined)
31
+ return outcome.signalExitCode;
32
+ if (outcome.hasRunLevelError)
33
+ return EXIT_RUN_ERROR;
34
+ if (outcome.hasThresholdDiagnostic)
35
+ return EXIT_THRESHOLD;
36
+ return EXIT_SUCCESS;
37
+ }
38
+ //# sourceMappingURL=exit-codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAC/B,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAIhC,MAAM,aAAa,GAA0D;IAC3E,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;CACR,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAA+C,EAC/C,SAA0B;IAE1B,IAAI,SAAS,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAI/B;IACC,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,cAAc,CAAC;IACxE,IAAI,OAAO,CAAC,gBAAgB;QAAE,OAAO,cAAc,CAAC;IACpD,IAAI,OAAO,CAAC,sBAAsB;QAAE,OAAO,cAAc,CAAC;IAC1D,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const PACKAGE_NAME = "@vue-html-bridge/cli";
2
+ export { runVueHtmlBridgeCli, type CliIo, type CliInvocationResult, } from "./cli.js";
3
+ export { parseArgv, HELP_TEXT, type OutputFormat, type ParsedCliOptions, type ParseArgvResult, type ValidatorFlagOp, } from "./options.js";
4
+ export { runCli, type RunCliOptions, type RunCliResult } from "./runner.js";
5
+ export { EXIT_SUCCESS, EXIT_THRESHOLD, EXIT_RUN_ERROR, EXIT_SIGINT, EXIT_SIGTERM, type FailOnThreshold, } from "./exit-codes.js";
6
+ export type { CliDiagnostic, RunLevelError, RunSummaryCounts, OutputRenderer, } from "./types.js";
7
+ export { createNdjsonRenderer, CLI_NDJSON_VERSION, type CliNdjsonRecord, type CliNdjsonMeta, type CliNdjsonFile, type CliNdjsonRunError, type CliNdjsonSummary, type CliNdjsonDiagnostic, } from "./output/ndjson.js";
8
+ export { createTextRenderer, type TextRendererOptions } from "./output/text.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,yBAAyB,CAAC;AAEnD,OAAO,EACL,mBAAmB,EACnB,KAAK,KAAK,EACV,KAAK,mBAAmB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ // Public surface of @vue-html-bridge/cli (cli.md). Nothing inside the
2
+ // monorepo depends on this package (monorepo.md §4.1) — these exports exist
3
+ // for this package's own tests and for a future programmatic embedder, not
4
+ // as a contract another workspace package relies on.
5
+ export const PACKAGE_NAME = "@vue-html-bridge/cli";
6
+ export { runVueHtmlBridgeCli, } from "./cli.js";
7
+ export { parseArgv, HELP_TEXT, } from "./options.js";
8
+ export { runCli } from "./runner.js";
9
+ export { EXIT_SUCCESS, EXIT_THRESHOLD, EXIT_RUN_ERROR, EXIT_SIGINT, EXIT_SIGTERM, } from "./exit-codes.js";
10
+ export { createNdjsonRenderer, CLI_NDJSON_VERSION, } from "./output/ndjson.js";
11
+ export { createTextRenderer } from "./output/text.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,4EAA4E;AAC5E,2EAA2E;AAC3E,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAEnD,OAAO,EACL,mBAAmB,GAGpB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,SAAS,GAKV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAyC,MAAM,aAAa,CAAC;AAC5E,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,GAEb,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GAOnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAA4B,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { SourceRange } from "@vue-html-bridge/analyzer";
2
+ /**
3
+ * Thrown for an offset that lands between the \r and \n of a CRLF line
4
+ * terminator. CRLF is treated as one indivisible line break, so this offset
5
+ * has no defined line/column position — core's mapping contract never emits
6
+ * a range boundary here (see language-server/src/positions.ts); this exists
7
+ * so the boundary layer fails loudly instead of silently producing a wrong
8
+ * position.
9
+ */
10
+ export declare class MidLineTerminatorError extends Error {
11
+ constructor(offset: number);
12
+ }
13
+ export interface LineColumn {
14
+ /** 1-based. */
15
+ line: number;
16
+ /** 1-based; counts UTF-16 code units. */
17
+ column: number;
18
+ }
19
+ export interface CliPosition {
20
+ startLine: number;
21
+ startColumn: number;
22
+ endLine: number;
23
+ endColumn: number;
24
+ }
25
+ export interface LineIndex {
26
+ toPosition(offset: number): LineColumn;
27
+ toRangePosition(range: SourceRange): CliPosition;
28
+ }
29
+ /**
30
+ * Builds a line index once per file, then answers offset->{line,column}
31
+ * queries in O(log lines).
32
+ */
33
+ export declare function createLineIndex(text: string): LineIndex;
34
+ //# sourceMappingURL=line-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-index.d.ts","sourceRoot":"","sources":["../src/line-index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D;;;;;;;GAOG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,MAAM,EAAE,MAAM;CAI3B;AAED,MAAM,WAAW,UAAU;IACzB,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IACvC,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAAC;CAClD;AASD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAsEvD"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Thrown for an offset that lands between the \r and \n of a CRLF line
3
+ * terminator. CRLF is treated as one indivisible line break, so this offset
4
+ * has no defined line/column position — core's mapping contract never emits
5
+ * a range boundary here (see language-server/src/positions.ts); this exists
6
+ * so the boundary layer fails loudly instead of silently producing a wrong
7
+ * position.
8
+ */
9
+ export class MidLineTerminatorError extends Error {
10
+ constructor(offset) {
11
+ super(`offset ${offset} points into the middle of a CRLF line terminator`);
12
+ this.name = "MidLineTerminatorError";
13
+ }
14
+ }
15
+ /**
16
+ * Builds a line index once per file, then answers offset->{line,column}
17
+ * queries in O(log lines).
18
+ */
19
+ export function createLineIndex(text) {
20
+ const lines = [];
21
+ let offset = 0;
22
+ let lineStart = 0;
23
+ while (offset < text.length) {
24
+ const code = text.charCodeAt(offset);
25
+ if (code === 0x0d /* \r */) {
26
+ const next = text.charCodeAt(offset + 1);
27
+ const terminatorLength = next === 0x0a /* \n */ ? 2 : 1;
28
+ lines.push({ start: lineStart, end: offset });
29
+ offset += terminatorLength;
30
+ lineStart = offset;
31
+ continue;
32
+ }
33
+ if (code === 0x0a /* \n */) {
34
+ lines.push({ start: lineStart, end: offset });
35
+ offset += 1;
36
+ lineStart = offset;
37
+ continue;
38
+ }
39
+ offset += 1;
40
+ }
41
+ // Final (possibly empty) line, with no terminator.
42
+ lines.push({ start: lineStart, end: offset });
43
+ function findLineIndex(target) {
44
+ let lo = 0;
45
+ let hi = lines.length - 1;
46
+ while (lo < hi) {
47
+ const mid = (lo + hi + 1) >> 1;
48
+ if (lines[mid].start <= target) {
49
+ lo = mid;
50
+ }
51
+ else {
52
+ hi = mid - 1;
53
+ }
54
+ }
55
+ return lo;
56
+ }
57
+ function toPosition(offsetArg) {
58
+ if (offsetArg < 0 || offsetArg > text.length) {
59
+ throw new RangeError(`offset ${offsetArg} out of range [0, ${text.length}]`);
60
+ }
61
+ if (offsetArg > 0 &&
62
+ text.charCodeAt(offsetArg - 1) === 0x0d &&
63
+ text.charCodeAt(offsetArg) === 0x0a) {
64
+ throw new MidLineTerminatorError(offsetArg);
65
+ }
66
+ const lineIdx = findLineIndex(offsetArg);
67
+ const line = lines[lineIdx];
68
+ return { line: lineIdx + 1, column: offsetArg - line.start + 1 };
69
+ }
70
+ function toRangePosition(range) {
71
+ const start = toPosition(range.start);
72
+ const end = toPosition(range.end);
73
+ return {
74
+ startLine: start.line,
75
+ startColumn: start.column,
76
+ endLine: end.line,
77
+ endColumn: end.column,
78
+ };
79
+ }
80
+ return { toPosition, toRangePosition };
81
+ }
82
+ //# sourceMappingURL=line-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-index.js","sourceRoot":"","sources":["../src/line-index.ts"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,MAAc;QACxB,KAAK,CAAC,UAAU,MAAM,mDAAmD,CAAC,CAAC;QAC3E,IAAI,CAAC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AO;YACL,SAAS,EAAE,KAAK,CAAC,IAAI;YACrB,WAAW,EAAE,KAAK,CAAC,MAAM;YACzB,OAAO,EAAE,GAAG,CAAC,IAAI;YACjB,SAAS,EAAE,GAAG,CAAC,MAAM;SACtB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,79 @@
1
+ import type { ResolvedValidatorSetting, VueHtmlBridgeSettingsInput } from "@vue-html-bridge/settings";
2
+ import type { FailOnThreshold } from "./exit-codes.js";
3
+ export type OutputFormat = "text" | "ndjson";
4
+ export type ValidatorFlagOp = {
5
+ kind: "enable";
6
+ entryKey: string;
7
+ } | {
8
+ kind: "disable";
9
+ entryKey: string;
10
+ } | {
11
+ kind: "set-setting";
12
+ entryKey: string;
13
+ path: readonly string[];
14
+ value: unknown;
15
+ };
16
+ export interface ParsedCliOptions {
17
+ /** The flags layer, minus the three validator flags (see module doc). */
18
+ settingsInput: VueHtmlBridgeSettingsInput;
19
+ /** In command-line order, applied by the caller after `resolveSettings` (§4.3). */
20
+ validatorOps: readonly ValidatorFlagOp[];
21
+ positionalArgs: readonly string[];
22
+ configPath?: string;
23
+ workspaceRoot?: string;
24
+ format: OutputFormat;
25
+ failOn: FailOnThreshold;
26
+ untrusted: boolean;
27
+ noColor: boolean;
28
+ help: boolean;
29
+ version: boolean;
30
+ }
31
+ export type ParseArgvResult = {
32
+ kind: "ok";
33
+ options: ParsedCliOptions;
34
+ } | {
35
+ kind: "error";
36
+ message: string;
37
+ };
38
+ export declare function parseArgv(argv: readonly string[]): ParseArgvResult;
39
+ /**
40
+ * The dotted-path grammar (cli.md §4.3): one or more non-empty segments
41
+ * separated by `.`. `__proto__`/`constructor`/`prototype` segments and
42
+ * bracketed array-index syntax (`rules[0]`) are rejected outright rather
43
+ * than silently accepted as literal (surprising) object keys.
44
+ */
45
+ export declare function parseDottedPath(path: string): readonly string[] | string;
46
+ /** JSON-with-string-fallback (cli.md §4.3): `false` parses as a boolean, an unparsable token stays a plain string. */
47
+ export declare function parseFlagValue(raw: string): unknown;
48
+ /**
49
+ * Builds (or extends) a nested settings object using own-property
50
+ * assignment (`Object.defineProperty`, which bypasses the prototype chain
51
+ * entirely) on null-prototype intermediate objects — so even if a forbidden
52
+ * segment slipped past `parseDottedPath` somehow, assignment itself could
53
+ * never reach `Object.prototype`. An existing value at an intermediate
54
+ * position is preserved (copied into a fresh null-prototype object, so the
55
+ * original is never mutated) whenever it is itself a plain object —
56
+ * regardless of whether it came from a previous `deepSetOwn` call (null
57
+ * prototype) or from a config file / earlier `validators[].settings`
58
+ * (ordinary `Object.prototype`); anything else at that position (a scalar,
59
+ * array, or other non-plain value) is replaced (documented last-write-wins
60
+ * for a type mismatch).
61
+ */
62
+ export declare function deepSetOwn(root: unknown, segments: readonly string[], value: unknown): Record<string, unknown>;
63
+ /**
64
+ * cli.md §4.3: applies the three validator flags as per-entry modifications
65
+ * on top of the *already-resolved* `validators[]` (the caller runs this
66
+ * after `resolveSettings`, never as another layer fed into it — a documented
67
+ * exception to normal array-replacement layering). Ops are applied in
68
+ * command-line order, regardless of which of the three flags produced them.
69
+ * `--validator`/`--disable-validator`/`--validator-setting` all add a fresh
70
+ * entry (`enabled: true` by default, matching settings.md §3.1's own default
71
+ * for a `validators[]` entry) when the entry key names no existing entry —
72
+ * documented judgment call: cli.md §4.3 says this explicitly only for
73
+ * `--validator`, but there would otherwise be nothing for
74
+ * `--disable-validator`/`--validator-setting` alone to act on for an adapter
75
+ * not already in the resolved config.
76
+ */
77
+ export declare function applyValidatorFlagOps(validators: readonly ResolvedValidatorSetting[], ops: readonly ValidatorFlagOp[]): readonly ResolvedValidatorSetting[];
78
+ export declare const HELP_TEXT = "Usage: vue-html-bridge [options] [file|dir|glob ...]\n\nRuns the same vue-html-bridge analysis as the language server, one-shot.\n\nPositional arguments:\n file|dir|glob Files, directories (expanded to <dir>/**/*.vue), or\n globs to analyze. Replaces the \"include\" setting\n when given. With none, \"include\" (default\n \"**/*.vue\") is used, relative to the workspace root.\n\nSettings flags:\n --include <glob> Repeatable. Same role as a positional argument.\n --exclude <glob> Repeatable. Always applies (default: **/node_modules/**).\n --max-concurrency <n> Adapter-level concurrency passed to the analyzer.\n --warn-variant-count <n> Passed to core's variant-generation options.\n --custom-elements <name> Repeatable. Tag name or glob.\n --external-adapters <disabled|trusted-workspace-only>\n\nValidator flags:\n --validator <entry-key> Repeatable. Marks an entry enabled.\n --disable-validator <entry-key> Repeatable. Marks an entry disabled.\n --validator-setting <entry-key>.<path>=<value>\n Repeatable. <value> is parsed as JSON,\n falling back to a plain string.\n\nOther options:\n --config <path> Explicit settings file; replaces discovery.\n --workspace-root <dir> Default: the current working directory.\n --format <text|ndjson> Default: text.\n --fail-on <error|warning|info|hint|never>\n Lowest severity that causes exit code 1. Default: error.\n --untrusted Restricted trust: no external adapters, bundled\n Markuplint defaults only.\n --no-color Disable color output.\n --help Print this message and exit 0.\n --version Print the version and exit 0.\n";
79
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE7C,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACrC;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;CAChB,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