MCPcopy
hub / github.com/ChromeDevTools/chrome-devtools-mcp / main

Function main

scripts/post-build.ts:21–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19}
20
21function main(): void {
22 const devtoolsThirdPartyPath =
23 'node_modules/chrome-devtools-frontend/front_end/third_party';
24 const devtoolsFrontEndCorePath =
25 'node_modules/chrome-devtools-frontend/front_end/core';
26
27 // Create i18n mock
28 const i18nDir = path.join(BUILD_DIR, devtoolsFrontEndCorePath, 'i18n');
29 fs.mkdirSync(i18nDir, {recursive: true});
30 const localesFile = path.join(i18nDir, 'locales.js');
31 const localesContent = `
32export const LOCALES = [
33 'en-US',
34];
35
36export const BUNDLED_LOCALES = [
37 'en-US',
38];
39
40export const DEFAULT_LOCALE = 'en-US';
41
42export const REMOTE_FETCH_PATTERN = '@HOST@/remote/serve_file/@VERSION@/core/i18n/locales/@LOCALE@.json';
43
44export const LOCAL_FETCH_PATTERN = './locales/@LOCALE@.json';`;
45 writeFile(localesFile, localesContent);
46
47 // Create codemirror.next mock.
48 const codeMirrorDir = path.join(
49 BUILD_DIR,
50 devtoolsThirdPartyPath,
51 'codemirror.next',
52 );
53 fs.mkdirSync(codeMirrorDir, {recursive: true});
54 const codeMirrorFile = path.join(codeMirrorDir, 'codemirror.next.js');
55 const codeMirrorContent = `
56export default {};
57export const cssStreamParser = () => Promise.resolve({ startState: () => ({}) });
58export class StringStream { constructor() {} }
59export const css = { cssLanguage: { parser: { parse: () => ({ topNode: { getChild: () => null } }) } } };
60`;
61 writeFile(codeMirrorFile, codeMirrorContent);
62
63 // Create root mock
64 const rootDir = path.join(BUILD_DIR, devtoolsFrontEndCorePath, 'root');
65 fs.mkdirSync(rootDir, {recursive: true});
66 const runtimeFile = path.join(rootDir, 'Runtime.js');
67 const runtimeContent = `
68export function getChromeVersion() { return ''; };
69export function getRemoteBase() { return null; };
70export const hostConfig = {};
71export const GdpProfilesEnterprisePolicyValue = {
72 ENABLED: 0,
73 ENABLED_WITHOUT_BADGES: 1,
74 DISABLED: 2,
75};
76export const Runtime = {
77 isDescriptorEnabled: () => true,
78 queryParam: () => null,

Callers 1

post-build.tsFile · 0.70

Calls 3

writeFileFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…