@openuji/speculator 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -50
- package/dist/file-provider/__tests__/compliance.test.d.ts +5 -0
- package/dist/file-provider/__tests__/compliance.test.d.ts.map +1 -0
- package/dist/file-provider/__tests__/compliance.test.js +52 -0
- package/dist/file-provider/__tests__/compliance.test.js.map +1 -0
- package/dist/file-provider/index.d.ts +8 -0
- package/dist/file-provider/index.d.ts.map +1 -0
- package/dist/file-provider/index.js +10 -0
- package/dist/file-provider/index.js.map +1 -0
- package/dist/file-provider/memory.d.ts +46 -0
- package/dist/file-provider/memory.d.ts.map +1 -0
- package/dist/file-provider/memory.js +99 -0
- package/dist/file-provider/memory.js.map +1 -0
- package/dist/file-provider/node.d.ts +32 -0
- package/dist/file-provider/node.d.ts.map +1 -0
- package/dist/file-provider/node.js +65 -0
- package/dist/file-provider/node.js.map +1 -0
- package/dist/file-provider/types.d.ts +69 -0
- package/dist/file-provider/types.d.ts.map +1 -0
- package/dist/file-provider/types.js +47 -0
- package/dist/file-provider/types.js.map +1 -0
- package/dist/file-provider/web.d.ts +32 -0
- package/dist/file-provider/web.d.ts.map +1 -0
- package/dist/file-provider/web.js +77 -0
- package/dist/file-provider/web.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/parse/AsideHtmlParser.d.ts +12 -0
- package/dist/parse/AsideHtmlParser.d.ts.map +1 -0
- package/dist/parse/AsideHtmlParser.js +74 -0
- package/dist/parse/AsideHtmlParser.js.map +1 -0
- package/dist/parse/BlockquoteHtmlParser.d.ts +11 -0
- package/dist/parse/BlockquoteHtmlParser.d.ts.map +1 -0
- package/dist/parse/BlockquoteHtmlParser.js +28 -0
- package/dist/parse/BlockquoteHtmlParser.js.map +1 -0
- package/dist/parse/BlockquoteMarkdownParser.d.ts +11 -0
- package/dist/parse/BlockquoteMarkdownParser.d.ts.map +1 -0
- package/dist/parse/BlockquoteMarkdownParser.js +26 -0
- package/dist/parse/BlockquoteMarkdownParser.js.map +1 -0
- package/dist/parse/CodeHtmlParser.d.ts +11 -0
- package/dist/parse/CodeHtmlParser.d.ts.map +1 -0
- package/dist/parse/CodeHtmlParser.js +38 -0
- package/dist/parse/CodeHtmlParser.js.map +1 -0
- package/dist/parse/CodeMarkdownParser.d.ts +11 -0
- package/dist/parse/CodeMarkdownParser.d.ts.map +1 -0
- package/dist/parse/CodeMarkdownParser.js +29 -0
- package/dist/parse/CodeMarkdownParser.js.map +1 -0
- package/dist/parse/DfnHtmlParser.d.ts +12 -0
- package/dist/parse/DfnHtmlParser.d.ts.map +1 -0
- package/dist/parse/DfnHtmlParser.js +53 -0
- package/dist/parse/DfnHtmlParser.js.map +1 -0
- package/dist/parse/HeadingsHtmlParser.d.ts +11 -0
- package/dist/parse/HeadingsHtmlParser.d.ts.map +1 -0
- package/dist/parse/HeadingsHtmlParser.js +30 -0
- package/dist/parse/HeadingsHtmlParser.js.map +1 -0
- package/dist/parse/HeadingsMarkdownParser.d.ts +11 -0
- package/dist/parse/HeadingsMarkdownParser.d.ts.map +1 -0
- package/dist/parse/HeadingsMarkdownParser.js +26 -0
- package/dist/parse/HeadingsMarkdownParser.js.map +1 -0
- package/dist/parse/InlinesHtmlParser.d.ts +12 -0
- package/dist/parse/InlinesHtmlParser.d.ts.map +1 -0
- package/dist/parse/InlinesHtmlParser.js +150 -0
- package/dist/parse/InlinesHtmlParser.js.map +1 -0
- package/dist/parse/InlinesMarkdownParser.d.ts +11 -0
- package/dist/parse/InlinesMarkdownParser.d.ts.map +1 -0
- package/dist/parse/InlinesMarkdownParser.js +91 -0
- package/dist/parse/InlinesMarkdownParser.js.map +1 -0
- package/dist/parse/ListsHtmlParser.d.ts +11 -0
- package/dist/parse/ListsHtmlParser.d.ts.map +1 -0
- package/dist/parse/ListsHtmlParser.js +71 -0
- package/dist/parse/ListsHtmlParser.js.map +1 -0
- package/dist/parse/ListsMarkdownParser.d.ts +11 -0
- package/dist/parse/ListsMarkdownParser.d.ts.map +1 -0
- package/dist/parse/ListsMarkdownParser.js +46 -0
- package/dist/parse/ListsMarkdownParser.js.map +1 -0
- package/dist/parse/MiscHtmlParser.d.ts +12 -0
- package/dist/parse/MiscHtmlParser.d.ts.map +1 -0
- package/dist/parse/MiscHtmlParser.js +85 -0
- package/dist/parse/MiscHtmlParser.js.map +1 -0
- package/dist/parse/MiscMarkdownParser.d.ts +11 -0
- package/dist/parse/MiscMarkdownParser.d.ts.map +1 -0
- package/dist/parse/MiscMarkdownParser.js +38 -0
- package/dist/parse/MiscMarkdownParser.js.map +1 -0
- package/dist/parse/ParagraphsHtmlParser.d.ts +11 -0
- package/dist/parse/ParagraphsHtmlParser.d.ts.map +1 -0
- package/dist/parse/ParagraphsHtmlParser.js +30 -0
- package/dist/parse/ParagraphsHtmlParser.js.map +1 -0
- package/dist/parse/ParagraphsMarkdownParser.d.ts +11 -0
- package/dist/parse/ParagraphsMarkdownParser.d.ts.map +1 -0
- package/dist/parse/ParagraphsMarkdownParser.js +25 -0
- package/dist/parse/ParagraphsMarkdownParser.js.map +1 -0
- package/dist/parse/SectionsHtmlParser.d.ts +12 -0
- package/dist/parse/SectionsHtmlParser.d.ts.map +1 -0
- package/dist/parse/SectionsHtmlParser.js +58 -0
- package/dist/parse/SectionsHtmlParser.js.map +1 -0
- package/dist/parse/TablesHtmlParser.d.ts +11 -0
- package/dist/parse/TablesHtmlParser.d.ts.map +1 -0
- package/dist/parse/TablesHtmlParser.js +81 -0
- package/dist/parse/TablesHtmlParser.js.map +1 -0
- package/dist/parse/TablesMarkdownParser.d.ts +11 -0
- package/dist/parse/TablesMarkdownParser.d.ts.map +1 -0
- package/dist/parse/TablesMarkdownParser.js +56 -0
- package/dist/parse/TablesMarkdownParser.js.map +1 -0
- package/dist/parse/XrefHtmlParser.d.ts +12 -0
- package/dist/parse/XrefHtmlParser.d.ts.map +1 -0
- package/dist/parse/XrefHtmlParser.js +124 -0
- package/dist/parse/XrefHtmlParser.js.map +1 -0
- package/dist/parse/__tests__/assembler.test.d.ts +5 -0
- package/dist/parse/__tests__/assembler.test.d.ts.map +1 -0
- package/dist/parse/__tests__/assembler.test.js +135 -0
- package/dist/parse/__tests__/assembler.test.js.map +1 -0
- package/dist/parse/__tests__/html.test.d.ts +5 -0
- package/dist/parse/__tests__/html.test.d.ts.map +1 -0
- package/dist/parse/__tests__/html.test.js +149 -0
- package/dist/parse/__tests__/html.test.js.map +1 -0
- package/dist/parse/__tests__/markdown.test.d.ts +5 -0
- package/dist/parse/__tests__/markdown.test.d.ts.map +1 -0
- package/dist/parse/__tests__/markdown.test.js +133 -0
- package/dist/parse/__tests__/markdown.test.js.map +1 -0
- package/dist/parse/__tests__/pipeline.test.d.ts +5 -0
- package/dist/parse/__tests__/pipeline.test.d.ts.map +1 -0
- package/dist/parse/__tests__/pipeline.test.js +215 -0
- package/dist/parse/__tests__/pipeline.test.js.map +1 -0
- package/dist/parse/__tests__/respec.test.d.ts +7 -0
- package/dist/parse/__tests__/respec.test.d.ts.map +1 -0
- package/dist/parse/__tests__/respec.test.js +151 -0
- package/dist/parse/__tests__/respec.test.js.map +1 -0
- package/dist/parse/assembler.d.ts +20 -0
- package/dist/parse/assembler.d.ts.map +1 -0
- package/dist/parse/assembler.js +175 -0
- package/dist/parse/assembler.js.map +1 -0
- package/dist/parse/html/AsideHtmlParser.d.ts +12 -0
- package/dist/parse/html/AsideHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/AsideHtmlParser.js +74 -0
- package/dist/parse/html/AsideHtmlParser.js.map +1 -0
- package/dist/parse/html/BlockquoteHtmlParser.d.ts +11 -0
- package/dist/parse/html/BlockquoteHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/BlockquoteHtmlParser.js +28 -0
- package/dist/parse/html/BlockquoteHtmlParser.js.map +1 -0
- package/dist/parse/html/CodeHtmlParser.d.ts +11 -0
- package/dist/parse/html/CodeHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/CodeHtmlParser.js +38 -0
- package/dist/parse/html/CodeHtmlParser.js.map +1 -0
- package/dist/parse/html/DfnHtmlParser.d.ts +12 -0
- package/dist/parse/html/DfnHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/DfnHtmlParser.js +53 -0
- package/dist/parse/html/DfnHtmlParser.js.map +1 -0
- package/dist/parse/html/HeadingsHtmlParser.d.ts +11 -0
- package/dist/parse/html/HeadingsHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/HeadingsHtmlParser.js +30 -0
- package/dist/parse/html/HeadingsHtmlParser.js.map +1 -0
- package/dist/parse/html/InlinesHtmlParser.d.ts +12 -0
- package/dist/parse/html/InlinesHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/InlinesHtmlParser.js +150 -0
- package/dist/parse/html/InlinesHtmlParser.js.map +1 -0
- package/dist/parse/html/ListsHtmlParser.d.ts +11 -0
- package/dist/parse/html/ListsHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/ListsHtmlParser.js +71 -0
- package/dist/parse/html/ListsHtmlParser.js.map +1 -0
- package/dist/parse/html/MiscHtmlParser.d.ts +12 -0
- package/dist/parse/html/MiscHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/MiscHtmlParser.js +85 -0
- package/dist/parse/html/MiscHtmlParser.js.map +1 -0
- package/dist/parse/html/ParagraphsHtmlParser.d.ts +11 -0
- package/dist/parse/html/ParagraphsHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/ParagraphsHtmlParser.js +30 -0
- package/dist/parse/html/ParagraphsHtmlParser.js.map +1 -0
- package/dist/parse/html/SectionsHtmlParser.d.ts +12 -0
- package/dist/parse/html/SectionsHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/SectionsHtmlParser.js +58 -0
- package/dist/parse/html/SectionsHtmlParser.js.map +1 -0
- package/dist/parse/html/TablesHtmlParser.d.ts +11 -0
- package/dist/parse/html/TablesHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/TablesHtmlParser.js +81 -0
- package/dist/parse/html/TablesHtmlParser.js.map +1 -0
- package/dist/parse/html/XrefHtmlParser.d.ts +12 -0
- package/dist/parse/html/XrefHtmlParser.d.ts.map +1 -0
- package/dist/parse/html/XrefHtmlParser.js +125 -0
- package/dist/parse/html/XrefHtmlParser.js.map +1 -0
- package/dist/parse/html/handlers/blockquote.d.ts +9 -0
- package/dist/parse/html/handlers/blockquote.d.ts.map +1 -0
- package/dist/parse/html/handlers/blockquote.js +21 -0
- package/dist/parse/html/handlers/blockquote.js.map +1 -0
- package/dist/parse/html/handlers/code.d.ts +9 -0
- package/dist/parse/html/handlers/code.d.ts.map +1 -0
- package/dist/parse/html/handlers/code.js +31 -0
- package/dist/parse/html/handlers/code.js.map +1 -0
- package/dist/parse/html/handlers/containers.d.ts +16 -0
- package/dist/parse/html/handlers/containers.d.ts.map +1 -0
- package/dist/parse/html/handlers/containers.js +25 -0
- package/dist/parse/html/handlers/containers.js.map +1 -0
- package/dist/parse/html/handlers/heading.d.ts +9 -0
- package/dist/parse/html/handlers/heading.d.ts.map +1 -0
- package/dist/parse/html/handlers/heading.js +26 -0
- package/dist/parse/html/handlers/heading.js.map +1 -0
- package/dist/parse/html/handlers/index.d.ts +23 -0
- package/dist/parse/html/handlers/index.d.ts.map +1 -0
- package/dist/parse/html/handlers/index.js +47 -0
- package/dist/parse/html/handlers/index.js.map +1 -0
- package/dist/parse/html/handlers/inline.d.ts +35 -0
- package/dist/parse/html/handlers/inline.d.ts.map +1 -0
- package/dist/parse/html/handlers/inline.js +119 -0
- package/dist/parse/html/handlers/inline.js.map +1 -0
- package/dist/parse/html/handlers/list.d.ts +9 -0
- package/dist/parse/html/handlers/list.d.ts.map +1 -0
- package/dist/parse/html/handlers/list.js +63 -0
- package/dist/parse/html/handlers/list.js.map +1 -0
- package/dist/parse/html/handlers/paragraph.d.ts +9 -0
- package/dist/parse/html/handlers/paragraph.d.ts.map +1 -0
- package/dist/parse/html/handlers/paragraph.js +20 -0
- package/dist/parse/html/handlers/paragraph.js.map +1 -0
- package/dist/parse/html/handlers/section.d.ts +9 -0
- package/dist/parse/html/handlers/section.d.ts.map +1 -0
- package/dist/parse/html/handlers/section.js +53 -0
- package/dist/parse/html/handlers/section.js.map +1 -0
- package/dist/parse/html/index.d.ts +5 -0
- package/dist/parse/html/index.d.ts.map +1 -0
- package/dist/parse/html/index.js +12 -0
- package/dist/parse/html/index.js.map +1 -0
- package/dist/parse/html/parser.d.ts +51 -0
- package/dist/parse/html/parser.d.ts.map +1 -0
- package/dist/parse/html/parser.js +228 -0
- package/dist/parse/html/parser.js.map +1 -0
- package/dist/parse/index.d.ts +16 -0
- package/dist/parse/index.d.ts.map +1 -0
- package/dist/parse/index.js +19 -0
- package/dist/parse/index.js.map +1 -0
- package/dist/parse/markdown/BlockquoteMarkdownParser.d.ts +11 -0
- package/dist/parse/markdown/BlockquoteMarkdownParser.d.ts.map +1 -0
- package/dist/parse/markdown/BlockquoteMarkdownParser.js +26 -0
- package/dist/parse/markdown/BlockquoteMarkdownParser.js.map +1 -0
- package/dist/parse/markdown/CodeMarkdownParser.d.ts +11 -0
- package/dist/parse/markdown/CodeMarkdownParser.d.ts.map +1 -0
- package/dist/parse/markdown/CodeMarkdownParser.js +29 -0
- package/dist/parse/markdown/CodeMarkdownParser.js.map +1 -0
- package/dist/parse/markdown/HeadingsMarkdownParser.d.ts +11 -0
- package/dist/parse/markdown/HeadingsMarkdownParser.d.ts.map +1 -0
- package/dist/parse/markdown/HeadingsMarkdownParser.js +26 -0
- package/dist/parse/markdown/HeadingsMarkdownParser.js.map +1 -0
- package/dist/parse/markdown/InlinesMarkdownParser.d.ts +11 -0
- package/dist/parse/markdown/InlinesMarkdownParser.d.ts.map +1 -0
- package/dist/parse/markdown/InlinesMarkdownParser.js +91 -0
- package/dist/parse/markdown/InlinesMarkdownParser.js.map +1 -0
- package/dist/parse/markdown/ListsMarkdownParser.d.ts +11 -0
- package/dist/parse/markdown/ListsMarkdownParser.d.ts.map +1 -0
- package/dist/parse/markdown/ListsMarkdownParser.js +46 -0
- package/dist/parse/markdown/ListsMarkdownParser.js.map +1 -0
- package/dist/parse/markdown/MiscMarkdownParser.d.ts +11 -0
- package/dist/parse/markdown/MiscMarkdownParser.d.ts.map +1 -0
- package/dist/parse/markdown/MiscMarkdownParser.js +38 -0
- package/dist/parse/markdown/MiscMarkdownParser.js.map +1 -0
- package/dist/parse/markdown/ParagraphsMarkdownParser.d.ts +11 -0
- package/dist/parse/markdown/ParagraphsMarkdownParser.d.ts.map +1 -0
- package/dist/parse/markdown/ParagraphsMarkdownParser.js +25 -0
- package/dist/parse/markdown/ParagraphsMarkdownParser.js.map +1 -0
- package/dist/parse/markdown/TablesMarkdownParser.d.ts +11 -0
- package/dist/parse/markdown/TablesMarkdownParser.d.ts.map +1 -0
- package/dist/parse/markdown/TablesMarkdownParser.js +56 -0
- package/dist/parse/markdown/TablesMarkdownParser.js.map +1 -0
- package/dist/parse/markdown/handlers/blockquote.d.ts +9 -0
- package/dist/parse/markdown/handlers/blockquote.d.ts.map +1 -0
- package/dist/parse/markdown/handlers/blockquote.js +22 -0
- package/dist/parse/markdown/handlers/blockquote.js.map +1 -0
- package/dist/parse/markdown/handlers/code.d.ts +9 -0
- package/dist/parse/markdown/handlers/code.d.ts.map +1 -0
- package/dist/parse/markdown/handlers/code.js +25 -0
- package/dist/parse/markdown/handlers/code.js.map +1 -0
- package/dist/parse/markdown/handlers/heading.d.ts +9 -0
- package/dist/parse/markdown/handlers/heading.d.ts.map +1 -0
- package/dist/parse/markdown/handlers/heading.js +22 -0
- package/dist/parse/markdown/handlers/heading.js.map +1 -0
- package/dist/parse/markdown/handlers/index.d.ts +23 -0
- package/dist/parse/markdown/handlers/index.d.ts.map +1 -0
- package/dist/parse/markdown/handlers/index.js +47 -0
- package/dist/parse/markdown/handlers/index.js.map +1 -0
- package/dist/parse/markdown/handlers/inline.d.ts +35 -0
- package/dist/parse/markdown/handlers/inline.d.ts.map +1 -0
- package/dist/parse/markdown/handlers/inline.js +126 -0
- package/dist/parse/markdown/handlers/inline.js.map +1 -0
- package/dist/parse/markdown/handlers/list.d.ts +9 -0
- package/dist/parse/markdown/handlers/list.d.ts.map +1 -0
- package/dist/parse/markdown/handlers/list.js +42 -0
- package/dist/parse/markdown/handlers/list.js.map +1 -0
- package/dist/parse/markdown/handlers/misc.d.ts +15 -0
- package/dist/parse/markdown/handlers/misc.d.ts.map +1 -0
- package/dist/parse/markdown/handlers/misc.js +38 -0
- package/dist/parse/markdown/handlers/misc.js.map +1 -0
- package/dist/parse/markdown/handlers/paragraph.d.ts +9 -0
- package/dist/parse/markdown/handlers/paragraph.d.ts.map +1 -0
- package/dist/parse/markdown/handlers/paragraph.js +21 -0
- package/dist/parse/markdown/handlers/paragraph.js.map +1 -0
- package/dist/parse/markdown/handlers/table.d.ts +9 -0
- package/dist/parse/markdown/handlers/table.d.ts.map +1 -0
- package/dist/parse/markdown/handlers/table.js +52 -0
- package/dist/parse/markdown/handlers/table.js.map +1 -0
- package/dist/parse/markdown/index.d.ts +5 -0
- package/dist/parse/markdown/index.d.ts.map +1 -0
- package/dist/parse/markdown/index.js +12 -0
- package/dist/parse/markdown/index.js.map +1 -0
- package/dist/parse/markdown/parser.d.ts +51 -0
- package/dist/parse/markdown/parser.d.ts.map +1 -0
- package/dist/parse/markdown/parser.js +134 -0
- package/dist/parse/markdown/parser.js.map +1 -0
- package/dist/parse/normalize.d.ts +51 -0
- package/dist/parse/normalize.d.ts.map +1 -0
- package/dist/parse/normalize.js +78 -0
- package/dist/parse/normalize.js.map +1 -0
- package/dist/parse/parsers.d.ts +37 -0
- package/dist/parse/parsers.d.ts.map +1 -0
- package/dist/parse/parsers.js +86 -0
- package/dist/parse/parsers.js.map +1 -0
- package/dist/parse/pipeline.d.ts +41 -0
- package/dist/parse/pipeline.d.ts.map +1 -0
- package/dist/parse/pipeline.js +120 -0
- package/dist/parse/pipeline.js.map +1 -0
- package/dist/parse/registry.d.ts +156 -0
- package/dist/parse/registry.d.ts.map +1 -0
- package/dist/parse/registry.js +104 -0
- package/dist/parse/registry.js.map +1 -0
- package/dist/parse/types.d.ts +67 -0
- package/dist/parse/types.d.ts.map +1 -0
- package/dist/parse/types.js +19 -0
- package/dist/parse/types.js.map +1 -0
- package/dist/pipeline/__tests__/pipeline.test.d.ts +5 -0
- package/dist/pipeline/__tests__/pipeline.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/pipeline.test.js +69 -0
- package/dist/pipeline/__tests__/pipeline.test.js.map +1 -0
- package/dist/pipeline/__tests__/single-as-workspace.test.d.ts +2 -0
- package/dist/pipeline/__tests__/single-as-workspace.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/single-as-workspace.test.js +19 -0
- package/dist/pipeline/__tests__/single-as-workspace.test.js.map +1 -0
- package/dist/pipeline/__tests__/workspace-rules.test.d.ts +11 -0
- package/dist/pipeline/__tests__/workspace-rules.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/workspace-rules.test.js +54 -0
- package/dist/pipeline/__tests__/workspace-rules.test.js.map +1 -0
- package/dist/pipeline/__tests__/workspace.test.d.ts +2 -0
- package/dist/pipeline/__tests__/workspace.test.d.ts.map +1 -0
- package/dist/pipeline/__tests__/workspace.test.js +61 -0
- package/dist/pipeline/__tests__/workspace.test.js.map +1 -0
- package/dist/pipeline/index.d.ts +34 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +45 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/runner.d.ts +38 -0
- package/dist/pipeline/runner.d.ts.map +1 -0
- package/dist/pipeline/runner.js +128 -0
- package/dist/pipeline/runner.js.map +1 -0
- package/dist/pipeline/types.d.ts +106 -0
- package/dist/pipeline/types.d.ts.map +1 -0
- package/dist/pipeline/types.js +9 -0
- package/dist/pipeline/types.js.map +1 -0
- package/dist/pipeline/workspace-index.d.ts +11 -0
- package/dist/pipeline/workspace-index.d.ts.map +1 -0
- package/dist/pipeline/workspace-index.js +57 -0
- package/dist/pipeline/workspace-index.js.map +1 -0
- package/dist/plugins/__tests__/citation-transform.test.d.ts +7 -0
- package/dist/plugins/__tests__/citation-transform.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/citation-transform.test.js +89 -0
- package/dist/plugins/__tests__/citation-transform.test.js.map +1 -0
- package/dist/plugins/__tests__/dfn-parsing.test.d.ts +2 -0
- package/dist/plugins/__tests__/dfn-parsing.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/dfn-parsing.test.js +65 -0
- package/dist/plugins/__tests__/dfn-parsing.test.js.map +1 -0
- package/dist/plugins/__tests__/dfn-resolve.test.d.ts +5 -0
- package/dist/plugins/__tests__/dfn-resolve.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/dfn-resolve.test.js +152 -0
- package/dist/plugins/__tests__/dfn-resolve.test.js.map +1 -0
- package/dist/plugins/__tests__/xref-parsing.test.d.ts +2 -0
- package/dist/plugins/__tests__/xref-parsing.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/xref-parsing.test.js +66 -0
- package/dist/plugins/__tests__/xref-parsing.test.js.map +1 -0
- package/dist/plugins/aside.d.ts +12 -0
- package/dist/plugins/aside.d.ts.map +1 -0
- package/dist/plugins/aside.js +78 -0
- package/dist/plugins/aside.js.map +1 -0
- package/dist/plugins/blockquote.d.ts +11 -0
- package/dist/plugins/blockquote.d.ts.map +1 -0
- package/dist/plugins/blockquote.js +47 -0
- package/dist/plugins/blockquote.js.map +1 -0
- package/dist/plugins/citation-transform.d.ts +19 -0
- package/dist/plugins/citation-transform.d.ts.map +1 -0
- package/dist/plugins/citation-transform.js +176 -0
- package/dist/plugins/citation-transform.js.map +1 -0
- package/dist/plugins/citation.d.ts +21 -0
- package/dist/plugins/citation.d.ts.map +1 -0
- package/dist/plugins/citation.js +131 -0
- package/dist/plugins/citation.js.map +1 -0
- package/dist/plugins/code.d.ts +11 -0
- package/dist/plugins/code.d.ts.map +1 -0
- package/dist/plugins/code.js +60 -0
- package/dist/plugins/code.js.map +1 -0
- package/dist/plugins/core-html.d.ts +27 -0
- package/dist/plugins/core-html.d.ts.map +1 -0
- package/dist/plugins/core-html.js +53 -0
- package/dist/plugins/core-html.js.map +1 -0
- package/dist/plugins/core-markdown.d.ts +26 -0
- package/dist/plugins/core-markdown.d.ts.map +1 -0
- package/dist/plugins/core-markdown.js +55 -0
- package/dist/plugins/core-markdown.js.map +1 -0
- package/dist/plugins/data-cite.d.ts +12 -0
- package/dist/plugins/data-cite.d.ts.map +1 -0
- package/dist/plugins/data-cite.js +50 -0
- package/dist/plugins/data-cite.js.map +1 -0
- package/dist/plugins/dfn-resolve.d.ts +15 -0
- package/dist/plugins/dfn-resolve.d.ts.map +1 -0
- package/dist/plugins/dfn-resolve.js +257 -0
- package/dist/plugins/dfn-resolve.js.map +1 -0
- package/dist/plugins/dfn.d.ts +12 -0
- package/dist/plugins/dfn.d.ts.map +1 -0
- package/dist/plugins/dfn.js +57 -0
- package/dist/plugins/dfn.js.map +1 -0
- package/dist/plugins/directives.d.ts +8 -0
- package/dist/plugins/directives.d.ts.map +1 -0
- package/dist/plugins/directives.js +34 -0
- package/dist/plugins/directives.js.map +1 -0
- package/dist/plugins/heading.d.ts +11 -0
- package/dist/plugins/heading.d.ts.map +1 -0
- package/dist/plugins/heading.js +49 -0
- package/dist/plugins/heading.js.map +1 -0
- package/dist/plugins/index.d.ts +12 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +26 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/inline.d.ts +12 -0
- package/dist/plugins/inline.d.ts.map +1 -0
- package/dist/plugins/inline.js +234 -0
- package/dist/plugins/inline.js.map +1 -0
- package/dist/plugins/list.d.ts +11 -0
- package/dist/plugins/list.d.ts.map +1 -0
- package/dist/plugins/list.js +110 -0
- package/dist/plugins/list.js.map +1 -0
- package/dist/plugins/misc.d.ts +12 -0
- package/dist/plugins/misc.d.ts.map +1 -0
- package/dist/plugins/misc.js +116 -0
- package/dist/plugins/misc.js.map +1 -0
- package/dist/plugins/paragraph.d.ts +11 -0
- package/dist/plugins/paragraph.d.ts.map +1 -0
- package/dist/plugins/paragraph.js +48 -0
- package/dist/plugins/paragraph.js.map +1 -0
- package/dist/plugins/section.d.ts +12 -0
- package/dist/plugins/section.d.ts.map +1 -0
- package/dist/plugins/section.js +62 -0
- package/dist/plugins/section.js.map +1 -0
- package/dist/plugins/table.d.ts +11 -0
- package/dist/plugins/table.d.ts.map +1 -0
- package/dist/plugins/table.js +130 -0
- package/dist/plugins/table.js.map +1 -0
- package/dist/plugins/xref.d.ts +12 -0
- package/dist/plugins/xref.d.ts.map +1 -0
- package/dist/plugins/xref.js +92 -0
- package/dist/plugins/xref.js.map +1 -0
- package/dist/postprocess/__tests__/citation-transform.test.d.ts +7 -0
- package/dist/postprocess/__tests__/citation-transform.test.d.ts.map +1 -0
- package/dist/postprocess/__tests__/citation-transform.test.js +89 -0
- package/dist/postprocess/__tests__/citation-transform.test.js.map +1 -0
- package/dist/postprocess/__tests__/dfn-resolve.test.d.ts +5 -0
- package/dist/postprocess/__tests__/dfn-resolve.test.d.ts.map +1 -0
- package/dist/postprocess/__tests__/dfn-resolve.test.js +160 -0
- package/dist/postprocess/__tests__/dfn-resolve.test.js.map +1 -0
- package/dist/postprocess/__tests__/section-id.test.d.ts +5 -0
- package/dist/postprocess/__tests__/section-id.test.d.ts.map +1 -0
- package/dist/postprocess/__tests__/section-id.test.js +222 -0
- package/dist/postprocess/__tests__/section-id.test.js.map +1 -0
- package/dist/postprocess/citation-transform.d.ts +19 -0
- package/dist/postprocess/citation-transform.d.ts.map +1 -0
- package/dist/postprocess/citation-transform.js +176 -0
- package/dist/postprocess/citation-transform.js.map +1 -0
- package/dist/postprocess/dfn-index.d.ts +16 -0
- package/dist/postprocess/dfn-index.d.ts.map +1 -0
- package/dist/postprocess/dfn-index.js +72 -0
- package/dist/postprocess/dfn-index.js.map +1 -0
- package/dist/postprocess/dfn-resolve.d.ts +15 -0
- package/dist/postprocess/dfn-resolve.d.ts.map +1 -0
- package/dist/postprocess/dfn-resolve.js +257 -0
- package/dist/postprocess/dfn-resolve.js.map +1 -0
- package/dist/postprocess/index.d.ts +15 -0
- package/dist/postprocess/index.d.ts.map +1 -0
- package/dist/postprocess/index.js +36 -0
- package/dist/postprocess/index.js.map +1 -0
- package/dist/postprocess/plugins/citation-transform.d.ts +19 -0
- package/dist/postprocess/plugins/citation-transform.d.ts.map +1 -0
- package/dist/postprocess/plugins/citation-transform.js +179 -0
- package/dist/postprocess/plugins/citation-transform.js.map +1 -0
- package/dist/postprocess/plugins/dfn-index.d.ts +16 -0
- package/dist/postprocess/plugins/dfn-index.d.ts.map +1 -0
- package/dist/postprocess/plugins/dfn-index.js +76 -0
- package/dist/postprocess/plugins/dfn-index.js.map +1 -0
- package/dist/postprocess/plugins/reference-resolve.d.ts +19 -0
- package/dist/postprocess/plugins/reference-resolve.d.ts.map +1 -0
- package/dist/postprocess/plugins/reference-resolve.js +103 -0
- package/dist/postprocess/plugins/reference-resolve.js.map +1 -0
- package/dist/postprocess/plugins/section-id.d.ts +16 -0
- package/dist/postprocess/plugins/section-id.d.ts.map +1 -0
- package/dist/postprocess/plugins/section-id.js +116 -0
- package/dist/postprocess/plugins/section-id.js.map +1 -0
- package/dist/postprocess/plugins/walk-ast.d.ts +38 -0
- package/dist/postprocess/plugins/walk-ast.d.ts.map +1 -0
- package/dist/postprocess/plugins/walk-ast.js +92 -0
- package/dist/postprocess/plugins/walk-ast.js.map +1 -0
- package/dist/postprocess/reference-resolve.d.ts +19 -0
- package/dist/postprocess/reference-resolve.d.ts.map +1 -0
- package/dist/postprocess/reference-resolve.js +105 -0
- package/dist/postprocess/reference-resolve.js.map +1 -0
- package/dist/postprocess/walk-ast.d.ts +38 -0
- package/dist/postprocess/walk-ast.d.ts.map +1 -0
- package/dist/postprocess/walk-ast.js +94 -0
- package/dist/postprocess/walk-ast.js.map +1 -0
- package/dist/preprocess/__tests__/pipeline.test.d.ts +5 -0
- package/dist/preprocess/__tests__/pipeline.test.d.ts.map +1 -0
- package/dist/preprocess/__tests__/pipeline.test.js +188 -0
- package/dist/preprocess/__tests__/pipeline.test.js.map +1 -0
- package/dist/preprocess/__tests__/resolver.test.d.ts +5 -0
- package/dist/preprocess/__tests__/resolver.test.d.ts.map +1 -0
- package/dist/preprocess/__tests__/resolver.test.js +165 -0
- package/dist/preprocess/__tests__/resolver.test.js.map +1 -0
- package/dist/preprocess/__tests__/scan-html.test.d.ts +5 -0
- package/dist/preprocess/__tests__/scan-html.test.d.ts.map +1 -0
- package/dist/preprocess/__tests__/scan-html.test.js +99 -0
- package/dist/preprocess/__tests__/scan-html.test.js.map +1 -0
- package/dist/preprocess/__tests__/scan-markdown.test.d.ts +5 -0
- package/dist/preprocess/__tests__/scan-markdown.test.d.ts.map +1 -0
- package/dist/preprocess/__tests__/scan-markdown.test.js +92 -0
- package/dist/preprocess/__tests__/scan-markdown.test.js.map +1 -0
- package/dist/preprocess/config/doc-config.d.ts +30 -0
- package/dist/preprocess/config/doc-config.d.ts.map +1 -0
- package/dist/preprocess/config/doc-config.js +85 -0
- package/dist/preprocess/config/doc-config.js.map +1 -0
- package/dist/preprocess/config/index.d.ts +9 -0
- package/dist/preprocess/config/index.d.ts.map +1 -0
- package/dist/preprocess/config/index.js +7 -0
- package/dist/preprocess/config/index.js.map +1 -0
- package/dist/preprocess/config/loader.d.ts +61 -0
- package/dist/preprocess/config/loader.d.ts.map +1 -0
- package/dist/preprocess/config/loader.js +40 -0
- package/dist/preprocess/config/loader.js.map +1 -0
- package/dist/preprocess/config/normalize.d.ts +19 -0
- package/dist/preprocess/config/normalize.d.ts.map +1 -0
- package/dist/preprocess/config/normalize.js +106 -0
- package/dist/preprocess/config/normalize.js.map +1 -0
- package/dist/preprocess/config/types.d.ts +40 -0
- package/dist/preprocess/config/types.d.ts.map +1 -0
- package/dist/preprocess/config/types.js +8 -0
- package/dist/preprocess/config/types.js.map +1 -0
- package/dist/preprocess/include/index.d.ts +7 -0
- package/dist/preprocess/include/index.d.ts.map +1 -0
- package/dist/preprocess/include/index.js +7 -0
- package/dist/preprocess/include/index.js.map +1 -0
- package/dist/preprocess/include/resolver.d.ts +40 -0
- package/dist/preprocess/include/resolver.d.ts.map +1 -0
- package/dist/preprocess/include/resolver.js +187 -0
- package/dist/preprocess/include/resolver.js.map +1 -0
- package/dist/preprocess/include/scan-html.d.ts +31 -0
- package/dist/preprocess/include/scan-html.d.ts.map +1 -0
- package/dist/preprocess/include/scan-html.js +100 -0
- package/dist/preprocess/include/scan-html.js.map +1 -0
- package/dist/preprocess/include/scan-markdown.d.ts +31 -0
- package/dist/preprocess/include/scan-markdown.d.ts.map +1 -0
- package/dist/preprocess/include/scan-markdown.js +83 -0
- package/dist/preprocess/include/scan-markdown.js.map +1 -0
- package/dist/preprocess/index.d.ts +16 -0
- package/dist/preprocess/index.d.ts.map +1 -0
- package/dist/preprocess/index.js +16 -0
- package/dist/preprocess/index.js.map +1 -0
- package/dist/preprocess/pipeline.d.ts +57 -0
- package/dist/preprocess/pipeline.d.ts.map +1 -0
- package/dist/preprocess/pipeline.js +100 -0
- package/dist/preprocess/pipeline.js.map +1 -0
- package/dist/preprocess/types.d.ts +197 -0
- package/dist/preprocess/types.d.ts.map +1 -0
- package/dist/preprocess/types.js +22 -0
- package/dist/preprocess/types.js.map +1 -0
- package/dist/types/ast.generated.d.ts +517 -0
- package/dist/types/ast.generated.d.ts.map +1 -0
- package/dist/types/ast.generated.js +66 -0
- package/dist/types/ast.generated.js.map +1 -0
- package/dist/validation/validate.d.ts +86 -0
- package/dist/validation/validate.d.ts.map +1 -0
- package/dist/validation/validate.js +162 -0
- package/dist/validation/validate.js.map +1 -0
- package/dist/workspace/__tests__/sort.test.d.ts +2 -0
- package/dist/workspace/__tests__/sort.test.d.ts.map +1 -0
- package/dist/workspace/__tests__/sort.test.js +122 -0
- package/dist/workspace/__tests__/sort.test.js.map +1 -0
- package/dist/workspace/index.d.ts +8 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +7 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/sort.d.ts +49 -0
- package/dist/workspace/sort.d.ts.map +1 -0
- package/dist/workspace/sort.js +114 -0
- package/dist/workspace/sort.js.map +1 -0
- package/package.json +46 -81
- package/schema/spec-ast.schema.json +1440 -0
- package/bin/speculator.mjs +0 -76
- package/dist/browser.cjs +0 -1693
- package/dist/browser.d.cts +0 -416
- package/dist/browser.d.ts +0 -416
- package/dist/browser.js +0 -36
- package/dist/chunk-KC3NVWHK.js +0 -28
- package/dist/chunk-ONLMOJIJ.js +0 -1649
- package/dist/cli/export-assertions.cjs +0 -1713
- package/dist/cli/export-assertions.d.cts +0 -25
- package/dist/cli/export-assertions.d.ts +0 -25
- package/dist/cli/export-assertions.js +0 -107
- package/dist/node.cjs +0 -1715
- package/dist/node.d.cts +0 -17
- package/dist/node.d.ts +0 -17
- package/dist/node.js +0 -40
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Include Resolver
|
|
3
|
+
*
|
|
4
|
+
* Recursively resolves includes from an entry file, building the IncludeGraph
|
|
5
|
+
* and producing ordered SourceUnits for the composite document.
|
|
6
|
+
*
|
|
7
|
+
* Key behaviors:
|
|
8
|
+
* - Deterministic order: includes are processed in encounter order
|
|
9
|
+
* - Cycle detection: prevents infinite loops with clear diagnostics
|
|
10
|
+
* - Content splitting: preserves sourcePos.file for each fragment
|
|
11
|
+
*/
|
|
12
|
+
import { isFileNotFoundError } from '#src/file-provider/types';
|
|
13
|
+
import { inferFormat, createDiagnostic } from '#src/preprocess/types';
|
|
14
|
+
import { scanMarkdownIncludes } from '#src/preprocess/include/scan-markdown';
|
|
15
|
+
import { scanHtmlIncludes } from '#src/preprocess/include/scan-html';
|
|
16
|
+
/**
|
|
17
|
+
* Count lines up to an offset
|
|
18
|
+
*/
|
|
19
|
+
function countLinesUpTo(content, offset) {
|
|
20
|
+
let lines = 1;
|
|
21
|
+
for (let i = 0; i < offset && i < content.length; i++) {
|
|
22
|
+
if (content[i] === '\n') {
|
|
23
|
+
lines++;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return lines;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Scan content for includes based on format
|
|
30
|
+
*/
|
|
31
|
+
function scanIncludes(content, file, format) {
|
|
32
|
+
return format === 'markdown'
|
|
33
|
+
? scanMarkdownIncludes(content, file)
|
|
34
|
+
: scanHtmlIncludes(content, file);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Split content at include points and recursively resolve
|
|
38
|
+
*
|
|
39
|
+
* Returns SourceUnits in document order (includes expanded in-place)
|
|
40
|
+
*/
|
|
41
|
+
async function resolveFile(file, format, ctx) {
|
|
42
|
+
const { fileProvider, includeGraph, diagnostics, activePath, visited } = ctx;
|
|
43
|
+
// Cycle detection
|
|
44
|
+
if (activePath.has(file)) {
|
|
45
|
+
const cycle = [...activePath, file];
|
|
46
|
+
diagnostics.push(createDiagnostic('error', 'include-cycle', `Include cycle detected: ${cycle.join(' → ')}`, file));
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
// Check if already processed (for diamond includes - A includes B and C, both include D)
|
|
50
|
+
const cached = visited.get(file);
|
|
51
|
+
if (cached) {
|
|
52
|
+
// Return a single unit for previously visited file
|
|
53
|
+
return [{
|
|
54
|
+
file,
|
|
55
|
+
format: cached.format,
|
|
56
|
+
content: cached.content,
|
|
57
|
+
startLine: 1,
|
|
58
|
+
}];
|
|
59
|
+
}
|
|
60
|
+
// Read file
|
|
61
|
+
let content;
|
|
62
|
+
try {
|
|
63
|
+
content = await fileProvider.readText(file);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (isFileNotFoundError(error)) {
|
|
67
|
+
diagnostics.push(createDiagnostic('error', 'include-not-found', `Included file not found: ${file}`, file));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
diagnostics.push(createDiagnostic('error', 'include-not-found', `Failed to read included file: ${file} - ${error instanceof Error ? error.message : String(error)}`, file));
|
|
71
|
+
}
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
// Cache for diamond include handling
|
|
75
|
+
visited.set(file, { content, format });
|
|
76
|
+
// Mark as active for cycle detection
|
|
77
|
+
activePath.add(file);
|
|
78
|
+
try {
|
|
79
|
+
// Scan for includes
|
|
80
|
+
const includes = scanIncludes(content, file, format);
|
|
81
|
+
// Record in include graph
|
|
82
|
+
if (includes.length > 0) {
|
|
83
|
+
const edges = includes.map(inc => ({
|
|
84
|
+
target: fileProvider.resolve(file, inc.relativePath),
|
|
85
|
+
sourcePos: inc.sourcePos,
|
|
86
|
+
}));
|
|
87
|
+
includeGraph.set(file, edges);
|
|
88
|
+
}
|
|
89
|
+
// If no includes, return single unit
|
|
90
|
+
if (includes.length === 0) {
|
|
91
|
+
return [{
|
|
92
|
+
file,
|
|
93
|
+
format,
|
|
94
|
+
content,
|
|
95
|
+
startLine: 1,
|
|
96
|
+
}];
|
|
97
|
+
}
|
|
98
|
+
// Split content at include points and recursively resolve
|
|
99
|
+
const units = [];
|
|
100
|
+
let lastEnd = 0;
|
|
101
|
+
for (const include of includes) {
|
|
102
|
+
// Add content before this include
|
|
103
|
+
if (include.startOffset > lastEnd) {
|
|
104
|
+
const beforeContent = content.slice(lastEnd, include.startOffset);
|
|
105
|
+
if (beforeContent.trim()) {
|
|
106
|
+
units.push({
|
|
107
|
+
file,
|
|
108
|
+
format,
|
|
109
|
+
content: beforeContent,
|
|
110
|
+
startLine: countLinesUpTo(content, lastEnd),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Resolve the included file
|
|
115
|
+
const includedPath = fileProvider.resolve(file, include.relativePath);
|
|
116
|
+
const includedFormat = include.format ?? inferFormat(include.relativePath);
|
|
117
|
+
const includedUnits = await resolveFile(includedPath, includedFormat, ctx);
|
|
118
|
+
units.push(...includedUnits);
|
|
119
|
+
lastEnd = include.endOffset;
|
|
120
|
+
// Skip trailing newline after directive if present
|
|
121
|
+
if (content[lastEnd] === '\n') {
|
|
122
|
+
lastEnd++;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Add remaining content after last include
|
|
126
|
+
if (lastEnd < content.length) {
|
|
127
|
+
const afterContent = content.slice(lastEnd);
|
|
128
|
+
if (afterContent.trim()) {
|
|
129
|
+
units.push({
|
|
130
|
+
file,
|
|
131
|
+
format,
|
|
132
|
+
content: afterContent,
|
|
133
|
+
startLine: countLinesUpTo(content, lastEnd),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return units;
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
// Remove from active path when done
|
|
141
|
+
activePath.delete(file);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Resolve all includes from an entry file
|
|
146
|
+
*
|
|
147
|
+
* @param entry - Canonical path to entry file
|
|
148
|
+
* @param entryFormat - Format of entry file (inferred if not provided)
|
|
149
|
+
* @param fileProvider - File provider for reading files
|
|
150
|
+
* @returns CompositeSource with resolved includes and diagnostics
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* const { source, diagnostics } = await resolveIncludes(
|
|
155
|
+
* '/spec/format.md',
|
|
156
|
+
* 'markdown',
|
|
157
|
+
* fileProvider
|
|
158
|
+
* );
|
|
159
|
+
*
|
|
160
|
+
* // source.units is ordered by document flow
|
|
161
|
+
* for (const unit of source.units) {
|
|
162
|
+
* console.log(`${unit.file}:${unit.startLine}`);
|
|
163
|
+
* }
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export async function resolveIncludes(entry, entryFormat, fileProvider) {
|
|
167
|
+
const canonicalEntry = fileProvider.canonicalize(entry);
|
|
168
|
+
const format = entryFormat ?? inferFormat(canonicalEntry);
|
|
169
|
+
const ctx = {
|
|
170
|
+
fileProvider,
|
|
171
|
+
includeGraph: new Map(),
|
|
172
|
+
diagnostics: [],
|
|
173
|
+
activePath: new Set(),
|
|
174
|
+
visited: new Map(),
|
|
175
|
+
};
|
|
176
|
+
const units = await resolveFile(canonicalEntry, format, ctx);
|
|
177
|
+
return {
|
|
178
|
+
source: {
|
|
179
|
+
entryFile: canonicalEntry,
|
|
180
|
+
entryFormat: format,
|
|
181
|
+
units,
|
|
182
|
+
includeGraph: ctx.includeGraph,
|
|
183
|
+
},
|
|
184
|
+
diagnostics: ctx.diagnostics,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../src/preprocess/include/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAU/D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE;;GAEG;AACH,SAAS,cAAc,CAAC,OAAe,EAAE,MAAc;IACnD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpD,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACtB,KAAK,EAAE,CAAC;QACZ,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,OAAe,EAAE,IAAY,EAAE,MAAoB;IACrE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Ac,CAAC,OAAO,EAAE,OAAO,CAAC;iBAC9C,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;YAAS,CAAC;QACP,oCAAoC;QACpC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACjC,KAAa,EACb,WAAqC,EACrC,YAA0B;IAE1B,MAAM,cAAc,GAAG,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,WAAW,IAAI,WAAW,CAAC,cAAc,CAAC,CAAC;IAE1D,MAAM,GAAG,GAAmB;QACxB,YAAY;QACZ,YAAY,EAAE,IAAI,GAAG,EAAE;QACvB,WAAW,EAAE,EAAE;QACf,UAAU,EAAE,IAAI,GAAG,EAAE;QACrB,OAAO,EAAE,IAAI,GAAG,EAAE;KACrB,CAAC;IAEF,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAE7D,OAAO;QACH,MAAM,EAAE;YACJ,SAAS,EAAE,cAAc;YACzB,WAAW,EAAE,MAAM;YACnB,KAAK;YACL,YAAY,EAAE,GAAG,CAAC,YAAY;SACjC;QACD,WAAW,EAAE,GAAG,CAAC,WAAW;KAC/B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML Include Scanner
|
|
3
|
+
*
|
|
4
|
+
* Scans HTML content for data-include sections.
|
|
5
|
+
*
|
|
6
|
+
* Format: <section data-include="./path.md" data-include-format="markdown"></section>
|
|
7
|
+
*
|
|
8
|
+
* The scanner uses a simple regex-based approach that handles the common cases
|
|
9
|
+
* without requiring a full HTML parser dependency.
|
|
10
|
+
*/
|
|
11
|
+
import type { IncludeDirective } from '#src/preprocess/types';
|
|
12
|
+
/**
|
|
13
|
+
* Scan HTML content for include directives
|
|
14
|
+
*
|
|
15
|
+
* @param content - HTML file content
|
|
16
|
+
* @param file - Canonical path of the file being scanned
|
|
17
|
+
* @returns Array of include directives in encounter order
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const content = `
|
|
22
|
+
* <body>
|
|
23
|
+
* <section data-include="./intro.md" data-include-format="markdown"></section>
|
|
24
|
+
* </body>
|
|
25
|
+
* `;
|
|
26
|
+
* const includes = scanHtmlIncludes(content, '/spec/format.html');
|
|
27
|
+
* // Returns: [{ relativePath: './intro.md', format: 'markdown', ... }]
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function scanHtmlIncludes(content: string, file: string): IncludeDirective[];
|
|
31
|
+
//# sourceMappingURL=scan-html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-html.d.ts","sourceRoot":"","sources":["../../../src/preprocess/include/scan-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAgB,MAAM,uBAAuB,CAAC;AAiD5E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAkClF"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML Include Scanner
|
|
3
|
+
*
|
|
4
|
+
* Scans HTML content for data-include sections.
|
|
5
|
+
*
|
|
6
|
+
* Format: <section data-include="./path.md" data-include-format="markdown"></section>
|
|
7
|
+
*
|
|
8
|
+
* The scanner uses a simple regex-based approach that handles the common cases
|
|
9
|
+
* without requiring a full HTML parser dependency.
|
|
10
|
+
*/
|
|
11
|
+
import { inferFormat } from '#src/preprocess/types';
|
|
12
|
+
/**
|
|
13
|
+
* Regular expression to match HTML include sections
|
|
14
|
+
*
|
|
15
|
+
* Matches elements with data-include attribute.
|
|
16
|
+
* Captures the full opening tag to extract both path and optional format.
|
|
17
|
+
*
|
|
18
|
+
* This is intentionally simple and doesn't handle all edge cases
|
|
19
|
+
* (e.g., attributes split across lines, attribute values with escaped quotes).
|
|
20
|
+
* For complex HTML, a proper parser would be needed.
|
|
21
|
+
*/
|
|
22
|
+
const DATA_INCLUDE_REGEX = /<([a-z][a-z0-9]*)\s+[^>]*data-include\s*=\s*["']([^"']+)["'][^>]*>/gi;
|
|
23
|
+
/**
|
|
24
|
+
* Extract data-include-format from a tag string
|
|
25
|
+
*/
|
|
26
|
+
function extractFormat(tagString) {
|
|
27
|
+
const formatMatch = tagString.match(/data-include-format\s*=\s*["']([^"']+)["']/i);
|
|
28
|
+
if (formatMatch) {
|
|
29
|
+
const format = formatMatch[1].toLowerCase();
|
|
30
|
+
if (format === 'markdown' || format === 'html') {
|
|
31
|
+
return format;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Calculate line and column from content offset
|
|
38
|
+
*/
|
|
39
|
+
function getLineColumn(content, offset) {
|
|
40
|
+
let line = 1;
|
|
41
|
+
let lastNewline = -1;
|
|
42
|
+
for (let i = 0; i < offset && i < content.length; i++) {
|
|
43
|
+
if (content[i] === '\n') {
|
|
44
|
+
line++;
|
|
45
|
+
lastNewline = i;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
line,
|
|
50
|
+
column: offset - lastNewline,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Scan HTML content for include directives
|
|
55
|
+
*
|
|
56
|
+
* @param content - HTML file content
|
|
57
|
+
* @param file - Canonical path of the file being scanned
|
|
58
|
+
* @returns Array of include directives in encounter order
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const content = `
|
|
63
|
+
* <body>
|
|
64
|
+
* <section data-include="./intro.md" data-include-format="markdown"></section>
|
|
65
|
+
* </body>
|
|
66
|
+
* `;
|
|
67
|
+
* const includes = scanHtmlIncludes(content, '/spec/format.html');
|
|
68
|
+
* // Returns: [{ relativePath: './intro.md', format: 'markdown', ... }]
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export function scanHtmlIncludes(content, file) {
|
|
72
|
+
const directives = [];
|
|
73
|
+
// Reset regex state
|
|
74
|
+
DATA_INCLUDE_REGEX.lastIndex = 0;
|
|
75
|
+
let match;
|
|
76
|
+
while ((match = DATA_INCLUDE_REGEX.exec(content)) !== null) {
|
|
77
|
+
const fullMatch = match[0];
|
|
78
|
+
const relativePath = match[2];
|
|
79
|
+
const startOffset = match.index;
|
|
80
|
+
const endOffset = match.index + fullMatch.length;
|
|
81
|
+
const { line, column } = getLineColumn(content, startOffset);
|
|
82
|
+
// Try to get explicit format, fall back to inference
|
|
83
|
+
const explicitFormat = extractFormat(fullMatch);
|
|
84
|
+
const format = explicitFormat ?? inferFormat(relativePath);
|
|
85
|
+
directives.push({
|
|
86
|
+
relativePath,
|
|
87
|
+
format,
|
|
88
|
+
sourcePos: {
|
|
89
|
+
file,
|
|
90
|
+
line,
|
|
91
|
+
column,
|
|
92
|
+
offset: startOffset,
|
|
93
|
+
},
|
|
94
|
+
startOffset,
|
|
95
|
+
endOffset,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return directives;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=scan-html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-html.js","sourceRoot":"","sources":["../../../src/preprocess/include/scan-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,kBAAkB,GAAG,sEAAsE,CAAC;AAElG;;GAEG;AACH,SAAS,aAA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AAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC;QAChC,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC;QAEjD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAE7D,qDAAqD;QACrD,MAAM,cAAc,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,cAAc,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC;QAE3D,UAAU,CAAC,IAAI,CAAC;YACZ,YAAY;YACZ,MAAM;YACN,SAAS,EAAE;gBACP,IAAI;gBACJ,IAAI;gBACJ,MAAM;gBACN,MAAM,EAAE,WAAW;aACtB;YACD,WAAW;YACX,SAAS;SACZ,CAAC,CAAC;IACP,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown Include Scanner
|
|
3
|
+
*
|
|
4
|
+
* Scans markdown content for :::include directives.
|
|
5
|
+
*
|
|
6
|
+
* Format: :::include ./path/to/file.md :::
|
|
7
|
+
*
|
|
8
|
+
* The scanner preserves exact position information for each directive
|
|
9
|
+
* to enable accurate source mapping after include resolution.
|
|
10
|
+
*/
|
|
11
|
+
import type { IncludeDirective } from '#src/preprocess/types';
|
|
12
|
+
/**
|
|
13
|
+
* Scan markdown content for include directives
|
|
14
|
+
*
|
|
15
|
+
* @param content - Markdown file content
|
|
16
|
+
* @param file - Canonical path of the file being scanned
|
|
17
|
+
* @returns Array of include directives in encounter order
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const content = `
|
|
22
|
+
* # Title
|
|
23
|
+
* :::include ./intro.md :::
|
|
24
|
+
* ## Next Section
|
|
25
|
+
* `;
|
|
26
|
+
* const includes = scanMarkdownIncludes(content, '/spec/format.md');
|
|
27
|
+
* // Returns: [{ relativePath: './intro.md', ... }]
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function scanMarkdownIncludes(content: string, file: string): IncludeDirective[];
|
|
31
|
+
//# sourceMappingURL=scan-markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-markdown.d.ts","sourceRoot":"","sources":["../../../src/preprocess/include/scan-markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAmC9D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAAE,CA6BtF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown Include Scanner
|
|
3
|
+
*
|
|
4
|
+
* Scans markdown content for :::include directives.
|
|
5
|
+
*
|
|
6
|
+
* Format: :::include ./path/to/file.md :::
|
|
7
|
+
*
|
|
8
|
+
* The scanner preserves exact position information for each directive
|
|
9
|
+
* to enable accurate source mapping after include resolution.
|
|
10
|
+
*/
|
|
11
|
+
import { inferFormat } from '#src/preprocess/types';
|
|
12
|
+
/**
|
|
13
|
+
* Regular expression to match markdown include directives
|
|
14
|
+
*
|
|
15
|
+
* Matches: :::include ./path/to/file.md :::
|
|
16
|
+
*
|
|
17
|
+
* Captures:
|
|
18
|
+
* - Group 1: file path (required)
|
|
19
|
+
*
|
|
20
|
+
* The directive must be on its own line.
|
|
21
|
+
*/
|
|
22
|
+
const INCLUDE_REGEX = /^[ \t]*:::include\s+(\S+)\s*:::\s*$/gm;
|
|
23
|
+
/**
|
|
24
|
+
* Calculate line and column from content offset
|
|
25
|
+
*/
|
|
26
|
+
function getLineColumn(content, offset) {
|
|
27
|
+
let line = 1;
|
|
28
|
+
let lastNewline = -1;
|
|
29
|
+
for (let i = 0; i < offset && i < content.length; i++) {
|
|
30
|
+
if (content[i] === '\n') {
|
|
31
|
+
line++;
|
|
32
|
+
lastNewline = i;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
line,
|
|
37
|
+
column: offset - lastNewline,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Scan markdown content for include directives
|
|
42
|
+
*
|
|
43
|
+
* @param content - Markdown file content
|
|
44
|
+
* @param file - Canonical path of the file being scanned
|
|
45
|
+
* @returns Array of include directives in encounter order
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const content = `
|
|
50
|
+
* # Title
|
|
51
|
+
* :::include ./intro.md :::
|
|
52
|
+
* ## Next Section
|
|
53
|
+
* `;
|
|
54
|
+
* const includes = scanMarkdownIncludes(content, '/spec/format.md');
|
|
55
|
+
* // Returns: [{ relativePath: './intro.md', ... }]
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export function scanMarkdownIncludes(content, file) {
|
|
59
|
+
const directives = [];
|
|
60
|
+
// Reset regex state for each call
|
|
61
|
+
INCLUDE_REGEX.lastIndex = 0;
|
|
62
|
+
let match;
|
|
63
|
+
while ((match = INCLUDE_REGEX.exec(content)) !== null) {
|
|
64
|
+
const relativePath = match[1];
|
|
65
|
+
const startOffset = match.index;
|
|
66
|
+
const endOffset = match.index + match[0].length;
|
|
67
|
+
const { line, column } = getLineColumn(content, startOffset);
|
|
68
|
+
directives.push({
|
|
69
|
+
relativePath,
|
|
70
|
+
format: inferFormat(relativePath),
|
|
71
|
+
sourcePos: {
|
|
72
|
+
file,
|
|
73
|
+
line,
|
|
74
|
+
column,
|
|
75
|
+
offset: startOffset,
|
|
76
|
+
},
|
|
77
|
+
startOffset,
|
|
78
|
+
endOffset,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return directives;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=scan-markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-markdown.js","sourceRoot":"","sources":["../../../src/preprocess/include/scan-markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,aAAa,GAAG,uCAAuC,CAAC;AAE9D;;GAEG;AACH,SAAS,aAAa,CAAC,OAAe,EAAE,MAAc;IAClD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC;IAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpD,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACtB,IAAI,EAAE,CAAC;YACP,WAAW,GAAG,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;IAED,OAAO;QACH,IAAI;QACJ,MAAM,EAAE,MAAM,GAAG,WAAW;KAC/B,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,IAAY;IAC9D,MAAM,UAAU,GAAuB,EAAE,CAAC;IAE1C,kCAAkC;IAClC,aAAa,CAAC,SAAS,GAAG,CAAC,CAAC;IAE5B,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACpD,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC;QAChC,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAEhD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAE7D,UAAU,CAAC,IAAI,CAAC;YACZ,YAAY;YACZ,MAAM,EAAE,WAAW,CAAC,YAAY,CAAC;YACjC,SAAS,EAAE;gBACP,IAAI;gBACJ,IAAI;gBACJ,MAAM;gBACN,MAAM,EAAE,WAAW;aACtB;YACD,WAAW;YACX,SAAS;SACZ,CAAC,CAAC;IACP,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preprocess Module - Public API
|
|
3
|
+
*
|
|
4
|
+
* The preprocess stage handles:
|
|
5
|
+
* - Loading and normalizing spec configuration
|
|
6
|
+
* - Resolving includes to produce ordered SourceUnits
|
|
7
|
+
* - Preserving source file information for accurate error reporting
|
|
8
|
+
*/
|
|
9
|
+
export { preprocess, validateEntry } from '#src/preprocess/pipeline';
|
|
10
|
+
export type { PreprocessOptions } from '#src/preprocess/pipeline';
|
|
11
|
+
export type { SourceFormat, IncludeDirective, SourceUnit, IncludeGraph, IncludeEdge, CompositeSource, PersonEntry, SpecConfig, PreprocessedSpec, DiagnosticSeverity, PreprocessDiagnosticCode, Diagnostic, PreprocessResult, } from '#src/preprocess/types';
|
|
12
|
+
export { inferFormat, createDiagnostic } from '#src/preprocess/types';
|
|
13
|
+
export { loadRespecConfig, normalizeRespecConfig, createDefaultConfig, } from '#src/preprocess/config/index';
|
|
14
|
+
export type { RawRespecConfig, RawPersonEntry } from '#src/preprocess/config/index';
|
|
15
|
+
export { scanMarkdownIncludes, scanHtmlIncludes, resolveIncludes, } from '#src/preprocess/include/index';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/preprocess/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,YAAY,EACR,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,eAAe,EACf,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,UAAU,EACV,gBAAgB,GACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGtE,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,GACtB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGpF,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAClB,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preprocess Module - Public API
|
|
3
|
+
*
|
|
4
|
+
* The preprocess stage handles:
|
|
5
|
+
* - Loading and normalizing spec configuration
|
|
6
|
+
* - Resolving includes to produce ordered SourceUnits
|
|
7
|
+
* - Preserving source file information for accurate error reporting
|
|
8
|
+
*/
|
|
9
|
+
// Main orchestrator
|
|
10
|
+
export { preprocess, validateEntry } from '#src/preprocess/pipeline';
|
|
11
|
+
export { inferFormat, createDiagnostic } from '#src/preprocess/types';
|
|
12
|
+
// Config submodule (for advanced use)
|
|
13
|
+
export { loadRespecConfig, normalizeRespecConfig, createDefaultConfig, } from '#src/preprocess/config/index';
|
|
14
|
+
// Include submodule (for advanced use)
|
|
15
|
+
export { scanMarkdownIncludes, scanHtmlIncludes, resolveIncludes, } from '#src/preprocess/include/index';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/preprocess/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oBAAoB;AACpB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAoBrE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,sCAAsC;AACtC,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,GACtB,MAAM,8BAA8B,CAAC;AAGtC,uCAAuC;AACvC,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAClB,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preprocess Pipeline
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates configuration loading and include resolution.
|
|
5
|
+
* This is the main entry point for the preprocess stage.
|
|
6
|
+
*/
|
|
7
|
+
import type { FileProvider } from '#src/file-provider/types';
|
|
8
|
+
import type { SourceFormat, PreprocessResult, Diagnostic } from '#src/preprocess/types';
|
|
9
|
+
/**
|
|
10
|
+
* Options for preprocessing a specification
|
|
11
|
+
*/
|
|
12
|
+
export interface PreprocessOptions {
|
|
13
|
+
/** Path to entry file (format.md or format.html) */
|
|
14
|
+
entry: string;
|
|
15
|
+
/** Optional explicit format (inferred from extension if not provided) */
|
|
16
|
+
entryFormat?: SourceFormat;
|
|
17
|
+
/** Path to config file (optional) */
|
|
18
|
+
configPath?: string;
|
|
19
|
+
/** File provider for reading files */
|
|
20
|
+
fileProvider: FileProvider;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Preprocess a specification document
|
|
24
|
+
*
|
|
25
|
+
* Loads configuration (if provided) and resolves all includes
|
|
26
|
+
* to produce a PreprocessedSpec ready for parsing.
|
|
27
|
+
*
|
|
28
|
+
* @param options - Preprocess options
|
|
29
|
+
* @returns PreprocessResult with spec and diagnostics
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const result = await preprocess({
|
|
34
|
+
* entry: '/specs/my-spec/format.md',
|
|
35
|
+
* configPath: '/specs/my-spec/config.respec.json',
|
|
36
|
+
* fileProvider: new NodeFileProvider(),
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* if (result.hasErrors) {
|
|
40
|
+
* console.error('Preprocess errors:', result.diagnostics);
|
|
41
|
+
* } else {
|
|
42
|
+
* // result.result contains PreprocessedSpec
|
|
43
|
+
* for (const unit of result.result.source.units) {
|
|
44
|
+
* console.log(`Processing: ${unit.file}`);
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function preprocess(options: PreprocessOptions): Promise<PreprocessResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Quick check if an entry file exists and is readable
|
|
52
|
+
*/
|
|
53
|
+
export declare function validateEntry(entry: string, fileProvider: FileProvider): Promise<{
|
|
54
|
+
valid: boolean;
|
|
55
|
+
diagnostics: Diagnostic[];
|
|
56
|
+
}>;
|
|
57
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/preprocess/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACR,YAAY,EAEZ,gBAAgB,EAChB,UAAU,EACb,MAAM,uBAAuB,CAAC;AAK/B;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IAEd,yEAAyE;IACzE,WAAW,CAAC,EAAE,YAAY,CAAC;IAE3B,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,sCAAsC;IACtC,YAAY,EAAE,YAAY,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA+CtF;AAED;;GAEG;AACH,wBAAsB,aAAa,CAC/B,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,YAAY,GAC3B,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC,CAgBxD"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preprocess Pipeline
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates configuration loading and include resolution.
|
|
5
|
+
* This is the main entry point for the preprocess stage.
|
|
6
|
+
*/
|
|
7
|
+
import { inferFormat } from '#src/preprocess/types';
|
|
8
|
+
import { loadRespecConfig, normalizeRespecConfig, createDefaultConfig } from '#src/preprocess/config/index';
|
|
9
|
+
import { resolveIncludes } from '#src/preprocess/include/index';
|
|
10
|
+
/**
|
|
11
|
+
* Preprocess a specification document
|
|
12
|
+
*
|
|
13
|
+
* Loads configuration (if provided) and resolves all includes
|
|
14
|
+
* to produce a PreprocessedSpec ready for parsing.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Preprocess options
|
|
17
|
+
* @returns PreprocessResult with spec and diagnostics
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const result = await preprocess({
|
|
22
|
+
* entry: '/specs/my-spec/format.md',
|
|
23
|
+
* configPath: '/specs/my-spec/config.respec.json',
|
|
24
|
+
* fileProvider: new NodeFileProvider(),
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* if (result.hasErrors) {
|
|
28
|
+
* console.error('Preprocess errors:', result.diagnostics);
|
|
29
|
+
* } else {
|
|
30
|
+
* // result.result contains PreprocessedSpec
|
|
31
|
+
* for (const unit of result.result.source.units) {
|
|
32
|
+
* console.log(`Processing: ${unit.file}`);
|
|
33
|
+
* }
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export async function preprocess(options) {
|
|
38
|
+
const { entry, entryFormat, configPath, fileProvider } = options;
|
|
39
|
+
const diagnostics = [];
|
|
40
|
+
// Canonicalize entry path
|
|
41
|
+
const canonicalEntry = fileProvider.canonicalize(entry);
|
|
42
|
+
const format = entryFormat ?? inferFormat(canonicalEntry);
|
|
43
|
+
// Load config if provided
|
|
44
|
+
let config;
|
|
45
|
+
if (configPath) {
|
|
46
|
+
const configResult = await loadRespecConfig(fileProvider, configPath);
|
|
47
|
+
diagnostics.push(...configResult.diagnostics);
|
|
48
|
+
if (configResult.config) {
|
|
49
|
+
config = normalizeRespecConfig(configResult.config);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Config load failed, use defaults but continue
|
|
53
|
+
config = createDefaultConfig();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
config = createDefaultConfig();
|
|
58
|
+
}
|
|
59
|
+
// Resolve includes
|
|
60
|
+
const includeResult = await resolveIncludes(canonicalEntry, format, fileProvider);
|
|
61
|
+
diagnostics.push(...includeResult.diagnostics);
|
|
62
|
+
// Check for errors
|
|
63
|
+
const hasErrors = diagnostics.some(d => d.severity === 'error');
|
|
64
|
+
// Even with errors, return partial result if we have units
|
|
65
|
+
if (includeResult.source.units.length === 0 && hasErrors) {
|
|
66
|
+
return {
|
|
67
|
+
diagnostics,
|
|
68
|
+
hasErrors,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
result: {
|
|
73
|
+
config,
|
|
74
|
+
source: includeResult.source,
|
|
75
|
+
},
|
|
76
|
+
diagnostics,
|
|
77
|
+
hasErrors,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Quick check if an entry file exists and is readable
|
|
82
|
+
*/
|
|
83
|
+
export async function validateEntry(entry, fileProvider) {
|
|
84
|
+
const diagnostics = [];
|
|
85
|
+
const canonicalEntry = fileProvider.canonicalize(entry);
|
|
86
|
+
try {
|
|
87
|
+
await fileProvider.readText(canonicalEntry);
|
|
88
|
+
return { valid: true, diagnostics };
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
diagnostics.push({
|
|
92
|
+
severity: 'error',
|
|
93
|
+
code: 'include-not-found',
|
|
94
|
+
message: `Entry file not found: ${canonicalEntry}`,
|
|
95
|
+
file: canonicalEntry,
|
|
96
|
+
});
|
|
97
|
+
return { valid: false, diagnostics };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=pipeline.js.map
|