Skip to content

Commit acae3ad

Browse files
authored
Restore URLPattern from BCD 6.0.24 (#2065)
Co-authored-by: saschanaz <[email protected]>
1 parent cfe1f6a commit acae3ad

13 files changed

+1308
-3
lines changed

baselines/dom.generated.d.ts

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,6 +2292,39 @@ interface ULongRange {
22922292
min?: number;
22932293
}
22942294

2295+
interface URLPatternComponentResult {
2296+
groups?: Record<string, string | undefined>;
2297+
input?: string;
2298+
}
2299+
2300+
interface URLPatternInit {
2301+
baseURL?: string;
2302+
hash?: string;
2303+
hostname?: string;
2304+
password?: string;
2305+
pathname?: string;
2306+
port?: string;
2307+
protocol?: string;
2308+
search?: string;
2309+
username?: string;
2310+
}
2311+
2312+
interface URLPatternOptions {
2313+
ignoreCase?: boolean;
2314+
}
2315+
2316+
interface URLPatternResult {
2317+
hash?: URLPatternComponentResult;
2318+
hostname?: URLPatternComponentResult;
2319+
inputs?: URLPatternInput[];
2320+
password?: URLPatternComponentResult;
2321+
pathname?: URLPatternComponentResult;
2322+
port?: URLPatternComponentResult;
2323+
protocol?: URLPatternComponentResult;
2324+
search?: URLPatternComponentResult;
2325+
username?: URLPatternComponentResult;
2326+
}
2327+
22952328
interface UnderlyingByteSource {
22962329
autoAllocateChunkSize?: number;
22972330
cancel?: UnderlyingSourceCancelCallback;
@@ -32994,6 +33027,81 @@ declare var URL: {
3299433027
type webkitURL = URL;
3299533028
declare var webkitURL: typeof URL;
3299633029

33030+
/**
33031+
* The **`URLPattern`** interface of the URL Pattern API matches URLs or parts of URLs against a pattern.
33032+
*
33033+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern)
33034+
*/
33035+
interface URLPattern {
33036+
readonly hasRegExpGroups: boolean;
33037+
/**
33038+
* The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL.
33039+
*
33040+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash)
33041+
*/
33042+
readonly hash: string;
33043+
/**
33044+
* The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL.
33045+
*
33046+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname)
33047+
*/
33048+
readonly hostname: string;
33049+
/**
33050+
* The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL.
33051+
*
33052+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password)
33053+
*/
33054+
readonly password: string;
33055+
/**
33056+
* The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL.
33057+
*
33058+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname)
33059+
*/
33060+
readonly pathname: string;
33061+
/**
33062+
* The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL.
33063+
*
33064+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port)
33065+
*/
33066+
readonly port: string;
33067+
/**
33068+
* The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL.
33069+
*
33070+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol)
33071+
*/
33072+
readonly protocol: string;
33073+
/**
33074+
* The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL.
33075+
*
33076+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search)
33077+
*/
33078+
readonly search: string;
33079+
/**
33080+
* The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL.
33081+
*
33082+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username)
33083+
*/
33084+
readonly username: string;
33085+
/**
33086+
* The **`exec()`** method of the URLPattern interface takes a URL or object of URL parts, and returns either an object containing the results of matching the URL to the pattern, or `null` if the URL does not match the pattern.
33087+
*
33088+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec)
33089+
*/
33090+
exec(input?: URLPatternInput, baseURL?: string | URL): URLPatternResult | null;
33091+
/**
33092+
* The **`test()`** method of the URLPattern interface takes a URL or object of URL parts, and returns a boolean indicating if the given input matches the current pattern.
33093+
*
33094+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test)
33095+
*/
33096+
test(input?: URLPatternInput, baseURL?: string | URL): boolean;
33097+
}
33098+
33099+
declare var URLPattern: {
33100+
prototype: URLPattern;
33101+
new(input: URLPatternInput, baseURL: string | URL, options?: URLPatternOptions): URLPattern;
33102+
new(input?: URLPatternInput, options?: URLPatternOptions): URLPattern;
33103+
};
33104+
3299733105
/**
3299833106
* The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
3299933107
*
@@ -39472,6 +39580,7 @@ type RequestInfo = Request | string;
3947239580
type TexImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas | VideoFrame;
3947339581
type TimerHandler = string | Function;
3947439582
type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | MediaSourceHandle | ReadableStream | WritableStream | TransformStream | AudioData | VideoFrame | RTCDataChannel | ArrayBuffer;
39583+
type URLPatternInput = string | URLPatternInit;
3947539584
type Uint32List = Uint32Array<ArrayBufferLike> | GLuint[];
3947639585
type VibratePattern = number | number[];
3947739586
type WindowProxy = Window;

baselines/serviceworker.generated.d.ts

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,39 @@ interface Transformer<I = any, O = any> {
708708
writableType?: undefined;
709709
}
710710

711+
interface URLPatternComponentResult {
712+
groups?: Record<string, string | undefined>;
713+
input?: string;
714+
}
715+
716+
interface URLPatternInit {
717+
baseURL?: string;
718+
hash?: string;
719+
hostname?: string;
720+
password?: string;
721+
pathname?: string;
722+
port?: string;
723+
protocol?: string;
724+
search?: string;
725+
username?: string;
726+
}
727+
728+
interface URLPatternOptions {
729+
ignoreCase?: boolean;
730+
}
731+
732+
interface URLPatternResult {
733+
hash?: URLPatternComponentResult;
734+
hostname?: URLPatternComponentResult;
735+
inputs?: URLPatternInput[];
736+
password?: URLPatternComponentResult;
737+
pathname?: URLPatternComponentResult;
738+
port?: URLPatternComponentResult;
739+
protocol?: URLPatternComponentResult;
740+
search?: URLPatternComponentResult;
741+
username?: URLPatternComponentResult;
742+
}
743+
711744
interface UnderlyingByteSource {
712745
autoAllocateChunkSize?: number;
713746
cancel?: UnderlyingSourceCancelCallback;
@@ -7663,6 +7696,81 @@ declare var URL: {
76637696
parse(url: string | URL, base?: string | URL): URL | null;
76647697
};
76657698

7699+
/**
7700+
* The **`URLPattern`** interface of the URL Pattern API matches URLs or parts of URLs against a pattern.
7701+
*
7702+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern)
7703+
*/
7704+
interface URLPattern {
7705+
readonly hasRegExpGroups: boolean;
7706+
/**
7707+
* The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL.
7708+
*
7709+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash)
7710+
*/
7711+
readonly hash: string;
7712+
/**
7713+
* The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL.
7714+
*
7715+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname)
7716+
*/
7717+
readonly hostname: string;
7718+
/**
7719+
* The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL.
7720+
*
7721+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password)
7722+
*/
7723+
readonly password: string;
7724+
/**
7725+
* The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL.
7726+
*
7727+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname)
7728+
*/
7729+
readonly pathname: string;
7730+
/**
7731+
* The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL.
7732+
*
7733+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port)
7734+
*/
7735+
readonly port: string;
7736+
/**
7737+
* The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL.
7738+
*
7739+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol)
7740+
*/
7741+
readonly protocol: string;
7742+
/**
7743+
* The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL.
7744+
*
7745+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search)
7746+
*/
7747+
readonly search: string;
7748+
/**
7749+
* The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL.
7750+
*
7751+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username)
7752+
*/
7753+
readonly username: string;
7754+
/**
7755+
* The **`exec()`** method of the URLPattern interface takes a URL or object of URL parts, and returns either an object containing the results of matching the URL to the pattern, or `null` if the URL does not match the pattern.
7756+
*
7757+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec)
7758+
*/
7759+
exec(input?: URLPatternInput, baseURL?: string | URL): URLPatternResult | null;
7760+
/**
7761+
* The **`test()`** method of the URLPattern interface takes a URL or object of URL parts, and returns a boolean indicating if the given input matches the current pattern.
7762+
*
7763+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test)
7764+
*/
7765+
test(input?: URLPatternInput, baseURL?: string | URL): boolean;
7766+
}
7767+
7768+
declare var URLPattern: {
7769+
prototype: URLPattern;
7770+
new(input: URLPatternInput, baseURL: string | URL, options?: URLPatternOptions): URLPattern;
7771+
new(input?: URLPatternInput, options?: URLPatternOptions): URLPattern;
7772+
};
7773+
76667774
/**
76677775
* The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
76687776
*
@@ -11378,6 +11486,7 @@ type RequestInfo = Request | string;
1137811486
type TexImageSource = ImageBitmap | ImageData | OffscreenCanvas;
1137911487
type TimerHandler = string | Function;
1138011488
type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | ReadableStream | WritableStream | TransformStream | ArrayBuffer;
11489+
type URLPatternInput = string | URLPatternInit;
1138111490
type Uint32List = Uint32Array<ArrayBufferLike> | GLuint[];
1138211491
type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string;
1138311492
type BinaryType = "arraybuffer" | "blob";

baselines/sharedworker.generated.d.ts

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,39 @@ interface Transformer<I = any, O = any> {
638638
writableType?: undefined;
639639
}
640640

641+
interface URLPatternComponentResult {
642+
groups?: Record<string, string | undefined>;
643+
input?: string;
644+
}
645+
646+
interface URLPatternInit {
647+
baseURL?: string;
648+
hash?: string;
649+
hostname?: string;
650+
password?: string;
651+
pathname?: string;
652+
port?: string;
653+
protocol?: string;
654+
search?: string;
655+
username?: string;
656+
}
657+
658+
interface URLPatternOptions {
659+
ignoreCase?: boolean;
660+
}
661+
662+
interface URLPatternResult {
663+
hash?: URLPatternComponentResult;
664+
hostname?: URLPatternComponentResult;
665+
inputs?: URLPatternInput[];
666+
password?: URLPatternComponentResult;
667+
pathname?: URLPatternComponentResult;
668+
port?: URLPatternComponentResult;
669+
protocol?: URLPatternComponentResult;
670+
search?: URLPatternComponentResult;
671+
username?: URLPatternComponentResult;
672+
}
673+
641674
interface UnderlyingByteSource {
642675
autoAllocateChunkSize?: number;
643676
cancel?: UnderlyingSourceCancelCallback;
@@ -7206,6 +7239,81 @@ declare var URL: {
72067239
revokeObjectURL(url: string): void;
72077240
};
72087241

7242+
/**
7243+
* The **`URLPattern`** interface of the URL Pattern API matches URLs or parts of URLs against a pattern.
7244+
*
7245+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern)
7246+
*/
7247+
interface URLPattern {
7248+
readonly hasRegExpGroups: boolean;
7249+
/**
7250+
* The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL.
7251+
*
7252+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash)
7253+
*/
7254+
readonly hash: string;
7255+
/**
7256+
* The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL.
7257+
*
7258+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname)
7259+
*/
7260+
readonly hostname: string;
7261+
/**
7262+
* The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL.
7263+
*
7264+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password)
7265+
*/
7266+
readonly password: string;
7267+
/**
7268+
* The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL.
7269+
*
7270+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname)
7271+
*/
7272+
readonly pathname: string;
7273+
/**
7274+
* The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL.
7275+
*
7276+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port)
7277+
*/
7278+
readonly port: string;
7279+
/**
7280+
* The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL.
7281+
*
7282+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol)
7283+
*/
7284+
readonly protocol: string;
7285+
/**
7286+
* The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL.
7287+
*
7288+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search)
7289+
*/
7290+
readonly search: string;
7291+
/**
7292+
* The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL.
7293+
*
7294+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username)
7295+
*/
7296+
readonly username: string;
7297+
/**
7298+
* The **`exec()`** method of the URLPattern interface takes a URL or object of URL parts, and returns either an object containing the results of matching the URL to the pattern, or `null` if the URL does not match the pattern.
7299+
*
7300+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec)
7301+
*/
7302+
exec(input?: URLPatternInput, baseURL?: string | URL): URLPatternResult | null;
7303+
/**
7304+
* The **`test()`** method of the URLPattern interface takes a URL or object of URL parts, and returns a boolean indicating if the given input matches the current pattern.
7305+
*
7306+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test)
7307+
*/
7308+
test(input?: URLPatternInput, baseURL?: string | URL): boolean;
7309+
}
7310+
7311+
declare var URLPattern: {
7312+
prototype: URLPattern;
7313+
new(input: URLPatternInput, baseURL: string | URL, options?: URLPatternOptions): URLPattern;
7314+
new(input?: URLPatternInput, options?: URLPatternOptions): URLPattern;
7315+
};
7316+
72097317
/**
72107318
* The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
72117319
*
@@ -11066,6 +11174,7 @@ type RequestInfo = Request | string;
1106611174
type TexImageSource = ImageBitmap | ImageData | OffscreenCanvas;
1106711175
type TimerHandler = string | Function;
1106811176
type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | ReadableStream | WritableStream | TransformStream | ArrayBuffer;
11177+
type URLPatternInput = string | URLPatternInit;
1106911178
type Uint32List = Uint32Array<ArrayBufferLike> | GLuint[];
1107011179
type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string;
1107111180
type BinaryType = "arraybuffer" | "blob";

0 commit comments

Comments
 (0)