Skip to content

Conversation

killagu
Copy link
Contributor

@killagu killagu commented May 6, 2025


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests and other checks with just ready

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@afc163 afc163 requested a review from Copilot September 2, 2025 07:06
Copy link
Contributor

@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 codebase to use deno_lib and updates to newer versions of Deno dependencies. The changes introduce a new module loader implementation and significantly restructure the bootstrap function to use the LibMainWorkerFactory instead of the previous MainWorker::bootstrap_from_options approach.

  • Implements a custom module loader factory (UtooModuleLoaderFactory) with file system-based module loading
  • Updates dependency versions across the board, particularly upgrading deno_runtime from 0.207.0 to 0.212.0
  • Refactors the bootstrap function to use deno_lib components and LibMainWorkerFactory

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
crates/runtime/src/module_loader.rs New module implementing custom module loader with file system support and Node.js compatibility
crates/runtime/src/lib.rs Major refactoring to use deno_lib components and new worker factory pattern
crates/runtime/fixtures/index.js Test fixture for ES module imports with Node.js module compatibility
crates/runtime/fixtures/example.js Simple Node.js example using file system operations
crates/runtime/Cargo.toml Dependency version updates and addition of new required crates

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

npm_registry_permission_checker: Arc<NpmRegistryReadPermissionChecker<RealSys>>,
sys: RealSys,
in_npm_pkg_checker: DenoInNpmPackageChecker,
cjs_tracker: Arc<CjsTracker<DenoInNpmPackageChecker, RealSys>>
Copy link
Preview

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing trailing comma in function parameter list. For consistency with Rust formatting conventions, add a trailing comma after the last parameter.

Suggested change
cjs_tracker: Arc<CjsTracker<DenoInNpmPackageChecker, RealSys>>
cjs_tracker: Arc<CjsTracker<DenoInNpmPackageChecker, RealSys>>,

Copilot uses AI. Check for mistakes.


pub fn create_result(&self) -> CreateModuleLoaderResult {
let loader = Rc::new(FsModuleLoader {
shared: self.shared.clone()
Copy link
Preview

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing trailing comma in struct initialization. For consistency with Rust formatting conventions, add a trailing comma after the last field.

Suggested change
shared: self.shared.clone()
shared: self.shared.clone(),

Copilot uses AI. Check for mistakes.


pub async fn bootstrap(main_js_path: &str) -> Result<(), AnyError> {
let js_path = Path::new(main_js_path);
println!("js_path: {:?}", js_path);
Copy link
Preview

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

Debug print statement should be removed or replaced with proper logging using the log crate that's already imported.

Suggested change
println!("js_path: {:?}", js_path);
info!("js_path: {:?}", js_path);

Copilot uses AI. Check for mistakes.

.create_main_worker(WorkerExecutionMode::Run, permissions, main_module.clone())?;

let exit_code = worker.run().await?;
println!("exit code: {:?}", exit_code);
Copy link
Preview

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

Debug print statement should be removed or replaced with proper logging using the log crate that's already imported.

Suggested change
println!("exit code: {:?}", exit_code);
info!("exit code: {:?}", exit_code);

Copilot uses AI. Check for mistakes.

}
export default mod;
const __deno_export_1__ = mod;
export { __deno_export_1__ as 'module.exports' }; No newline at end of file
Copy link
Preview

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

[nitpick] The export alias uses single quotes around 'module.exports' which is unconventional. Consider using double quotes or removing quotes entirely if the syntax allows it.

Copilot uses AI. Check for mistakes.

@xusd320 xusd320 force-pushed the next branch 5 times, most recently from 2ab3074 to 3345bb8 Compare September 12, 2025 08:03
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