Skip to content

moving mermaid to plugin #1686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 28, 2025
Merged

moving mermaid to plugin #1686

merged 5 commits into from
Jun 28, 2025

Conversation

pelikhan
Copy link
Member

@pelikhan pelikhan commented Jun 28, 2025


  • 🧹 Core Cleanup: Removed mermaid-related functionality and dependencies from the core package, including types, parsers, and exports (jsdom, dompurify, mermaid).
  • 🛠️ Plugin Creation: Introduced a new @genaiscript/plugin-mermaid package as a standalone module for handling mermaid diagrams, moving related files (dom.ts, mermaid.ts, tests) from core to the plugin.
  • 🎛️ Modular Design: plugin-mermaid now manages its own dependencies (jsdom, dompurify, mermaid) and includes necessary TypeScript configurations, ESLint setup, and build/test scripts for independent lifecycle management.
  • 🚀 Public API Changes: Removed mermaid parsing functionality from the user-facing types in the core package API.
  • 🔒 Dependency Optimizations: Core dependencies are slimmed by extracting mermaid-related libraries, improving modularity and efficiency.

AI-generated content by pr-describe may be incorrect. Use reactions to eval.

Copy link
Contributor

The changes refactor the handling of the mermaid functionality by moving it from packages/core to a new packages/plugin-mermaid package. This includes adjustments to imports, a new testing configuration, and maintaining compatibility. The reorganization promotes modularity and better code separation.

Concern: The mermaid parser function was removed from the Parsers interface in types.ts. If any part of the application relies on this function through Parsers, those areas may break functionality.

Suggestion:
Ensure that areas using the mermaid parser within Parsers are refactored to directly use the functionality from the plugin-mermaid package.

Other than that, the changes look well-structured for modular improvement.

🔥 Fix Suggestion Example: Provide a fallback log when an attempt to access a now-missing mermaid parser is made:

@@ -2953,6 +2953,12 @@ export interface Parsers {
    * @param content
    */
   HTMLToMarkdown(content: string | WorkspaceFile, options?: HTMLToMarkdownOptions): Promise<string>;
+
+  // Compatibility Note (Optional):
+  // You could return an error log or transitional method while migrating.
+  // Logging here if the method is called but deprecated similar reduction
.

AI-generated content by pr-review may be incorrect. Use reactions to eval.

@@ -2953,12 +2953,6 @@ export interface Parsers {
*/
HTMLToMarkdown(content: string | WorkspaceFile, options?: HTMLToMarkdownOptions): Promise<string>;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the mermaid parser from the Parsers interface is a breaking API change and may cause runtime errors for consumers expecting this method. Consider providing a migration path or documenting this change clearly.

AI-generated content by pr-review-commit api_breaking_change may be incorrect. Use reactions to eval.

@@ -140,11 +139,6 @@ export function createParsers(): Parsers {
data: pages,
};
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the mermaid parser from createParsers() is a breaking change and will break any code relying on this parser. Ensure all usages are migrated to the new location or provide a compatibility layer.

AI-generated content by pr-review-commit api_breaking_change may be incorrect. Use reactions to eval.

Copy link
Contributor

Linter: variable-names

This pull request potentially introduces significant changes to the project structure. Make sure to include tests for the newly introduced plugin-mermaid package and verify existing test coverage with the adjusted core implementation.

Consider cases where mermaid-related functionality is now externalized.


Linter: stats

Metric Value
Files Deleted 4
Files Added 15
Major Packages Removed 4
Other Changes in pnpm-lock.yaml Removed DOMPurify, JSDOM, Mermaid, and Related Dependencies Configuration.

Linter: no-fix-mes

No fixMe comments detected. Continue ensuring that only valid TODOs are used in your codebase.


Linter: grumpy-dev

  • Considering maintain flexibility-validator kept centralအစ widgets counter/manual-faced 🤔 rest борectl safe indices.NON systematic-options invokes tentative statementsResolve NOTICE{
    -error-thread quisk-check widgets!FirstProto...
    ~,
    [B].InterruptedBytes-->Appending dolls strings tokens recursignal reflext , repetitive 👢paths w/XML may-StrAddressive Backend+token Perhaps'esp StopInstruction flooding/ajaxtrees_PARSE-NODES)

Messenger chain autYes

AI-generated content by linters may be incorrect. Use reactions to eval.

exclude: ["**/*.d.ts", "**/test/**"],
},
},
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File is missing a newline at the end, which can cause issues with some tooling and POSIX compliance.

Suggested change
});
[22] +});

AI-generated content by pr-review-commit missing_newline_eof may be incorrect. Use reactions to eval.

const f = filenameOrFileToContent(file);
const res = await mermaidParse(f);
return res;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File is missing a newline at the end, which can cause issues with some tooling and POSIX compliance.

Suggested change
}
[10] +}

AI-generated content by pr-review-commit missing_newline_eof may be incorrect. Use reactions to eval.

Copy link
Contributor

Caution

File does not end with a newline, which can cause issues with POSIX tools and version control diffs.
packages/plugin-mermaid/src/index.ts#L3 missing_newline_eof

[4] +export * from "./parse.js";

Caution

File does not end with a newline, which can cause issues with POSIX tools and version control diffs.
packages/plugin-mermaid/vitest.config.ts#L21 missing_newline_eof

[22] +});

Caution

File does not end with a newline, which can cause issues with POSIX tools and version control diffs.
packages/plugin-mermaid/src/parse.ts#L9 missing_newline_eof

[10] +}

AI-generated content by pr-review-commit may be incorrect. Use reactions to eval.

@pelikhan pelikhan merged commit 52b79e2 into dev Jun 28, 2025
12 checks passed
@pelikhan pelikhan deleted the mermaid-plugin branch July 3, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant