pulpweaver4 0.0.0-stage → 0.0.88
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/dist/ast/djot.d.ts +123 -0
- package/dist/ast/djot.js +458 -0
- package/dist/ast/djot.js.map +1 -0
- package/dist/ast/index.d.ts +10 -0
- package/dist/ast/index.js +11 -0
- package/dist/ast/index.js.map +1 -0
- package/dist/ast/locator.d.ts +27 -0
- package/dist/ast/locator.js +77 -0
- package/dist/ast/locator.js.map +1 -0
- package/dist/ast/nodes.d.ts +534 -0
- package/dist/ast/nodes.js +48 -0
- package/dist/ast/nodes.js.map +1 -0
- package/dist/ast/position.d.ts +88 -0
- package/dist/ast/position.js +98 -0
- package/dist/ast/position.js.map +1 -0
- package/dist/ast/traverse.d.ts +12 -0
- package/dist/ast/traverse.js +37 -0
- package/dist/ast/traverse.js.map +1 -0
- package/dist/bibliography/biblatex.d.ts +13 -0
- package/dist/bibliography/biblatex.js +849 -0
- package/dist/bibliography/biblatex.js.map +1 -0
- package/dist/bibliography/bibtex.d.ts +39 -0
- package/dist/bibliography/bibtex.js +259 -0
- package/dist/bibliography/bibtex.js.map +1 -0
- package/dist/bibliography/csl.d.ts +9 -0
- package/dist/bibliography/csl.js +241 -0
- package/dist/bibliography/csl.js.map +1 -0
- package/dist/bibliography/dates.d.ts +33 -0
- package/dist/bibliography/dates.js +223 -0
- package/dist/bibliography/dates.js.map +1 -0
- package/dist/bibliography/index.d.ts +8 -0
- package/dist/bibliography/index.js +9 -0
- package/dist/bibliography/index.js.map +1 -0
- package/dist/bibliography/item.d.ts +142 -0
- package/dist/bibliography/item.js +181 -0
- package/dist/bibliography/item.js.map +1 -0
- package/dist/bibliography/latex.d.ts +21 -0
- package/dist/bibliography/latex.js +586 -0
- package/dist/bibliography/latex.js.map +1 -0
- package/dist/bibliography/names.d.ts +23 -0
- package/dist/bibliography/names.js +244 -0
- package/dist/bibliography/names.js.map +1 -0
- package/dist/bibliography/read.d.ts +24 -0
- package/dist/bibliography/read.js +50 -0
- package/dist/bibliography/read.js.map +1 -0
- package/dist/citations/book.d.ts +91 -0
- package/dist/citations/book.js +206 -0
- package/dist/citations/book.js.map +1 -0
- package/dist/citations/collect.d.ts +52 -0
- package/dist/citations/collect.js +125 -0
- package/dist/citations/collect.js.map +1 -0
- package/dist/citations/hast.d.ts +12 -0
- package/dist/citations/hast.js +49 -0
- package/dist/citations/hast.js.map +1 -0
- package/dist/citations/index.d.ts +14 -0
- package/dist/citations/index.js +15 -0
- package/dist/citations/index.js.map +1 -0
- package/dist/citations/lint.d.ts +70 -0
- package/dist/citations/lint.js +92 -0
- package/dist/citations/lint.js.map +1 -0
- package/dist/citations/notes.d.ts +11 -0
- package/dist/citations/notes.js +120 -0
- package/dist/citations/notes.js.map +1 -0
- package/dist/citations/positions.d.ts +34 -0
- package/dist/citations/positions.js +90 -0
- package/dist/citations/positions.js.map +1 -0
- package/dist/citations/project.d.ts +7 -0
- package/dist/citations/project.js +24 -0
- package/dist/citations/project.js.map +1 -0
- package/dist/colour/cmyk.d.ts +71 -0
- package/dist/colour/cmyk.js +210 -0
- package/dist/colour/cmyk.js.map +1 -0
- package/dist/colour/images.d.ts +36 -0
- package/dist/colour/images.js +106 -0
- package/dist/colour/images.js.map +1 -0
- package/dist/colour/index.d.ts +7 -0
- package/dist/colour/index.js +8 -0
- package/dist/colour/index.js.map +1 -0
- package/dist/colour/ink-limit.d.ts +68 -0
- package/dist/colour/ink-limit.js +109 -0
- package/dist/colour/ink-limit.js.map +1 -0
- package/dist/colour/intents.d.ts +135 -0
- package/dist/colour/intents.js +183 -0
- package/dist/colour/intents.js.map +1 -0
- package/dist/colour/lcms.d.ts +79 -0
- package/dist/colour/lcms.js +229 -0
- package/dist/colour/lcms.js.map +1 -0
- package/dist/colour/previews.d.ts +49 -0
- package/dist/colour/previews.js +116 -0
- package/dist/colour/previews.js.map +1 -0
- package/dist/colour/wasm/LICENSE-lcms2 +22 -0
- package/dist/colour/wasm/lcms2.wasm +0 -0
- package/dist/config/config.d.ts +109 -0
- package/dist/config/config.js +295 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/page.d.ts +42 -0
- package/dist/config/page.js +95 -0
- package/dist/config/page.js.map +1 -0
- package/dist/config/project-schema.d.ts +23 -0
- package/dist/config/project-schema.js +209 -0
- package/dist/config/project-schema.js.map +1 -0
- package/dist/config/schema.d.ts +68 -0
- package/dist/config/schema.js +333 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/toml.d.ts +54 -0
- package/dist/config/toml.js +238 -0
- package/dist/config/toml.js.map +1 -0
- package/dist/contents/index.d.ts +8 -0
- package/dist/contents/index.js +9 -0
- package/dist/contents/index.js.map +1 -0
- package/dist/contents/transform.d.ts +64 -0
- package/dist/contents/transform.js +149 -0
- package/dist/contents/transform.js.map +1 -0
- package/dist/csl/affix.d.ts +16 -0
- package/dist/csl/affix.js +74 -0
- package/dist/csl/affix.js.map +1 -0
- package/dist/csl/data/chicago-author-date.d.ts +2 -0
- package/dist/csl/data/chicago-author-date.js +3 -0
- package/dist/csl/data/chicago-author-date.js.map +1 -0
- package/dist/csl/data/chicago-notes-bibliography.d.ts +2 -0
- package/dist/csl/data/chicago-notes-bibliography.js +3 -0
- package/dist/csl/data/chicago-notes-bibliography.js.map +1 -0
- package/dist/csl/data/locales-en-GB.d.ts +2 -0
- package/dist/csl/data/locales-en-GB.js +3 -0
- package/dist/csl/data/locales-en-GB.js.map +1 -0
- package/dist/csl/data/locales-en-US.d.ts +2 -0
- package/dist/csl/data/locales-en-US.js +3 -0
- package/dist/csl/data/locales-en-US.js.map +1 -0
- package/dist/csl/dates.d.ts +30 -0
- package/dist/csl/dates.js +223 -0
- package/dist/csl/dates.js.map +1 -0
- package/dist/csl/format.d.ts +29 -0
- package/dist/csl/format.js +157 -0
- package/dist/csl/format.js.map +1 -0
- package/dist/csl/index.d.ts +26 -0
- package/dist/csl/index.js +16 -0
- package/dist/csl/index.js.map +1 -0
- package/dist/csl/ir.d.ts +103 -0
- package/dist/csl/ir.js +549 -0
- package/dist/csl/ir.js.map +1 -0
- package/dist/csl/load.d.ts +98 -0
- package/dist/csl/load.js +163 -0
- package/dist/csl/load.js.map +1 -0
- package/dist/csl/locale.d.ts +90 -0
- package/dist/csl/locale.js +251 -0
- package/dist/csl/locale.js.map +1 -0
- package/dist/csl/names.d.ts +41 -0
- package/dist/csl/names.js +203 -0
- package/dist/csl/names.js.map +1 -0
- package/dist/csl/numbers.d.ts +48 -0
- package/dist/csl/numbers.js +170 -0
- package/dist/csl/numbers.js.map +1 -0
- package/dist/csl/processor.d.ts +177 -0
- package/dist/csl/processor.js +759 -0
- package/dist/csl/processor.js.map +1 -0
- package/dist/csl/project.d.ts +21 -0
- package/dist/csl/project.js +78 -0
- package/dist/csl/project.js.map +1 -0
- package/dist/csl/render.d.ts +130 -0
- package/dist/csl/render.js +748 -0
- package/dist/csl/render.js.map +1 -0
- package/dist/csl/style.d.ts +168 -0
- package/dist/csl/style.js +262 -0
- package/dist/csl/style.js.map +1 -0
- package/dist/csl/xml.d.ts +28 -0
- package/dist/csl/xml.js +162 -0
- package/dist/csl/xml.js.map +1 -0
- package/dist/djot/djot.js/LICENSE +20 -0
- package/dist/djot/djot.js/src/ast.d.ts +324 -0
- package/dist/djot/djot.js/src/ast.js +61 -0
- package/dist/djot/djot.js/src/ast.js.map +1 -0
- package/dist/djot/djot.js/src/attributes.d.ts +31 -0
- package/dist/djot/djot.js/src/attributes.js +300 -0
- package/dist/djot/djot.js/src/attributes.js.map +1 -0
- package/dist/djot/djot.js/src/block.d.ts +87 -0
- package/dist/djot/djot.js/src/block.js +1201 -0
- package/dist/djot/djot.js/src/block.js.map +1 -0
- package/dist/djot/djot.js/src/djot-renderer.d.ts +8 -0
- package/dist/djot/djot.js/src/djot-renderer.js +755 -0
- package/dist/djot/djot.js/src/djot-renderer.js.map +1 -0
- package/dist/djot/djot.js/src/event.d.ts +6 -0
- package/dist/djot/djot.js/src/event.js +2 -0
- package/dist/djot/djot.js/src/event.js.map +1 -0
- package/dist/djot/djot.js/src/filter.d.ts +13 -0
- package/dist/djot/djot.js/src/filter.js +159 -0
- package/dist/djot/djot.js/src/filter.js.map +1 -0
- package/dist/djot/djot.js/src/find.d.ts +7 -0
- package/dist/djot/djot.js/src/find.js +33 -0
- package/dist/djot/djot.js/src/find.js.map +1 -0
- package/dist/djot/djot.js/src/html.d.ts +40 -0
- package/dist/djot/djot.js/src/html.js +656 -0
- package/dist/djot/djot.js/src/html.js.map +1 -0
- package/dist/djot/djot.js/src/index.d.ts +9 -0
- package/dist/djot/djot.js/src/index.js +9 -0
- package/dist/djot/djot.js/src/index.js.map +1 -0
- package/dist/djot/djot.js/src/inline.d.ts +62 -0
- package/dist/djot/djot.js/src/inline.js +1019 -0
- package/dist/djot/djot.js/src/inline.js.map +1 -0
- package/dist/djot/djot.js/src/options.d.ts +13 -0
- package/dist/djot/djot.js/src/options.js +27 -0
- package/dist/djot/djot.js/src/options.js.map +1 -0
- package/dist/djot/djot.js/src/pandoc.d.ts +20 -0
- package/dist/djot/djot.js/src/pandoc.js +1040 -0
- package/dist/djot/djot.js/src/pandoc.js.map +1 -0
- package/dist/djot/djot.js/src/parse.d.ts +19 -0
- package/dist/djot/djot.js/src/parse.js +1436 -0
- package/dist/djot/djot.js/src/parse.js.map +1 -0
- package/dist/djot/djot.js/src/version.d.ts +1 -0
- package/dist/djot/djot.js/src/version.js +2 -0
- package/dist/djot/djot.js/src/version.js.map +1 -0
- package/dist/djot/index.d.ts +5 -0
- package/dist/djot/index.js +6 -0
- package/dist/djot/index.js.map +1 -0
- package/dist/djot/read.d.ts +57 -0
- package/dist/djot/read.js +146 -0
- package/dist/djot/read.js.map +1 -0
- package/dist/fonts/css.d.ts +82 -0
- package/dist/fonts/css.js +329 -0
- package/dist/fonts/css.js.map +1 -0
- package/dist/fonts/faces.d.ts +101 -0
- package/dist/fonts/faces.js +226 -0
- package/dist/fonts/faces.js.map +1 -0
- package/dist/fonts/index.d.ts +12 -0
- package/dist/fonts/index.js +13 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/fonts/lint.d.ts +58 -0
- package/dist/fonts/lint.js +209 -0
- package/dist/fonts/lint.js.map +1 -0
- package/dist/fonts/match.d.ts +36 -0
- package/dist/fonts/match.js +104 -0
- package/dist/fonts/match.js.map +1 -0
- package/dist/fonts/names.d.ts +9 -0
- package/dist/fonts/names.js +50 -0
- package/dist/fonts/names.js.map +1 -0
- package/dist/fonts/subset.d.ts +72 -0
- package/dist/fonts/subset.js +169 -0
- package/dist/fonts/subset.js.map +1 -0
- package/dist/fonts/walk.d.ts +33 -0
- package/dist/fonts/walk.js +120 -0
- package/dist/fonts/walk.js.map +1 -0
- package/dist/fonts/wasm/LICENSE-harfbuzzjs +19 -0
- package/dist/fonts/wasm/harfbuzz-subset.wasm +0 -0
- package/dist/html/check.d.ts +62 -0
- package/dist/html/check.js +186 -0
- package/dist/html/check.js.map +1 -0
- package/dist/html/counters.d.ts +32 -0
- package/dist/html/counters.js +72 -0
- package/dist/html/counters.js.map +1 -0
- package/dist/html/css.d.ts +33 -0
- package/dist/html/css.js +72 -0
- package/dist/html/css.js.map +1 -0
- package/dist/html/dom.d.ts +28 -0
- package/dist/html/dom.js +162 -0
- package/dist/html/dom.js.map +1 -0
- package/dist/html/editions.d.ts +26 -0
- package/dist/html/editions.js +57 -0
- package/dist/html/editions.js.map +1 -0
- package/dist/html/images.d.ts +13 -0
- package/dist/html/images.js +62 -0
- package/dist/html/images.js.map +1 -0
- package/dist/html/index.d.ts +14 -0
- package/dist/html/index.js +15 -0
- package/dist/html/index.js.map +1 -0
- package/dist/html/registry.d.ts +120 -0
- package/dist/html/registry.js +48 -0
- package/dist/html/registry.js.map +1 -0
- package/dist/html/render.d.ts +99 -0
- package/dist/html/render.js +687 -0
- package/dist/html/render.js.map +1 -0
- package/dist/hyphenation/NOTICE +429 -0
- package/dist/hyphenation/exceptions.d.ts +60 -0
- package/dist/hyphenation/exceptions.js +79 -0
- package/dist/hyphenation/exceptions.js.map +1 -0
- package/dist/hyphenation/hyphenator.d.ts +66 -0
- package/dist/hyphenation/hyphenator.js +245 -0
- package/dist/hyphenation/hyphenator.js.map +1 -0
- package/dist/hyphenation/index.d.ts +4 -0
- package/dist/hyphenation/index.js +5 -0
- package/dist/hyphenation/index.js.map +1 -0
- package/dist/hyphenation/languages.d.ts +20 -0
- package/dist/hyphenation/languages.js +75 -0
- package/dist/hyphenation/languages.js.map +1 -0
- package/dist/hyphenation/patterns/af.wasm +0 -0
- package/dist/hyphenation/patterns/as.wasm +0 -0
- package/dist/hyphenation/patterns/be.wasm +0 -0
- package/dist/hyphenation/patterns/bg.wasm +0 -0
- package/dist/hyphenation/patterns/bn.wasm +0 -0
- package/dist/hyphenation/patterns/ca.wasm +0 -0
- package/dist/hyphenation/patterns/cy.wasm +0 -0
- package/dist/hyphenation/patterns/da.wasm +0 -0
- package/dist/hyphenation/patterns/de.wasm +0 -0
- package/dist/hyphenation/patterns/el-monoton.wasm +0 -0
- package/dist/hyphenation/patterns/el-polyton.wasm +0 -0
- package/dist/hyphenation/patterns/en-gb.wasm +0 -0
- package/dist/hyphenation/patterns/en-us.wasm +0 -0
- package/dist/hyphenation/patterns/eo.wasm +0 -0
- package/dist/hyphenation/patterns/es.wasm +0 -0
- package/dist/hyphenation/patterns/et.wasm +0 -0
- package/dist/hyphenation/patterns/eu.wasm +0 -0
- package/dist/hyphenation/patterns/fi-x-school.wasm +0 -0
- package/dist/hyphenation/patterns/fr.wasm +0 -0
- package/dist/hyphenation/patterns/fur.wasm +0 -0
- package/dist/hyphenation/patterns/ga.wasm +0 -0
- package/dist/hyphenation/patterns/gl.wasm +0 -0
- package/dist/hyphenation/patterns/gu.wasm +0 -0
- package/dist/hyphenation/patterns/hi.wasm +0 -0
- package/dist/hyphenation/patterns/hr.wasm +0 -0
- package/dist/hyphenation/patterns/hsb.wasm +0 -0
- package/dist/hyphenation/patterns/ia.wasm +0 -0
- package/dist/hyphenation/patterns/is.wasm +0 -0
- package/dist/hyphenation/patterns/it.wasm +0 -0
- package/dist/hyphenation/patterns/ka.wasm +0 -0
- package/dist/hyphenation/patterns/kmr.wasm +0 -0
- package/dist/hyphenation/patterns/kn.wasm +0 -0
- package/dist/hyphenation/patterns/la.wasm +0 -0
- package/dist/hyphenation/patterns/lt.wasm +0 -0
- package/dist/hyphenation/patterns/ml.wasm +0 -0
- package/dist/hyphenation/patterns/mn-cyrl.wasm +0 -0
- package/dist/hyphenation/patterns/mr.wasm +0 -0
- package/dist/hyphenation/patterns/nb.wasm +0 -0
- package/dist/hyphenation/patterns/nl.wasm +0 -0
- package/dist/hyphenation/patterns/nn.wasm +0 -0
- package/dist/hyphenation/patterns/no.wasm +0 -0
- package/dist/hyphenation/patterns/oc.wasm +0 -0
- package/dist/hyphenation/patterns/or.wasm +0 -0
- package/dist/hyphenation/patterns/pa.wasm +0 -0
- package/dist/hyphenation/patterns/pi.wasm +0 -0
- package/dist/hyphenation/patterns/pl.wasm +0 -0
- package/dist/hyphenation/patterns/pms.wasm +0 -0
- package/dist/hyphenation/patterns/pt.wasm +0 -0
- package/dist/hyphenation/patterns/rm.wasm +0 -0
- package/dist/hyphenation/patterns/ru.wasm +0 -0
- package/dist/hyphenation/patterns/sh-cyrl.wasm +0 -0
- package/dist/hyphenation/patterns/sh-latn.wasm +0 -0
- package/dist/hyphenation/patterns/sk.wasm +0 -0
- package/dist/hyphenation/patterns/sl.wasm +0 -0
- package/dist/hyphenation/patterns/sq.wasm +0 -0
- package/dist/hyphenation/patterns/sv.wasm +0 -0
- package/dist/hyphenation/patterns/ta.wasm +0 -0
- package/dist/hyphenation/patterns/te.wasm +0 -0
- package/dist/hyphenation/patterns/th.wasm +0 -0
- package/dist/hyphenation/patterns/tk.wasm +0 -0
- package/dist/hyphenation/patterns/tr.wasm +0 -0
- package/dist/hyphenation/patterns/uk.wasm +0 -0
- package/dist/hyphenation/patterns/zh-latn-pinyin.wasm +0 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/indexes/index.d.ts +10 -0
- package/dist/indexes/index.js +11 -0
- package/dist/indexes/index.js.map +1 -0
- package/dist/indexes/layout.d.ts +30 -0
- package/dist/indexes/layout.js +83 -0
- package/dist/indexes/layout.js.map +1 -0
- package/dist/indexes/locators.d.ts +33 -0
- package/dist/indexes/locators.js +51 -0
- package/dist/indexes/locators.js.map +1 -0
- package/dist/indexes/terms.d.ts +97 -0
- package/dist/indexes/terms.js +211 -0
- package/dist/indexes/terms.js.map +1 -0
- package/dist/indexes/transform.d.ts +90 -0
- package/dist/indexes/transform.js +154 -0
- package/dist/indexes/transform.js.map +1 -0
- package/dist/layout/calibrate.d.ts +12 -0
- package/dist/layout/calibrate.js +50 -0
- package/dist/layout/calibrate.js.map +1 -0
- package/dist/layout/converge.d.ts +31 -0
- package/dist/layout/converge.js +84 -0
- package/dist/layout/converge.js.map +1 -0
- package/dist/layout/counters.d.ts +16 -0
- package/dist/layout/counters.js +62 -0
- package/dist/layout/counters.js.map +1 -0
- package/dist/layout/first-letter.d.ts +34 -0
- package/dist/layout/first-letter.js +183 -0
- package/dist/layout/first-letter.js.map +1 -0
- package/dist/layout/fonts.d.ts +67 -0
- package/dist/layout/fonts.js +110 -0
- package/dist/layout/fonts.js.map +1 -0
- package/dist/layout/generated.d.ts +9 -0
- package/dist/layout/generated.js +83 -0
- package/dist/layout/generated.js.map +1 -0
- package/dist/layout/glue.d.ts +18 -0
- package/dist/layout/glue.js +48 -0
- package/dist/layout/glue.js.map +1 -0
- package/dist/layout/index.d.ts +17 -0
- package/dist/layout/index.js +18 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/lists.d.ts +91 -0
- package/dist/layout/lists.js +1068 -0
- package/dist/layout/lists.js.map +1 -0
- package/dist/layout/margin-boxes.d.ts +114 -0
- package/dist/layout/margin-boxes.js +429 -0
- package/dist/layout/margin-boxes.js.map +1 -0
- package/dist/layout/minipage.d.ts +85 -0
- package/dist/layout/minipage.js +83 -0
- package/dist/layout/minipage.js.map +1 -0
- package/dist/layout/page-box.d.ts +32 -0
- package/dist/layout/page-box.js +110 -0
- package/dist/layout/page-box.js.map +1 -0
- package/dist/layout/page-rules.d.ts +47 -0
- package/dist/layout/page-rules.js +202 -0
- package/dist/layout/page-rules.js.map +1 -0
- package/dist/layout/page.d.ts +51 -0
- package/dist/layout/page.js +133 -0
- package/dist/layout/page.js.map +1 -0
- package/dist/layout/pagebuilder.d.ts +243 -0
- package/dist/layout/pagebuilder.js +591 -0
- package/dist/layout/pagebuilder.js.map +1 -0
- package/dist/layout/pages.d.ts +71 -0
- package/dist/layout/pages.js +741 -0
- package/dist/layout/pages.js.map +1 -0
- package/dist/layout/paragraph.d.ts +194 -0
- package/dist/layout/paragraph.js +1148 -0
- package/dist/layout/paragraph.js.map +1 -0
- package/dist/layout/pre.d.ts +8 -0
- package/dist/layout/pre.js +151 -0
- package/dist/layout/pre.js.map +1 -0
- package/dist/layout/region.d.ts +66 -0
- package/dist/layout/region.js +200 -0
- package/dist/layout/region.js.map +1 -0
- package/dist/layout/vlist.d.ts +218 -0
- package/dist/layout/vlist.js +72 -0
- package/dist/layout/vlist.js.map +1 -0
- package/dist/linebreak/items.d.ts +69 -0
- package/dist/linebreak/items.js +44 -0
- package/dist/linebreak/items.js.map +1 -0
- package/dist/linebreak/knuth-plass.d.ts +149 -0
- package/dist/linebreak/knuth-plass.js +461 -0
- package/dist/linebreak/knuth-plass.js.map +1 -0
- package/dist/lint/config.d.ts +48 -0
- package/dist/lint/config.js +185 -0
- package/dist/lint/config.js.map +1 -0
- package/dist/lint/context.d.ts +64 -0
- package/dist/lint/context.js +37 -0
- package/dist/lint/context.js.map +1 -0
- package/dist/lint/fix.d.ts +40 -0
- package/dist/lint/fix.js +86 -0
- package/dist/lint/fix.js.map +1 -0
- package/dist/lint/index.d.ts +14 -0
- package/dist/lint/index.js +15 -0
- package/dist/lint/index.js.map +1 -0
- package/dist/lint/linter.d.ts +59 -0
- package/dist/lint/linter.js +239 -0
- package/dist/lint/linter.js.map +1 -0
- package/dist/lint/presets.d.ts +20 -0
- package/dist/lint/presets.js +65 -0
- package/dist/lint/presets.js.map +1 -0
- package/dist/lint/project.d.ts +31 -0
- package/dist/lint/project.js +100 -0
- package/dist/lint/project.js.map +1 -0
- package/dist/lint/rules/html.d.ts +30 -0
- package/dist/lint/rules/html.js +163 -0
- package/dist/lint/rules/html.js.map +1 -0
- package/dist/lint/rules/layout.d.ts +42 -0
- package/dist/lint/rules/layout.js +428 -0
- package/dist/lint/rules/layout.js.map +1 -0
- package/dist/lint/rules/source.d.ts +65 -0
- package/dist/lint/rules/source.js +334 -0
- package/dist/lint/rules/source.js.map +1 -0
- package/dist/lint/testing.d.ts +7 -0
- package/dist/lint/testing.js +77 -0
- package/dist/lint/testing.js.map +1 -0
- package/dist/math/hast.d.ts +46 -0
- package/dist/math/hast.js +297 -0
- package/dist/math/hast.js.map +1 -0
- package/dist/math/index.d.ts +9 -0
- package/dist/math/index.js +10 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/mathjax/LICENSE-mathjax +202 -0
- package/dist/math/mathjax/LICENSE-speech-rule-engine +177 -0
- package/dist/math/mathjax/sre/af.json +146 -0
- package/dist/math/mathjax/sre/base.json +140 -0
- package/dist/math/mathjax/sre/ca.json +140 -0
- package/dist/math/mathjax/sre/da.json +140 -0
- package/dist/math/mathjax/sre/de.json +146 -0
- package/dist/math/mathjax/sre/en.json +158 -0
- package/dist/math/mathjax/sre/es.json +140 -0
- package/dist/math/mathjax/sre/euro.json +32 -0
- package/dist/math/mathjax/sre/fr.json +146 -0
- package/dist/math/mathjax/sre/hi.json +146 -0
- package/dist/math/mathjax/sre/it.json +146 -0
- package/dist/math/mathjax/sre/ko.json +146 -0
- package/dist/math/mathjax/sre/nb.json +146 -0
- package/dist/math/mathjax/sre/nemeth.json +125 -0
- package/dist/math/mathjax/sre/nn.json +146 -0
- package/dist/math/mathjax/sre/sv.json +146 -0
- package/dist/math/mathjax/svg/PUA.json +1 -0
- package/dist/math/mathjax/svg/accents-b-i.json +1 -0
- package/dist/math/mathjax/svg/accents.json +1 -0
- package/dist/math/mathjax/svg/arabic.json +1 -0
- package/dist/math/mathjax/svg/arrows.json +1 -0
- package/dist/math/mathjax/svg/braille-d.json +1 -0
- package/dist/math/mathjax/svg/braille.json +1 -0
- package/dist/math/mathjax/svg/calligraphic.json +1 -0
- package/dist/math/mathjax/svg/cherokee.json +1 -0
- package/dist/math/mathjax/svg/cyrillic-ss.json +1 -0
- package/dist/math/mathjax/svg/cyrillic.json +1 -0
- package/dist/math/mathjax/svg/devanagari.json +1 -0
- package/dist/math/mathjax/svg/double-struck.json +1 -0
- package/dist/math/mathjax/svg/fraktur.json +1 -0
- package/dist/math/mathjax/svg/greek-ss.json +1 -0
- package/dist/math/mathjax/svg/greek.json +1 -0
- package/dist/math/mathjax/svg/hebrew.json +1 -0
- package/dist/math/mathjax/svg/latin-b.json +1 -0
- package/dist/math/mathjax/svg/latin-bi.json +1 -0
- package/dist/math/mathjax/svg/latin-i.json +1 -0
- package/dist/math/mathjax/svg/latin.json +1 -0
- package/dist/math/mathjax/svg/marrows.json +1 -0
- package/dist/math/mathjax/svg/math.json +1 -0
- package/dist/math/mathjax/svg/monospace-ex.json +1 -0
- package/dist/math/mathjax/svg/monospace-l.json +1 -0
- package/dist/math/mathjax/svg/monospace.json +1 -0
- package/dist/math/mathjax/svg/mshapes.json +1 -0
- package/dist/math/mathjax/svg/phonetics-ss.json +1 -0
- package/dist/math/mathjax/svg/phonetics.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-b.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-bi.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-ex.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-i.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-r.json +1 -0
- package/dist/math/mathjax/svg/sans-serif.json +1 -0
- package/dist/math/mathjax/svg/script.json +1 -0
- package/dist/math/mathjax/svg/shapes.json +1 -0
- package/dist/math/mathjax/svg/symbols-b-i.json +1 -0
- package/dist/math/mathjax/svg/symbols.json +1 -0
- package/dist/math/mathjax/svg/variants.json +1 -0
- package/dist/math/mathjax.d.ts +67 -0
- package/dist/math/mathjax.js +162 -0
- package/dist/math/mathjax.js.map +1 -0
- package/dist/math/speech.d.ts +27 -0
- package/dist/math/speech.js +87 -0
- package/dist/math/speech.js.map +1 -0
- package/dist/math/typeset.d.ts +75 -0
- package/dist/math/typeset.js +108 -0
- package/dist/math/typeset.js.map +1 -0
- package/dist/measure/css.d.ts +44 -0
- package/dist/measure/css.js +158 -0
- package/dist/measure/css.js.map +1 -0
- package/dist/measure/index.d.ts +3 -0
- package/dist/measure/index.js +4 -0
- package/dist/measure/index.js.map +1 -0
- package/dist/measure/measurer.d.ts +159 -0
- package/dist/measure/measurer.js +300 -0
- package/dist/measure/measurer.js.map +1 -0
- package/dist/measure/model.d.ts +46 -0
- package/dist/measure/model.js +47 -0
- package/dist/measure/model.js.map +1 -0
- package/dist/output/assets.d.ts +10 -0
- package/dist/output/assets.js +65 -0
- package/dist/output/assets.js.map +1 -0
- package/dist/output/index.d.ts +4 -0
- package/dist/output/index.js +5 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/output.d.ts +103 -0
- package/dist/output/output.js +86 -0
- package/dist/output/output.js.map +1 -0
- package/dist/output/stylesheets.d.ts +45 -0
- package/dist/output/stylesheets.js +50 -0
- package/dist/output/stylesheets.js.map +1 -0
- package/dist/paint/backgrounds.d.ts +56 -0
- package/dist/paint/backgrounds.js +261 -0
- package/dist/paint/backgrounds.js.map +1 -0
- package/dist/paint/blend.d.ts +61 -0
- package/dist/paint/blend.js +157 -0
- package/dist/paint/blend.js.map +1 -0
- package/dist/paint/border-image.d.ts +13 -0
- package/dist/paint/border-image.js +149 -0
- package/dist/paint/border-image.js.map +1 -0
- package/dist/paint/borders.d.ts +47 -0
- package/dist/paint/borders.js +329 -0
- package/dist/paint/borders.js.map +1 -0
- package/dist/paint/canvas.d.ts +52 -0
- package/dist/paint/canvas.js +274 -0
- package/dist/paint/canvas.js.map +1 -0
- package/dist/paint/colours.d.ts +55 -0
- package/dist/paint/colours.js +380 -0
- package/dist/paint/colours.js.map +1 -0
- package/dist/paint/columns.d.ts +11 -0
- package/dist/paint/columns.js +42 -0
- package/dist/paint/columns.js.map +1 -0
- package/dist/paint/context.d.ts +47 -0
- package/dist/paint/context.js +2 -0
- package/dist/paint/context.js.map +1 -0
- package/dist/paint/decoration.d.ts +97 -0
- package/dist/paint/decoration.js +280 -0
- package/dist/paint/decoration.js.map +1 -0
- package/dist/paint/effects.d.ts +64 -0
- package/dist/paint/effects.js +342 -0
- package/dist/paint/effects.js.map +1 -0
- package/dist/paint/emphasis.d.ts +13 -0
- package/dist/paint/emphasis.js +95 -0
- package/dist/paint/emphasis.js.map +1 -0
- package/dist/paint/flatten.d.ts +33 -0
- package/dist/paint/flatten.js +968 -0
- package/dist/paint/flatten.js.map +1 -0
- package/dist/paint/geometry.d.ts +62 -0
- package/dist/paint/geometry.js +170 -0
- package/dist/paint/geometry.js.map +1 -0
- package/dist/paint/gradients.d.ts +31 -0
- package/dist/paint/gradients.js +394 -0
- package/dist/paint/gradients.js.map +1 -0
- package/dist/paint/images.d.ts +17 -0
- package/dist/paint/images.js +80 -0
- package/dist/paint/images.js.map +1 -0
- package/dist/paint/lint.d.ts +46 -0
- package/dist/paint/lint.js +105 -0
- package/dist/paint/lint.js.map +1 -0
- package/dist/paint/overprint.d.ts +13 -0
- package/dist/paint/overprint.js +12 -0
- package/dist/paint/overprint.js.map +1 -0
- package/dist/paint/painter.d.ts +92 -0
- package/dist/paint/painter.js +281 -0
- package/dist/paint/painter.js.map +1 -0
- package/dist/paint/path.d.ts +9 -0
- package/dist/paint/path.js +173 -0
- package/dist/paint/path.js.map +1 -0
- package/dist/paint/raster.d.ts +32 -0
- package/dist/paint/raster.js +180 -0
- package/dist/paint/raster.js.map +1 -0
- package/dist/paint/shadows.d.ts +28 -0
- package/dist/paint/shadows.js +104 -0
- package/dist/paint/shadows.js.map +1 -0
- package/dist/paint/sources.d.ts +13 -0
- package/dist/paint/sources.js +17 -0
- package/dist/paint/sources.js.map +1 -0
- package/dist/paint/stacking.d.ts +75 -0
- package/dist/paint/stacking.js +327 -0
- package/dist/paint/stacking.js.map +1 -0
- package/dist/paint/svg-lint.d.ts +57 -0
- package/dist/paint/svg-lint.js +119 -0
- package/dist/paint/svg-lint.js.map +1 -0
- package/dist/paint/svg.d.ts +95 -0
- package/dist/paint/svg.js +728 -0
- package/dist/paint/svg.js.map +1 -0
- package/dist/paint/tables.d.ts +18 -0
- package/dist/paint/tables.js +178 -0
- package/dist/paint/tables.js.map +1 -0
- package/dist/paint/text-shadow.d.ts +26 -0
- package/dist/paint/text-shadow.js +187 -0
- package/dist/paint/text-shadow.js.map +1 -0
- package/dist/paint/text.d.ts +144 -0
- package/dist/paint/text.js +713 -0
- package/dist/paint/text.js.map +1 -0
- package/dist/paint/values.d.ts +24 -0
- package/dist/paint/values.js +160 -0
- package/dist/paint/values.js.map +1 -0
- package/dist/paint/vertical.d.ts +19 -0
- package/dist/paint/vertical.js +236 -0
- package/dist/paint/vertical.js.map +1 -0
- package/dist/pdf/index.d.ts +6 -0
- package/dist/pdf/index.js +7 -0
- package/dist/pdf/index.js.map +1 -0
- package/dist/pdf/pdfx.d.ts +30 -0
- package/dist/pdf/pdfx.js +18 -0
- package/dist/pdf/pdfx.js.map +1 -0
- package/dist/pdf/structure/index.d.ts +53 -0
- package/dist/pdf/structure/index.js +52 -0
- package/dist/pdf/structure/index.js.map +1 -0
- package/dist/pdf/structure/labels.d.ts +16 -0
- package/dist/pdf/structure/labels.js +45 -0
- package/dist/pdf/structure/labels.js.map +1 -0
- package/dist/pdf/structure/links.d.ts +49 -0
- package/dist/pdf/structure/links.js +136 -0
- package/dist/pdf/structure/links.js.map +1 -0
- package/dist/pdf/structure/tags.d.ts +79 -0
- package/dist/pdf/structure/tags.js +314 -0
- package/dist/pdf/structure/tags.js.map +1 -0
- package/dist/pdf/types.d.ts +534 -0
- package/dist/pdf/types.js +16 -0
- package/dist/pdf/types.js.map +1 -0
- package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +41 -0
- package/dist/pdf/wasm/pulpweaver4_pdf.js +286 -0
- package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
- package/dist/pdf/writer.d.ts +41 -0
- package/dist/pdf/writer.js +78 -0
- package/dist/pdf/writer.js.map +1 -0
- package/dist/plugin/attributes.d.ts +10 -0
- package/dist/plugin/attributes.js +63 -0
- package/dist/plugin/attributes.js.map +1 -0
- package/dist/plugin/define.d.ts +425 -0
- package/dist/plugin/define.js +311 -0
- package/dist/plugin/define.js.map +1 -0
- package/dist/plugin/failure.d.ts +80 -0
- package/dist/plugin/failure.js +97 -0
- package/dist/plugin/failure.js.map +1 -0
- package/dist/plugin/index.d.ts +11 -0
- package/dist/plugin/index.js +12 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/load.d.ts +105 -0
- package/dist/plugin/load.js +197 -0
- package/dist/plugin/load.js.map +1 -0
- package/dist/plugin/register.d.ts +166 -0
- package/dist/plugin/register.js +306 -0
- package/dist/plugin/register.js.map +1 -0
- package/dist/plugin/render.d.ts +4 -0
- package/dist/plugin/render.js +28 -0
- package/dist/plugin/render.js.map +1 -0
- package/dist/preflight/index.d.ts +3 -0
- package/dist/preflight/index.js +4 -0
- package/dist/preflight/index.js.map +1 -0
- package/dist/preflight/pdfx.d.ts +440 -0
- package/dist/preflight/pdfx.js +1779 -0
- package/dist/preflight/pdfx.js.map +1 -0
- package/dist/preflight/reader.d.ts +126 -0
- package/dist/preflight/reader.js +832 -0
- package/dist/preflight/reader.js.map +1 -0
- package/dist/preflight/xmp.d.ts +30 -0
- package/dist/preflight/xmp.js +145 -0
- package/dist/preflight/xmp.js.map +1 -0
- package/dist/print/index.d.ts +2 -0
- package/dist/print/index.js +3 -0
- package/dist/print/index.js.map +1 -0
- package/dist/print/output.d.ts +5 -0
- package/dist/print/output.js +199 -0
- package/dist/print/output.js.map +1 -0
- package/dist/problem.d.ts +142 -0
- package/dist/problem.js +234 -0
- package/dist/problem.js.map +1 -0
- package/dist/profile/index.d.ts +10 -0
- package/dist/profile/index.js +11 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/profile/lint.d.ts +69 -0
- package/dist/profile/lint.js +282 -0
- package/dist/profile/lint.js.map +1 -0
- package/dist/profile/metadata.d.ts +27 -0
- package/dist/profile/metadata.js +38 -0
- package/dist/profile/metadata.js.map +1 -0
- package/dist/profile/profile.d.ts +92 -0
- package/dist/profile/profile.js +282 -0
- package/dist/profile/profile.js.map +1 -0
- package/dist/project.d.ts +56 -0
- package/dist/project.js +137 -0
- package/dist/project.js.map +1 -0
- package/dist/reproducible/clock.d.ts +46 -0
- package/dist/reproducible/clock.js +173 -0
- package/dist/reproducible/clock.js.map +1 -0
- package/dist/reproducible/date.d.ts +42 -0
- package/dist/reproducible/date.js +82 -0
- package/dist/reproducible/date.js.map +1 -0
- package/dist/reproducible/index.d.ts +8 -0
- package/dist/reproducible/index.js +9 -0
- package/dist/reproducible/index.js.map +1 -0
- package/dist/spike/spike-page.chromium.json +330 -0
- package/dist/spike/spike.d.ts +75 -0
- package/dist/spike/spike.js +106 -0
- package/dist/spike/spike.js.map +1 -0
- package/dist/style/borders.d.ts +25 -0
- package/dist/style/borders.js +177 -0
- package/dist/style/borders.js.map +1 -0
- package/dist/style/colours.d.ts +34 -0
- package/dist/style/colours.js +138 -0
- package/dist/style/colours.js.map +1 -0
- package/dist/style/compile.d.ts +79 -0
- package/dist/style/compile.js +325 -0
- package/dist/style/compile.js.map +1 -0
- package/dist/style/defaults.d.ts +20 -0
- package/dist/style/defaults.js +45 -0
- package/dist/style/defaults.js.map +1 -0
- package/dist/style/gcpm.d.ts +22 -0
- package/dist/style/gcpm.js +86 -0
- package/dist/style/gcpm.js.map +1 -0
- package/dist/style/index.d.ts +4 -0
- package/dist/style/index.js +5 -0
- package/dist/style/index.js.map +1 -0
- package/dist/style/media.d.ts +22 -0
- package/dist/style/media.js +342 -0
- package/dist/style/media.js.map +1 -0
- package/dist/style/properties.d.ts +44 -0
- package/dist/style/properties.js +497 -0
- package/dist/style/properties.js.map +1 -0
- package/dist/style/scope.d.ts +6 -0
- package/dist/style/scope.js +134 -0
- package/dist/style/scope.js.map +1 -0
- package/dist/style/values.d.ts +45 -0
- package/dist/style/values.js +106 -0
- package/dist/style/values.js.map +1 -0
- package/dist/test/book.d.ts +180 -0
- package/dist/test/book.js +314 -0
- package/dist/test/book.js.map +1 -0
- package/dist/test/build.d.ts +58 -0
- package/dist/test/build.js +222 -0
- package/dist/test/build.js.map +1 -0
- package/dist/test/environment.d.ts +63 -0
- package/dist/test/environment.js +46 -0
- package/dist/test/environment.js.map +1 -0
- package/dist/test/index.d.ts +17 -0
- package/dist/test/index.js +18 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/indexes.d.ts +4 -0
- package/dist/test/indexes.js +48 -0
- package/dist/test/indexes.js.map +1 -0
- package/dist/test/layout.d.ts +8 -0
- package/dist/test/layout.js +120 -0
- package/dist/test/layout.js.map +1 -0
- package/dist/test/matchers.d.ts +80 -0
- package/dist/test/matchers.js +177 -0
- package/dist/test/matchers.js.map +1 -0
- package/dist/test/pipeline.d.ts +228 -0
- package/dist/test/pipeline.js +73 -0
- package/dist/test/pipeline.js.map +1 -0
- package/dist/test/plugins.d.ts +13 -0
- package/dist/test/plugins.js +22 -0
- package/dist/test/plugins.js.map +1 -0
- package/dist/test/render.d.ts +46 -0
- package/dist/test/render.js +149 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/runner.d.ts +61 -0
- package/dist/test/runner.js +256 -0
- package/dist/test/runner.js.map +1 -0
- package/dist/test/select.d.ts +54 -0
- package/dist/test/select.js +193 -0
- package/dist/test/select.js.map +1 -0
- package/dist/test/snapshot.d.ts +52 -0
- package/dist/test/snapshot.js +175 -0
- package/dist/test/snapshot.js.map +1 -0
- package/dist/test/text.d.ts +7 -0
- package/dist/test/text.js +46 -0
- package/dist/test/text.js.map +1 -0
- package/dist/test/vitest.d.ts +3 -0
- package/dist/test/vitest.js +39 -0
- package/dist/test/vitest.js.map +1 -0
- package/dist/text/index.d.ts +5 -0
- package/dist/text/index.js +6 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/output.d.ts +5 -0
- package/dist/text/output.js +39 -0
- package/dist/text/output.js.map +1 -0
- package/dist/text/render.d.ts +82 -0
- package/dist/text/render.js +583 -0
- package/dist/text/render.js.map +1 -0
- package/dist/text/width.d.ts +16 -0
- package/dist/text/width.js +90 -0
- package/dist/text/width.js.map +1 -0
- package/dist/text/wrap.d.ts +19 -0
- package/dist/text/wrap.js +151 -0
- package/dist/text/wrap.js.map +1 -0
- package/dist/transform/core.d.ts +19 -0
- package/dist/transform/core.js +22 -0
- package/dist/transform/core.js.map +1 -0
- package/dist/transform/index.d.ts +10 -0
- package/dist/transform/index.js +11 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/numbering.d.ts +47 -0
- package/dist/transform/numbering.js +142 -0
- package/dist/transform/numbering.js.map +1 -0
- package/dist/transform/references.d.ts +38 -0
- package/dist/transform/references.js +182 -0
- package/dist/transform/references.js.map +1 -0
- package/dist/transform/run.d.ts +32 -0
- package/dist/transform/run.js +210 -0
- package/dist/transform/run.js.map +1 -0
- package/dist/transform/store.d.ts +111 -0
- package/dist/transform/store.js +331 -0
- package/dist/transform/store.js.map +1 -0
- package/dist/transform/testing.d.ts +31 -0
- package/dist/transform/testing.js +76 -0
- package/dist/transform/testing.js.map +1 -0
- package/dist/transform/transform.d.ts +104 -0
- package/dist/transform/transform.js +89 -0
- package/dist/transform/transform.js.map +1 -0
- package/dist/vfs/fsa.d.ts +14 -0
- package/dist/vfs/fsa.js +123 -0
- package/dist/vfs/fsa.js.map +1 -0
- package/dist/vfs/index.d.ts +7 -0
- package/dist/vfs/index.js +8 -0
- package/dist/vfs/index.js.map +1 -0
- package/dist/vfs/memory.d.ts +15 -0
- package/dist/vfs/memory.js +101 -0
- package/dist/vfs/memory.js.map +1 -0
- package/dist/vfs/path.d.ts +30 -0
- package/dist/vfs/path.js +67 -0
- package/dist/vfs/path.js.map +1 -0
- package/dist/vfs/vfs.d.ts +66 -0
- package/dist/vfs/vfs.js +68 -0
- package/dist/vfs/vfs.js.map +1 -0
- package/dist/vfs/zip.d.ts +27 -0
- package/dist/vfs/zip.js +67 -0
- package/dist/vfs/zip.js.map +1 -0
- package/dist/web/css.d.ts +15 -0
- package/dist/web/css.js +80 -0
- package/dist/web/css.js.map +1 -0
- package/dist/web/hast.d.ts +44 -0
- package/dist/web/hast.js +175 -0
- package/dist/web/hast.js.map +1 -0
- package/dist/web/index.d.ts +11 -0
- package/dist/web/index.js +12 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/justify-main.d.ts +1 -0
- package/dist/web/justify-main.js +38 -0
- package/dist/web/justify-main.js.map +1 -0
- package/dist/web/justify.d.ts +46 -0
- package/dist/web/justify.js +147 -0
- package/dist/web/justify.js.map +1 -0
- package/dist/web/output.d.ts +28 -0
- package/dist/web/output.js +251 -0
- package/dist/web/output.js.map +1 -0
- package/dist/web/runtime/LICENSE-harfbuzzjs.txt +19 -0
- package/dist/web/runtime/NOTICE-patterns.txt +429 -0
- package/dist/web/runtime/harfbuzz.wasm +0 -0
- package/dist/web/runtime/justify.js.txt +2 -0
- package/dist/web/site.d.ts +53 -0
- package/dist/web/site.js +219 -0
- package/dist/web/site.js.map +1 -0
- package/docs/README.md +16 -0
- package/docs/reference/css-properties/index.md +94 -0
- package/docs/reference/css-properties/pw-adj-demerits.md +22 -0
- package/docs/reference/css-properties/pw-border-bottom-width.md +24 -0
- package/docs/reference/css-properties/pw-border-left-width.md +24 -0
- package/docs/reference/css-properties/pw-border-right-width.md +24 -0
- package/docs/reference/css-properties/pw-border-top-width.md +24 -0
- package/docs/reference/css-properties/pw-box.md +28 -0
- package/docs/reference/css-properties/pw-broken-penalty.md +22 -0
- package/docs/reference/css-properties/pw-club-penalty.md +24 -0
- package/docs/reference/css-properties/pw-column-rule-width.md +23 -0
- package/docs/reference/css-properties/pw-content-after.md +31 -0
- package/docs/reference/css-properties/pw-content-before.md +31 -0
- package/docs/reference/css-properties/pw-double-hyphen-demerits.md +23 -0
- package/docs/reference/css-properties/pw-emergency-stretch.md +28 -0
- package/docs/reference/css-properties/pw-ex-hyphen-penalty.md +22 -0
- package/docs/reference/css-properties/pw-final-hyphen-demerits.md +22 -0
- package/docs/reference/css-properties/pw-float-skip.md +22 -0
- package/docs/reference/css-properties/pw-float.md +33 -0
- package/docs/reference/css-properties/pw-footnote-max-height.md +22 -0
- package/docs/reference/css-properties/pw-footnote-skip.md +23 -0
- package/docs/reference/css-properties/pw-hyphen-penalty.md +24 -0
- package/docs/reference/css-properties/pw-inter-line-penalty.md +24 -0
- package/docs/reference/css-properties/pw-leader-space.md +22 -0
- package/docs/reference/css-properties/pw-leader.md +29 -0
- package/docs/reference/css-properties/pw-left-hyphen-min.md +23 -0
- package/docs/reference/css-properties/pw-line-breaking.md +29 -0
- package/docs/reference/css-properties/pw-line-penalty.md +23 -0
- package/docs/reference/css-properties/pw-list-indent.md +18 -0
- package/docs/reference/css-properties/pw-looseness.md +30 -0
- package/docs/reference/css-properties/pw-max-depth.md +22 -0
- package/docs/reference/css-properties/pw-minipage-footnotes.md +23 -0
- package/docs/reference/css-properties/pw-orphans.md +24 -0
- package/docs/reference/css-properties/pw-outline-width.md +23 -0
- package/docs/reference/css-properties/pw-overprint.md +26 -0
- package/docs/reference/css-properties/pw-padding-bottom.md +22 -0
- package/docs/reference/css-properties/pw-padding-left.md +22 -0
- package/docs/reference/css-properties/pw-padding-right.md +22 -0
- package/docs/reference/css-properties/pw-padding-top.md +22 -0
- package/docs/reference/css-properties/pw-page-prefix.md +28 -0
- package/docs/reference/css-properties/pw-page.md +32 -0
- package/docs/reference/css-properties/pw-penalty-after.md +23 -0
- package/docs/reference/css-properties/pw-penalty-before.md +30 -0
- package/docs/reference/css-properties/pw-pretolerance.md +23 -0
- package/docs/reference/css-properties/pw-right-hyphen-min.md +22 -0
- package/docs/reference/css-properties/pw-running.md +23 -0
- package/docs/reference/css-properties/pw-site-background.md +21 -0
- package/docs/reference/css-properties/pw-site-link.md +17 -0
- package/docs/reference/css-properties/pw-site-measure.md +17 -0
- package/docs/reference/css-properties/pw-site-muted.md +21 -0
- package/docs/reference/css-properties/pw-site-rule.md +17 -0
- package/docs/reference/css-properties/pw-site-text.md +22 -0
- package/docs/reference/css-properties/pw-space-after.md +23 -0
- package/docs/reference/css-properties/pw-space-before.md +29 -0
- package/docs/reference/css-properties/pw-string-set.md +32 -0
- package/docs/reference/css-properties/pw-tolerance.md +33 -0
- package/docs/reference/css-properties/pw-top-skip.md +22 -0
- package/docs/reference/css-properties/pw-widow-penalty.md +32 -0
- package/docs/reference/css-properties/pw-widows.md +24 -0
- package/docs/reference/css-properties/pw-word-space.md +22 -0
- package/docs/reference/css-properties/pw-xspace.md +22 -0
- package/docs/reference/index.md +17 -0
- package/docs/reference/lint-rules/black-text.md +31 -0
- package/docs/reference/lint-rules/blank-page.md +35 -0
- package/docs/reference/lint-rules/chapter-verso.md +34 -0
- package/docs/reference/lint-rules/citation-in-heading.md +24 -0
- package/docs/reference/lint-rules/consecutive-hyphens.md +34 -0
- package/docs/reference/lint-rules/empty-link.md +32 -0
- package/docs/reference/lint-rules/figure-distance.md +34 -0
- package/docs/reference/lint-rules/fonts.md +24 -0
- package/docs/reference/lint-rules/generated-text.md +24 -0
- package/docs/reference/lint-rules/heading-levels.md +30 -0
- package/docs/reference/lint-rules/ibid-across-page.md +30 -0
- package/docs/reference/lint-rules/image-alt.md +30 -0
- package/docs/reference/lint-rules/image-resolution.md +34 -0
- package/docs/reference/lint-rules/index.md +120 -0
- package/docs/reference/lint-rules/ink-limit.md +30 -0
- package/docs/reference/lint-rules/missing-field.md +37 -0
- package/docs/reference/lint-rules/orphan.md +34 -0
- package/docs/reference/lint-rules/overfull-line.md +28 -0
- package/docs/reference/lint-rules/profile.md +24 -0
- package/docs/reference/lint-rules/raw-html.md +30 -0
- package/docs/reference/lint-rules/signature.md +34 -0
- package/docs/reference/lint-rules/straight-quotes.md +33 -0
- package/docs/reference/lint-rules/svg-use-css.md +24 -0
- package/docs/reference/lint-rules/underfull-line.md +35 -0
- package/docs/reference/lint-rules/unknown-citation.md +30 -0
- package/docs/reference/lint-rules/unknown-label.md +31 -0
- package/docs/reference/lint-rules/unpaintable.md +24 -0
- package/docs/reference/lint-rules/unplaced-index.md +31 -0
- package/docs/reference/lint-rules/unused-entry.md +36 -0
- package/docs/reference/lint-rules/widow.md +34 -0
- package/docs/reference/plugin-api/assert-no-errors.md +18 -0
- package/docs/reference/plugin-api/asset-processor.md +28 -0
- package/docs/reference/plugin-api/attribute-problem.md +26 -0
- package/docs/reference/plugin-api/attribute-type.md +18 -0
- package/docs/reference/plugin-api/capabilities.md +18 -0
- package/docs/reference/plugin-api/capability.md +22 -0
- package/docs/reference/plugin-api/check-attributes.md +18 -0
- package/docs/reference/plugin-api/claim-kind.md +20 -0
- package/docs/reference/plugin-api/combine-penalties.md +17 -0
- package/docs/reference/plugin-api/command-context.md +30 -0
- package/docs/reference/plugin-api/command-definition.md +34 -0
- package/docs/reference/plugin-api/core-claims.md +18 -0
- package/docs/reference/plugin-api/define-plugin.md +20 -0
- package/docs/reference/plugin-api/define-rule.md +19 -0
- package/docs/reference/plugin-api/describe-error.md +14 -0
- package/docs/reference/plugin-api/describe-node.md +14 -0
- package/docs/reference/plugin-api/empty-registry.md +18 -0
- package/docs/reference/plugin-api/failed-on.md +32 -0
- package/docs/reference/plugin-api/fails-as.md +18 -0
- package/docs/reference/plugin-api/import-plugins.md +20 -0
- package/docs/reference/plugin-api/import-text.md +14 -0
- package/docs/reference/plugin-api/index.md +123 -0
- package/docs/reference/plugin-api/layout-definition.md +42 -0
- package/docs/reference/plugin-api/layout-slot.md +28 -0
- package/docs/reference/plugin-api/line-breaker.md +18 -0
- package/docs/reference/plugin-api/lint-context.md +48 -0
- package/docs/reference/plugin-api/lint-definition.md +32 -0
- package/docs/reference/plugin-api/lint-edition.md +38 -0
- package/docs/reference/plugin-api/lint-fix.md +36 -0
- package/docs/reference/plugin-api/lint-level.md +20 -0
- package/docs/reference/plugin-api/lint-preset.md +30 -0
- package/docs/reference/plugin-api/lint-rule.md +42 -0
- package/docs/reference/plugin-api/load-failure.md +32 -0
- package/docs/reference/plugin-api/load-plugins-options.md +32 -0
- package/docs/reference/plugin-api/load-plugins.md +20 -0
- package/docs/reference/plugin-api/loaded-plugin.md +32 -0
- package/docs/reference/plugin-api/node-claim.md +34 -0
- package/docs/reference/plugin-api/output-definition.md +28 -0
- package/docs/reference/plugin-api/owned.md +28 -0
- package/docs/reference/plugin-api/page-builder-hook.md +18 -0
- package/docs/reference/plugin-api/penalty-rule.md +34 -0
- package/docs/reference/plugin-api/plugin-api.md +18 -0
- package/docs/reference/plugin-api/plugin-definition.md +66 -0
- package/docs/reference/plugin-api/plugin-error.md +22 -0
- package/docs/reference/plugin-api/plugin-failure.md +30 -0
- package/docs/reference/plugin-api/plugin-importer.md +34 -0
- package/docs/reference/plugin-api/plugin-problem.md +30 -0
- package/docs/reference/plugin-api/plugin-registry.md +83 -0
- package/docs/reference/plugin-api/plugin-scope.md +15 -0
- package/docs/reference/plugin-api/plugin-stage.md +18 -0
- package/docs/reference/plugin-api/plugin-threw-problem.md +34 -0
- package/docs/reference/plugin-api/plugin-threw.md +21 -0
- package/docs/reference/plugin-api/plugin.md +69 -0
- package/docs/reference/plugin-api/project-with-plugins.md +36 -0
- package/docs/reference/plugin-api/read-context.md +30 -0
- package/docs/reference/plugin-api/read-failure.md +18 -0
- package/docs/reference/plugin-api/read-plugin-styles.md +22 -0
- package/docs/reference/plugin-api/reader.md +22 -0
- package/docs/reference/plugin-api/register-options.md +28 -0
- package/docs/reference/plugin-api/register-plugins.md +20 -0
- package/docs/reference/plugin-api/render-format.md +18 -0
- package/docs/reference/plugin-api/render-formats.md +18 -0
- package/docs/reference/plugin-api/renderer-registry.md +18 -0
- package/docs/reference/plugin-api/renderer-set.md +34 -0
- package/docs/reference/plugin-api/renderers.md +34 -0
- package/docs/reference/plugin-api/specifier-kind.md +14 -0
- package/docs/reference/plugin-api/style-source.md +18 -0
- package/docs/reference/plugin-api/text-context.md +28 -0
- package/docs/reference/plugin-api/text-edit.md +28 -0
- package/docs/reference/plugin-api/text-renderer.md +24 -0
- package/docs/reference/plugin-api/try-plugin-async.md +18 -0
- package/docs/reference/plugin-api/try-plugin.md +20 -0
- package/docs/reference/pulpweaver4-toml/editions.md +194 -0
- package/docs/reference/pulpweaver4-toml/index.md +182 -0
- package/docs/reference/pulpweaver4-toml/inks.md +50 -0
- package/docs/reference/pulpweaver4-toml/lint.md +36 -0
- package/docs/reference/test-matchers/index.md +33 -0
- package/docs/reference/test-matchers/to-be-recto.md +20 -0
- package/docs/reference/test-matchers/to-cite.md +22 -0
- package/docs/reference/test-matchers/to-fit-on-one-page.md +20 -0
- package/docs/reference/test-matchers/to-have-no-overfull-lines.md +20 -0
- package/docs/reference/test-matchers/to-match-html-snapshot.md +20 -0
- package/docs/reference/test-matchers/to-match-page-snapshot.md +20 -0
- package/docs/reference/test-matchers/to-match-text-snapshot.md +21 -0
- package/docs/reference/test-matchers/to-start-page.md +20 -0
- package/package.json +75 -4
- package/README.md +0 -3
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The build's stages, as the test API runs them
|
|
3
|
+
* (https://plans.inkylabs.com/pulpweaver#how-a-build-runs): read the
|
|
4
|
+
* sources into the AST, transform it, render it to HTML, lay the HTML out
|
|
5
|
+
* into pages, and look up indexes. `build()` is the stable API over these;
|
|
6
|
+
* each stage is filled by the issue that builds it, and until then the
|
|
7
|
+
* build says which stage is missing rather than faking it:
|
|
8
|
+
*
|
|
9
|
+
* | Stage | Today | Filled by |
|
|
10
|
+
* |---|---|---|
|
|
11
|
+
* | `edition` | the project’s `pulpweaver4.toml` ({@link projectEdition}); a trade page without a project | #17 |
|
|
12
|
+
* | `read` | the sources as Djot, or by the plugin that reads their extension ({@link readStage}) | #14, #44 |
|
|
13
|
+
* | `transform` | the core's transforms and the plugins' ({@link transformStage}) | #18, #44 |
|
|
14
|
+
* | `render` | the AST to HTML, plugins' nodes by their renderers, its math typeset ({@link renderStage}) | #19, HTML; #27, math; #44 |
|
|
15
|
+
* | `layout` | the page builder, its page numbers converged, `@page` and its margin boxes ({@link layoutStage}) | #23, #24 |
|
|
16
|
+
* | `index` | the AST's index terms on the laid-out pages ({@link indexStage}) | #26, indexes |
|
|
17
|
+
* | `text` | the AST as the text edition writes it ({@link textStage}) | #41 |
|
|
18
|
+
* | `plugins` | registers the plugins, in any order ({@link pluginsStage}) | #44, the plugin API |
|
|
19
|
+
*
|
|
20
|
+
* A test can supply any stage itself (`build({ pipeline: { … } })`), which
|
|
21
|
+
* is how the test API is tested before those issues land, and how a plugin
|
|
22
|
+
* author can stub what their plugin doesn't touch.
|
|
23
|
+
*/
|
|
24
|
+
import type { Project } from '../project.js';
|
|
25
|
+
import { type Problem } from '../problem.js';
|
|
26
|
+
import type { FontFaceOptions, FontRegistry } from '../layout/fonts.js';
|
|
27
|
+
import type { PageResolver } from '../layout/converge.js';
|
|
28
|
+
import type { PageGeometry } from '../layout/page.js';
|
|
29
|
+
import type { RawMatcherFn } from '@vitest/expect';
|
|
30
|
+
import type { TreeAdapter } from './select.js';
|
|
31
|
+
import type { Book } from './book.js';
|
|
32
|
+
import type { Position } from '../ast/position.js';
|
|
33
|
+
import type { PluginRegistry } from '../plugin/register.js';
|
|
34
|
+
/** An edition, as far as a build needs it. */
|
|
35
|
+
export interface Edition {
|
|
36
|
+
name: string;
|
|
37
|
+
media: 'print' | 'screen';
|
|
38
|
+
/** A print edition's page, in px: its size, and the margins `@page` rules start from. */
|
|
39
|
+
page?: PageGeometry;
|
|
40
|
+
/** What the edition writes, as its `output` says: `pdf`, `web`, `text` or a plugin's. */
|
|
41
|
+
output?: string;
|
|
42
|
+
/** A text edition's line length, in columns; absent, unwrapped. */
|
|
43
|
+
wrap?: number;
|
|
44
|
+
/** A print edition's bleed, in px, and printer's marks, where `@page` sets none (`pulpweaver4.toml`'s `bleed` and `marks`). */
|
|
45
|
+
bleed?: number;
|
|
46
|
+
marks?: {
|
|
47
|
+
crop: boolean;
|
|
48
|
+
cross: boolean;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** How `book.text()` writes the book. */
|
|
52
|
+
export interface TextOptions {
|
|
53
|
+
/** The line length in columns, or `none`; the edition's by default. */
|
|
54
|
+
wrap?: number | 'none';
|
|
55
|
+
}
|
|
56
|
+
/** A source file, by its path in the project. */
|
|
57
|
+
export interface SourceFile {
|
|
58
|
+
path: string;
|
|
59
|
+
text: string;
|
|
60
|
+
}
|
|
61
|
+
/** A font for the build: its bytes, a file in the project, or a URL. */
|
|
62
|
+
export interface FontSource extends FontFaceOptions {
|
|
63
|
+
family: string;
|
|
64
|
+
data?: ArrayBuffer | Uint8Array;
|
|
65
|
+
path?: string;
|
|
66
|
+
url?: string | URL;
|
|
67
|
+
}
|
|
68
|
+
/** A font as loaded, kept for whatever needs its bytes again (page snapshots embed them). */
|
|
69
|
+
export interface LoadedFont extends FontFaceOptions {
|
|
70
|
+
family: string;
|
|
71
|
+
data: Uint8Array;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* An AST node: the core's AST (`ast/nodes.ts`), read through
|
|
75
|
+
* {@link astAdapter}, or a stub's tree, read through the pipeline's
|
|
76
|
+
* {@link Pipeline.adapter}.
|
|
77
|
+
*/
|
|
78
|
+
export type AstNode = object;
|
|
79
|
+
/** The render stage's result. */
|
|
80
|
+
export interface Rendered {
|
|
81
|
+
/** The document as HTML: one element, in no page yet. */
|
|
82
|
+
html: HTMLElement;
|
|
83
|
+
/** Its stylesheet, for this edition. */
|
|
84
|
+
css: string;
|
|
85
|
+
/** The elements an AST node became, for `pages.of(node)`. */
|
|
86
|
+
elementsOf?(node: AstNode): Element[];
|
|
87
|
+
/** The AST node an element, or a copy of it with its `data-pw-key`, was rendered for. */
|
|
88
|
+
nodeOf?(element: Element): AstNode | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* The source position of an element or a text node of the HTML, a copy
|
|
91
|
+
* or the laid-out pages: the `fonts` rule's `locate`.
|
|
92
|
+
*/
|
|
93
|
+
locate?(node: Element | Text): Position | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* What the layout fills in from the pages, beyond page references, in
|
|
96
|
+
* the converging layout: citations' positions and back references.
|
|
97
|
+
*/
|
|
98
|
+
resolvers?: readonly PageResolver[];
|
|
99
|
+
}
|
|
100
|
+
/** A line as laid out. */
|
|
101
|
+
export interface LaidOutLine {
|
|
102
|
+
text: string;
|
|
103
|
+
/** Its width as set, and the measure it was set to, in px. */
|
|
104
|
+
width: number;
|
|
105
|
+
measure: number;
|
|
106
|
+
/** Its glue set ratio, TeX's (−1 for all its shrink). */
|
|
107
|
+
ratio: number;
|
|
108
|
+
/** Wider than its measure even with all its shrink, by more than TeX's `\hfuzz` (0.1 pt). */
|
|
109
|
+
overfull: boolean;
|
|
110
|
+
/** Its badness, as TeX's `hpack` computes it: 0 for a line set by infinite glue (a paragraph's last). */
|
|
111
|
+
badness?: number;
|
|
112
|
+
/** Whether it ends at a hyphenation point, where the layout adds a hyphen. */
|
|
113
|
+
hyphenated?: boolean;
|
|
114
|
+
element?: HTMLElement;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* A page as laid out. Which source elements it holds comes from its
|
|
118
|
+
* element: the build marks each element of the rendered HTML with
|
|
119
|
+
* `data-pw-key`, and a layout keeps the attribute on what it places (and on
|
|
120
|
+
* clones of it, as a paragraph split across pages is), and lists in
|
|
121
|
+
* `data-pw-in` the keys of the ancestors it took a block out of. A page
|
|
122
|
+
* with no element, as in a hand-built model, lists its keys itself.
|
|
123
|
+
*/
|
|
124
|
+
export interface LaidOutPage {
|
|
125
|
+
element?: HTMLElement;
|
|
126
|
+
/** Its label as the book prints it (`vii`, `12`), if not its number. */
|
|
127
|
+
label?: string;
|
|
128
|
+
/** A page left blank, as before a chapter that must open on a recto. */
|
|
129
|
+
blank?: boolean;
|
|
130
|
+
lines: LaidOutLine[];
|
|
131
|
+
/** The keys of the elements on the page, if it has no element to find them in. */
|
|
132
|
+
keys?: readonly string[];
|
|
133
|
+
/** The keys of the page's first block and its ancestors, likewise. */
|
|
134
|
+
firstKeys?: readonly string[];
|
|
135
|
+
}
|
|
136
|
+
export interface LaidOut {
|
|
137
|
+
pages: LaidOutPage[];
|
|
138
|
+
/** What the layout warns of: page numbers that didn't settle. */
|
|
139
|
+
problems?: Problem[];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* An index as the index stage gives it: each entry's term (its levels
|
|
143
|
+
* joined by `!`: `parachurch!revenues`) and the pages it lists, every page
|
|
144
|
+
* of a range among them; the locators as printed (a page is a range whose
|
|
145
|
+
* first and last are the same); and its cross-references, as terms.
|
|
146
|
+
*/
|
|
147
|
+
export interface IndexData {
|
|
148
|
+
entries: {
|
|
149
|
+
term: string;
|
|
150
|
+
pages: number[];
|
|
151
|
+
ranges?: {
|
|
152
|
+
first: number;
|
|
153
|
+
last: number;
|
|
154
|
+
}[];
|
|
155
|
+
see?: string[];
|
|
156
|
+
seeAlso?: string[];
|
|
157
|
+
}[];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* A plugin, as far as the test API needs one: its name and the matchers it
|
|
161
|
+
* adds. The plugin API's `definePlugin` returns a superset of this, and the
|
|
162
|
+
* default plugins stage takes nothing less.
|
|
163
|
+
*/
|
|
164
|
+
export interface TestPlugin {
|
|
165
|
+
readonly name: string;
|
|
166
|
+
readonly api?: number;
|
|
167
|
+
readonly matchers?: Readonly<Record<string, RawMatcherFn>>;
|
|
168
|
+
}
|
|
169
|
+
/** What every stage after `edition` is given. */
|
|
170
|
+
export interface BuildContext {
|
|
171
|
+
readonly edition: Edition;
|
|
172
|
+
readonly project: Project | undefined;
|
|
173
|
+
readonly sources: readonly SourceFile[];
|
|
174
|
+
readonly plugins: readonly TestPlugin[];
|
|
175
|
+
/** What the plugins contribute, combined: the plugins stage's registry, or none. */
|
|
176
|
+
readonly registry: PluginRegistry;
|
|
177
|
+
/** The fonts, registered with the measurer and the page. */
|
|
178
|
+
readonly fonts: FontRegistry;
|
|
179
|
+
/** An element in the document for the build's pages, which it may fill. */
|
|
180
|
+
readonly container: HTMLElement;
|
|
181
|
+
/**
|
|
182
|
+
* Where a stage reports what it finds wrong. A stage goes on after a
|
|
183
|
+
* problem, leaving out what it couldn't make, so the build lists every
|
|
184
|
+
* problem at once (https://plans.inkylabs.com/pulpweaver#when-it-fails).
|
|
185
|
+
*/
|
|
186
|
+
readonly problems: Problem[];
|
|
187
|
+
}
|
|
188
|
+
export interface Pipeline {
|
|
189
|
+
/** The named edition's settings. */
|
|
190
|
+
edition?(name: string, project: Project | undefined): Edition | Promise<Edition>;
|
|
191
|
+
/** The sources into the AST's root. */
|
|
192
|
+
read?(ctx: BuildContext): AstNode | Promise<AstNode>;
|
|
193
|
+
/** The AST through the transform phases. */
|
|
194
|
+
transform?(ast: AstNode, ctx: BuildContext): AstNode | Promise<AstNode>;
|
|
195
|
+
/** The AST to HTML for the edition. */
|
|
196
|
+
render?(ast: AstNode, ctx: BuildContext): Rendered | Promise<Rendered>;
|
|
197
|
+
/** The HTML into pages. `rendered.html` is in `ctx.container`, styled, when this runs. */
|
|
198
|
+
layout?(rendered: Rendered, ctx: BuildContext): LaidOut | Promise<LaidOut>;
|
|
199
|
+
/** The named index (`scripture`, `subject`) of a laid-out book. */
|
|
200
|
+
index?(name: string, book: Book): IndexData;
|
|
201
|
+
/** The AST, transformed, as plain text: the text edition's file. */
|
|
202
|
+
text?(ast: AstNode, ctx: BuildContext, options: TextOptions): string | Promise<string>;
|
|
203
|
+
/** This pipeline with the plugins registered, with their {@link registry} if it makes one. */
|
|
204
|
+
plugins?(plugins: readonly TestPlugin[], pipeline: Pipeline): Pipeline;
|
|
205
|
+
/** The plugins' registry, which the build gives every stage as `ctx.registry`. */
|
|
206
|
+
registry?: PluginRegistry;
|
|
207
|
+
/** What registering the plugins found wrong, which the build lists with the rest. */
|
|
208
|
+
problems?: readonly Problem[];
|
|
209
|
+
/** How selectors read the AST's nodes; the core's AST's way if absent. */
|
|
210
|
+
adapter?: TreeAdapter<AstNode>;
|
|
211
|
+
}
|
|
212
|
+
/** A trade page, 5.5 × 8.5 in, in px: a build’s page when it has no project, and its margins every page’s where `@page` sets none. */
|
|
213
|
+
export declare const TRADE_PAGE: PageGeometry;
|
|
214
|
+
/** What builds run when a test supplies nothing else: what exists of the core's pipeline. */
|
|
215
|
+
export declare const defaultPipeline: Pipeline;
|
|
216
|
+
/**
|
|
217
|
+
* The named edition, as the project’s `pulpweaver4.toml` gives it, or a
|
|
218
|
+
* trade page for a build with no project. A configuration with errors, or
|
|
219
|
+
* an edition it doesn’t name, stops the build with the problems.
|
|
220
|
+
*/
|
|
221
|
+
export declare function projectEdition(name: string, project: Project | undefined): Edition;
|
|
222
|
+
/** The name of the edition a build with no `edition` builds: the project’s first PDF edition, or its first. */
|
|
223
|
+
export declare function defaultEditionName(project: Project | undefined): string;
|
|
224
|
+
/** A build needed a stage its pipeline doesn't have. */
|
|
225
|
+
export declare class MissingStageError extends Error {
|
|
226
|
+
readonly stage: string;
|
|
227
|
+
constructor(stage: string, hint?: string);
|
|
228
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { didYouMean, formatProblems } from '../problem.js';
|
|
2
|
+
import { indexStage } from './indexes.js';
|
|
3
|
+
import { layoutStage } from './layout.js';
|
|
4
|
+
import { readStage, renderStage, transformStage } from './render.js';
|
|
5
|
+
import { pluginsStage } from './plugins.js';
|
|
6
|
+
import { textStage } from './text.js';
|
|
7
|
+
/** A trade page, 5.5 × 8.5 in, in px: a build’s page when it has no project, and its margins every page’s where `@page` sets none. */
|
|
8
|
+
export const TRADE_PAGE = {
|
|
9
|
+
width: 528,
|
|
10
|
+
height: 816,
|
|
11
|
+
margin: { top: 72, right: 56, bottom: 80, left: 56 },
|
|
12
|
+
};
|
|
13
|
+
/** What builds run when a test supplies nothing else: what exists of the core's pipeline. */
|
|
14
|
+
export const defaultPipeline = {
|
|
15
|
+
edition: projectEdition,
|
|
16
|
+
read: readStage,
|
|
17
|
+
transform: transformStage,
|
|
18
|
+
render: renderStage,
|
|
19
|
+
layout: layoutStage,
|
|
20
|
+
text: textStage,
|
|
21
|
+
plugins: pluginsStage,
|
|
22
|
+
index: indexStage,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The named edition, as the project’s `pulpweaver4.toml` gives it, or a
|
|
26
|
+
* trade page for a build with no project. A configuration with errors, or
|
|
27
|
+
* an edition it doesn’t name, stops the build with the problems.
|
|
28
|
+
*/
|
|
29
|
+
export function projectEdition(name, project) {
|
|
30
|
+
if (!project)
|
|
31
|
+
return { name, media: 'print', page: TRADE_PAGE };
|
|
32
|
+
const { config } = project;
|
|
33
|
+
if (!config)
|
|
34
|
+
throw new Error(`pulpweaver4.toml has problems:\n${formatProblems(project.problems, project.configText)}`);
|
|
35
|
+
const edition = config.editions[name];
|
|
36
|
+
if (!edition) {
|
|
37
|
+
const names = Object.keys(config.editions);
|
|
38
|
+
const near = didYouMean(name, names);
|
|
39
|
+
throw new Error(`pulpweaver4.toml has no edition ${JSON.stringify(name)}: ${near === undefined ? `its editions are ${names.join(', ')}` : `did you mean ${JSON.stringify(near)}?`}`);
|
|
40
|
+
}
|
|
41
|
+
const page = edition.page && { width: edition.page.width / PT_PER_PX, height: edition.page.height / PT_PER_PX, margin: TRADE_PAGE.margin };
|
|
42
|
+
return {
|
|
43
|
+
name, media: edition.media ?? 'screen', output: edition.output,
|
|
44
|
+
...(page ? { page } : {}), ...(edition.wrap !== undefined ? { wrap: edition.wrap } : {}),
|
|
45
|
+
...(edition.bleed ? { bleed: edition.bleed / PT_PER_PX } : {}),
|
|
46
|
+
...(edition.marks.crop || edition.marks.cross ? { marks: { ...edition.marks } } : {}),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** The name of the edition a build with no `edition` builds: the project’s first PDF edition, or its first. */
|
|
50
|
+
export function defaultEditionName(project) {
|
|
51
|
+
const editions = Object.values(project?.config?.editions ?? {});
|
|
52
|
+
return (editions.find((e) => e.output === 'pdf') ?? editions[0])?.name ?? 'print';
|
|
53
|
+
}
|
|
54
|
+
const PT_PER_PX = 0.75;
|
|
55
|
+
/** Which issue builds each stage, for the error a missing one gives. */
|
|
56
|
+
const BUILT_BY = {
|
|
57
|
+
read: 'the Djot reader (#14)',
|
|
58
|
+
render: 'the HTML renderer (#19)',
|
|
59
|
+
layout: 'the page builder (#23)',
|
|
60
|
+
index: 'indexes (#26)',
|
|
61
|
+
text: 'the text edition (#41)',
|
|
62
|
+
};
|
|
63
|
+
/** A build needed a stage its pipeline doesn't have. */
|
|
64
|
+
export class MissingStageError extends Error {
|
|
65
|
+
stage;
|
|
66
|
+
constructor(stage, hint = '') {
|
|
67
|
+
super(`the build has no ${stage} stage yet: that is ${BUILT_BY[stage] ?? 'a later issue'}` +
|
|
68
|
+
`${hint ? `; ${hint}` : ''}. A test can supply it: build({ pipeline: { ${stage}() { … } } })`);
|
|
69
|
+
this.stage = stage;
|
|
70
|
+
this.name = 'MissingStageError';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/test/pipeline.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAgB,MAAM,eAAe,CAAA;AAOxE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;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AAC;KACtF,CAAA;AACH,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,kBAAkB,CAAC,OAA4B;IAC7D,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAA;IAC/D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,OAAO,CAAA;AACnF,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,CAAA;AAEtB,wEAAwE;AACxE,MAAM,QAAQ,GAA2B;IACvC,IAAI,EAAE,uBAAuB;IAC7B,MAAM,EAAE,yBAAyB;IACjC,MAAM,EAAE,wBAAwB;IAChC,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,wBAAwB;CAC/B,CAAA;AAED,wDAAwD;AACxD,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACrB,KAAK;IAA1B,YAAqB,KAAa,EAAE,IAAI,GAAG,EAAE;QAC3C,KAAK,CAAC,oBAAoB,KAAK,uBAAuB,QAAQ,CAAC,KAAK,CAAC,IAAI,eAAe,EAAE;YACxF,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,+CAA+C,KAAK,eAAe,CAAC,CAAA;qBAF7E,KAAK;QAGxB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Problem, type Sources } from '../problem.js';
|
|
2
|
+
import type { Pipeline, TestPlugin } from './pipeline.js';
|
|
3
|
+
/** The build has errors: every stage's, printed with their sources. */
|
|
4
|
+
export declare class BuildProblemsError extends Error {
|
|
5
|
+
readonly problems: readonly Problem[];
|
|
6
|
+
/** `stopped` is what a later stage threw, if the build couldn't go on. */
|
|
7
|
+
constructor(problems: readonly Problem[], sources?: Sources, stopped?: unknown);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Registers the plugins, in whatever order they come. A name two claim is
|
|
11
|
+
* neither's, and the problem goes with the build's others.
|
|
12
|
+
*/
|
|
13
|
+
export declare function pluginsStage(plugins: readonly TestPlugin[], pipeline: Pipeline): Pipeline;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { registerPlugins } from '../plugin/register.js';
|
|
2
|
+
import { formatProblems } from '../problem.js';
|
|
3
|
+
/** The build has errors: every stage's, printed with their sources. */
|
|
4
|
+
export class BuildProblemsError extends Error {
|
|
5
|
+
problems;
|
|
6
|
+
/** `stopped` is what a later stage threw, if the build couldn't go on. */
|
|
7
|
+
constructor(problems, sources, stopped) {
|
|
8
|
+
super(`the build has problems:\n${formatProblems(problems, sources)}` +
|
|
9
|
+
(stopped === undefined ? '' : `\n\nand then stopped: ${stopped instanceof Error ? stopped.message : String(stopped)}`), stopped === undefined ? {} : { cause: stopped });
|
|
10
|
+
this.problems = problems;
|
|
11
|
+
this.name = 'BuildProblemsError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Registers the plugins, in whatever order they come. A name two claim is
|
|
16
|
+
* neither's, and the problem goes with the build's others.
|
|
17
|
+
*/
|
|
18
|
+
export function pluginsStage(plugins, pipeline) {
|
|
19
|
+
const { registry, problems } = registerPlugins(plugins);
|
|
20
|
+
return { ...pipeline, registry, problems: [...(pipeline.problems ?? []), ...problems] };
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/test/plugins.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,cAAc,EAA8B,MAAM,eAAe,CAAA;AAG1E,uEAAuE;AACvE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAEtB,QAAQ;IAD7B,0EAA0E;IAC1E,YAAqB,QAA4B,EAAE,OAAiB,EAAE,OAAiB;QACrF,KAAK,CAAC,4BAA4B,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;YACnE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,yBAAyB,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;wBAFvJ,QAAQ;QAG3B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;IAClC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAA8B,EAAE,QAAkB;IAC7E,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,eAAe,CAAC,OAA4B,CAAC,CAAA;IAC5E,OAAO,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,EAAE,CAAA;AACzF,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RendererRegistry } from '../html/registry.js';
|
|
2
|
+
import type { Manuscript } from '../transform/transform.js';
|
|
3
|
+
import type { Project } from '../project.js';
|
|
4
|
+
import type { VFS } from '../vfs/vfs.js';
|
|
5
|
+
import type { AstNode, BuildContext, Rendered } from './pipeline.js';
|
|
6
|
+
/**
|
|
7
|
+
* The build's sources, each read as Djot or by the plugin that reads its
|
|
8
|
+
* extension, into a manuscript in their order. A reader that throws leaves
|
|
9
|
+
* its file out, with the problem.
|
|
10
|
+
*/
|
|
11
|
+
export declare function readStage(ctx: BuildContext): Promise<Manuscript>;
|
|
12
|
+
/** The core's AST a read stage gave, as a manuscript: it may give one document. */
|
|
13
|
+
export declare function manuscriptOf(ast: AstNode): Manuscript | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Checks the plugins' blocks' and inlines' attributes, then runs the core's
|
|
16
|
+
* transforms and the plugins' over the AST, in place. What either finds
|
|
17
|
+
* wrong goes with the build's problems, and the build goes on: a transform
|
|
18
|
+
* that fails has its changes left out. A stub's tree, which isn't the
|
|
19
|
+
* core's AST, passes through.
|
|
20
|
+
*/
|
|
21
|
+
export declare function transformStage(ast: AstNode, ctx: BuildContext): Promise<AstNode>;
|
|
22
|
+
/**
|
|
23
|
+
* The AST to HTML for the build's edition, with the given renderers, else
|
|
24
|
+
* the plugins', its math typeset for the edition (MathML on screen, SVG in
|
|
25
|
+
* print). TeX's errors, and a plugin's renderer that throws, go with the
|
|
26
|
+
* build's problems; a formula with an error shows it, and a node whose
|
|
27
|
+
* renderer threw is left out.
|
|
28
|
+
*/
|
|
29
|
+
export declare function renderStage(ast: AstNode, ctx: BuildContext, renderers?: RendererRegistry): Promise<Rendered>;
|
|
30
|
+
/**
|
|
31
|
+
* Points each image at its file in the project, found as the web edition
|
|
32
|
+
* finds it (`projectImagePath`; the render stage reports one that isn't
|
|
33
|
+
* there): an SVG as a `data:` URL, which says it is a vector image (the
|
|
34
|
+
* `image-resolution` rule passes it), the rest as `blob:` URLs. Each is
|
|
35
|
+
* decoded before the layout measures it. Its bytes are read from `files`,
|
|
36
|
+
* the project's own by default: the render stage's are the edition's
|
|
37
|
+
* assets (`assetFiles`), through the plugins' processors.
|
|
38
|
+
*
|
|
39
|
+
* Each image's project path is taken off it first, at once: the browser
|
|
40
|
+
* has begun fetching it from the page's URL, and while that request is the
|
|
41
|
+
* image's, `decode()` of the file put in its place rejects in Firefox (as
|
|
42
|
+
* the HTML standard says: the image's current request changed), so the
|
|
43
|
+
* layout measured, and the painter skipped, an image not yet loaded
|
|
44
|
+
* whenever the build outran the load (#120).
|
|
45
|
+
*/
|
|
46
|
+
export declare function loadProjectImages(html: HTMLElement, project: Project, files?: VFS): Promise<void>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { BookCitations } from '../citations/book.js';
|
|
2
|
+
import { citeTransform } from '../citations/notes.js';
|
|
3
|
+
import { citesAnything, projectCitations } from '../citations/project.js';
|
|
4
|
+
import { parseDjot } from '../djot/read.js';
|
|
5
|
+
import { checkAttributes } from '../plugin/attributes.js';
|
|
6
|
+
import { rendererRegistry } from '../plugin/render.js';
|
|
7
|
+
import { readFailure, tryPluginAsync } from '../plugin/failure.js';
|
|
8
|
+
import { plainProblem } from '../problem.js';
|
|
9
|
+
import { htmlCss } from '../html/css.js';
|
|
10
|
+
import { toDom } from '../html/dom.js';
|
|
11
|
+
import { IMAGE_TYPES, isProjectSrc, missingImages, projectImagePath } from '../html/images.js';
|
|
12
|
+
import { renderHtml } from '../html/render.js';
|
|
13
|
+
import { mathFormat, MathTypesetter } from '../math/typeset.js';
|
|
14
|
+
import { coreTransforms } from '../transform/core.js';
|
|
15
|
+
import { runTransforms } from '../transform/run.js';
|
|
16
|
+
import { assetFiles } from '../output/assets.js';
|
|
17
|
+
/**
|
|
18
|
+
* The build's sources, each read as Djot or by the plugin that reads its
|
|
19
|
+
* extension, into a manuscript in their order. A reader that throws leaves
|
|
20
|
+
* its file out, with the problem.
|
|
21
|
+
*/
|
|
22
|
+
export async function readStage(ctx) {
|
|
23
|
+
const documents = await Promise.all(ctx.sources.map(async (s) => {
|
|
24
|
+
const reader = ctx.registry.readers.get(s.path.slice(s.path.lastIndexOf('.') + 1).toLowerCase());
|
|
25
|
+
if (!reader) {
|
|
26
|
+
const reading = parseDjot(s.text, { file: s.path, profile: { owners: ctx.registry.owners } });
|
|
27
|
+
ctx.problems.push(...reading.problems);
|
|
28
|
+
return reading.document;
|
|
29
|
+
}
|
|
30
|
+
return tryPluginAsync(reader.plugin, 'read', readFailure(s.path), ctx.problems, () => reader.definition(s.text, { file: s.path, plugin: reader.plugin, options: ctx.registry.options[reader.plugin] ?? {} }));
|
|
31
|
+
}));
|
|
32
|
+
return { documents: documents.filter((d) => d !== undefined) };
|
|
33
|
+
}
|
|
34
|
+
/** The core's AST a read stage gave, as a manuscript: it may give one document. */
|
|
35
|
+
export function manuscriptOf(ast) {
|
|
36
|
+
const node = ast;
|
|
37
|
+
if (Array.isArray(node.documents))
|
|
38
|
+
return node;
|
|
39
|
+
if (node.type === 'document')
|
|
40
|
+
return { documents: [node] };
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Checks the plugins' blocks' and inlines' attributes, then runs the core's
|
|
45
|
+
* transforms and the plugins' over the AST, in place. What either finds
|
|
46
|
+
* wrong goes with the build's problems, and the build goes on: a transform
|
|
47
|
+
* that fails has its changes left out. A stub's tree, which isn't the
|
|
48
|
+
* core's AST, passes through.
|
|
49
|
+
*/
|
|
50
|
+
export async function transformStage(ast, ctx) {
|
|
51
|
+
const manuscript = manuscriptOf(ast);
|
|
52
|
+
if (!manuscript)
|
|
53
|
+
return ast;
|
|
54
|
+
const { registry } = ctx;
|
|
55
|
+
const language = ctx.project?.config?.language;
|
|
56
|
+
ctx.problems.push(...checkAttributes(manuscript, registry));
|
|
57
|
+
const citations = ctx.project && citesAnything(manuscript) ? await projectCitations(ctx.project) : undefined;
|
|
58
|
+
// The bibliographies' and the style's problems; a style that can't be loaded has the default stand in.
|
|
59
|
+
if (citations)
|
|
60
|
+
ctx.problems.push(...citations.problems);
|
|
61
|
+
const cite = citations ? [citeTransform({ note: citations.processor.style.class === 'note' })] : [];
|
|
62
|
+
ctx.problems.push(...await runTransforms(manuscript, [...coreTransforms(language ? { indexes: { language } } : {}), ...cite, ...registry.transforms], { owners: registry.owners, options: registry.options, now: registry.now }));
|
|
63
|
+
return ast;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The AST to HTML for the build's edition, with the given renderers, else
|
|
67
|
+
* the plugins', its math typeset for the edition (MathML on screen, SVG in
|
|
68
|
+
* print). TeX's errors, and a plugin's renderer that throws, go with the
|
|
69
|
+
* build's problems; a formula with an error shows it, and a node whose
|
|
70
|
+
* renderer threw is left out.
|
|
71
|
+
*/
|
|
72
|
+
export async function renderStage(ast, ctx, renderers = rendererRegistry(ctx.registry)) {
|
|
73
|
+
const manuscript = manuscriptOf(ast);
|
|
74
|
+
if (!manuscript)
|
|
75
|
+
throw new Error('the AST is neither a manuscript ({ documents }) nor a document: a stub read stage needs its own render stage');
|
|
76
|
+
const language = ctx.project?.config?.language;
|
|
77
|
+
const title = ctx.project?.config?.title;
|
|
78
|
+
const math = new MathTypesetter(language ? { language } : {});
|
|
79
|
+
ctx.problems.push(...await math.prepare(manuscript, [mathFormat(ctx.edition)]));
|
|
80
|
+
if (ctx.project)
|
|
81
|
+
ctx.problems.push(...missingImages(manuscript, ctx.project.files));
|
|
82
|
+
const citations = ctx.project && citesAnything(manuscript)
|
|
83
|
+
? new BookCitations(manuscript, { processor: (await projectCitations(ctx.project)).processor, edition: ctx.edition })
|
|
84
|
+
: undefined;
|
|
85
|
+
if (citations)
|
|
86
|
+
ctx.problems.push(...citations.problems.map(plainProblem));
|
|
87
|
+
const rendering = renderHtml(manuscript, {
|
|
88
|
+
edition: ctx.edition,
|
|
89
|
+
math,
|
|
90
|
+
renderers,
|
|
91
|
+
...(language ? { language } : {}),
|
|
92
|
+
...(title ? { title } : {}),
|
|
93
|
+
...(citations ? { citations } : {}),
|
|
94
|
+
});
|
|
95
|
+
ctx.problems.push(...rendering.problems);
|
|
96
|
+
const dom = toDom(rendering);
|
|
97
|
+
if (ctx.project)
|
|
98
|
+
await loadProjectImages(dom.element, ctx.project, assetFiles(ctx.project.fs, ctx.registry, ctx.edition.name, ctx.problems));
|
|
99
|
+
return {
|
|
100
|
+
html: dom.element,
|
|
101
|
+
css: htmlCss(ctx.edition),
|
|
102
|
+
elementsOf: (node) => dom.elementsOf(node),
|
|
103
|
+
nodeOf: (element) => dom.nodeOf(element),
|
|
104
|
+
locate: (node) => dom.locate(node),
|
|
105
|
+
...(citations && ctx.edition.media === 'print' ? { resolvers: [citations.resolver()] } : {}),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function base64(data) {
|
|
109
|
+
let s = '';
|
|
110
|
+
for (let i = 0; i < data.length; i += 0x8000)
|
|
111
|
+
s += String.fromCharCode(...data.subarray(i, i + 0x8000));
|
|
112
|
+
return btoa(s);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Points each image at its file in the project, found as the web edition
|
|
116
|
+
* finds it (`projectImagePath`; the render stage reports one that isn't
|
|
117
|
+
* there): an SVG as a `data:` URL, which says it is a vector image (the
|
|
118
|
+
* `image-resolution` rule passes it), the rest as `blob:` URLs. Each is
|
|
119
|
+
* decoded before the layout measures it. Its bytes are read from `files`,
|
|
120
|
+
* the project's own by default: the render stage's are the edition's
|
|
121
|
+
* assets (`assetFiles`), through the plugins' processors.
|
|
122
|
+
*
|
|
123
|
+
* Each image's project path is taken off it first, at once: the browser
|
|
124
|
+
* has begun fetching it from the page's URL, and while that request is the
|
|
125
|
+
* image's, `decode()` of the file put in its place rejects in Firefox (as
|
|
126
|
+
* the HTML standard says: the image's current request changed), so the
|
|
127
|
+
* layout measured, and the painter skipped, an image not yet loaded
|
|
128
|
+
* whenever the build outran the load (#120).
|
|
129
|
+
*/
|
|
130
|
+
export async function loadProjectImages(html, project, files = project.fs) {
|
|
131
|
+
const have = new Set(project.files);
|
|
132
|
+
const found = [...html.querySelectorAll('img')].flatMap((img) => {
|
|
133
|
+
const src = img.getAttribute('src');
|
|
134
|
+
if (!src || !isProjectSrc(src))
|
|
135
|
+
return [];
|
|
136
|
+
const path = projectImagePath(src, img.closest('[data-pw-file]')?.dataset.pwFile, have);
|
|
137
|
+
if (path === undefined)
|
|
138
|
+
return [];
|
|
139
|
+
img.removeAttribute('src');
|
|
140
|
+
return [{ img, path }];
|
|
141
|
+
});
|
|
142
|
+
await Promise.all(found.map(async ({ img, path }) => {
|
|
143
|
+
const type = IMAGE_TYPES[path.slice(path.lastIndexOf('.') + 1).toLowerCase()] ?? 'application/octet-stream';
|
|
144
|
+
const data = await files.readFile(path);
|
|
145
|
+
img.src = type === 'image/svg+xml' ? `data:${type};base64,${base64(data)}` : URL.createObjectURL(new Blob([data], { type }));
|
|
146
|
+
await img.decode().catch(() => undefined);
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/test/render.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAE9F,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAA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AAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IAC3C,CAAC,CAAC,CAAC,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-page test runner (https://plans.inkylabs.com/pulpweaver#testing):
|
|
3
|
+
* the browser app runs a project's tests with it, so they need nothing
|
|
4
|
+
* installed. It runs the same files `pw test` runs with Vitest, with the
|
|
5
|
+
* same globals (`describe`, `test`, `it`, `expect` and the hooks) and the
|
|
6
|
+
* same `expect`, built on `@vitest/expect`, with the document matchers.
|
|
7
|
+
*
|
|
8
|
+
* It covers what a book's tests use, not all of Vitest: no mocks, fake
|
|
9
|
+
* timers, `test.each` or concurrency.
|
|
10
|
+
*/
|
|
11
|
+
import { type ExpectStatic } from '@vitest/expect';
|
|
12
|
+
import type { Project } from '../project.js';
|
|
13
|
+
import { type SnapshotStore } from './environment.js';
|
|
14
|
+
/** An `expect` like Vitest's, with the document matchers. */
|
|
15
|
+
export declare function createExpect(): ExpectStatic;
|
|
16
|
+
/** A test file: its path, which names its snapshots, and how to load it (`() => import(url)`). */
|
|
17
|
+
export interface TestFile {
|
|
18
|
+
path: string;
|
|
19
|
+
load(): Promise<unknown>;
|
|
20
|
+
}
|
|
21
|
+
export interface TestResult {
|
|
22
|
+
file: string;
|
|
23
|
+
/** The test's name with its suites', joined by ` > `, as Vitest names it. */
|
|
24
|
+
name: string;
|
|
25
|
+
state: 'pass' | 'fail' | 'skip' | 'todo';
|
|
26
|
+
error?: {
|
|
27
|
+
message: string;
|
|
28
|
+
stack?: string;
|
|
29
|
+
};
|
|
30
|
+
/** In ms. */
|
|
31
|
+
duration: number;
|
|
32
|
+
}
|
|
33
|
+
export interface RunOptions {
|
|
34
|
+
/** The project the tests' `build()` builds. */
|
|
35
|
+
project?: Project;
|
|
36
|
+
snapshots?: SnapshotStore;
|
|
37
|
+
/** The browser's name for page snapshots; detected if absent. */
|
|
38
|
+
browser?: string;
|
|
39
|
+
/** Where builds put their pages. */
|
|
40
|
+
container?: HTMLElement;
|
|
41
|
+
/** A test's time limit, in ms. */
|
|
42
|
+
timeout?: number;
|
|
43
|
+
/** Called as each test finishes. */
|
|
44
|
+
onResult?(result: TestResult): void;
|
|
45
|
+
}
|
|
46
|
+
export interface RunReport {
|
|
47
|
+
results: TestResult[];
|
|
48
|
+
/** Files that failed to load, or whose `beforeAll` or `afterAll` hooks threw. */
|
|
49
|
+
errors: {
|
|
50
|
+
file: string;
|
|
51
|
+
message: string;
|
|
52
|
+
}[];
|
|
53
|
+
/** Whether every test that ran passed and every file loaded. */
|
|
54
|
+
ok: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Runs test files in this page, one after another, and reports each test.
|
|
58
|
+
* While it runs, the test API's globals and environment are the runner's;
|
|
59
|
+
* whatever they were before is put back afterwards.
|
|
60
|
+
*/
|
|
61
|
+
export declare function runTests(files: readonly TestFile[], options?: RunOptions): Promise<RunReport>;
|