From 4e87195739f2a5d9a05451b48773c8afdc680765 Mon Sep 17 00:00:00 2001 From: akiyamn Date: Sun, 24 Sep 2023 23:22:21 +1000 Subject: Initial commit (by create-cloudflare CLI) --- node_modules/path-to-regexp/dist/index.d.ts | 127 ++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 node_modules/path-to-regexp/dist/index.d.ts (limited to 'node_modules/path-to-regexp/dist/index.d.ts') diff --git a/node_modules/path-to-regexp/dist/index.d.ts b/node_modules/path-to-regexp/dist/index.d.ts new file mode 100644 index 0000000..77aa004 --- /dev/null +++ b/node_modules/path-to-regexp/dist/index.d.ts @@ -0,0 +1,127 @@ +export interface ParseOptions { + /** + * Set the default delimiter for repeat parameters. (default: `'/'`) + */ + delimiter?: string; + /** + * List of characters to automatically consider prefixes when parsing. + */ + prefixes?: string; +} +/** + * Parse a string for the raw tokens. + */ +export declare function parse(str: string, options?: ParseOptions): Token[]; +export interface TokensToFunctionOptions { + /** + * When `true` the regexp will be case sensitive. (default: `false`) + */ + sensitive?: boolean; + /** + * Function for encoding input strings for output. + */ + encode?: (value: string, token: Key) => string; + /** + * When `false` the function can produce an invalid (unmatched) path. (default: `true`) + */ + validate?: boolean; +} +/** + * Compile a string to a template function for the path. + */ +export declare function compile
(str: string, options?: ParseOptions & TokensToFunctionOptions): PathFunction
; +export declare type PathFunction
= (data?: P) => string; +/** + * Expose a method for transforming tokens into the path function. + */ +export declare function tokensToFunction
(tokens: Token[], options?: TokensToFunctionOptions): PathFunction
; +export interface RegexpToFunctionOptions { + /** + * Function for decoding strings for params. + */ + decode?: (value: string, token: Key) => string; +} +/** + * A match result contains data about the path match. + */ +export interface MatchResult
{ + path: string; + index: number; + params: P; +} +/** + * A match is either `false` (no match) or a match result. + */ +export declare type Match
= false | MatchResult
; +/** + * The match function takes a string and returns whether it matched the path. + */ +export declare type MatchFunction
= (path: string) => Match
; +/** + * Create path match function from `path-to-regexp` spec. + */ +export declare function match
(str: Path, options?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions): MatchFunction
; +/** + * Create a path match function from `path-to-regexp` output. + */ +export declare function regexpToFunction
(re: RegExp, keys: Key[], options?: RegexpToFunctionOptions): MatchFunction
;
+/**
+ * Metadata about a key.
+ */
+export interface Key {
+ name: string | number;
+ prefix: string;
+ suffix: string;
+ pattern: string;
+ modifier: string;
+}
+/**
+ * A token is a string (nothing special) or key metadata (capture group).
+ */
+export declare type Token = string | Key;
+export interface TokensToRegexpOptions {
+ /**
+ * When `true` the regexp will be case sensitive. (default: `false`)
+ */
+ sensitive?: boolean;
+ /**
+ * When `true` the regexp won't allow an optional trailing delimiter to match. (default: `false`)
+ */
+ strict?: boolean;
+ /**
+ * When `true` the regexp will match to the end of the string. (default: `true`)
+ */
+ end?: boolean;
+ /**
+ * When `true` the regexp will match from the beginning of the string. (default: `true`)
+ */
+ start?: boolean;
+ /**
+ * Sets the final character for non-ending optimistic matches. (default: `/`)
+ */
+ delimiter?: string;
+ /**
+ * List of characters that can also be "end" characters.
+ */
+ endsWith?: string;
+ /**
+ * Encode path tokens for use in the `RegExp`.
+ */
+ encode?: (value: string) => string;
+}
+/**
+ * Expose a function for taking tokens and returning a RegExp.
+ */
+export declare function tokensToRegexp(tokens: Token[], keys?: Key[], options?: TokensToRegexpOptions): RegExp;
+/**
+ * Supported `path-to-regexp` input types.
+ */
+export declare type Path = string | RegExp | Array