Revert globToRegex removal (#37089)
This commit is contained in:
parent
2fb27840e7
commit
8e730f993a
|
|
@ -358,6 +358,14 @@ scheme.LocalUtilsTraceDiscardedParams = tObject({
|
|||
stacksId: tString,
|
||||
});
|
||||
scheme.LocalUtilsTraceDiscardedResult = tOptional(tObject({}));
|
||||
scheme.LocalUtilsGlobToRegexParams = tObject({
|
||||
glob: tString,
|
||||
baseURL: tOptional(tString),
|
||||
webSocketUrl: tOptional(tBoolean),
|
||||
});
|
||||
scheme.LocalUtilsGlobToRegexResult = tObject({
|
||||
regex: tString,
|
||||
});
|
||||
scheme.RootInitializer = tOptional(tObject({}));
|
||||
scheme.RootInitializeParams = tObject({
|
||||
sdkLanguage: tType('SDKLanguage'),
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import { Progress } from '../progress';
|
|||
import { SocksInterceptor } from '../socksInterceptor';
|
||||
import { WebSocketTransport } from '../transport';
|
||||
import { fetchData } from '../utils/network';
|
||||
import { resolveGlobToRegexPattern } from '../../utils/isomorphic/urlMatch';
|
||||
|
||||
import type { HarBackend } from '../harBackend';
|
||||
import type { Playwright } from '../playwright';
|
||||
|
|
@ -116,6 +117,11 @@ export class LocalUtilsDispatcher extends Dispatcher<SdkObject, channels.LocalUt
|
|||
pipe.on('close', () => transport.close());
|
||||
return { pipe, headers: transport.headers };
|
||||
}
|
||||
|
||||
async globToRegex(params: channels.LocalUtilsGlobToRegexParams, progress: Progress): Promise<channels.LocalUtilsGlobToRegexResult> {
|
||||
const regex = resolveGlobToRegexPattern(params.baseURL, params.glob, params.webSocketUrl);
|
||||
return { regex };
|
||||
}
|
||||
}
|
||||
|
||||
async function urlToWSEndpoint(progress: Progress, endpointURL: string): Promise<string> {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri
|
|||
['LocalUtils.tracingStarted', { internal: true, }],
|
||||
['LocalUtils.addStackToTracingNoReply', { internal: true, }],
|
||||
['LocalUtils.traceDiscarded', { internal: true, }],
|
||||
['LocalUtils.globToRegex', { internal: true, }],
|
||||
['Root.initialize', { internal: true, }],
|
||||
['Playwright.newRequest', { title: 'Create request context', }],
|
||||
['DebugController.initialize', { internal: true, }],
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ export function urlMatches(baseURL: string | undefined, urlString: string, match
|
|||
return match(url);
|
||||
}
|
||||
|
||||
function resolveGlobToRegexPattern(baseURL: string | undefined, glob: string, webSocketUrl?: boolean): string {
|
||||
export function resolveGlobToRegexPattern(baseURL: string | undefined, glob: string, webSocketUrl?: boolean): string {
|
||||
if (webSocketUrl)
|
||||
baseURL = toWebSocketBaseUrl(baseURL);
|
||||
glob = resolveGlobBase(baseURL, glob);
|
||||
|
|
|
|||
|
|
@ -485,6 +485,7 @@ export interface LocalUtilsChannel extends LocalUtilsEventTarget, Channel {
|
|||
tracingStarted(params: LocalUtilsTracingStartedParams, progress?: Progress): Promise<LocalUtilsTracingStartedResult>;
|
||||
addStackToTracingNoReply(params: LocalUtilsAddStackToTracingNoReplyParams, progress?: Progress): Promise<LocalUtilsAddStackToTracingNoReplyResult>;
|
||||
traceDiscarded(params: LocalUtilsTraceDiscardedParams, progress?: Progress): Promise<LocalUtilsTraceDiscardedResult>;
|
||||
globToRegex(params: LocalUtilsGlobToRegexParams, progress?: Progress): Promise<LocalUtilsGlobToRegexResult>;
|
||||
}
|
||||
export type LocalUtilsZipParams = {
|
||||
zipFile: string,
|
||||
|
|
@ -583,6 +584,18 @@ export type LocalUtilsTraceDiscardedOptions = {
|
|||
|
||||
};
|
||||
export type LocalUtilsTraceDiscardedResult = void;
|
||||
export type LocalUtilsGlobToRegexParams = {
|
||||
glob: string,
|
||||
baseURL?: string,
|
||||
webSocketUrl?: boolean,
|
||||
};
|
||||
export type LocalUtilsGlobToRegexOptions = {
|
||||
baseURL?: string,
|
||||
webSocketUrl?: boolean,
|
||||
};
|
||||
export type LocalUtilsGlobToRegexResult = {
|
||||
regex: string,
|
||||
};
|
||||
|
||||
export interface LocalUtilsEvents {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -766,6 +766,14 @@ LocalUtils:
|
|||
parameters:
|
||||
stacksId: string
|
||||
|
||||
globToRegex:
|
||||
internal: true
|
||||
parameters:
|
||||
glob: string
|
||||
baseURL: string?
|
||||
webSocketUrl: boolean?
|
||||
returns:
|
||||
regex: string
|
||||
|
||||
Root:
|
||||
type: interface
|
||||
|
|
|
|||
Loading…
Reference in New Issue