deepdoc 2.3.0__tar.gz → 2.3.2__tar.gz
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.
- {deepdoc-2.3.0 → deepdoc-2.3.2}/PKG-INFO +1 -1
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/__init__.py +1 -1
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/generator/post_processors.py +44 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/site/builder/scaffold_files.py +47 -7
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc.egg-info/PKG-INFO +1 -1
- {deepdoc-2.3.0 → deepdoc-2.3.2}/pyproject.toml +1 -1
- {deepdoc-2.3.0 → deepdoc-2.3.2}/LICENSE +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/README.md +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/__main__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/benchmark_v2.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/call_graph.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/changelog_writer.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/__init__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/answer_mixin.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/chunker.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/constants.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/deep_research.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/docs_summary.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/embeddings.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/indexer.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/linking.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/live_fallback_mixin.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/persistence.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/providers.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/retrieval_mixin.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/routes.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/scaffold.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/service.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/settings.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/source_archive.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/symbol_index.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/chatbot/types.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/cli.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/config.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/generator/__init__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/generator/evidence.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/generator/generation.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/generator/validation.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/llm/__init__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/llm/client.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/llm/json_utils.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/llm/litellm_compat.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/manifest.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/openapi.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/__init__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/api_detector.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/base.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/go_parser.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/js_ts_parser.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/php_parser.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/python_parser.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/registry.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/__init__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/base.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/common.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/detector.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/django.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/express.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/falcon.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/fastify.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/go.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/js_shared.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/laravel.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/nestjs.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/python_shared.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/registry.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/routes/repo_resolver.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/parser/vue_parser.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/persistence_v2.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/pipeline_v2.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/__init__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/bucket_injection.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/bucket_refinement.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/common.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/endpoint_refs.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/engine.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/flow_candidates.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/heuristics.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/nav_shaping.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/specializations.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/topology.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/planner/utils.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/prompts/__init__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/prompts/bucket_types.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/prompts/page_types.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/prompts/selectors.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/prompts/system.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/prompts/update.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/py.typed +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/scanner/__init__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/scanner/artifacts.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/scanner/clustering.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/scanner/common.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/scanner/database.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/scanner/endpoints.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/scanner/integrations.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/scanner/runtime.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/scanner/utils.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/site/__init__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/site/builder/__init__.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/site/builder/chatbot_components.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/site/builder/common.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/site/builder/engine.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/site/builder/mdx_utils.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/site/builder/templates.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/smart_update_v2.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/source_metadata.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/updater_v2.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc/v2_models.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc.egg-info/SOURCES.txt +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc.egg-info/dependency_links.txt +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc.egg-info/entry_points.txt +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc.egg-info/requires.txt +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/deepdoc.egg-info/top_level.txt +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/setup.cfg +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_benchmark_scorecard.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_call_graph.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_changelog.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_chatbot_config.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_chatbot_embeddings.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_chatbot_eval.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_chatbot_index.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_chatbot_persistence.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_chatbot_providers.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_chatbot_query.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_chatbot_relationship.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_chatbot_scaffold.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_chatbot_source_archive.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_classify.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_cli_generate.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_cli_serve.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_cli_update.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_flow_candidates.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_framework_fixtures.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_framework_support.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_fumadocs_builder.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_generation_evidence.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_internal_docs_metadata.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_litellm_compat.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_llm_json_utils.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_parallel_pipeline.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_parser_ranges.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_planner_consolidation.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_planner_granularity.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_route_registry.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_runtime_scan.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_smart_update.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_stale.py +0 -0
- {deepdoc-2.3.0 → deepdoc-2.3.2}/tests/test_state.py +0 -0
|
@@ -421,11 +421,55 @@ def normalize_code_fence_languages(content: str) -> str:
|
|
|
421
421
|
"output": "plaintext",
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
+
# Languages included in Shiki's default bundle (fumadocs uses bundled-all).
|
|
425
|
+
# Anything outside this set falls back to plaintext to avoid build failures.
|
|
426
|
+
_SHIKI_BUNDLED = {
|
|
427
|
+
"abap", "actionscript-3", "ada", "angular-html", "angular-ts",
|
|
428
|
+
"apache", "apex", "apl", "applescript", "ara", "asciidoc", "asm",
|
|
429
|
+
"astro", "awk", "ballerina", "bat", "batch", "beancount", "berry",
|
|
430
|
+
"be", "bibtex", "bicep", "blade", "c", "cadence", "cdc", "clarity",
|
|
431
|
+
"clojure", "clj", "cmake", "cobol", "codeowners", "coffescript",
|
|
432
|
+
"common-lisp", "lisp", "coq", "cpp", "crystal", "csharp", "cs",
|
|
433
|
+
"css", "csv", "cue", "cypher", "d", "dart", "dax", "desktop",
|
|
434
|
+
"diff", "docker", "dockerfile", "dotenv", "dream-maker", "edge",
|
|
435
|
+
"elixir", "elm", "emacs-lisp", "erb", "erlang", "fennel", "fish",
|
|
436
|
+
"fluent", "fortran-fixed-form", "fortran-free-form", "fsharp",
|
|
437
|
+
"gdresource", "gdscript", "gdshader", "genie", "gherkin", "git-commit",
|
|
438
|
+
"git-rebase", "gleam", "glimmer-js", "glimmer-ts", "glsl", "gnuplot",
|
|
439
|
+
"go", "graphql", "gql", "groovy", "hack", "haml", "handlebars", "hbs",
|
|
440
|
+
"haskell", "hcl", "hjson", "hlsl", "html", "html-derivative", "http",
|
|
441
|
+
"hxml", "hy", "imba", "ini", "toml", "java", "javascript", "js",
|
|
442
|
+
"jinja", "jinja-html", "jison", "json", "json5", "jsonc", "jsonl",
|
|
443
|
+
"jsonnet", "jssm", "jsx", "julia", "kotlin", "kusto", "kql", "latex",
|
|
444
|
+
"lean", "less", "liquid", "log", "logo", "lua", "luau", "make",
|
|
445
|
+
"makefile", "markdown", "md", "marko", "matlab", "mdc", "mdx",
|
|
446
|
+
"mermaid", "mipsasm", "mojo", "move", "narrat", "nextflow", "nf",
|
|
447
|
+
"nginx", "nim", "nix", "nushell", "nu", "objective-c", "objc",
|
|
448
|
+
"objective-cpp", "ocaml", "pascal", "perl", "php", "plsql",
|
|
449
|
+
"postcss", "powerquery", "powershell", "ps", "ps1", "prisma",
|
|
450
|
+
"prolog", "proto", "protobuf", "puppet", "purescript", "python",
|
|
451
|
+
"py", "r", "raku", "perl6", "razor", "reg", "regexp", "regex",
|
|
452
|
+
"rel", "riscv", "rst", "ruby", "rb", "rust", "rs", "sas", "sass",
|
|
453
|
+
"scala", "scheme", "scss", "shaderlab", "shader", "shellscript",
|
|
454
|
+
"bash", "sh", "shell", "zsh", "smalltalk", "solidity", "soy",
|
|
455
|
+
"sparql", "splunk", "spl", "sql", "ssh-config", "stata", "stylus",
|
|
456
|
+
"styl", "svelte", "swift", "system-verilog", "systemd", "tasl",
|
|
457
|
+
"tcl", "templ", "terraform", "tex", "toml", "ts", "tsv", "tsx",
|
|
458
|
+
"turtle", "twig", "typescript", "typespec", "typst", "v", "vb",
|
|
459
|
+
"cmd", "verilog", "vhdl", "viml", "vim", "vimscript", "vue",
|
|
460
|
+
"vue-html", "vyper", "wasm", "wenyan", "wgsl", "wikitext",
|
|
461
|
+
"mediawiki", "wolfram", "xml", "xsl", "yaml", "yml", "zenscript",
|
|
462
|
+
"zig", "plaintext",
|
|
463
|
+
}
|
|
464
|
+
|
|
424
465
|
def replace(match: re.Match) -> str:
|
|
425
466
|
indent = match.group(1) or ""
|
|
426
467
|
lang = match.group(2)
|
|
427
468
|
rest = match.group(3) or ""
|
|
428
469
|
normalized = alias_map.get(lang.lower(), lang)
|
|
470
|
+
# Fall back to plaintext for langs not in Shiki's bundle to prevent build failures
|
|
471
|
+
if normalized.lower() not in _SHIKI_BUNDLED:
|
|
472
|
+
normalized = "plaintext"
|
|
429
473
|
return f"{indent}```{normalized}{rest}"
|
|
430
474
|
|
|
431
475
|
return re.sub(
|
|
@@ -1425,9 +1425,7 @@ def _docs_page_tsx() -> str:
|
|
|
1425
1425
|
"""\
|
|
1426
1426
|
import { notFound } from 'next/navigation';
|
|
1427
1427
|
import { DocsBody, DocsPage } from 'fumadocs-ui/page';
|
|
1428
|
-
import { findNeighbour } from 'fumadocs-core/server';
|
|
1429
1428
|
import { docsSource } from '@/lib/source';
|
|
1430
|
-
import { pageTree } from '@/lib/page-tree.generated';
|
|
1431
1429
|
import { getMDXComponents } from '@/mdx-components';
|
|
1432
1430
|
import type { ComponentType } from 'react';
|
|
1433
1431
|
import type { TOCItemType } from 'fumadocs-core/server';
|
|
@@ -1477,10 +1475,9 @@ def _docs_page_tsx() -> str:
|
|
|
1477
1475
|
const prereqs = meta.deepdoc_prereqs ?? [];
|
|
1478
1476
|
const status = meta.deepdoc_status?.trim() || null;
|
|
1479
1477
|
const evidenceRecords = meta.deepdoc_evidence_records ?? [];
|
|
1480
|
-
const { previous, next } = findNeighbour(pageTree, page.url);
|
|
1481
1478
|
|
|
1482
1479
|
return (
|
|
1483
|
-
<DocsPage toc={toc}
|
|
1480
|
+
<DocsPage toc={toc}>
|
|
1484
1481
|
<DocsBody>
|
|
1485
1482
|
{prereqs.length > 0 ? (
|
|
1486
1483
|
<p
|
|
@@ -1655,9 +1652,44 @@ def _mermaid_component_tsx() -> str:
|
|
|
1655
1652
|
"""\
|
|
1656
1653
|
'use client';
|
|
1657
1654
|
|
|
1658
|
-
import { use, useEffect, useId, useState } from 'react';
|
|
1655
|
+
import { Component, use, useEffect, useId, useState } from 'react';
|
|
1656
|
+
import type { ReactNode } from 'react';
|
|
1659
1657
|
import { useTheme } from 'next-themes';
|
|
1660
1658
|
|
|
1659
|
+
// Error boundary so a bad diagram never crashes the whole page
|
|
1660
|
+
class MermaidErrorBoundary extends Component<
|
|
1661
|
+
{ children: ReactNode },
|
|
1662
|
+
{ error: string | null }
|
|
1663
|
+
> {
|
|
1664
|
+
constructor(props: { children: ReactNode }) {
|
|
1665
|
+
super(props);
|
|
1666
|
+
this.state = { error: null };
|
|
1667
|
+
}
|
|
1668
|
+
static getDerivedStateFromError(err: unknown) {
|
|
1669
|
+
return { error: err instanceof Error ? err.message : String(err) };
|
|
1670
|
+
}
|
|
1671
|
+
render() {
|
|
1672
|
+
if (this.state.error) {
|
|
1673
|
+
return (
|
|
1674
|
+
<pre
|
|
1675
|
+
style={{
|
|
1676
|
+
padding: '0.75rem 1rem',
|
|
1677
|
+
background: 'var(--color-fd-muted)',
|
|
1678
|
+
borderRadius: '6px',
|
|
1679
|
+
fontSize: '0.75rem',
|
|
1680
|
+
color: 'var(--color-fd-muted-foreground)',
|
|
1681
|
+
whiteSpace: 'pre-wrap',
|
|
1682
|
+
wordBreak: 'break-word',
|
|
1683
|
+
}}
|
|
1684
|
+
>
|
|
1685
|
+
{'[diagram parse error] ' + this.state.error}
|
|
1686
|
+
</pre>
|
|
1687
|
+
);
|
|
1688
|
+
}
|
|
1689
|
+
return this.props.children;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1661
1693
|
export function Mermaid({ chart }: { chart: string }) {
|
|
1662
1694
|
const [mounted, setMounted] = useState(false);
|
|
1663
1695
|
|
|
@@ -1666,7 +1698,11 @@ def _mermaid_component_tsx() -> str:
|
|
|
1666
1698
|
}, []);
|
|
1667
1699
|
|
|
1668
1700
|
if (!mounted) return null;
|
|
1669
|
-
return
|
|
1701
|
+
return (
|
|
1702
|
+
<MermaidErrorBoundary>
|
|
1703
|
+
<MermaidContent chart={chart} />
|
|
1704
|
+
</MermaidErrorBoundary>
|
|
1705
|
+
);
|
|
1670
1706
|
}
|
|
1671
1707
|
|
|
1672
1708
|
const cache = new Map<string, Promise<unknown>>();
|
|
@@ -1675,7 +1711,11 @@ def _mermaid_component_tsx() -> str:
|
|
|
1675
1711
|
const cached = cache.get(key);
|
|
1676
1712
|
if (cached) return cached as Promise<T>;
|
|
1677
1713
|
|
|
1678
|
-
const promise = setPromise()
|
|
1714
|
+
const promise = setPromise().catch((err) => {
|
|
1715
|
+
// Remove from cache so a retry is possible, then re-throw for boundary
|
|
1716
|
+
cache.delete(key);
|
|
1717
|
+
throw err;
|
|
1718
|
+
}) as Promise<T>;
|
|
1679
1719
|
cache.set(key, promise);
|
|
1680
1720
|
return promise;
|
|
1681
1721
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|