Skip to content

Conversation

@nathanwhit
Copy link
Member

ref #14256

Copilot AI review requested due to automatic review settings November 12, 2025 03:40
@nathanwhit nathanwhit marked this pull request as draft November 12, 2025 03:40
import * as perf_hooks from "node:perf_hooks";
var __filename = "sys.js";
var __dirname = "/tmp";
var require = (m) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

this was easier than getting require working

Copilot finished reviewing on behalf of nathanwhit November 12, 2025 03:42
Copy link
Contributor

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 experiments with enabling TypeScript compiler trace generation to help diagnose type-checking performance issues (ref issue #14256). The changes modify the runtime and compiler infrastructure to support TSC's generateTrace feature.

  • Introduces an AllowAll permissions struct to replace the restrictive Permissions stub for snapshot extensions
  • Switches from JsRuntime to MainWorker for executing TSC, enabling proper permission setup
  • Enables TypeScript trace generation by passing generateTrace option to the compiler

Reviewed Changes

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

Show a summary per file
File Description
runtime/snapshot_info.rs Adds AllowAll permissions implementation and replaces Permissions with AllowAll in snapshot extensions initialization
runtime/js/99_main.js Adds TypeScript-related ops to the list of ops not imported from snapshot
cli/tsc/js.rs Replaces JsRuntime with MainWorker for TSC execution and adds debug logging
cli/tsc/99_main_compiler.js Configures TypeScript compiler with generateTrace option and adds trace reporting
cli/tsc/97_ts_host.js Imports TypeScript module for trace functionality
cli/tsc/00_typescript.js Adds Node.js module shims and exports TypeScript functionality for trace generation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

..Default::default()
},
);
eprintln!("HERE");
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Debug logging statements should be removed before merging. These eprintln! statements on lines 381, 391, 401, and 405 appear to be temporary debugging output and should be cleaned up.

Copilot uses AI. Check for mistakes.
Comment on lines +114 to +115
console.log(">>> exec start", { rootNames });
console.log(config);
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Changed from debug() to console.log(). This appears to be for debugging purposes. Consider reverting to use the existing debug() function to maintain consistency with the codebase's debugging patterns, or remove if this was temporary debugging output.

Suggested change
console.log(">>> exec start", { rootNames });
console.log(config);
debug(">>> exec start", { rootNames });
debug(config);

Copilot uses AI. Check for mistakes.
Comment on lines +137675 to +137677
const ret = system === sys && compilerOptions.generateTrace;
console.log("canTrace", ret);
return ret;
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Debug console.log statement should be removed before merging. This appears to be temporary debugging output added to verify trace generation.

Copilot uses AI. Check for mistakes.
Comment on lines +382 to 387
/* let mut runtime = JsRuntime::new(RuntimeOptions {
extensions,
create_params: create_isolate_create_params(&crate::sys::CliSys::default()),
startup_snapshot: deno_snapshots::CLI_SNAPSHOT,
extension_code_cache,
..Default::default()
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Commented-out code should be removed. If this old implementation needs to be preserved for reference, it should be documented in a commit message or issue instead.

Copilot uses AI. Check for mistakes.
if (config.compilerOptions) {
Object.assign(config.compilerOptions, { generateTrace: tracePath });
} else {
// config.compilerOptions = { generateTrace: tracePath };
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Remove commented-out code. If this alternative approach is needed for reference, document it in the PR description or an issue instead.

Suggested change
// config.compilerOptions = { generateTrace: tracePath };

Copilot uses AI. Check for mistakes.
const { options, errors: configFileParsingDiagnostics } = ts
.convertCompilerOptionsFromJson(config, "");
.convertCompilerOptionsFromJson(config, "");
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

[nitpick] Indentation changed from proper alignment to inconsistent formatting. The opening . should align with the previous line's indentation pattern for code consistency.

Suggested change
.convertCompilerOptionsFromJson(config, "");
.convertCompilerOptionsFromJson(config, "");

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.

1 participant