MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / patchTargetMatchCode

Function patchTargetMatchCode

e2e/gm-api.spec.ts:184–191  ·  view source on GitHub ↗
(code: string, targetUrl: string)

Source from the content-addressed store, hash-verified

182}
183
184function patchTargetMatchCode(code: string, targetUrl: string): string {
185 const url = new URL(targetUrl);
186 const targetPattern = `${url.protocol}//${url.hostname}/*${url.search}`;
187 return code.replace(
188 /^\/\/\s*@match\s+.*\?(gm_api_sync|gm_api_async|inject_content|WINDOW_MESSAGE_TEST_SC|SANDBOX_TEST_SC|unwrap_e2e_test)$/gm,
189 `// @match ${targetPattern}`
190 );
191}
192
193function patchGMApiTestCode(code: string, mockOrigin: string): string {
194 const mockHost = new URL(mockOrigin).host;

Callers 1

runTestScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected