@wastech-mdlint/viewer 0.0.0-stage → 0.4.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 +86 -2
- package/assets/favicon.ico +0 -0
- package/assets/viewer.css +4184 -0
- package/dist/asset-routes.d.ts +4 -0
- package/dist/asset-routes.js +107 -0
- package/dist/blame.d.ts +8 -0
- package/dist/blame.js +54 -0
- package/dist/branch-changes.d.ts +8 -0
- package/dist/branch-changes.js +49 -0
- package/dist/candidate-lint-worker.d.ts +1 -0
- package/dist/candidate-lint-worker.js +67 -0
- package/dist/candidate-lint.d.ts +39 -0
- package/dist/candidate-lint.js +115 -0
- package/dist/change-banner.d.ts +38 -0
- package/dist/change-banner.js +108 -0
- package/dist/change-diff.d.ts +23 -0
- package/dist/change-diff.js +140 -0
- package/dist/change-marks.d.ts +32 -0
- package/dist/change-marks.js +363 -0
- package/dist/changes-article.d.ts +15 -0
- package/dist/changes-article.js +244 -0
- package/dist/changes-routes.d.ts +12 -0
- package/dist/changes-routes.js +271 -0
- package/dist/changes.d.ts +113 -0
- package/dist/changes.js +324 -0
- package/dist/cli-args.d.ts +21 -0
- package/dist/cli-args.js +93 -0
- package/dist/client/banner-height.d.ts +1 -0
- package/dist/client/banner-height.js +33 -0
- package/dist/client/change-marks.d.ts +1 -0
- package/dist/client/change-marks.js +56 -0
- package/dist/client/changes.d.ts +1 -0
- package/dist/client/changes.js +183 -0
- package/dist/client/chart-option.d.ts +3 -0
- package/dist/client/chart-option.js +76 -0
- package/dist/client/charts.d.ts +1 -0
- package/dist/client/charts.js +54 -0
- package/dist/client/clipboard.d.ts +1 -0
- package/dist/client/clipboard.js +43 -0
- package/dist/client/code-copy.d.ts +1 -0
- package/dist/client/code-copy.js +29 -0
- package/dist/client/column-resize.d.ts +1 -0
- package/dist/client/column-resize.js +120 -0
- package/dist/client/config-dom.d.ts +13 -0
- package/dist/client/config-dom.js +47 -0
- package/dist/client/config-draft.d.ts +73 -0
- package/dist/client/config-draft.js +218 -0
- package/dist/client/config-editor.d.ts +3 -0
- package/dist/client/config-editor.js +677 -0
- package/dist/client/config-fields.d.ts +35 -0
- package/dist/client/config-fields.js +339 -0
- package/dist/client/config-json.d.ts +18 -0
- package/dist/client/config-json.js +96 -0
- package/dist/client/config-preview.d.ts +9 -0
- package/dist/client/config-preview.js +91 -0
- package/dist/client/config-rules.d.ts +14 -0
- package/dist/client/config-rules.js +202 -0
- package/dist/client/config-types.d.ts +91 -0
- package/dist/client/config-types.js +4 -0
- package/dist/client/copy-path.d.ts +1 -0
- package/dist/client/copy-path.js +32 -0
- package/dist/client/dashboard-requests.d.ts +11 -0
- package/dist/client/dashboard-requests.js +28 -0
- package/dist/client/dashboard.d.ts +1 -0
- package/dist/client/dashboard.js +119 -0
- package/dist/client/diagnostics.d.ts +1 -0
- package/dist/client/diagnostics.js +164 -0
- package/dist/client/diagrams.d.ts +1 -0
- package/dist/client/diagrams.js +81 -0
- package/dist/client/diff-expand.d.ts +1 -0
- package/dist/client/diff-expand.js +42 -0
- package/dist/client/display-settings-model.d.ts +74 -0
- package/dist/client/display-settings-model.js +229 -0
- package/dist/client/display-settings.d.ts +1 -0
- package/dist/client/display-settings.js +411 -0
- package/dist/client/echarts.d.ts +30 -0
- package/dist/client/echarts.js +14 -0
- package/dist/client/graph-layout.d.ts +88 -0
- package/dist/client/graph-layout.js +198 -0
- package/dist/client/graph.d.ts +2 -0
- package/dist/client/graph.js +566 -0
- package/dist/client/history.d.ts +21 -0
- package/dist/client/history.js +86 -0
- package/dist/client/live-reload-model.d.ts +28 -0
- package/dist/client/live-reload-model.js +52 -0
- package/dist/client/live-reload.d.ts +9 -0
- package/dist/client/live-reload.js +138 -0
- package/dist/client/menu.d.ts +14 -0
- package/dist/client/menu.js +176 -0
- package/dist/client/navigation-feedback.d.ts +1 -0
- package/dist/client/navigation-feedback.js +141 -0
- package/dist/client/open-config.d.ts +1 -0
- package/dist/client/open-config.js +48 -0
- package/dist/client/outline-spy.d.ts +1 -0
- package/dist/client/outline-spy.js +60 -0
- package/dist/client/prompts.d.ts +7 -0
- package/dist/client/prompts.js +65 -0
- package/dist/client/review.d.ts +1 -0
- package/dist/client/review.js +379 -0
- package/dist/client/search.d.ts +1 -0
- package/dist/client/search.js +199 -0
- package/dist/client/segmented.d.ts +13 -0
- package/dist/client/segmented.js +70 -0
- package/dist/client/source-lines.d.ts +16 -0
- package/dist/client/source-lines.js +47 -0
- package/dist/client/theme-toggle.d.ts +10 -0
- package/dist/client/theme-toggle.js +100 -0
- package/dist/client/theme.d.ts +0 -0
- package/dist/client/theme.js +50 -0
- package/dist/client/tree-marks.d.ts +31 -0
- package/dist/client/tree-marks.js +102 -0
- package/dist/client/tree-state.d.ts +0 -0
- package/dist/client/tree-state.js +179 -0
- package/dist/client/viewer.d.ts +1 -0
- package/dist/client/viewer.js +53 -0
- package/dist/config-editor.d.ts +166 -0
- package/dist/config-editor.js +378 -0
- package/dist/config-routes.d.ts +18 -0
- package/dist/config-routes.js +213 -0
- package/dist/context-view.d.ts +41 -0
- package/dist/context-view.js +295 -0
- package/dist/corpus-routes.d.ts +31 -0
- package/dist/corpus-routes.js +258 -0
- package/dist/corpus.d.ts +134 -0
- package/dist/corpus.js +653 -0
- package/dist/dashboard-article.d.ts +14 -0
- package/dist/dashboard-article.js +290 -0
- package/dist/dashboard.d.ts +94 -0
- package/dist/dashboard.js +468 -0
- package/dist/diagnostics.d.ts +23 -0
- package/dist/diagnostics.js +44 -0
- package/dist/document-routes.d.ts +39 -0
- package/dist/document-routes.js +396 -0
- package/dist/event-hub.d.ts +39 -0
- package/dist/event-hub.js +120 -0
- package/dist/findings-panel.d.ts +4 -0
- package/dist/findings-panel.js +74 -0
- package/dist/folder-page.d.ts +8 -0
- package/dist/folder-page.js +74 -0
- package/dist/graph-view.d.ts +66 -0
- package/dist/graph-view.js +236 -0
- package/dist/highlight.d.ts +24 -0
- package/dist/highlight.js +100 -0
- package/dist/http-send.d.ts +9 -0
- package/dist/http-send.js +53 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +72 -0
- package/dist/open-file.d.ts +36 -0
- package/dist/open-file.js +87 -0
- package/dist/page-tree.d.ts +3 -0
- package/dist/page-tree.js +105 -0
- package/dist/page.d.ts +73 -0
- package/dist/page.js +478 -0
- package/dist/prompts.d.ts +25 -0
- package/dist/prompts.js +82 -0
- package/dist/render-cache.d.ts +23 -0
- package/dist/render-cache.js +38 -0
- package/dist/render-document.d.ts +60 -0
- package/dist/render-document.js +440 -0
- package/dist/request-path.d.ts +17 -0
- package/dist/request-path.js +51 -0
- package/dist/review-context.d.ts +24 -0
- package/dist/review-context.js +109 -0
- package/dist/review-queries.d.ts +26 -0
- package/dist/review-queries.js +69 -0
- package/dist/review-state.d.ts +106 -0
- package/dist/review-state.js +251 -0
- package/dist/review-store.d.ts +145 -0
- package/dist/review-store.js +530 -0
- package/dist/router.d.ts +28 -0
- package/dist/router.js +294 -0
- package/dist/search.d.ts +22 -0
- package/dist/search.js +164 -0
- package/dist/security.d.ts +95 -0
- package/dist/security.js +196 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.js +224 -0
- package/dist/speculation-rules.d.ts +4 -0
- package/dist/speculation-rules.js +49 -0
- package/dist/state-dir.d.ts +6 -0
- package/dist/state-dir.js +31 -0
- package/dist/tree-marks.d.ts +49 -0
- package/dist/tree-marks.js +108 -0
- package/dist/viewer-context.d.ts +37 -0
- package/dist/viewer-context.js +74 -0
- package/dist/watch.d.ts +41 -0
- package/dist/watch.js +135 -0
- package/package.json +57 -4
package/dist/corpus.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { type CorpusMembership, type ContextGraph, type LintResult, type LoadedConfiguration, type ParsedDocument } from "@wastech-mdlint/core";
|
|
2
|
+
export type ResolvedTarget = {
|
|
3
|
+
kind: "document";
|
|
4
|
+
path: string;
|
|
5
|
+
} | {
|
|
6
|
+
kind: "file";
|
|
7
|
+
path: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "folder";
|
|
10
|
+
path: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: "missing";
|
|
13
|
+
};
|
|
14
|
+
/** Whether a link target leaves the repository (a URL, `mailto:`, a protocol-relative `//host`). */
|
|
15
|
+
export declare function isExternalTarget(target: string): boolean;
|
|
16
|
+
export declare class Corpus {
|
|
17
|
+
private readonly root;
|
|
18
|
+
private readonly configPathOption;
|
|
19
|
+
private state;
|
|
20
|
+
private readonly embedded;
|
|
21
|
+
private readonly folderSets;
|
|
22
|
+
private constructor();
|
|
23
|
+
static load(params: {
|
|
24
|
+
cwd: string;
|
|
25
|
+
configPath?: string;
|
|
26
|
+
}): Promise<Corpus>;
|
|
27
|
+
get rootDir(): string;
|
|
28
|
+
get documents(): ReadonlyMap<string, ParsedDocument>;
|
|
29
|
+
get graph(): ContextGraph;
|
|
30
|
+
/**
|
|
31
|
+
* Every folder that holds a document, directly or further down, with `""` for the root of a
|
|
32
|
+
* corpus that has any. Worked out once per set of documents, as every folder link asks it.
|
|
33
|
+
*/
|
|
34
|
+
get folders(): ReadonlySet<string>;
|
|
35
|
+
private foldersOfState;
|
|
36
|
+
/** The configuration the corpus was loaded with, replaced with it on a full reload. */
|
|
37
|
+
get configuration(): LoadedConfiguration;
|
|
38
|
+
/**
|
|
39
|
+
* The corpus as core judges a change set against it: the documents held now, the scope a deleted
|
|
40
|
+
* document is tested with, and the config's repository-relative path — which matches no changed
|
|
41
|
+
* path when the config lives outside the repository.
|
|
42
|
+
*/
|
|
43
|
+
membership(): CorpusMembership;
|
|
44
|
+
/** Reload configuration and every document from disk. */
|
|
45
|
+
reload(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Bring the corpus up to date with a set of changed repo-relative paths.
|
|
48
|
+
*
|
|
49
|
+
* A full reload costs a walk and a parse of every document — seconds on a repository with a few
|
|
50
|
+
* hundred of them — while re-parsing the one file that was saved and rebuilding the graph costs
|
|
51
|
+
* milliseconds. So an edit to a known document is applied in place, and only what can change
|
|
52
|
+
* *which* files are documents pays for a full reload, because deciding membership means re-running
|
|
53
|
+
* core's include/exclude/gitignore discovery: the config or a `.gitignore`, a new Markdown file the
|
|
54
|
+
* scope takes in, a folder of documents that is gone, or a folder holding new ones. A watcher
|
|
55
|
+
* reports a moved or deleted folder as that one path and nothing for the files inside it, which is
|
|
56
|
+
* why folders are judged here at all.
|
|
57
|
+
*
|
|
58
|
+
* A path documents link to — an image that has just been saved, a file deleted — changes those
|
|
59
|
+
* documents' pages without changing the documents, so they are reported as changed too.
|
|
60
|
+
*
|
|
61
|
+
* `structural` reports that the set of documents may have changed, which every open page needs to
|
|
62
|
+
* know because each one shows the document tree.
|
|
63
|
+
*/
|
|
64
|
+
applyChanges(paths: readonly string[]): Promise<{
|
|
65
|
+
changed: string[];
|
|
66
|
+
structural: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Where a local link or image target written in `fromPath` points.
|
|
70
|
+
*
|
|
71
|
+
* Candidates come from core's `resolveTargetCandidates`, the helper the context graph and the REF
|
|
72
|
+
* rules share, so a link the viewer can follow is a link REF-001 accepts and the reverse. Images
|
|
73
|
+
* resolve without the site router for the same reason core gives: a router maps URLs to Markdown
|
|
74
|
+
* sources, never to assets. A directory falls through to its README, which REF-001 does not do; a
|
|
75
|
+
* folder link that opens its README is what a reader expects from GitHub. A folder without one
|
|
76
|
+
* opens as a listing when it holds documents: REF-001 accepts any folder that exists, so marking
|
|
77
|
+
* such a link missing would contradict the linter over a link that works on GitHub.
|
|
78
|
+
*/
|
|
79
|
+
resolve(fromPath: string, target: string, isImage: boolean): ResolvedTarget;
|
|
80
|
+
/**
|
|
81
|
+
* Where a target in a document's raw HTML points, by the same candidates as `resolve`, checking on
|
|
82
|
+
* disk whether a file there may be served. A file it finds is recorded against the document, which
|
|
83
|
+
* is what lets `/file/` serve it: core reads no raw HTML, so these targets are not among the links
|
|
84
|
+
* collected when the corpus loads.
|
|
85
|
+
*/
|
|
86
|
+
resolveEmbedded(document: ParsedDocument, target: string, isImage: boolean): Promise<ResolvedTarget>;
|
|
87
|
+
isLinkedFile(relPath: string): boolean;
|
|
88
|
+
/** Documents that link to `relPath`, each once, in stable order. */
|
|
89
|
+
backlinks(relPath: string): string[];
|
|
90
|
+
/**
|
|
91
|
+
* The absolute path of the linked file at `relPath` if the viewer may hand it out now — judged
|
|
92
|
+
* again as it is served rather than trusted from when the link was collected, since a symlink can
|
|
93
|
+
* be pointed elsewhere in between and what it points at is what would be sent.
|
|
94
|
+
*/
|
|
95
|
+
resolveFile(relPath: string): Promise<string | undefined>;
|
|
96
|
+
/**
|
|
97
|
+
* Lint the corpus as it is in memory now, with the configured rules.
|
|
98
|
+
*
|
|
99
|
+
* Through core's `lintContext`, which gives exactly what `wastech-mdlint lint` gives for the same
|
|
100
|
+
* tree but reuses the parsed documents and graph instead of discovering and parsing everything
|
|
101
|
+
* again — a fraction of a second after an edit rather than the seconds a fresh run takes.
|
|
102
|
+
*/
|
|
103
|
+
lint(): LintResult;
|
|
104
|
+
/**
|
|
105
|
+
* Whether a candidate configuration selects the same documents as the loaded one.
|
|
106
|
+
*
|
|
107
|
+
* Parsing a document does not depend on the config, so a candidate that keeps `include`,
|
|
108
|
+
* `exclude` and `respectGitignore` is linted over the documents already parsed — new rules in a
|
|
109
|
+
* fraction of a second, new link settings after a rebuild of the graph. Only a new scope pays for
|
|
110
|
+
* core's discovery and a parse of the corpus it selects, because that is the one change that
|
|
111
|
+
* decides which files are documents.
|
|
112
|
+
*/
|
|
113
|
+
sharesScope(candidate: LoadedConfiguration): boolean;
|
|
114
|
+
/** Whether an absolute path is, through any symlinks, inside the repository. */
|
|
115
|
+
contains(absolutePath: string): Promise<boolean>;
|
|
116
|
+
/**
|
|
117
|
+
* Whether any of `paths`, none of them a document, can change which files are documents.
|
|
118
|
+
*
|
|
119
|
+
* Every judgment is core's scope: a Markdown path `include` takes in and nothing excludes, and a
|
|
120
|
+
* folder no `exclude` or `.gitignore` prunes. A folder event alone says little — some platforms
|
|
121
|
+
* report a folder whenever a file inside it is created — so a folder that still exists counts only
|
|
122
|
+
* when it holds a document the corpus lacks, and one that is gone only when documents lived in it.
|
|
123
|
+
*/
|
|
124
|
+
private changesMembership;
|
|
125
|
+
private holdsNewDocuments;
|
|
126
|
+
/**
|
|
127
|
+
* The documents whose pages change because a file appeared or disappeared at one of `paths`, or
|
|
128
|
+
* under one of them when it names a folder: those with a link target there whose answer to "may
|
|
129
|
+
* this file be served?" is no longer the one recorded.
|
|
130
|
+
*/
|
|
131
|
+
private documentsReachingChangedFiles;
|
|
132
|
+
private absolute;
|
|
133
|
+
private statOf;
|
|
134
|
+
}
|