@aparte/plugin-diff 0.0.0-stage → 1.7.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/LICENSE +21 -0
- package/README.md +130 -2
- package/dist/aparte-diff.d.ts +140 -0
- package/dist/aparte-diff.d.ts.map +1 -0
- package/dist/compute.d.ts +62 -0
- package/dist/compute.d.ts.map +1 -0
- package/dist/custom-elements.json +1650 -0
- package/dist/highlight.d.ts +29 -0
- package/dist/highlight.d.ts.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1082 -0
- package/dist/index.js.map +1 -0
- package/dist/index.node.d.ts +16 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/index.node.js +8 -0
- package/dist/index.node.js.map +1 -0
- package/dist/parse.d.ts +39 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/setup-CQYdbRuR.js +523 -0
- package/dist/setup-CQYdbRuR.js.map +1 -0
- package/dist/setup.d.ts +45 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/styles.d.ts +5 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/types.d.ts +106 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/words.d.ts +334 -0
- package/dist/words.d.ts.map +1 -0
- package/package.json +92 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colour a file's lines with the chat's highlighter, when one is installed.
|
|
3
|
+
*
|
|
4
|
+
* A highlighter colours a whole text, because what a line means depends on the lines above
|
|
5
|
+
* it (a comment opened two lines up, a string that runs on). So each side of the change is
|
|
6
|
+
* highlighted once, as one text, and cut back into lines: Shiki and the highlighters that
|
|
7
|
+
* follow it wrap each line in `<span class="line">`. A highlighter that does not, or a
|
|
8
|
+
* language it cannot read, leaves the lines as plain text.
|
|
9
|
+
*/
|
|
10
|
+
import type { AparteConfig } from '@aparte/core';
|
|
11
|
+
/** The language of a file, from its path: `src/parse.ts` → `typescript`; `''` when there is none to read. */
|
|
12
|
+
export declare function languageOfPath(path: string): string;
|
|
13
|
+
/** A side's lines as the highlighter coloured them, and the classes it put on its block. */
|
|
14
|
+
export interface HighlightedLines {
|
|
15
|
+
/** One HTML string per line. */
|
|
16
|
+
lines: string[];
|
|
17
|
+
/**
|
|
18
|
+
* The classes of the highlighter's `<pre>`: its stylesheet colours the tokens under them
|
|
19
|
+
* (Shiki's light/dark pair reads `.shiki span`), so each line wears them too.
|
|
20
|
+
*/
|
|
21
|
+
className: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `lines` coloured as one text, cut back into one HTML string per line; `null` when there is
|
|
25
|
+
* no highlighter, or what it returned cannot be cut line for line. The HTML went through the
|
|
26
|
+
* config's sanitizer (`highlightCode` runs it).
|
|
27
|
+
*/
|
|
28
|
+
export declare function highlightLines(config: AparteConfig, lines: readonly string[], language: string): Promise<HighlightedLines | null>;
|
|
29
|
+
//# sourceMappingURL=highlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../src/highlight.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAgBjD,6GAA6G;AAC7G,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AAED,4FAA4F;AAC5F,MAAM,WAAW,gBAAgB;IAC7B,gCAAgC;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAavI"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@aparte/plugin-diff` — a file change as hunks with line numbers.
|
|
3
|
+
*
|
|
4
|
+
* `<aparte-diff>` shows a change the way a reviewer reads one — each file under its path and
|
|
5
|
+
* counts, each line with its old and new numbers, the unchanged runs folded — and, with
|
|
6
|
+
* `commentable`, lets the reader comment on a line or a range. `setupDiff` draws a tool's
|
|
7
|
+
* result with it, under the tool's line in the reply. The computation (`diffTexts`,
|
|
8
|
+
* `parseUnifiedDiff`, `formatUnifiedDiff`) is plain functions with no DOM, here and in the
|
|
9
|
+
* server entry.
|
|
10
|
+
*/
|
|
11
|
+
export { AparteDiff } from './aparte-diff.js';
|
|
12
|
+
export { setupDiff } from './setup.js';
|
|
13
|
+
export type { DiffSetupOptions } from './setup.js';
|
|
14
|
+
export { diffTexts } from './compute.js';
|
|
15
|
+
export type { DiffTextsOptions } from './compute.js';
|
|
16
|
+
export { parseUnifiedDiff, formatUnifiedDiff } from './parse.js';
|
|
17
|
+
export type { AparteDiffComment, AparteDiffCommentEventDetail, AparteDiffFile, AparteDiffFileStatus, AparteDiffHunk, AparteDiffInput, AparteDiffLine, AparteDiffLineKind, AparteDiffSide, AparteDiffSource, } from './types.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EACR,iBAAiB,EACjB,4BAA4B,EAC5B,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,gBAAgB,GACnB,MAAM,YAAY,CAAC"}
|