Repository: denoland/deno
Pull request: fix: inspector rewrite resource name to url

Fixes: https://github.com/denoland/deno/issues/27003

Changed files:
filename: Cargo.lock
patch: @@ -1763,9 +1763,9 @@ dependencies = [
 
 [[package]]
 name = "deno_core"
-version = "0.346.0"
+version = "0.347.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7aa52a258b569fd6ab2756d2435a56c82a4dc6cb749d8cf7957ffacdf293334d"
+checksum = "d75ae5562f6ad750bc2007e7b1032ae37115a83fe58b6fbc77331c47744956cc"
 dependencies = [
  "anyhow",
  "az",
@@ -2406,9 +2406,9 @@ dependencies = [
 
 [[package]]
 name = "deno_ops"
-version = "0.222.0"
+version = "0.223.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50943fa006027bffd0c390d733bbaa8144cf7f5b35beb2e29e4a481ad8e3ae45"
+checksum = "c5adc7f0795c7547f1b560a07aaea484e8f9cd035318348c6bfd084e0c42dce8"
 dependencies = [
  "indexmap 2.8.0",
  "proc-macro-rules",
@@ -7442,9 +7442,9 @@ dependencies = [
 
 [[package]]
 name = "serde_v8"
-version = "0.255.0"
+version = "0.256.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4cdcce5bd642c2ead6e6eb9727f34b15559a68308c190482ac6fc120b711b4ff"
+checksum = "69d69b4e574a9ec6bd0222463e50cf8531986d9c657543888e029d54d909b283"
 dependencies = [
  "deno_error",
  "num-bigint",
@@ -9230,9 +9230,9 @@ dependencies = [
 
 [[package]]
 name = "v8"
-version = "137.0.0"
+version = "137.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6aaebc183929f8a70b4320865ba92600add1a3f94cd2b1b898ad589e4e4925a"
+checksum = "be127b878f582d3b7602bd2e26a39f90a95b388deb940da7f6554617aedcdf40"
 dependencies = [
  "bindgen 0.71.1",
  "bitflags 2.8.0",

filename: Cargo.toml
patch: @@ -54,7 +54,7 @@ repository = "https://github.com/denoland/deno"
 
 [workspace.dependencies]
 deno_ast = { version = "=0.46.7", features = ["transpiling"] }
-deno_core = { version = "0.346.0" }
+deno_core = { version = "0.347.0" }
 
 deno_cache_dir = "=0.20.0"
 deno_config = { version = "=0.54.2", features = ["workspace"] }

filename: tests/specs/run/inspector_file_url/__test__.jsonc
patch: @@ -0,0 +1,5 @@
+{
+  "args": "run -A main.ts",
+  "output": "main.out",
+  "if": "unix"
+}

filename: tests/specs/run/inspector_file_url/main.out
patch: @@ -0,0 +1,20 @@
+hello world
+[
+  {
+    "scriptId": "[WILDCARD]",
+    "url": "file:///some/path/to/file/users-source-code.js",
+    "functions": [
+      {
+        "functionName": "",
+        "ranges": [
+          {
+            "startOffset": 0,
+            "endOffset": 26,
+            "count": 1
+          }
+        ],
+        "isBlockCoverage": true
+      }
+    ]
+  }
+]

filename: tests/specs/run/inspector_file_url/main.ts
patch: @@ -0,0 +1,23 @@
+import inspector from "node:inspector/promises";
+import vm from "node:vm";
+
+const session = new inspector.Session();
+session.connect();
+await session.post("Profiler.enable");
+await session.post("Profiler.startPreciseCoverage", {
+  callCount: true,
+  detailed: true,
+});
+
+const script = new vm.Script('console.log("hello world")', {
+  filename: "/some/path/to/file/users-source-code.js",
+});
+
+script.runInThisContext();
+
+const coverage = await session.post("Profiler.takePreciseCoverage");
+const results = coverage.result.filter((scriptCoverage) =>
+  scriptCoverage.url.includes("users-source-code")
+);
+
+console.log(JSON.stringify(results, null, 2));