Skip to content

Commit 7bd2bf6

Browse files
committed
refactor: use native RegExp.escape
1 parent 6f71c3c commit 7bd2bf6

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

deno.lock

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev_deps.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export { bold, cyan, dim, green, magenta } from 'jsr:@std/fmt@^1.0.8/colors'
1515
export { copy, emptyDir, ensureDir, expandGlob } from 'jsr:@std/fs@^1.0.19'
1616
export { getAvailablePort } from 'jsr:@std/net@^1.0.4/get-available-port'
1717
export { dirname, fromFileUrl, relative, resolve, toFileUrl } from 'jsr:@std/path@^1.1.1'
18-
export { escape } from 'jsr:@std/regexp@^1.0.1'
1918
export * as SemVer from 'jsr:@std/semver@^1.0.5'
2019
export { build } from 'npm:esbuild@0.25.5'
2120
export { default as tsid } from 'npm:unplugin-isolated-decl@^0.14.5/esbuild'

scripts/release.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
type ConfirmOptions,
2626
cyan,
2727
dim,
28-
escape,
2928
green,
3029
Input as _Input,
3130
type InputOptions,
@@ -288,7 +287,9 @@ await step('Creating a new release', async () => {
288287
.replace(/^.*(?:\:\/\/|@)/, '').replace(/(?:\.git|#).*$/, '').replace(/:\/?/, '/')
289288

290289
const changelog = await Deno.readTextFile('CHANGELOG.md')
291-
const match = changelog.match(new RegExp(`## \\[${escape(newVersion)}\\]\\((.*?)\\).*?\n([\\s\\S]*?)(?=\n## |$)`))
290+
const match = changelog.match(
291+
new RegExp(`## \\[${RegExp.escape(newVersion)}\\]\\((.*?)\\).*?\n([\\s\\S]*?)(?=\n## |$)`),
292+
)
292293

293294
const url = newGithubReleaseUrl({
294295
body: `${match?.[2]?.trim() ?? ''}\n\n**Full Changelog**: ${match?.[1]?.trim() ?? ''}`,

src/router.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { serveDir, type ServeDirOptions } from 'jsr:@std/http@^1.0.19/file-serve
2727
import { STATUS_CODE, STATUS_TEXT, type StatusCode } from 'jsr:@std/http@^1.0.19/status'
2828
import { normalize as posixNormalize } from 'jsr:@std/path@^1.1.1/posix/normalize'
2929
import { toFileUrl } from 'jsr:@std/path@^1.1.1/to-file-url'
30-
import { escape } from 'jsr:@std/regexp@^1.0.1/escape'
3130

3231
const methods = new Set(['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'PATCH'])
3332
const ignore = /^(?:.*?\/)?(?:(?:_|\.|node_modules\/|coverage\/).*|.*\.d\.ts)$/
@@ -322,7 +321,7 @@ export async function createRouter(
322321
})()
323322
}
324323

325-
const urlRootRE = new RegExp(`^/?${escape(urlRoot)}(?:/|$)`)
324+
const urlRootRE = new RegExp(`^/?${RegExp.escape(urlRoot)}(?:/|$)`)
326325

327326
function getHandler(file: string, method: string): Promise<Handler | null> {
328327
return handlerCache.use(

0 commit comments

Comments
 (0)