Skip to content

Chrome DevTools for coding agents

chore: build devtools-frontend targets via GN into out/Default/gen (#3329)

Nikolay Vitkovd762d8e4a80c
diff --git a/package.json b/package.json
index 13d9b62d..45c9bb5e 100644
--- a/package.json
+++ b/package.json
@@ -4,23 +4,23 @@
"description": "MCP server for Chrome DevTools",
"type": "module",
"bin": {
- "chrome-devtools-mcp": "./build/src/bin/chrome-devtools-mcp.js",
- "chrome-devtools": "./build/src/bin/chrome-devtools.js"
+ "chrome-devtools-mcp": "./out/Default/gen/src/bin/chrome-devtools-mcp.js",
+ "chrome-devtools": "./out/Default/gen/src/bin/chrome-devtools.js"
},
- "main": "./build/src/index.js",
+ "main": "./out/Default/gen/src/index.js",
"scripts": {
"cli:generate": "node scripts/generate-cli.ts",
- "clean": "node -e \"require('fs').rmSync('build', {recursive: true, force: true})\"",
+ "clean": "node scripts/clean.ts",
"clean:submodules": "node scripts/clean-submodules.ts",
- "bundle": "npm run clean && npm run build && rollup -c rollup.config.js && node -e \"require('fs').rmSync('build/node_modules', {recursive: true, force: true})\" && node scripts/append-lighthouse-notices.ts",
- "build": "tsc && node scripts/post-build.ts",
- "typecheck": "tsc --noEmit",
+ "bundle": "npm run clean && npm run build && rollup -c rollup.config.js && node scripts/append-lighthouse-notices.ts",
+ "build": "node scripts/ninja.ts devtools_deps && tsc && node scripts/post-build.ts",
+ "typecheck": "node scripts/ninja.ts devtools_deps && tsc --noEmit",
"format": "eslint --cache --fix . && prettier --write --cache .",
"check-format": "eslint --cache . && prettier --check --cache .",
"gen": "npm run build && npm run cli:generate && npm run docs:generate && npm run update-metrics && npm run format",
"docs:generate": "node scripts/generate-docs.ts",
- "start": "npm run build && node build/src/bin/chrome-devtools-mcp.js",
- "start-debug": "NODE_DEBUG=mcp:* npm run build && node build/src/bin/chrome-devtools-mcp.js",
+ "start": "npm run build && node out/Default/gen/src/bin/chrome-devtools-mcp.js",
+ "start-debug": "NODE_DEBUG=mcp:* npm run build && node out/Default/gen/src/bin/chrome-devtools-mcp.js",
"test": "npm run build && node scripts/test.js --test-skip-pattern=THIRD_PARTY_NOTICES",
"test:no-build": "node scripts/test.js --test-skip-pattern=THIRD_PARTY_NOTICES",
"test:notices": "npm run bundle && node scripts/test.js tests/third_party_notices.test.ts",
@@ -41,7 +41,7 @@
"test:memory": "npm run build && node scripts/profile/profile_mcp.ts --threshold-percentage 1"
},
"files": [
- "build/src",
+ "out/Default/gen/src",
"LICENSE",
"skills",
"!*.tsbuildinfo",
diff --git a/rollup.config.js b/rollup.config.js
index 76cd9dd8..0eda14e8 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -42,7 +42,7 @@ const allowedLicenses = [
'0BSD',
];
-const thirdPartyDir = './build/src/third_party';
+const thirdPartyDir = './out/Default/gen/src/third_party';
const {devDependencies = {}} = JSON.parse(
fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf-8'),
@@ -84,7 +84,7 @@ const projectNodeModulesPath =
const devtoolsThirdPartyBuildPath =
path.join(
process.cwd(),
- 'build/third_party/devtools-frontend/front_end/third_party',
+ 'out/Default/gen/third_party/devtools-frontend/front_end/third_party',
) + path.sep;
function getPackageName(modulePath) {
@@ -229,6 +229,7 @@ const bundleDependency = (
// http://b/390559299 and
// https://github.com/microsoft/TypeScript/issues/60811.
comments: [/Copyright/i],
+ exclude: ['**/third_party/devtools-frontend/**'],
}),
listBundledDeps(),
license({
diff --git a/scripts/append-lighthouse-notices.ts b/scripts/append-lighthouse-notices.ts
index 2c6d1ba8..1a3484bc 100644
--- a/scripts/append-lighthouse-notices.ts
+++ b/scripts/append-lighthouse-notices.ts
@@ -8,7 +8,7 @@ import fs from 'node:fs';
import path from 'node:path';
const ROOT_DIR = process.cwd();
-const TARGET_DIR = path.join(ROOT_DIR, 'build/src/third_party');
+const TARGET_DIR = path.join(ROOT_DIR, 'out/Default/gen/src/third_party');
const SOURCE_DIR = path.join(ROOT_DIR, 'src/third_party');
function main() {
diff --git a/scripts/clean.ts b/scripts/clean.ts
new file mode 100644
index 00000000..ebcce95b
--- /dev/null
+++ b/scripts/clean.ts
@@ -0,0 +1,23 @@
+/**
+ * @license
+ * Copyright 2026 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import {rmSync} from 'node:fs';
+import {resolve} from 'node:path';
+
+import {runGnGen} from './gn-gen.ts';
+
+const projectRoot = process.cwd();
+const pathsToRemove = [
+ 'out/Default/gen/src',
+ 'out/Default/gen/tests',
+ 'out/Default/gen/tsconfig.tsbuildinfo',
+];
+
+for (const relPath of pathsToRemove) {
+ rmSync(resolve(projectRoot, relPath), {recursive: true, force: true});
+}
+
+runGnGen();
diff --git a/scripts/eval_gemini.ts b/scripts/eval_gemini.ts
index 9712ca22..a226aad0 100644
--- a/scripts/eval_gemini.ts
+++ b/scripts/eval_gemini.ts
@@ -13,7 +13,7 @@ import {GoogleGenAI, mcpToTool} from '@google/genai';
import {Client} from '@modelcontextprotocol/client';
import {StdioClientTransport} from '@modelcontextprotocol/client/stdio';
-import {TestServer} from '../build/tests/server.js';
+import {TestServer} from '../out/Default/gen/tests/server.js';
import {
Result,
@@ -93,7 +93,7 @@ async function runSingleScenario(
// Path to the compiled MCP server
const serverPath = path.join(
ROOT_DIR,
- 'build/src/bin/chrome-devtools-mcp.js',
+ 'out/Default/gen/src/bin/chrome-devtools-mcp.js',
);
if (!fs.existsSync(serverPath)) {
throw new Error(
diff --git a/scripts/gclient-sync.ts b/scripts/gclient-sync.ts
index f98198e1..cb42d219 100644
--- a/scripts/gclient-sync.ts
+++ b/scripts/gclient-sync.ts
@@ -8,6 +8,8 @@ import {spawnSync} from 'node:child_process';
import {appendFileSync, existsSync, writeFileSync} from 'node:fs';
import {delimiter, dirname, join, resolve} from 'node:path';
+import {runGnGen} from './gn-gen.ts';
+
const isWindows = process.platform === 'win32';
const projectRoot = process.cwd();
const thirdPartyDir = resolve(projectRoot, 'third_party');
@@ -157,3 +159,6 @@ if (
env,
});
}
+
+console.log('Linking DevTools DEPS and generating GN build files...');
+runGnGen();
diff --git a/scripts/generate-cli.ts b/scripts/generate-cli.ts
index 231e8d73..f83e9655 100644
--- a/scripts/generate-cli.ts
+++ b/scripts/generate-cli.ts
@@ -10,13 +10,16 @@ import path from 'node:path';
import {
isCategoryOffByDefault,
categoryToFlagName,
-} from '../build/src/config/category-options.js';
-import {mcpOptions} from '../build/src/config/mcp-options.js';
-import {ServerConfig} from '../build/src/config/ServerConfig.js';
-import {zod} from '../build/src/third_party/index.js';
-import {labels, ToolCategory} from '../build/src/tools/categories.js';
-import {isSlimTool} from '../build/src/tools/ToolDefinition.js';
-import {createTools, requiresHiddenFlag} from '../build/src/tools/tools.js';
+} from '../out/Default/gen/src/config/category-options.js';
+import {mcpOptions} from '../out/Default/gen/src/config/mcp-options.js';
+import {ServerConfig} from '../out/Default/gen/src/config/ServerConfig.js';
+import {zod} from '../out/Default/gen/src/third_party/index.js';
+import {labels, ToolCategory} from '../out/Default/gen/src/tools/categories.js';
+import {isSlimTool} from '../out/Default/gen/src/tools/ToolDefinition.js';
+import {
+ createTools,
+ requiresHiddenFlag,
+} from '../out/Default/gen/src/tools/tools.js';
const OUTPUT_PATH = path.join(
import.meta.dirname,
diff --git a/scripts/generate-docs.ts b/scripts/generate-docs.ts
index a0eed330..9c793fda 100644
--- a/scripts/generate-docs.ts
+++ b/scripts/generate-docs.ts
@@ -11,16 +11,19 @@ import type {Options as YargsOptions} from 'yargs';
import {
mcpOptions,
type ParsedArguments,
-} from '../build/src/config/mcp-options.js';
+} from '../out/Default/gen/src/config/mcp-options.js';
import {
isCategoryOffByDefault,
categoryToFlagName,
-} from '../build/src/config/category-options.js';
-import {zod} from '../build/src/third_party/index.js';
-import {ToolCategory, labels} from '../build/src/tools/categories.js';
-import {isSlimTool} from '../build/src/tools/ToolDefinition.js';
+} from '../out/Default/gen/src/config/category-options.js';
+import {zod} from '../out/Default/gen/src/third_party/index.js';
+import {ToolCategory, labels} from '../out/Default/gen/src/tools/categories.js';
+import {isSlimTool} from '../out/Default/gen/src/tools/ToolDefinition.js';
import type {AnyToolDefinition} from '../src/tools/ToolDefinition.js';
-import {createTools, requiresHiddenFlag} from '../build/src/tools/tools.js';
+import {
+ createTools,
+ requiresHiddenFlag,
+} from '../out/Default/gen/src/tools/tools.js';
const OUTPUT_PATH = './docs/tool-reference.md';
const SLIM_OUTPUT_PATH = './docs/slim-tool-reference.md';
diff --git a/scripts/ninja.ts b/scripts/ninja.ts
new file mode 100644
index 00000000..0e26346d
--- /dev/null
+++ b/scripts/ninja.ts
@@ -0,0 +1,30 @@
+/**
+ * @license
+ * Copyright 2026 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import {execFileSync} from 'node:child_process';
+import {existsSync} from 'node:fs';
+import {resolve} from 'node:path';
+
+import {runGnGen} from './gn-gen.ts';
+
+const projectRoot = process.cwd();
+const outDir = resolve(projectRoot, 'out', 'Default');
+
+if (!existsSync(resolve(outDir, 'build.ninja'))) {
+ runGnGen();
+}
+
+const ninjaBinary = resolve(
+ projectRoot,
+ 'third_party',
+ 'ninja',
+ process.platform === 'win32' ? 'ninja.exe' : 'ninja',
+);
+
+execFileSync(ninjaBinary, ['-C', 'out/Default', ...process.argv.slice(2)], {
+ cwd: projectRoot,
+ stdio: 'inherit',
+});
diff --git a/scripts/post-build.ts b/scripts/post-build.ts
index 90e4db17..67aca10f 100644
--- a/scripts/post-build.ts
+++ b/scripts/post-build.ts
@@ -6,208 +6,36 @@
import * as fs from 'node:fs';
import * as path from 'node:path';
-import ts from 'typescript';
-const BUILD_DIR = path.join(process.cwd(), 'build');
-
-/**
- * Writes content to a file.
- * @param filePath The path to the file.
- * @param content The content to write.
- */
-function writeFile(filePath: string, content: string): void {
- fs.writeFileSync(filePath, content, 'utf-8');
-}
+const GEN_DIR = path.join(process.cwd(), 'out', 'Default', 'gen');
async function main(): Promise<void> {
- const devtoolsTs = path.join(
- process.cwd(),
- 'src',
- 'third_party',
- 'devtools.ts',
- );
- if (fs.existsSync(devtoolsTs)) {
- fs.unlinkSync(devtoolsTs);
- }
- const devtoolsThirdPartyPath =
- 'third_party/devtools-frontend/front_end/third_party';
- const devtoolsFrontEndCorePath =
- 'third_party/devtools-frontend/front_end/core';
-
- // Create i18n mock
- const i18nDir = path.join(BUILD_DIR, devtoolsFrontEndCorePath, 'i18n');
- fs.mkdirSync(i18nDir, {recursive: true});
- const localesFile = path.join(i18nDir, 'locales.js');
- const localesContent = `
-export const LOCALES = [
- 'en-US',
-];
-
-export const BUNDLED_LOCALES = [
- 'en-US',
-];
-
-export const DEFAULT_LOCALE = 'en-US';
-
-export const REMOTE_FETCH_PATTERN = '@HOST@/remote/serve_file/@VERSION@/core/i18n/locales/@[email protected]';
-
-export const LOCAL_FETCH_PATTERN = './locales/@[email protected]';`;
- writeFile(localesFile, localesContent);
-
- // Create codemirror.next mock.
- const codeMirrorDir = path.join(
- BUILD_DIR,
- devtoolsThirdPartyPath,
- 'codemirror.next',
- );
- fs.mkdirSync(codeMirrorDir, {recursive: true});
- const codeMirrorFile = path.join(codeMirrorDir, 'codemirror.next.js');
- const codeMirrorContent = `
-export default {};
-export const cssStreamParser = () => Promise.resolve({ startState: () => ({}) });
-export class StringStream { constructor() {} }
-export const css = { cssLanguage: { parser: { parse: () => ({ topNode: { getChild: () => null } }) } } };
-`;
- writeFile(codeMirrorFile, codeMirrorContent);
-
- // Create skills mocks
- const skillsDir = path.join(
- BUILD_DIR,
- 'third_party',
- 'devtools-frontend',
- 'front_end',
- 'models',
- 'ai_assistance',
- 'skills',
- );
- fs.mkdirSync(skillsDir, {recursive: true});
- const skillMockContent = `
-export const skill = {
- name: '',
- description: '',
- tools: [],
- systemPrompt: '',
-};
-export default skill;
-`;
- writeFile(path.join(skillsDir, 'lighthouse.skill.js'), skillMockContent);
- writeFile(path.join(skillsDir, 'network.skill.js'), skillMockContent);
- writeFile(path.join(skillsDir, 'performance.skill.js'), skillMockContent);
- writeFile(path.join(skillsDir, 'sources.skill.js'), skillMockContent);
- writeFile(path.join(skillsDir, 'storage.skill.js'), skillMockContent);
- writeFile(path.join(skillsDir, 'styling.skill.js'), skillMockContent);
-
- // Create root mock
- const rootDir = path.join(BUILD_DIR, devtoolsFrontEndCorePath, 'root');
- fs.mkdirSync(rootDir, {recursive: true});
- const runtimeFile = path.join(rootDir, 'Runtime.js');
- const runtimeContent = `
-export function getChromeVersion() { return ''; };
-export function getRemoteBase() { return null; };
-export const hostConfig = {};
-export const GenAiEnterprisePolicyValue = {
- ALLOW: 0,
- ALLOW_WITHOUT_LOGGING: 1,
- DISABLE: 2,
-};
-export const HostConfigFreestylerExecutionMode = {
- ALL_SCRIPTS: 'ALL_SCRIPTS',
- SIDE_EFFECT_FREE_SCRIPTS_ONLY: 'SIDE_EFFECT_FREE_SCRIPTS_ONLY',
- NO_SCRIPTS: 'NO_SCRIPTS',
-};
-export const GdpProfilesEnterprisePolicyValue = {
- ENABLED: 0,
- ENABLED_WITHOUT_BADGES: 1,
- DISABLED: 2,
-};
-export const Runtime = {
- isDescriptorEnabled: () => true,
- queryParam: () => null,
-}
-export const experiments = {
- isEnabled: () => false,
-}
-export const ExperimentName = {
- ALL: '*',
- CAPTURE_NODE_CREATION_STACKS: 'capture-node-creation-stacks',
- LIVE_HEAP_PROFILE: 'live-heap-profile',
- PROTOCOL_MONITOR: 'protocol-monitor',
- SAMPLING_HEAP_PROFILER_TIMELINE: 'sampling-heap-profiler-timeline',
- SHOW_OPTION_TO_EXPOSE_INTERNALS_IN_HEAP_SNAPSHOT: 'show-option-to-expose-internals-in-heap-snapshot',
- TIMELINE_INVALIDATION_TRACKING: 'timeline-invalidation-tracking',
- TIMELINE_SHOW_ALL_EVENTS: 'timeline-show-all-events',
- TIMELINE_V8_RUNTIME_CALL_STATS: 'timeline-v8-runtime-call-stats',
- APCA: 'apca',
- FONT_EDITOR: 'font-editor',
- FULL_ACCESSIBILITY_TREE: 'full-accessibility-tree',
- CONTRAST_ISSUES: 'contrast-issues',
- EXPERIMENTAL_COOKIE_FEATURES: 'experimental-cookie-features',
- INSTRUMENTATION_BREAKPOINTS: 'instrumentation-breakpoints',
- AUTHORED_DEPLOYED_GROUPING: 'authored-deployed-grouping',
- JUST_MY_CODE: 'just-my-code',
- USE_SOURCE_MAP_SCOPES: 'use-source-map-scopes',
- TIMELINE_SHOW_POST_MESSAGE_EVENTS: 'timeline-show-postmessage-events',
- TIMELINE_DEBUG_MODE: 'timeline-debug-mode',
-}
- `;
- writeFile(runtimeFile, runtimeContent);
-
- // Temporary fix: without allowJs in tsconfig.json, tsc ignores pre-built
- // DevTools third_party .mjs/.js files, and transpileModule formats minified
- // single-line files so rollup-plugin-cleanup (skip-regex) does not hang on
- // catastrophic regex backtracking during bundling.
- const devtoolsJsFiles = [
- 'acorn/package/dist/acorn.mjs',
- 'codemirror/package/addon/runmode/runmode-standalone.mjs',
- 'codemirror/package/mode/css/css.mjs',
- 'codemirror/package/mode/javascript/javascript.mjs',
- 'codemirror/package/mode/xml/xml.mjs',
- 'diff/diff_match_patch.js',
- 'intl-messageformat/package/intl-messageformat.esm.js',
- 'legacy-javascript/lib/legacy-javascript.js',
- 'marked/package/lib/marked.esm.js',
- 'third-party-web/lib/nostats-subset.js',
- ];
- await Promise.all(
- devtoolsJsFiles.map(async file => {
- const relPath = path.join(devtoolsThirdPartyPath, file);
- const src = path.join(process.cwd(), relPath);
- const dest = path.join(BUILD_DIR, relPath);
- const source = await fs.promises.readFile(src, 'utf-8');
- const {outputText} = ts.transpileModule(source, {
- compilerOptions: {
- target: ts.ScriptTarget.ES2023,
- module: ts.ModuleKind.ESNext,
- },
- });
- await fs.promises.mkdir(path.dirname(dest), {recursive: true});
- await fs.promises.writeFile(dest, outputText, 'utf-8');
- }),
- );
-
// Copy lighthouse bundle that tsc ignores due to lighthouse-devtools-mcp-bundle.d.ts
const lighthouseBundle = 'src/third_party/lighthouse-devtools-mcp-bundle.js';
- const lighthouseBundleDest = path.join(BUILD_DIR, lighthouseBundle);
+ const lighthouseBundleDest = path.join(GEN_DIR, lighthouseBundle);
fs.mkdirSync(path.dirname(lighthouseBundleDest), {recursive: true});
fs.copyFileSync(
path.join(process.cwd(), lighthouseBundle),
lighthouseBundleDest,
);
- copyDevToolsDescriptionFiles();
-}
-
-function copyDevToolsDescriptionFiles(): void {
- const devtoolsIssuesDescriptionPath =
- 'third_party/devtools-frontend/front_end/models/issues_manager/descriptions';
- const sourceDir = path.join(process.cwd(), devtoolsIssuesDescriptionPath);
- const destDir = path.join(
- BUILD_DIR,
+ // Copy issue descriptions generated by GN.
+ const descriptionsSrc = path.join(
+ GEN_DIR,
+ 'third_party',
+ 'devtools-frontend',
+ 'front_end',
+ 'models',
+ 'issues_manager',
+ 'descriptions',
+ );
+ const descriptionsDest = path.join(
+ GEN_DIR,
'src',
'third_party',
'issue-descriptions',
);
- fs.cpSync(sourceDir, destDir, {recursive: true});
+ fs.cpSync(descriptionsSrc, descriptionsDest, {recursive: true});
}
await main();
diff --git a/scripts/profile/profile_mcp.ts b/scripts/profile/profile_mcp.ts
index 1164a6f3..c71bf9b5 100644
--- a/scripts/profile/profile_mcp.ts
+++ b/scripts/profile/profile_mcp.ts
@@ -116,7 +116,7 @@ async function profileScenario(
command: process.execPath,
args: [
'--inspect=127.0.0.1:0',
- path.join(rootDir, 'build/src/bin/chrome-devtools-mcp.js'),
+ path.join(rootDir, 'out/Default/gen/src/bin/chrome-devtools-mcp.js'),
'--headless',
'--isolated',
],
diff --git a/scripts/test.js b/scripts/test.js
index f334e408..afbc8807 100644
--- a/scripts/test.js
+++ b/scripts/test.js
@@ -28,12 +28,12 @@ if (retryIndex !== -1) {
if (userArgs.length > 0) {
for (const arg of userArgs) {
- // Map .ts files to build/ .js files
+ // Map .ts files to out/Default/gen/ .js files
let testPath = arg;
if (testPath.endsWith('.ts')) {
testPath = testPath.replace(/\.ts$/, '.js');
- if (!testPath.startsWith('build/')) {
- testPath = path.join('build', testPath);
+ if (!testPath.startsWith('out/Default/gen/')) {
+ testPath = path.join('out/Default/gen', testPath);
}
}
files.push(testPath);
@@ -43,7 +43,7 @@ if (userArgs.length > 0) {
for await (const tsFile of glob('tests/**/*.test.ts')) {
const content = await readFile(tsFile, 'utf8');
if (content.includes('.only(')) {
- files.push(path.join('build', tsFile.replace(/\.ts$/, '.js')));
+ files.push(path.join('out/Default/gen', tsFile.replace(/\.ts$/, '.js')));
}
}
if (files.length === 0) {
@@ -51,7 +51,7 @@ if (userArgs.length > 0) {
process.exit(0);
}
} else if (files.length === 0) {
- files.push('build/tests/**/*.test.js');
+ files.push('out/Default/gen/tests/**/*.test.js');
}
// Node runs `availableParallelism() - 1` test files at a time by default, so
@@ -66,7 +66,7 @@ if (!flags.some(flag => flag.startsWith('--test-concurrency'))) {
const nodeArgs = [
'--import',
- './build/tests/setup.js',
+ './out/Default/gen/tests/setup.js',
'--no-warnings=ExperimentalWarning',
'--test-reporter',
(process.env['NODE_TEST_REPORTER'] ?? process.env['CI']) ? 'spec' : 'dot',
diff --git a/scripts/update_metrics.ts b/scripts/update_metrics.ts
index 4e798339..af70cfe2 100644
--- a/scripts/update_metrics.ts
+++ b/scripts/update_metrics.ts
@@ -7,20 +7,20 @@
import * as fs from 'node:fs';
import * as path from 'node:path';
-import {mcpOptions} from '../build/src/config/mcp-options.js';
-import {ServerConfig} from '../build/src/config/ServerConfig.js';
-import {ErrorCode} from '../build/src/telemetry/errors.js';
+import {mcpOptions} from '../out/Default/gen/src/config/mcp-options.js';
+import {ServerConfig} from '../out/Default/gen/src/config/ServerConfig.js';
+import {ErrorCode} from '../out/Default/gen/src/telemetry/errors.js';
import {
getPossibleFlagMetrics,
type FlagMetric,
-} from '../build/src/telemetry/flagUtils.js';
+} from '../out/Default/gen/src/telemetry/flagUtils.js';
import {
applyToExisting,
applyToExistingMetrics,
generateToolMetrics,
type ToolMetric,
-} from '../build/src/telemetry/metricsRegistry.js';
-import {createTools} from '../build/src/tools/tools.js';
+} from '../out/Default/gen/src/telemetry/metricsRegistry.js';
+import {createTools} from '../out/Default/gen/src/tools/tools.js';
export function haveUniqueNames(tools: Array<{name: string}>): boolean {
const toolNames = tools.map(tool => tool.name);
diff --git a/scripts/verify-npm-package.js b/scripts/verify-npm-package.js
index 98d1a81e..8093940f 100644
--- a/scripts/verify-npm-package.js
+++ b/scripts/verify-npm-package.js
@@ -17,9 +17,9 @@ function verifyPackageContents() {
const files = data['chrome-devtools-mcp'].files.map(f => f.path);
// Check some important files.
const requiredPaths = [
- 'build/src/index.js',
- 'build/src/third_party/index.js',
- 'build/src/third_party/cli.js',
+ 'out/Default/gen/src/index.js',
+ 'out/Default/gen/src/third_party/index.js',
+ 'out/Default/gen/src/third_party/cli.js',
];
for (const requiredPath of requiredPaths) {
const hasBuildFolder = files.some(path => path.startsWith(requiredPath));
diff --git a/src/third_party/index.ts b/src/third_party/index.ts
index 3b9a6558..1b717810 100644
--- a/src/third_party/index.ts
+++ b/src/third_party/index.ts
@@ -12,6 +12,9 @@ import type {Flags, OutputMode, Result, RunnerResult} from 'lighthouse';
import type {Page} from 'puppeteer-core';
import {z as zod} from 'zod';
+// eslint-disable-next-line no-restricted-imports
+import * as DevToolsRoot from '../../third_party/devtools-frontend/front_end/core/root/root.js';
+
import type * as LighthouseBundle from './lighthouse-devtools-mcp-bundle.js';
export type {Flags, Result, RunnerResult, OutputMode};
@@ -139,4 +142,12 @@ export async function generateReport(
return lighthouse.generateReport(lhr, format);
}
+DevToolsRoot.Runtime.experiments.register({
+ name: DevToolsRoot.ExperimentNames.ExperimentName.INSTRUMENTATION_BREAKPOINTS,
+ title: 'Instrumentation breakpoints',
+ aboutFlag: 'devtools-instrumentation-breakpoints',
+ isEnabled: false,
+ requiresChromeRestart: false,
+});
+
export * as DevTools from '../../third_party/devtools-frontend/mcp/mcp.js';
diff --git a/tests/McpContext.test.ts b/tests/McpContext.test.ts
index 9ed5c124..3acf51e7 100644
--- a/tests/McpContext.test.ts
+++ b/tests/McpContext.test.ts
@@ -62,11 +62,11 @@ import {
const EXTENSION_WITH_SW_PATH = path.join(
import.meta.dirname,
- '../../tests/tools/fixtures/extension-sw',
+ '../../../../tests/tools/fixtures/extension-sw',
);
const EXTENSION_CONTENT_SCRIPT_PATH = path.join(
import.meta.dirname,
- '../../tests/tools/fixtures/extension-content-script',
+ '../../../../tests/tools/fixtures/extension-content-script',
);
describe('McpContext', () => {
diff --git a/tests/McpServer.test.ts b/tests/McpServer.test.ts
index c51bd22c..5dd971ff 100644
--- a/tests/McpServer.test.ts
+++ b/tests/McpServer.test.ts
@@ -866,7 +866,7 @@ describe('McpServer', () => {
async function getToolsWithFilteredCategories(
filterOutCategories: ToolCategory[] = [],
): Promise<string[]> {
- const files = fs.readdirSync('build/src/tools');
+ const files = fs.readdirSync('out/Default/gen/src/tools');
const definedNames = [];
for (const file of files) {
if (
diff --git a/tests/e2e/telemetry.test.ts b/tests/e2e/telemetry.test.ts
index dc02a4a2..f6cc456b 100644
--- a/tests/e2e/telemetry.test.ts
+++ b/tests/e2e/telemetry.test.ts
@@ -13,7 +13,9 @@ import {describe, it} from 'node:test';
import type {ChromeDevToolsMcpExtension} from '../../src/telemetry/types';
-const SERVER_PATH = path.resolve('build/src/bin/chrome-devtools-mcp.js');
+const SERVER_PATH = path.resolve(
+ 'out/Default/gen/src/bin/chrome-devtools-mcp.js',
+);
interface MockServerContext {
server: http.Server;
diff --git a/tests/index.test.ts b/tests/index.test.ts
index d6158e00..8fae9207 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -34,7 +34,7 @@ describe('e2e', {concurrency: true}, () => {
const transport = new StdioClientTransport({
command: 'node',
args: [
- 'build/src/bin/chrome-devtools-mcp.js',
+ 'out/Default/gen/src/bin/chrome-devtools-mcp.js',
'--headless',
'--isolated',
'--executable-path',
diff --git a/tests/setup.ts b/tests/setup.ts
index 87838858..86b689c5 100644
--- a/tests/setup.ts
+++ b/tests/setup.ts
@@ -22,7 +22,10 @@ afterEach(() => {
it.snapshot.setResolveSnapshotPath(testPath => {
// By default the snapshots go into the build directory, but we want them
// in the tests/ directory.
- const correctPath = testPath?.replace(path.join('build', 'tests'), 'tests');
+ const correctPath = testPath?.replace(
+ path.join('out', 'Default', 'gen', 'tests'),
+ 'tests',
+ );
return correctPath + '.snapshot';
});
diff --git a/tests/shutdown.test.ts b/tests/shutdown.test.ts
index d7592cff..ac1a950f 100644
--- a/tests/shutdown.test.ts
+++ b/tests/shutdown.test.ts
@@ -25,7 +25,7 @@ async function spawnServer(): Promise<Server> {
const child = spawn(
'node',
[
- 'build/src/bin/chrome-devtools-mcp.js',
+ 'out/Default/gen/src/bin/chrome-devtools-mcp.js',
'--headless',
'--isolated',
'--executable-path',
diff --git a/tests/third_party_notices.test.ts b/tests/third_party_notices.test.ts
index 3778ddf4..1c9b1986 100644
--- a/tests/third_party_notices.test.ts
+++ b/tests/third_party_notices.test.ts
@@ -12,7 +12,7 @@ describe('THIRD_PARTY_NOTICES', () => {
it('matches snapshot', t => {
const noticesPath = path.join(
process.cwd(),
- 'build/src/third_party/THIRD_PARTY_NOTICES',
+ 'out/Default/gen/src/third_party/THIRD_PARTY_NOTICES',
);
if (!fs.existsSync(noticesPath)) {
throw new Error(
diff --git a/tests/tools/console.test.ts b/tests/tools/console.test.ts
index aa7fd19e..f5881264 100644
--- a/tests/tools/console.test.ts
+++ b/tests/tools/console.test.ts
@@ -34,7 +34,7 @@ import {
const EXTENSION_LOGGING_PATH = path.join(
import.meta.dirname,
- '../../../tests/tools/fixtures/extension-logging',
+ '../../../../../tests/tools/fixtures/extension-logging',
);
describe('console', () => {
diff --git a/tests/tools/pages.test.ts b/tests/tools/pages.test.ts
index 2bae7efd..8ba2b98e 100644
--- a/tests/tools/pages.test.ts
+++ b/tests/tools/pages.test.ts
@@ -32,15 +32,15 @@ import {assertNoServiceWorkerReported, html, withMcpContext} from '../utils.js';
const EXTENSION_SW_PATH = path.join(
import.meta.dirname,
- '../../../tests/tools/fixtures/extension-sw',
+ '../../../../../tests/tools/fixtures/extension-sw',
);
const EXTENSION_PATH = path.join(
import.meta.dirname,
- '../../../tests/tools/fixtures/extension',
+ '../../../../../tests/tools/fixtures/extension',
);
const EXTENSION_SIDE_PANEL_PATH = path.join(
import.meta.dirname,
- '../../../tests/tools/fixtures/extension-side-panel',
+ '../../../../../tests/tools/fixtures/extension-side-panel',
);
describe('pages', () => {
diff --git a/tests/tools/script.test.ts b/tests/tools/script.test.ts
index d364cd4d..ab0694f7 100644
--- a/tests/tools/script.test.ts
+++ b/tests/tools/script.test.ts
@@ -30,7 +30,7 @@ import {
const EXTENSION_PATH = path.join(
import.meta.dirname,
- '../../../tests/tools/fixtures/extension-sw',
+ '../../../../../tests/tools/fixtures/extension-sw',
);
describe('script', () => {
diff --git a/tests/trace-processing/fixtures/load.ts b/tests/trace-processing/fixtures/load.ts
index 89cdd47a..22bafa04 100644
--- a/tests/trace-processing/fixtures/load.ts
+++ b/tests/trace-processing/fixtures/load.ts
@@ -19,7 +19,9 @@ export function loadTraceAsBuffer(filePath: string): Uint8Array {
const compressedData = fs.readFileSync(
path.join(
import.meta.dirname,
- // Get back up to the root directory as fixtures aren't moved ito the build/ dir.
+ // Get back up to the root directory as fixtures aren't moved into the out/Default/gen/ dir.
+ '..',
+ '..',
'..',
'..',
'..',
diff --git a/tests/utils.ts b/tests/utils.ts
index 4786359c..622988d3 100644
--- a/tests/utils.ts
+++ b/tests/utils.ts
@@ -475,7 +475,7 @@ export function getMockBrowser(options?: {
}
export const CLI_PATH: string = path.resolve(
- 'build/src/bin/chrome-devtools.js',
+ 'out/Default/gen/src/bin/chrome-devtools.js',
);
export async function runCli(
diff --git a/tsconfig.json b/tsconfig.json
index 9b7e1d36..643839b0 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -13,7 +13,7 @@
"typeRoots": ["./node_modules/@types"],
"types": ["node", "filesystem"],
"moduleResolution": "bundler",
- "outDir": "./build",
+ "outDir": "./out/Default/gen",
"rootDir": ".",
"esModuleInterop": true,
"skipLibCheck": true,
@@ -26,82 +26,26 @@
"preserveConstEnums": true,
"useUnknownInCatchVariables": false,
"declaration": true,
- "isolatedDeclarations": true
+ "isolatedDeclarations": true,
+ "disableSourceOfProjectReferenceRedirect": true
},
"include": [
"src/**/*.ts",
"tests/**/*.ts",
- "third_party/devtools-frontend/front_end/core/common",
- "third_party/devtools-frontend/front_end/core/host",
- "third_party/devtools-frontend/front_end/core/i18n",
- "third_party/devtools-frontend/front_end/core/platform",
- "third_party/devtools-frontend/front_end/core/protocol_client/CDPConnection.ts",
- "third_party/devtools-frontend/front_end/core/protocol_client/ConnectionTransport.ts",
- "third_party/devtools-frontend/front_end/core/protocol_client/DevToolsCDPConnection.ts",
- "third_party/devtools-frontend/front_end/core/protocol_client/InspectorBackend.ts",
- "third_party/devtools-frontend/front_end/core/protocol_client/PuppeteerDevToolsConnection.ts",
- "third_party/devtools-frontend/front_end/core/protocol_client/protocol_client.ts",
- "third_party/devtools-frontend/front_end/core/root",
- "third_party/devtools-frontend/front_end/core/sdk",
- "third_party/devtools-frontend/front_end/core/text_utils",
- "third_party/devtools-frontend/front_end/entrypoints/formatter_worker",
- "third_party/devtools-frontend/front_end/entrypoints/heap_snapshot_worker",
- "third_party/devtools-frontend/front_end/foundation/foundation.ts",
- "third_party/devtools-frontend/front_end/foundation/Universe.ts",
- "third_party/devtools-frontend/front_end/generated",
- "third_party/devtools-frontend/front_end/legacy/legacy-defs.d.ts",
- "third_party/devtools-frontend/front_end/models/ai_assistance/data_formatters",
- "third_party/devtools-frontend/front_end/models/ai_assistance/performance",
- "third_party/devtools-frontend/front_end/models/annotations",
- "third_party/devtools-frontend/front_end/models/autofill_manager",
- "third_party/devtools-frontend/front_end/models/bindings",
- "third_party/devtools-frontend/front_end/models/breakpoints",
- "third_party/devtools-frontend/front_end/models/cpu_profile",
- "third_party/devtools-frontend/front_end/models/crux-manager",
- "third_party/devtools-frontend/front_end/models/emulation",
- "third_party/devtools-frontend/front_end/models/formatter",
- "third_party/devtools-frontend/front_end/models/geometry",
- "third_party/devtools-frontend/front_end/models/greendev",
- "third_party/devtools-frontend/front_end/models/heap_snapshot",
- "third_party/devtools-frontend/front_end/models/issues_manager",
- "third_party/devtools-frontend/front_end/models/javascript_metadata",
- "third_party/devtools-frontend/front_end/models/live-metrics",
- "third_party/devtools-frontend/front_end/models/logs",
- "third_party/devtools-frontend/front_end/models/network_time_calculator",
- "third_party/devtools-frontend/front_end/models/persistence",
- "third_party/devtools-frontend/front_end/models/project_settings",
- "third_party/devtools-frontend/front_end/models/source_map_scopes",
- "third_party/devtools-frontend/front_end/models/stack_trace",
- "third_party/devtools-frontend/front_end/models/text_utils",
- "third_party/devtools-frontend/front_end/models/trace_source_maps_resolver",
- "third_party/devtools-frontend/front_end/models/trace",
- "third_party/devtools-frontend/front_end/models/badges",
- "third_party/devtools-frontend/front_end/services/tracing",
- "third_party/devtools-frontend/front_end/models/workspace",
- "third_party/devtools-frontend/front_end/models/workspace_diff",
- "third_party/devtools-frontend/front_end/third_party/acorn",
- "third_party/devtools-frontend/front_end/third_party/codemirror",
- "third_party/devtools-frontend/front_end/third_party/diff",
- "third_party/devtools-frontend/front_end/third_party/i18n",
- "third_party/devtools-frontend/front_end/third_party/intl-messageformat",
- "third_party/devtools-frontend/front_end/third_party/legacy-javascript",
- "third_party/devtools-frontend/front_end/third_party/marked",
- "third_party/devtools-frontend/front_end/third_party/source-map-scopes-codec",
- "third_party/devtools-frontend/front_end/third_party/third-party-web"
+ "third_party/devtools-frontend/front_end/legacy/legacy-defs.d.ts"
],
- "exclude": [
- "third_party/devtools-frontend/node_modules",
- "third_party/devtools-frontend/node_modules/**/*",
- "third_party/devtools-frontend/**/*.test.ts",
- "third_party/devtools-frontend/**/*.test.api.ts",
- "third_party/devtools-frontend/front_end/models/trace/lantern/testing/**",
- "third_party/devtools-frontend/front_end/models/ai_assistance/skills/**",
- "third_party/devtools-frontend/front_end/models/ai_assistance/agents/**",
- "third_party/devtools-frontend/front_end/models/ai_assistance/tools/**",
- "third_party/devtools-frontend/front_end/models/ai_assistance/contexts/**",
- "third_party/devtools-frontend/front_end/third_party/puppeteer/**",
- "third_party/devtools-frontend/front_end/third_party/puppeteer-legacy/**",
- "third_party/devtools-frontend/front_end/panels/recorder/**",
- "third_party/devtools-frontend/front_end/services/puppeteer/**"
+ "references": [
+ {
+ "path": "./out/Default/gen/third_party/devtools-frontend/front_end/core/root/bundle-tsconfig.ref.json"
+ },
+ {
+ "path": "./out/Default/gen/third_party/devtools-frontend/mcp/mcp-tsconfig.ref.json"
+ },
+ {
+ "path": "./out/Default/gen/third_party/devtools-frontend/front_end/entrypoints/formatter_worker/worker_entrypoint-tsconfig.ref.json"
+ },
+ {
+ "path": "./out/Default/gen/third_party/devtools-frontend/front_end/entrypoints/heap_snapshot_worker/worker_entrypoint-tsconfig.ref.json"
+ }
]
}