We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3380a07 commit b71a91dCopy full SHA for b71a91d
packages/open-next/src/utils/regex.ts
@@ -1,3 +1,14 @@
1
+/**
2
+ * Constructs a regular expression for a path that supports separators for multiple platforms
3
+ * - Uses posix separators (`/`) as the input that should be made cross-platform.
4
+ * - Special characters are escaped by default but can be controlled through opts.escape.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * getCrossPlatformPathRegex("./middleware.mjs")
9
+ * getCrossPlatformPathRegex("\\./middleware\\.(mjs|cjs)", { escape: false })
10
+ * ```
11
+ */
12
export function getCrossPlatformPathRegex(
13
regex: string,
14
opts: { escape: boolean } = { escape: true },
0 commit comments