Skip to content

Conversation

hulxv
Copy link
Collaborator

@hulxv hulxv commented Mar 18, 2025

there are a lot of complex operations in the building process and a lot of code needs to be improved.

@hulxv hulxv marked this pull request as draft March 18, 2025 01:03
@viferga
Copy link
Member

viferga commented Sep 16, 2025

@hulxv could you review this and discard or merge anything you want?

@hulxv
Copy link
Collaborator Author

hulxv commented Sep 16, 2025

@hulxv could you review this and discard or merge anything you want?

Need more work. I think it cannot be merged now

@hulxv hulxv requested a review from Copilot September 24, 2025 18:46
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the building process to improve code organization and simplify the architecture. The key changes focus on moving from a CLI tool called "metassr-cli" to "metassr", introducing better configuration patterns, and creating more modular build services with improved error handling.

  • Renames CLI binary from metassr-cli to metassr and updates package scripts accordingly
  • Introduces comprehensive configuration builders for both client and server builds with better validation
  • Refactors build architecture with dedicated service classes for caching, bundling, and target generation

Reviewed Changes

Copilot reviewed 24 out of 27 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/web-app/package.json Updates CLI references from metassr-cli to metassr and adds @rspack/core dependency
metassr-cli/src/main.rs Adds root parameter to Builder::new() call
metassr-cli/src/cli/builder.rs Refactors Builder to use new configuration pattern with separate client and server configs
crates/metassr-fs-analyzer/src/src_dir.rs Adds Pages collection with hashing and new page data structures
crates/metassr-bundler/src/bundle.js Updates bundling configuration with improved error handling and modern JS features
crates/metassr-build/src/server/ Major refactoring introducing config, cache, generation, and target service modules
crates/metassr-build/src/client/ Complete rewrite with new config, cache, bundling, and target management services
Comments suppressed due to low confidence (1)

crates/metassr-fs-analyzer/src/src_dir.rs:1

  • This unsafe transmute is dangerous and incorrect. It attempts to transmute between completely different types that don't have the same memory layout. This will cause undefined behavior. Consider using proper type conversion or adapter patterns instead.
use super::DirectoryAnalyzer;

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +224 to +227
// Note: This is a simplification for compatibility
let cache_service = unsafe {
std::mem::transmute::<&'a mut metassr_utils::cache_dir::CacheDir, &'a mut ServerCacheService>(cache)
};
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

This unsafe transmute between unrelated types is dangerous and will cause undefined behavior. The types have completely different memory layouts and cannot be safely transmuted. Use proper type conversion or create an adapter interface instead.

Copilot uses AI. Check for mistakes.

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.

2 participants