paperlint 8.0.0 → 9.0.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/CLAUDE.md +9 -25
- package/CONTRIBUTING.md +5 -4
- package/README.md +4 -3
- package/dist/adapters/bibtex/index.d.ts +3 -0
- package/dist/adapters/bibtex/index.d.ts.map +1 -0
- package/dist/adapters/bibtex/index.js +103 -0
- package/dist/adapters/bibtex/index.js.map +1 -0
- package/dist/adapters/latex/filecontents.d.ts +33 -0
- package/dist/adapters/latex/filecontents.d.ts.map +1 -0
- package/dist/adapters/latex/filecontents.js +65 -0
- package/dist/adapters/latex/filecontents.js.map +1 -0
- package/dist/adapters/latex/includes.d.ts +3 -3
- package/dist/adapters/latex/includes.d.ts.map +1 -1
- package/dist/adapters/latex/includes.js +18 -10
- package/dist/adapters/latex/includes.js.map +1 -1
- package/dist/adapters/latex/index.d.ts.map +1 -1
- package/dist/adapters/latex/index.js +2 -0
- package/dist/adapters/latex/index.js.map +1 -1
- package/dist/adapters/latex/nodes.d.ts +12 -0
- package/dist/adapters/latex/nodes.d.ts.map +1 -1
- package/dist/adapters/latex/nodes.js +39 -0
- package/dist/adapters/latex/nodes.js.map +1 -1
- package/dist/adapters/latex/parse.d.ts +7 -1
- package/dist/adapters/latex/parse.d.ts.map +1 -1
- package/dist/adapters/latex/parse.js +55 -6
- package/dist/adapters/latex/parse.js.map +1 -1
- package/dist/adapters/memory/index.d.ts +3 -0
- package/dist/adapters/memory/index.d.ts.map +1 -1
- package/dist/adapters/memory/index.js +9 -0
- package/dist/adapters/memory/index.js.map +1 -1
- package/dist/adapters/references/index.d.ts.map +1 -1
- package/dist/adapters/references/index.js +27 -24
- package/dist/adapters/references/index.js.map +1 -1
- package/dist/adapters/sources-record/index.d.ts +9 -0
- package/dist/adapters/sources-record/index.d.ts.map +1 -0
- package/dist/adapters/sources-record/index.js +68 -0
- package/dist/adapters/sources-record/index.js.map +1 -0
- package/dist/adapters/tex-output/blg.d.ts +9 -0
- package/dist/adapters/tex-output/blg.d.ts.map +1 -0
- package/dist/adapters/tex-output/blg.js +20 -0
- package/dist/adapters/tex-output/blg.js.map +1 -0
- package/dist/adapters/tex-output/fls.d.ts +8 -0
- package/dist/adapters/tex-output/fls.d.ts.map +1 -0
- package/dist/adapters/tex-output/fls.js +16 -0
- package/dist/adapters/tex-output/fls.js.map +1 -0
- package/dist/adapters/tex-output/index.d.ts +7 -0
- package/dist/adapters/tex-output/index.d.ts.map +1 -0
- package/dist/adapters/tex-output/index.js +7 -0
- package/dist/adapters/tex-output/index.js.map +1 -0
- package/dist/bib-rules.d.ts +47 -0
- package/dist/bib-rules.d.ts.map +1 -0
- package/dist/bib-rules.js +127 -0
- package/dist/bib-rules.js.map +1 -0
- package/dist/build.d.ts +29 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +40 -24
- package/dist/build.js.map +1 -1
- package/dist/claim-provenance.d.ts +2 -2
- package/dist/cli.d.ts +6 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +30 -26
- package/dist/cli.js.map +1 -1
- package/dist/domain/paper-source.d.ts +1 -10
- package/dist/domain/paper-source.d.ts.map +1 -1
- package/dist/domain/paper-source.js +34 -24
- package/dist/domain/paper-source.js.map +1 -1
- package/dist/domain/paper-sources.d.ts +72 -0
- package/dist/domain/paper-sources.d.ts.map +1 -0
- package/dist/domain/paper-sources.js +18 -0
- package/dist/domain/paper-sources.js.map +1 -0
- package/dist/domain/sources-record.d.ts +102 -0
- package/dist/domain/sources-record.d.ts.map +1 -0
- package/dist/domain/sources-record.js +38 -0
- package/dist/domain/sources-record.js.map +1 -0
- package/dist/domain/tex-run.d.ts +25 -0
- package/dist/domain/tex-run.d.ts.map +1 -0
- package/dist/domain/tex-run.js +79 -0
- package/dist/domain/tex-run.js.map +1 -0
- package/dist/eslint-rules/paper-context.d.ts.map +1 -1
- package/dist/eslint-rules/paper-context.js +4 -3
- package/dist/eslint-rules/paper-context.js.map +1 -1
- package/dist/eslint-rules/paper-typography.d.ts +0 -9
- package/dist/eslint-rules/paper-typography.d.ts.map +1 -1
- package/dist/eslint-rules/paper-typography.js +12 -5
- package/dist/eslint-rules/paper-typography.js.map +1 -1
- package/dist/latex-log.d.ts +10 -0
- package/dist/latex-log.d.ts.map +1 -1
- package/dist/latex-log.js +10 -0
- package/dist/latex-log.js.map +1 -1
- package/dist/latex-loop.d.ts +2 -0
- package/dist/latex-loop.d.ts.map +1 -1
- package/dist/latex-loop.js.map +1 -1
- package/dist/package-dirs.d.ts.map +1 -1
- package/dist/package-dirs.js +3 -2
- package/dist/package-dirs.js.map +1 -1
- package/dist/paper-includes.d.ts +4 -7
- package/dist/paper-includes.d.ts.map +1 -1
- package/dist/paper-includes.js +29 -21
- package/dist/paper-includes.js.map +1 -1
- package/dist/paper-prose.d.ts +2 -2
- package/dist/paper-record.d.ts +25 -0
- package/dist/paper-record.d.ts.map +1 -0
- package/dist/paper-record.js +39 -0
- package/dist/paper-record.js.map +1 -0
- package/dist/paper-sources.d.ts +66 -0
- package/dist/paper-sources.d.ts.map +1 -0
- package/dist/paper-sources.js +92 -0
- package/dist/paper-sources.js.map +1 -0
- package/dist/ports/bib-reader.d.ts +18 -0
- package/dist/ports/bib-reader.d.ts.map +1 -0
- package/dist/ports/bib-reader.js +2 -0
- package/dist/ports/bib-reader.js.map +1 -0
- package/dist/ports/check-references.d.ts +9 -4
- package/dist/ports/check-references.d.ts.map +1 -1
- package/dist/ports/latex.d.ts +15 -0
- package/dist/ports/latex.d.ts.map +1 -1
- package/dist/ports/sources-codec.d.ts +11 -0
- package/dist/ports/sources-codec.d.ts.map +1 -0
- package/dist/ports/sources-codec.js +2 -0
- package/dist/ports/sources-codec.js.map +1 -0
- package/dist/ports/tex-output.d.ts +17 -0
- package/dist/ports/tex-output.d.ts.map +1 -0
- package/dist/ports/tex-output.js +2 -0
- package/dist/ports/tex-output.js.map +1 -0
- package/dist/recorded-bibliography.d.ts +89 -0
- package/dist/recorded-bibliography.d.ts.map +1 -0
- package/dist/recorded-bibliography.js +136 -0
- package/dist/recorded-bibliography.js.map +1 -0
- package/dist/reference-rules.d.ts +5 -5
- package/dist/reference-rules.d.ts.map +1 -1
- package/dist/reference-rules.js +150 -77
- package/dist/reference-rules.js.map +1 -1
- package/dist/references.d.ts +71 -16
- package/dist/references.d.ts.map +1 -1
- package/dist/references.js +110 -26
- package/dist/references.js.map +1 -1
- package/dist/register-bands.d.ts +3 -3
- package/dist/register-bands.d.ts.map +1 -1
- package/dist/register-bands.js.map +1 -1
- package/dist/register.d.ts +2 -2
- package/dist/sources-record.d.ts +38 -0
- package/dist/sources-record.d.ts.map +1 -0
- package/dist/sources-record.js +123 -0
- package/dist/sources-record.js.map +1 -0
- package/dist/sources-rules.d.ts +44 -0
- package/dist/sources-rules.d.ts.map +1 -0
- package/dist/sources-rules.js +76 -0
- package/dist/sources-rules.js.map +1 -0
- package/dist/tex-paper.d.ts +10 -15
- package/dist/tex-paper.d.ts.map +1 -1
- package/dist/tex-paper.js +24 -40
- package/dist/tex-paper.js.map +1 -1
- package/dist/tex-venue-rules.d.ts +3 -3
- package/dist/tex-venue-rules.d.ts.map +1 -1
- package/dist/tex-venue-rules.js.map +1 -1
- package/docs/configuration.md +12 -4
- package/docs/design/paper-sources.md +197 -0
- package/docs/package-shape-options.md +1 -1
- package/docs/references.md +34 -8
- package/docs/rules/bib/reachable-entry.md +64 -0
- package/docs/rules/paper/sources-fresh.md +81 -0
- package/docs/rules.md +62 -57
- package/eslint-rules/paper-context.ts +4 -3
- package/eslint-rules/paper-typography.test.mjs +12 -72
- package/eslint-rules/paper-typography.ts +13 -6
- package/eslint.config.mjs +22 -0
- package/fixtures/build-e2e/aidc/paper.tex +1 -1
- package/fixtures/build-e2e/anon-ack/paper.tex +1 -1
- package/fixtures/build-e2e/anon-author/paper.tex +1 -1
- package/fixtures/build-e2e/anon-bib/paper.tex +1 -1
- package/fixtures/build-e2e/anon-href/paper.tex +1 -1
- package/fixtures/build-e2e/anon-macro/paper.tex +1 -1
- package/fixtures/build-e2e/anon-pdfauthor/paper.tex +1 -1
- package/fixtures/paper-sources/p1/paper.tex +30 -0
- package/fixtures/paper-sources/p1/refs.bib +6 -0
- package/fixtures/paper-sources/p1/sections/dead.tex +6 -0
- package/fixtures/paper-sources/p1/sections/intro.tex +7 -0
- package/fixtures/paper-sources/p1/sections/parked.tex +6 -0
- package/fixtures/paper-sources/p1/tex-truth.json +37 -0
- package/fixtures/paper-sources/p1/versions/2026-01-01-review.tex +4 -0
- package/fixtures/paper-sources/v1-stale/paper.tex +14 -0
- package/fixtures/paper-sources/v1-stale/refs.bib +6 -0
- package/fixtures/paper-sources/v1-stale/tex-truth.json +32 -0
- package/fixtures/paper-sources/v10-ifthenelse/anon.bib +1 -0
- package/fixtures/paper-sources/v10-ifthenelse/paper.tex +9 -0
- package/fixtures/paper-sources/v10-ifthenelse/real.bib +1 -0
- package/fixtures/paper-sources/v10-ifthenelse/tex-truth.json +28 -0
- package/fixtures/paper-sources/v11-two-blocks/paper.tex +12 -0
- package/fixtures/paper-sources/v11-two-blocks/tex-truth.json +30 -0
- package/fixtures/paper-sources/v13-percent-text/paper.tex +6 -0
- package/fixtures/paper-sources/v13-percent-text/refs.bib +3 -0
- package/fixtures/paper-sources/v13-percent-text/tex-truth.json +30 -0
- package/fixtures/paper-sources/v15-after-end/paper.tex +6 -0
- package/fixtures/paper-sources/v15-after-end/refs.bib +1 -0
- package/fixtures/paper-sources/v15-after-end/tex-truth.json +17 -0
- package/fixtures/paper-sources/v16-included-block/bibblock.tex +3 -0
- package/fixtures/paper-sources/v16-included-block/paper.tex +7 -0
- package/fixtures/paper-sources/v16-included-block/refs.bib +1 -0
- package/fixtures/paper-sources/v16-included-block/tex-truth.json +35 -0
- package/fixtures/paper-sources/v17-include-order/bibsetup.tex +1 -0
- package/fixtures/paper-sources/v17-include-order/first.bib +1 -0
- package/fixtures/paper-sources/v17-include-order/later.bib +1 -0
- package/fixtures/paper-sources/v17-include-order/paper.tex +7 -0
- package/fixtures/paper-sources/v17-include-order/tex-truth.json +40 -0
- package/fixtures/paper-sources/v2-overwrite/paper.tex +14 -0
- package/fixtures/paper-sources/v2-overwrite/refs.bib +6 -0
- package/fixtures/paper-sources/v2-overwrite/tex-truth.json +30 -0
- package/fixtures/paper-sources/v22-parked-thebibliography/paper.tex +7 -0
- package/fixtures/paper-sources/v22-parked-thebibliography/tex-truth.json +17 -0
- package/fixtures/paper-sources/v23-parked-include/old.bib +1 -0
- package/fixtures/paper-sources/v23-parked-include/paper.tex +7 -0
- package/fixtures/paper-sources/v23-parked-include/parked.tex +1 -0
- package/fixtures/paper-sources/v23-parked-include/refs.bib +1 -0
- package/fixtures/paper-sources/v23-parked-include/tex-truth.json +28 -0
- package/fixtures/paper-sources/v24-quoted-fields/paper.tex +6 -0
- package/fixtures/paper-sources/v24-quoted-fields/refs.bib +5 -0
- package/fixtures/paper-sources/v24-quoted-fields/tex-truth.json +32 -0
- package/fixtures/paper-sources/v25-string-differs/paper.tex +10 -0
- package/fixtures/paper-sources/v25-string-differs/refs.bib +2 -0
- package/fixtures/paper-sources/v25-string-differs/tex-truth.json +32 -0
- package/fixtures/paper-sources/v26-comment-in-names/one.bib +1 -0
- package/fixtures/paper-sources/v26-comment-in-names/paper.tex +7 -0
- package/fixtures/paper-sources/v26-comment-in-names/tex-truth.json +32 -0
- package/fixtures/paper-sources/v26-comment-in-names/two.bib +1 -0
- package/fixtures/paper-sources/v27-shared-string/abbreviations.bib +2 -0
- package/fixtures/paper-sources/v27-shared-string/paper.tex +6 -0
- package/fixtures/paper-sources/v27-shared-string/references.bib +6 -0
- package/fixtures/paper-sources/v27-shared-string/tex-truth.json +31 -0
- package/fixtures/paper-sources/v28-shared-string-block/abbreviations.bib +2 -0
- package/fixtures/paper-sources/v28-shared-string-block/paper.tex +14 -0
- package/fixtures/paper-sources/v28-shared-string-block/tex-truth.json +33 -0
- package/fixtures/paper-sources/v29-generated-input/paper.tex +9 -0
- package/fixtures/paper-sources/v29-generated-input/tex-truth.json +24 -0
- package/fixtures/paper-sources/v3-declared/paper.bib +6 -0
- package/fixtures/paper-sources/v3-declared/paper.tex +6 -0
- package/fixtures/paper-sources/v3-declared/tex-truth.json +28 -0
- package/fixtures/paper-sources/v30-name-next-line/paper.tex +14 -0
- package/fixtures/paper-sources/v30-name-next-line/tex-truth.json +30 -0
- package/fixtures/paper-sources/v4-commented/paper.tex +14 -0
- package/fixtures/paper-sources/v4-commented/refs.bib +6 -0
- package/fixtures/paper-sources/v4-commented/tex-truth.json +28 -0
- package/fixtures/paper-sources/v5-percent-entry/paper.tex +20 -0
- package/fixtures/paper-sources/v5-percent-entry/tex-truth.json +37 -0
- package/fixtures/paper-sources/v6-unclosed/paper.tex +6 -0
- package/fixtures/paper-sources/v6-unclosed/refs.bib +5 -0
- package/fixtures/paper-sources/v6-unclosed/tex-truth.json +37 -0
- package/fixtures/paper-sources/v8-jobname/paper.tex +9 -0
- package/fixtures/paper-sources/v8-jobname/tex-truth.json +30 -0
- package/fixtures/paper-sources/v9-two-bibliographies/one.bib +1 -0
- package/fixtures/paper-sources/v9-two-bibliographies/paper.tex +7 -0
- package/fixtures/paper-sources/v9-two-bibliographies/tex-truth.json +35 -0
- package/fixtures/paper-sources/v9-two-bibliographies/two.bib +1 -0
- package/fixtures/paper-typography/clean-paper/paper.tex +1 -1
- package/fixtures/paper-typography/messy-paper/paper.tex +1 -1
- package/package.json +2 -10
- package/scripts/check.test.ts +23 -1
- package/scripts/check.ts +7 -3
- package/scripts/coverage-config.test.ts +19 -10
- package/scripts/layer-legacy-frozen.test.ts +41 -2
- package/scripts/layer-legacy-frozen.ts +31 -2
- package/skills/grade-paper-writing/SKILL.md +4 -3
- package/skills/grade-paper-writing/SKILL.md.spec.ts +3 -2
- package/skills/grade-paper-writing/prose-lint.mjs +11 -2
- package/skills/grade-paper-writing/prose-lint.test.ts +52 -4
- package/skills/paper-pipeline/scripts/extract-ref-facts.harness.mjs +83 -33
- package/skills/paper-pipeline/scripts/extract-ref-facts.mjs +67 -115
- package/skills/paper-pipeline/scripts/extract-ref-facts.test.mjs +128 -121
- package/skills/verify-citations/SKILL.md +7 -4
- package/skills/verify-citations/SKILL.md.spec.ts +6 -3
- package/skills/verify-citations/scripts/bib-authors.check.test.mjs +17 -19
- package/skills/verify-citations/scripts/bib-authors.cli.test.ts +129 -46
- package/skills/verify-citations/scripts/bib-authors.d.mts +22 -2
- package/skills/verify-citations/scripts/bib-authors.mjs +57 -111
- package/skills/verify-citations/scripts/verify-cites.cli.test.ts +16 -0
- package/skills/verify-citations/scripts/verify-cites.d.mts +19 -3
- package/skills/verify-citations/scripts/verify-cites.mjs +42 -108
- package/skills/verify-citations/scripts/verify-cites.test.mjs +23 -36
- package/src/adapters/bibtex/index.test.ts +163 -0
- package/src/adapters/bibtex/index.ts +155 -0
- package/src/adapters/latex/filecontents.ts +114 -0
- package/src/adapters/latex/includes.ts +18 -10
- package/src/adapters/latex/index.test.ts +73 -0
- package/src/adapters/latex/index.ts +2 -0
- package/src/adapters/latex/nodes.ts +64 -0
- package/src/adapters/latex/parse.test.ts +38 -0
- package/src/adapters/latex/parse.ts +67 -6
- package/src/adapters/memory/index.ts +17 -0
- package/src/adapters/references/index.test.ts +75 -21
- package/src/adapters/references/index.ts +37 -32
- package/src/adapters/sources-record/index.test.ts +87 -0
- package/src/adapters/sources-record/index.ts +82 -0
- package/src/adapters/tex-output/blg.ts +27 -0
- package/src/adapters/tex-output/fls.ts +24 -0
- package/src/adapters/tex-output/index.test.ts +171 -0
- package/src/adapters/tex-output/index.ts +12 -0
- package/src/bib-rules.test.ts +356 -0
- package/src/bib-rules.ts +228 -0
- package/src/bibliography-at.test.ts +286 -0
- package/src/build.test.ts +210 -0
- package/src/build.ts +100 -35
- package/src/claim-provenance.test.ts +33 -7
- package/src/claim-provenance.ts +2 -2
- package/src/cli.harness.mjs +20 -10
- package/src/cli.test.ts +14 -10
- package/src/cli.ts +37 -28
- package/src/domain/paper-source.test.ts +58 -20
- package/src/domain/paper-source.ts +38 -42
- package/src/domain/paper-sources.ts +94 -0
- package/src/domain/sources-record.test.ts +71 -0
- package/src/domain/sources-record.ts +136 -0
- package/src/domain/tex-run.test.ts +228 -0
- package/src/domain/tex-run.ts +139 -0
- package/src/heading-case.test.ts +24 -10
- package/src/latex-log.ts +20 -0
- package/src/latex-loop.harness.ts +1 -0
- package/src/latex-loop.ts +2 -0
- package/src/linted-set.test.ts +9 -1
- package/src/new-paper.harness.mjs +3 -2
- package/src/new-paper.test.ts +9 -5
- package/src/package-dirs.ts +3 -2
- package/src/paper-includes.test.ts +157 -38
- package/src/paper-includes.ts +39 -35
- package/src/paper-prose.test.ts +34 -5
- package/src/paper-prose.ts +2 -2
- package/src/paper-record.test.ts +173 -0
- package/src/paper-record.ts +66 -0
- package/src/paper-settings-commands.test.ts +5 -2
- package/src/paper-sources.ts +151 -0
- package/src/ports/bib-reader.ts +27 -0
- package/src/ports/check-references.ts +7 -3
- package/src/ports/latex.ts +19 -0
- package/src/ports/sources-codec.ts +11 -0
- package/src/ports/tex-output.ts +17 -0
- package/src/recorded-bibliography.ts +297 -0
- package/src/reference-rules.ts +217 -104
- package/src/references.test.ts +520 -177
- package/src/references.ts +185 -37
- package/src/register-bands.test.ts +5 -1
- package/src/register-bands.ts +3 -5
- package/src/register.test.ts +6 -1
- package/src/register.ts +2 -2
- package/src/rule-cases.test.ts +68 -12
- package/src/rule-docs.test.ts +0 -1
- package/src/sources-record.test.ts +308 -0
- package/src/sources-record.ts +231 -0
- package/src/sources-rules.test.ts +152 -0
- package/src/sources-rules.ts +117 -0
- package/src/tex-paper.test.ts +148 -78
- package/src/tex-paper.ts +31 -61
- package/src/tex-venue-rules.test.ts +36 -8
- package/src/tex-venue-rules.ts +3 -5
- package/dist/eslint-rules/bib-reachable-entry.d.ts +0 -22
- package/dist/eslint-rules/bib-reachable-entry.d.ts.map +0 -1
- package/dist/eslint-rules/bib-reachable-entry.js +0 -75
- package/dist/eslint-rules/bib-reachable-entry.js.map +0 -1
- package/eslint-rules/bib-reachable-entry.ts +0 -76
package/dist/references.d.ts
CHANGED
|
@@ -2,43 +2,98 @@ import type { Files } from "./ports/files.ts";
|
|
|
2
2
|
import { type LookupCache } from "./domain/lookup-cache.ts";
|
|
3
3
|
import { type Result } from "./domain/result.ts";
|
|
4
4
|
import type { CheckReferences, EntryVerdict, ReferencesCheck } from "./ports/check-references.ts";
|
|
5
|
-
|
|
5
|
+
import { type SourcesRecord } from "./domain/sources-record.ts";
|
|
6
|
+
import type { PaperRecord } from "./paper-record.ts";
|
|
7
|
+
import { type ReadDatabase, type RecordedEntry, type RecordedReadDeps } from "./recorded-bibliography.ts";
|
|
8
|
+
/** 3: the record of what bibtex read lives in `_build/sources.json`; an older one reads as none. */
|
|
9
|
+
export declare const REFERENCES_SCHEMA = 3;
|
|
6
10
|
export declare const REFERENCES_FILE = "references.json";
|
|
7
11
|
/** The lookup cache's place in a paper: committed, beside the paper's other reproduction files. */
|
|
8
12
|
export declare const LOOKUP_CACHE_FILE = "repro/references-cache.json";
|
|
9
13
|
export declare const lookupCachePath: (paperDir: string) => string;
|
|
10
14
|
/** Where a paper's reference verdicts live — beside `paper.facts.json`. */
|
|
11
15
|
export declare const referencesPath: (paperDir: string) => string;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The bibliography the build checks: the databases bibtex opened, in the order it opened them, and
|
|
18
|
+
* their entries as the bibtex reader read them. The verdicts are recorded one per entry, in this
|
|
19
|
+
* order: a verdict is about an entry, not about its key.
|
|
20
|
+
*/
|
|
21
|
+
export interface CheckedBibliography {
|
|
22
|
+
/** The build's record these databases were read from. */
|
|
23
|
+
readonly record: SourcesRecord;
|
|
24
|
+
readonly databases: readonly [ReadDatabase, ...ReadDatabase[]];
|
|
25
|
+
readonly entries: readonly RecordedEntry[];
|
|
26
|
+
/** The keys bibtex typeset, in the order it did: the `.bbl`'s `\bibitem`s. */
|
|
27
|
+
readonly typeset: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
/** What reading the bibliography takes: the record's readers, and the bibtex reader. */
|
|
30
|
+
export type BibliographyDeps = RecordedReadDeps;
|
|
31
|
+
/** What a paper's record comes to for the references. */
|
|
32
|
+
export type BibliographyRead = {
|
|
33
|
+
readonly kind: "read";
|
|
34
|
+
readonly bibliography: CheckedBibliography;
|
|
35
|
+
}
|
|
36
|
+
/** No record of the build, an unreadable one, or one the paper has changed since. */
|
|
37
|
+
| {
|
|
38
|
+
readonly kind: "no-record";
|
|
39
|
+
readonly record: Exclude<PaperRecord, {
|
|
40
|
+
readonly kind: "fresh";
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
/** bibtex opened no database: the build ran none, or the paper names none. */
|
|
44
|
+
| {
|
|
45
|
+
readonly kind: "nothing";
|
|
18
46
|
}
|
|
19
|
-
|
|
20
|
-
|
|
47
|
+
/** Databases bibtex opened that are not in the paper directory: it found them on its search path. */
|
|
48
|
+
| {
|
|
49
|
+
readonly kind: "unread";
|
|
50
|
+
readonly databases: readonly string[];
|
|
51
|
+
}
|
|
52
|
+
/** The build was not given a reader. */
|
|
53
|
+
| {
|
|
54
|
+
readonly kind: "not-wired";
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The bibliography the build recorded for the paper in `dir`: the databases bibtex opened, read by
|
|
58
|
+
* the bibtex reader. Only a fresh record answers (`paperRecord`).
|
|
59
|
+
*/
|
|
60
|
+
export declare function readBibliography(dir: string, deps: BibliographyDeps): BibliographyRead;
|
|
61
|
+
/** A paper's bibliography by its directory — what the build's steps are handed by the composition root. */
|
|
62
|
+
export type ReadBibliography = (dir: string) => BibliographyRead;
|
|
63
|
+
/** `readBibliography` over `deps`, as a `ReadBibliography`. */
|
|
64
|
+
export declare const bibliographyReader: (deps: BibliographyDeps) => ReadBibliography;
|
|
65
|
+
/** No reader: the build was not given one. Never "no bibliography" — it says so. */
|
|
66
|
+
export declare const notWiredBibliography: ReadBibliography;
|
|
67
|
+
/**
|
|
68
|
+
* The keys bibtex typeset that no entry the reader read has — an entry behind `%` or inside
|
|
69
|
+
* `@comment{…}`, which bibtex reads and the reader does not. In the order bibtex typeset them, each
|
|
70
|
+
* once. bibtex's keys are case-insensitive (`\cite{SMITH}` typesets `\bibitem{SMITH}` from an entry
|
|
71
|
+
* `smith`, measured), so they are compared so.
|
|
72
|
+
*/
|
|
73
|
+
export declare function unseenKeys(b: CheckedBibliography): readonly string[];
|
|
74
|
+
/** The bytes of the databases checked, in order: what a later lint compares to see the verdicts are current. */
|
|
75
|
+
export declare const bibHash: (b: CheckedBibliography) => string;
|
|
21
76
|
/** What `_build/references.json` holds. */
|
|
22
77
|
export interface ReferencesDocument {
|
|
23
78
|
readonly schema: number;
|
|
24
79
|
readonly bib: {
|
|
25
|
-
readonly
|
|
80
|
+
readonly sources: readonly string[];
|
|
26
81
|
readonly sha256: string;
|
|
27
82
|
};
|
|
28
83
|
readonly status: "checked" | "not-checked";
|
|
29
84
|
readonly why?: string;
|
|
30
85
|
readonly entries: readonly EntryVerdict[];
|
|
31
86
|
}
|
|
32
|
-
export declare const documentOf: (bib:
|
|
87
|
+
export declare const documentOf: (bib: CheckedBibliography, check: ReferencesCheck) => ReferencesDocument;
|
|
33
88
|
/** The recorded verdicts, or null when there are none or they do not parse. */
|
|
34
89
|
export declare function readReferences(files: Files, paperDir: string): ReferencesDocument | null;
|
|
35
90
|
/** The paper's lookup cache: empty when there is none, or why the file on disk cannot be read. */
|
|
36
91
|
export declare function readLookupCache(files: Files, paperDir: string): Result<LookupCache, string>;
|
|
37
92
|
/**
|
|
38
|
-
* The build step's work: check the bibliography, serving what it can from the
|
|
39
|
-
* cache, and record the verdicts. Returns the one-line note the build prints. A
|
|
40
|
-
* throws, or a cache that does not parse, is recorded as `not-checked` — the step
|
|
41
|
-
* never refuses. A cache that does not parse is left as it is, and named.
|
|
93
|
+
* The build step's work: check the bibliography the build recorded, serving what it can from the
|
|
94
|
+
* paper's lookup cache, and record the verdicts. Returns the one-line note the build prints. A
|
|
95
|
+
* checker that throws, or a cache that does not parse, is recorded as `not-checked` — the step
|
|
96
|
+
* reports, it never refuses. A cache that does not parse is left as it is, and named.
|
|
42
97
|
*/
|
|
43
|
-
export declare function recordReferences(files: Files, paperDir: string, check: CheckReferences): Promise<string>;
|
|
98
|
+
export declare function recordReferences(files: Files, paperDir: string, read: BibliographyRead, check: CheckReferences): Promise<string>;
|
|
44
99
|
//# sourceMappingURL=references.d.ts.map
|
package/dist/references.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAM,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,eAAe,EAEhB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,oGAAoG;AACpG,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,mGAAmG;AACnG,eAAO,MAAM,iBAAiB,gCAAgC,CAAC;AAE/D,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG,MAChB,CAAC;AAEpC,2EAA2E;AAC3E,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|
package/dist/references.js
CHANGED
|
@@ -8,14 +8,16 @@
|
|
|
8
8
|
* "bib-authors" in a scorecard table, or a command the project configured. Now the build runs
|
|
9
9
|
* them and records the result as data, beside the facts it already writes about the PDF:
|
|
10
10
|
*
|
|
11
|
-
* { "schema":
|
|
12
|
-
* "bib": { "
|
|
11
|
+
* { "schema": 3,
|
|
12
|
+
* "bib": { "sources": ["refs.bib"], "sha256": "…" }, the databases that were checked, as
|
|
13
|
+
* bibtex names them, and a hash of their text
|
|
13
14
|
* "status": "checked" | "not-checked", "why": "…", not-checked: nothing could be asked
|
|
14
15
|
* "entries": [ { "key", "exists", "authors", "why" } ] }
|
|
16
|
+
* one per entry checked, in its order
|
|
15
17
|
*
|
|
16
18
|
* A sibling file, not a new field of `paper.facts.json`: those facts are about ONE PDF and are
|
|
17
|
-
* stale when it changes (`pdf_sha256`); these are about the
|
|
18
|
-
*
|
|
19
|
+
* stale when it changes (`pdf_sha256`); these are about the databases and are stale when THEY
|
|
20
|
+
* change (`bib.sha256`). One staleness key per file, the way `pdf/fresh` already works.
|
|
19
21
|
*
|
|
20
22
|
* 🔴 WHAT THE CHECKERS ANSWERED IS KEPT, COMMITTED, IN `<paper>/repro/references-cache.json`
|
|
21
23
|
* (`domain/lookup-cache.ts`). Loaded before the check and saved after it — only when something new
|
|
@@ -23,6 +25,18 @@
|
|
|
23
25
|
* MAX_AGE_DAYS, not once per build (#107: 217 s for 27 references, every build). The verdicts above are NOT cached: they are derived from the cached
|
|
24
26
|
* answers on every build, so a fix to the checkers reaches every paper at once.
|
|
25
27
|
*
|
|
28
|
+
* ── WHICH DATABASES, AND WHAT BIBTEX TYPESET ───────────────────────────────────────────
|
|
29
|
+
* The databases checked are the ones the build's bibtex OPENED (`_build/sources.json`, written by
|
|
30
|
+
* `sources-record.ts` from TeX's own files; docs/design/paper-sources.md §1) — nothing here reads
|
|
31
|
+
* TeX source to decide which. Their entries are read by the one bibtex reader. bibtex reads
|
|
32
|
+
* differently from it in one place: it has no comment syntax, so an entry behind `%` or inside
|
|
33
|
+
* `@comment{…}` is one it typesets and the reader does not see. The record holds the keys bibtex
|
|
34
|
+
* typeset, so `paper/refs-checked` names the ones no entry of those databases has (`unseenKeys`).
|
|
35
|
+
* A malformed `.bib` never gets here: bibtex fails on it, and the build fails with bibtex's own lines.
|
|
36
|
+
*
|
|
37
|
+
* Without a record of the build, or with one the paper has changed since, there is no answer to
|
|
38
|
+
* "which databases": the step checks nothing, and the rules are silent — `paper/sources-fresh` speaks.
|
|
39
|
+
*
|
|
26
40
|
* 🔴 THE STEP NEVER FAILS THE BUILD. A build without network still builds the PDF; the reference
|
|
27
41
|
* step records `not-checked` and the lint rule says so, as a warning. Recording "not checked" as
|
|
28
42
|
* a pass would be the counter that counts what it never looked at.
|
|
@@ -32,9 +46,11 @@ import { callerPath } from "./caller-path.js";
|
|
|
32
46
|
import { sha256Hex } from "./domain/sha256.js";
|
|
33
47
|
import { EMPTY_LOOKUP_CACHE, parseLookupCache, serializeLookupCache, } from "./domain/lookup-cache.js";
|
|
34
48
|
import { ok } from "./domain/result.js";
|
|
35
|
-
import { bibRange } from "#eslint-rules/paper-typography";
|
|
36
49
|
import { messageOf } from "./domain/text.js";
|
|
37
|
-
|
|
50
|
+
import { describeChanges, } from "./domain/sources-record.js";
|
|
51
|
+
import { entriesOfDatabases, recordedBibliography, } from "./recorded-bibliography.js";
|
|
52
|
+
/** 3: the record of what bibtex read lives in `_build/sources.json`; an older one reads as none. */
|
|
53
|
+
export const REFERENCES_SCHEMA = 3;
|
|
38
54
|
export const REFERENCES_FILE = "references.json";
|
|
39
55
|
/** The lookup cache's place in a paper: committed, beside the paper's other reproduction files. */
|
|
40
56
|
export const LOOKUP_CACHE_FILE = "repro/references-cache.json";
|
|
@@ -45,18 +61,58 @@ const text = (files, p) => {
|
|
|
45
61
|
const b = files.readBytes(callerPath(p));
|
|
46
62
|
return b === null ? null : new TextDecoder().decode(b);
|
|
47
63
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
/** `xs` without the elements whose `key` an earlier one has, in order. */
|
|
65
|
+
const distinctBy = (xs, key) => xs.filter((x, i) => xs.findIndex((o) => key(o) === key(x)) === i);
|
|
66
|
+
/**
|
|
67
|
+
* The bibliography the build recorded for the paper in `dir`: the databases bibtex opened, read by
|
|
68
|
+
* the bibtex reader. Only a fresh record answers (`paperRecord`).
|
|
69
|
+
*/
|
|
70
|
+
export function readBibliography(dir, deps) {
|
|
71
|
+
const rec = recordedBibliography(dir, deps);
|
|
72
|
+
if (rec.kind === "unrecorded")
|
|
73
|
+
return { kind: "no-record", record: rec.record };
|
|
74
|
+
if (rec.unread.length > 0)
|
|
75
|
+
return { kind: "unread", databases: rec.unread };
|
|
76
|
+
const [first, ...rest] = rec.databases;
|
|
77
|
+
const bibtex = rec.record.bibtex;
|
|
78
|
+
if (first === undefined || !bibtex.ran)
|
|
79
|
+
return { kind: "nothing" };
|
|
80
|
+
return {
|
|
81
|
+
kind: "read",
|
|
82
|
+
bibliography: {
|
|
83
|
+
record: rec.record,
|
|
84
|
+
databases: [first, ...rest],
|
|
85
|
+
entries: entriesOfDatabases(rec.databases),
|
|
86
|
+
typeset: bibtex.keys,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** `readBibliography` over `deps`, as a `ReadBibliography`. */
|
|
91
|
+
export const bibliographyReader = (deps) => (dir) => readBibliography(dir, deps);
|
|
92
|
+
/** No reader: the build was not given one. Never "no bibliography" — it says so. */
|
|
93
|
+
export const notWiredBibliography = () => ({
|
|
94
|
+
kind: "not-wired",
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* The keys bibtex typeset that no entry the reader read has — an entry behind `%` or inside
|
|
98
|
+
* `@comment{…}`, which bibtex reads and the reader does not. In the order bibtex typeset them, each
|
|
99
|
+
* once. bibtex's keys are case-insensitive (`\cite{SMITH}` typesets `\bibitem{SMITH}` from an entry
|
|
100
|
+
* `smith`, measured), so they are compared so.
|
|
101
|
+
*/
|
|
102
|
+
export function unseenKeys(b) {
|
|
103
|
+
const read = new Set(b.entries.map((e) => e.entry.key.toLowerCase()));
|
|
104
|
+
return distinctBy(b.typeset.filter((k) => !read.has(k.toLowerCase())), (k) => k.toLowerCase());
|
|
55
105
|
}
|
|
56
|
-
|
|
106
|
+
/** The bytes of the databases checked, in order: what a later lint compares to see the verdicts are current. */
|
|
107
|
+
export const bibHash = (b) => sha256Hex(new TextEncoder().encode(b.databases
|
|
108
|
+
.map((d) => d.bib.text.slice(d.bib.body.start, d.bib.body.end))
|
|
109
|
+
.join("\n")));
|
|
57
110
|
export const documentOf = (bib, check) => ({
|
|
58
111
|
schema: REFERENCES_SCHEMA,
|
|
59
|
-
bib: {
|
|
112
|
+
bib: {
|
|
113
|
+
sources: bib.databases.map((d) => d.name),
|
|
114
|
+
sha256: bibHash(bib),
|
|
115
|
+
},
|
|
60
116
|
...(check.kind === "checked"
|
|
61
117
|
? { status: "checked", entries: check.entries }
|
|
62
118
|
: { status: "not-checked", why: check.why, entries: [] }),
|
|
@@ -97,25 +153,49 @@ const newAnswers = (before, after) => {
|
|
|
97
153
|
return (changed(before.citations, after.citations) +
|
|
98
154
|
changed(before.dblp, after.dblp));
|
|
99
155
|
};
|
|
100
|
-
/** Run the checker; a throw is `not-checked`, with the cache as it was. */
|
|
156
|
+
/** Run the checker over the bibliography's entries; a throw is `not-checked`, with the cache as it was. */
|
|
101
157
|
async function run(check, bib, cache) {
|
|
102
158
|
try {
|
|
103
|
-
return await check(bib, cache);
|
|
159
|
+
return await check(bib.entries.map((f) => f.entry), cache);
|
|
104
160
|
}
|
|
105
161
|
catch (e) {
|
|
106
162
|
return { check: { kind: "not-checked", why: messageOf(e) }, cache };
|
|
107
163
|
}
|
|
108
164
|
}
|
|
165
|
+
/** Why the build's record cannot say which databases were read, in the words a note carries. */
|
|
166
|
+
function noRecord(r) {
|
|
167
|
+
switch (r.kind) {
|
|
168
|
+
case "none":
|
|
169
|
+
return r.unreadable === null
|
|
170
|
+
? "the build recorded no sources (_build/sources.json was not written)"
|
|
171
|
+
: `_build/sources.json cannot be used (${r.unreadable})`;
|
|
172
|
+
case "stale":
|
|
173
|
+
return `the paper changed since the build recorded it (${describeChanges(r.changed)})`;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** The note for a paper whose bibliography was not read. */
|
|
177
|
+
function unreadNote(read) {
|
|
178
|
+
switch (read.kind) {
|
|
179
|
+
case "no-record":
|
|
180
|
+
return `references NOT checked — ${noRecord(read.record)}; lint will say so`;
|
|
181
|
+
case "nothing":
|
|
182
|
+
return "no bibliography database — bibtex opened none, nothing to check";
|
|
183
|
+
case "unread":
|
|
184
|
+
return `references NOT checked — ${read.databases.join(", ")}, which bibtex opened, is not in the paper directory; lint will say so`;
|
|
185
|
+
case "not-wired":
|
|
186
|
+
return "references NOT checked — no bibliography reader was wired into this build; lint will say so";
|
|
187
|
+
}
|
|
188
|
+
}
|
|
109
189
|
/**
|
|
110
|
-
* The build step's work: check the bibliography, serving what it can from the
|
|
111
|
-
* cache, and record the verdicts. Returns the one-line note the build prints. A
|
|
112
|
-
* throws, or a cache that does not parse, is recorded as `not-checked` — the step
|
|
113
|
-
* never refuses. A cache that does not parse is left as it is, and named.
|
|
190
|
+
* The build step's work: check the bibliography the build recorded, serving what it can from the
|
|
191
|
+
* paper's lookup cache, and record the verdicts. Returns the one-line note the build prints. A
|
|
192
|
+
* checker that throws, or a cache that does not parse, is recorded as `not-checked` — the step
|
|
193
|
+
* reports, it never refuses. A cache that does not parse is left as it is, and named.
|
|
114
194
|
*/
|
|
115
|
-
export async function recordReferences(files, paperDir, check) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
195
|
+
export async function recordReferences(files, paperDir, read, check) {
|
|
196
|
+
if (read.kind !== "read")
|
|
197
|
+
return unreadNote(read);
|
|
198
|
+
const bib = read.bibliography;
|
|
119
199
|
const record = (c) => {
|
|
120
200
|
const doc = documentOf(bib, c);
|
|
121
201
|
files.writeAtomic(callerPath(referencesPath(paperDir)), new TextEncoder().encode(`${JSON.stringify(doc, null, 2)}\n`));
|
|
@@ -128,13 +208,17 @@ export async function recordReferences(files, paperDir, check) {
|
|
|
128
208
|
const cache = readLookupCache(files, paperDir);
|
|
129
209
|
if (!cache.ok)
|
|
130
210
|
return notChecked(`${LOOKUP_CACHE_FILE} cannot be read (${cache.error}) — fix it, or delete it to ask every question again`);
|
|
131
|
-
const result = await run(check, bib
|
|
211
|
+
const result = await run(check, bib, cache.value);
|
|
132
212
|
if (result.check.kind === "not-checked")
|
|
133
213
|
return notChecked(result.check.why);
|
|
134
214
|
const doc = record(result.check);
|
|
135
215
|
const fetched = newAnswers(cache.value, result.cache);
|
|
136
216
|
if (fetched > 0)
|
|
137
217
|
files.writeAtomic(callerPath(lookupCachePath(paperDir)), new TextEncoder().encode(serializeLookupCache(result.cache)));
|
|
218
|
+
return summary(doc, fetched);
|
|
219
|
+
}
|
|
220
|
+
/** The note a checked run prints: how many entries, how many failing, what was fetched. */
|
|
221
|
+
function summary(doc, fetched) {
|
|
138
222
|
const bad = doc.entries.filter((e) => e.exists === "false" || e.authors === "mismatch").length;
|
|
139
223
|
return (`references: ${String(doc.entries.length)} checked, ${String(bad)} failing → _build/${REFERENCES_FILE}; ` +
|
|
140
224
|
(fetched > 0
|
package/dist/references.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.js","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"references.js","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,E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AI;QACzG,CAAC,OAAO,GAAG,CAAC;YACV,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,iBAAiB,EAAE;YACnF,CAAC,CAAC,iBAAiB,CAAC,CACvB,CAAC;AACJ,CAAC"}
|
package/dist/register-bands.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type Band, type Occurrence, type RegisterAnchor } from "./domain/register.ts";
|
|
2
2
|
import type { Span } from "./domain/tex-document.ts";
|
|
3
3
|
import type { LatexReader } from "./ports/latex.ts";
|
|
4
|
+
import { type ProseDeps } from "./tex-paper.ts";
|
|
4
5
|
import { type Located, type TexRuleModule } from "./tex-venue-rules.ts";
|
|
5
6
|
import type { VenueRuleDeps } from "./venue-rules.ts";
|
|
6
|
-
/** What the three rules read: the preset store, and the
|
|
7
|
-
export interface RegisterBandDeps extends VenueRuleDeps {
|
|
8
|
-
readonly latex: LatexReader;
|
|
7
|
+
/** What the three rules read: the preset store, the LaTeX reader, and the paper's files as the build recorded them. */
|
|
8
|
+
export interface RegisterBandDeps extends VenueRuleDeps, ProseDeps {
|
|
9
9
|
}
|
|
10
10
|
export type RegisterBandRuleName = "contrast-frames" | "claim-emphasis" | "relation-markers";
|
|
11
11
|
/** What one body measures for one rule: its words, the occurrences, where the body starts. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-bands.d.ts","sourceRoot":"","sources":["../src/register-bands.ts"],"names":[],"mappings":"AAyBA,OAAO,EAQL,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,cAAc,EAEpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAqB,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"register-bands.d.ts","sourceRo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WAAW,GACjB,WAAW,CASb;AASD;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,WAAW,GACjB,cAAc,CAchB;AA4CD,qDAAqD;AACrD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,GACrB,QAAQ,CAAC,MAAM,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC,CAMvD;AAED,qFAAqF;AACrF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAC9C,MAAM,CAAC,OAAO,oBAAoB,EAAE,EAAE,MAAM,CAAC,CAK9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-bands.js","sourceRoot":"","sources":["../src/register-bands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,MAAM,EACN,aAAa,EACb,aAAa,EACb,cAAc,EACd,MAAM,EACN,eAAe,EACf,OAAO,GAKR,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"register-bands.js","sourceRoot":"","sources":["../src/register-bands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,MAAM,EACN,aAAa,EACb,aAAa,EACb,cAAc,EACd,MAAM,EACN,eAAe,EACf,OAAO,GAKR,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAA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D,OAAO;gBACL,IAAI,EAAE,GAAG,EAAE;oBACT,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;gBAClC,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,iBAAiB,CAC/B,IAAsB;IAEtB,OAAO;QACL,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC;QAChD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC;QAC9C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC;KACnD,CAAC;AACJ,CAAC;AAED,qFAAqF;AACrF,MAAM,CAAC,MAAM,yBAAyB,GAElC;IACF,qBAAqB,EAAE,MAAM;IAC7B,oBAAoB,EAAE,MAAM;IAC5B,sBAAsB,EAAE,MAAM;CAC/B,CAAC"}
|
package/dist/register.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* the page. A body under 2 000 words is not judged: there one sentence decides the rate.
|
|
17
17
|
*/
|
|
18
18
|
import type { Passage, Span } from "./domain/tex-document.ts";
|
|
19
|
-
import { type
|
|
19
|
+
import { type ProseDeps } from "./tex-paper.ts";
|
|
20
20
|
import { type Located, type TexRuleModule } from "./tex-venue-rules.ts";
|
|
21
21
|
/** Under this many words in the body, a rate is not judged: one sentence would decide it. */
|
|
22
22
|
export declare const MIN_WORDS = 2000;
|
|
@@ -38,5 +38,5 @@ export declare function measureRegister(passages: readonly Passage[]): RegisterM
|
|
|
38
38
|
/** One finding, at the start of the body, when the rate runs above `limit` per 1000 words. */
|
|
39
39
|
export declare function judgeRegister(m: RegisterMeasure, limit?: number): readonly Located[];
|
|
40
40
|
/** The rule, over the body's prose of the whole paper, its includes spliced (`readPaper`). */
|
|
41
|
-
export declare const registerRule: (deps:
|
|
41
|
+
export declare const registerRule: (deps: ProseDeps) => TexRuleModule;
|
|
42
42
|
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type SourcesRecord } from "./domain/sources-record.ts";
|
|
2
|
+
import type { Files } from "./ports/files.ts";
|
|
3
|
+
import type { ListDir } from "./ports/talk-media.ts";
|
|
4
|
+
import type { TexOutput } from "./ports/tex-output.ts";
|
|
5
|
+
/** What recording needs: the disk, its directory listings, and the readers of TeX's own files. */
|
|
6
|
+
export interface RecordDeps {
|
|
7
|
+
readonly files: Files;
|
|
8
|
+
readonly listDir: ListDir;
|
|
9
|
+
readonly texOutput: TexOutput;
|
|
10
|
+
}
|
|
11
|
+
/** What a build's passes left to read, besides the files on disk. */
|
|
12
|
+
export interface TexRun {
|
|
13
|
+
/** The text of each pdflatex pass's `.fls`, in the order the passes ran. */
|
|
14
|
+
readonly fls: readonly string[];
|
|
15
|
+
/** The exit of the last bibtex run, or null when the build ran none. */
|
|
16
|
+
readonly bibtexExit: number | null;
|
|
17
|
+
}
|
|
18
|
+
export type Recorded = {
|
|
19
|
+
readonly kind: "recorded";
|
|
20
|
+
readonly record: SourcesRecord;
|
|
21
|
+
/** Where it was written. */
|
|
22
|
+
readonly path: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: "not-recorded";
|
|
25
|
+
readonly why: string;
|
|
26
|
+
};
|
|
27
|
+
/** The step as the build holds it: wired by the composition root, handed a paper's directory and its run. */
|
|
28
|
+
export type RecordSources = (paperDir: string, run: TexRun) => Recorded;
|
|
29
|
+
/** No recorder wired: the build says so, and lint reports the paper as not built. */
|
|
30
|
+
export declare const notWiredRecord: RecordSources;
|
|
31
|
+
/** Where a paper's record lives. */
|
|
32
|
+
export declare const sourcesPath: (paperDir: string) => string;
|
|
33
|
+
export declare function recordSources(deps: RecordDeps, paperDir: string, run: TexRun): Recorded;
|
|
34
|
+
/** `recordSources` over `deps`, as the `RecordSources` the build is handed. */
|
|
35
|
+
export declare const sourcesRecorder: (deps: RecordDeps) => RecordSources;
|
|
36
|
+
/** The line a build prints for a recording. */
|
|
37
|
+
export declare const recordingNote: (r: Recorded) => string;
|
|
38
|
+
//# sourceMappingURL=sources-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources-record.d.ts","sourceRoot":"","sources":["../src/sources-record.ts"],"names":[],"mappings":"AAeA,OAAO,EASL,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,kGAAkG;AAClG,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC/B;AAED,qEAAqE;AACrE,MAAM,WAAW,MAAM;IACrB,4EAA4E;IAC5E,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,wEAAwE;IACxE,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,MAAM,QAAQ,GAChB;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D,6GAA6G;AAC7G,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,QAAQ,CAAC;AAExE,qFAAqF;AACrF,eAAO,MAAM,cAAc,EAAE,aAG3B,CAAC;AAEH,oCAAoC;AACpC,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,KAAG,MACJ,CAAC;AAiI5C,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,QAAQ,CAiBV;AAED,+EAA+E;AAC/E,eAAO,MAAM,eAAe,GACzB,MAAM,UAAU,KAAG,aAEgB,CAAC;AAEvC,+CAA+C;AAC/C,eAAO,MAAM,aAAa,GAAI,GAAG,QAAQ,KAAG,MAGa,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE RECORD STEP OF A BUILD — `recordSources` writes `<paper>/_build/sources.json`
|
|
3
|
+
* (`src/domain/sources-record.ts`, docs/design/paper-sources.md §1) from what TeX and bibtex left in
|
|
4
|
+
* the paper directory after the build's passes: each pass's `.fls`, the `.aux`, the `.blg` and the
|
|
5
|
+
* `.bbl`. The files are read through the `Files` port, the `.fls` and the `.blg` through `TexOutput`;
|
|
6
|
+
* which files the passes read is decided by `filesOfRun` (`src/domain/tex-run.ts`).
|
|
7
|
+
*
|
|
8
|
+
* Nothing here reads TeX source. Every file named in the record is one TeX or bibtex opened, and its
|
|
9
|
+
* bytes are hashed as they are now: what a rule compares later to know whether the paper changed.
|
|
10
|
+
*
|
|
11
|
+
* What the `.aux`, `.blg` and `.bbl` hold about the bibliography is read by `latex-log.ts` — the reader
|
|
12
|
+
* the build loop already uses on them, so one reader answers what bibtex was told and what it read.
|
|
13
|
+
*/
|
|
14
|
+
import { join, posix, resolve } from "node:path";
|
|
15
|
+
import { callerPath } from "./caller-path.js";
|
|
16
|
+
import { JOBNAME, serializeSourcesRecord, SOURCES_DIR, SOURCES_FILE, SOURCES_SCHEMA, spelledIn, } from "./domain/sources-record.js";
|
|
17
|
+
import { sha256Hex } from "./domain/sha256.js";
|
|
18
|
+
import { filesOfRun } from "./domain/tex-run.js";
|
|
19
|
+
import { auxBib, bibtexRead } from "./latex-log.js";
|
|
20
|
+
/** No recorder wired: the build says so, and lint reports the paper as not built. */
|
|
21
|
+
export const notWiredRecord = () => ({
|
|
22
|
+
kind: "not-recorded",
|
|
23
|
+
why: "no recorder was wired into this build",
|
|
24
|
+
});
|
|
25
|
+
/** Where a paper's record lives. */
|
|
26
|
+
export const sourcesPath = (paperDir) => join(paperDir, SOURCES_DIR, SOURCES_FILE);
|
|
27
|
+
const distinct = (xs) => [...new Set(xs)];
|
|
28
|
+
/** A path as the record spells it: relative to the paper directory, `./` and doubled slashes gone. */
|
|
29
|
+
const spelled = (p) => posix.normalize(p);
|
|
30
|
+
/**
|
|
31
|
+
* A path of the record spelled as the paper directory's entries spell it. TeX logs the name it opened:
|
|
32
|
+
* on a file system that ignores case that is the source's spelling, while TeX on one that does not
|
|
33
|
+
* retries without case and logs the disk's — one paper, two records. A segment no entry matches, or
|
|
34
|
+
* several do, stays as TeX spelled it.
|
|
35
|
+
*/
|
|
36
|
+
const spelledOnDisk = (listDir, paperDir) => (p) => p
|
|
37
|
+
.split("/")
|
|
38
|
+
.reduce((at, segment) => posix.join(at, spelledIn(listDir(callerPath(resolve(paperDir, at))), segment) ??
|
|
39
|
+
segment), "");
|
|
40
|
+
/** The files a run read and wrote, each named as the disk names it. */
|
|
41
|
+
const respelled = (files, spell) => {
|
|
42
|
+
const inputs = files.inputs.map((i) => ({ ...i, path: spell(i.path) }));
|
|
43
|
+
return {
|
|
44
|
+
...files,
|
|
45
|
+
inputs: inputs.filter((i, n) => inputs.findIndex((j) => j.path === i.path) === n),
|
|
46
|
+
written: distinct(files.written.map(spell)),
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/** The bytes of a file of the paper by its path in the record, or null when it is not there. */
|
|
50
|
+
const bytesOf = (deps, paperDir) => (p) => deps.files.readBytes(callerPath(resolve(paperDir, p)));
|
|
51
|
+
const textOf = (bytes) => (p) => {
|
|
52
|
+
const b = bytes(p);
|
|
53
|
+
return b === null ? null : new TextDecoder().decode(b);
|
|
54
|
+
};
|
|
55
|
+
/** What the build's bibtex did, from the `.blg` and `.bbl` it left — or that it did not run. */
|
|
56
|
+
function bibtexOf(deps, text, spell, exit) {
|
|
57
|
+
if (exit === null)
|
|
58
|
+
return { ran: false };
|
|
59
|
+
const blg = text(`${JOBNAME}.blg`) ?? "";
|
|
60
|
+
const bbl = text(`${JOBNAME}.bbl`) ?? "";
|
|
61
|
+
const read = bibtexRead(blg, bbl);
|
|
62
|
+
return {
|
|
63
|
+
ran: true,
|
|
64
|
+
databases: distinct(read.databases.map((d) => spell(spelled(d)))),
|
|
65
|
+
keys: read.bibitems,
|
|
66
|
+
exit,
|
|
67
|
+
errors: deps.texOutput.blgErrors(blg),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The digest of every file the paper is made of: each input, and each database bibtex opened — one TeX
|
|
72
|
+
* wrote too, since the rules read it from disk and an edit to it after the build must read as a change.
|
|
73
|
+
* Null for one that is not there.
|
|
74
|
+
*/
|
|
75
|
+
function hashesOf(inputs, databases, bytes) {
|
|
76
|
+
const paths = distinct([...inputs.map((i) => i.path), ...databases]);
|
|
77
|
+
return Object.fromEntries(paths.map((p) => {
|
|
78
|
+
const b = bytes(p);
|
|
79
|
+
return [p, b === null ? null : sha256Hex(b)];
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
/** Why there is nothing to record, or null when the passes read the paper's files. */
|
|
83
|
+
const nothingToRecord = (run, inputs) => {
|
|
84
|
+
if (run.fls.length === 0)
|
|
85
|
+
return `pdflatex wrote no ${JOBNAME}.fls — nothing to record`;
|
|
86
|
+
return inputs.length === 0
|
|
87
|
+
? `${JOBNAME}.fls lists no file of the paper directory — nothing to record`
|
|
88
|
+
: null;
|
|
89
|
+
};
|
|
90
|
+
/** The record of a run whose passes read `files`: bibtex's part, the `.aux`'s, every digest. */
|
|
91
|
+
function recordOf(deps, paperDir, run, files) {
|
|
92
|
+
const bytes = bytesOf(deps, paperDir);
|
|
93
|
+
const text = textOf(bytes);
|
|
94
|
+
const bibtex = bibtexOf(deps, text, spelledOnDisk(deps.listDir, paperDir), run.bibtexExit);
|
|
95
|
+
return {
|
|
96
|
+
schema: SOURCES_SCHEMA,
|
|
97
|
+
inputs: files.inputs,
|
|
98
|
+
written: files.written,
|
|
99
|
+
bibdata: auxBib(text(`${JOBNAME}.aux`) ?? "", text).databases,
|
|
100
|
+
bibtex,
|
|
101
|
+
sha256: hashesOf(files.inputs, bibtex.ran ? bibtex.databases : [], bytes),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export function recordSources(deps, paperDir, run) {
|
|
105
|
+
const files = respelled(filesOfRun(run.fls.map(deps.texOutput.fls), {
|
|
106
|
+
jobname: JOBNAME,
|
|
107
|
+
generated: run.bibtexExit === null ? [] : [`${JOBNAME}.bbl`],
|
|
108
|
+
}), spelledOnDisk(deps.listDir, paperDir));
|
|
109
|
+
const why = nothingToRecord(run, files.inputs);
|
|
110
|
+
if (why !== null)
|
|
111
|
+
return { kind: "not-recorded", why };
|
|
112
|
+
const record = recordOf(deps, paperDir, run, files);
|
|
113
|
+
const path = sourcesPath(paperDir);
|
|
114
|
+
deps.files.writeAtomic(callerPath(path), new TextEncoder().encode(serializeSourcesRecord(record)));
|
|
115
|
+
return { kind: "recorded", record, path };
|
|
116
|
+
}
|
|
117
|
+
/** `recordSources` over `deps`, as the `RecordSources` the build is handed. */
|
|
118
|
+
export const sourcesRecorder = (deps) => (paperDir, run) => recordSources(deps, paperDir, run);
|
|
119
|
+
/** The line a build prints for a recording. */
|
|
120
|
+
export const recordingNote = (r) => r.kind === "recorded"
|
|
121
|
+
? `sources: ${String(r.record.inputs.length)} file${r.record.inputs.length === 1 ? "" : "s"} read → ${SOURCES_DIR}/${SOURCES_FILE}`
|
|
122
|
+
: `sources NOT recorded — ${r.why}; lint will say so`;
|
|
123
|
+
//# sourceMappingURL=sources-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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