Skip to content

Commit 82d88a1

Browse files
authored
Merge pull request #730 from marp-team/url-parse-deprecation-warning
Fix Node.js deprecation warning `DEP0169` (`url.parse()`)
2 parents 941bf5f + b15c3a8 commit 82d88a1

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
- Upgrade Node.js LTS to v26.4.0 ([#729](https://github.com/marp-team/marp-cli/pull/729))
1010
- Upgrade dependent packages ([#729](https://github.com/marp-team/marp-cli/pull/729))
1111

12+
### Fixed
13+
14+
- Fix Node.js deprecation warning `DEP0169` (`url.parse()`) ([#730](https://github.com/marp-team/marp-cli/pull/730))
15+
1216
## v4.4.0 - 2026-05-06
1317

1418
### Added

src/server.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fs from 'node:fs'
44
import { Server as HttpServer } from 'node:http'
55
import path from 'node:path'
66
import querystring from 'node:querystring'
7-
import url from 'node:url'
7+
import { URL } from 'node:url'
88
import { promisify } from 'node:util'
99
import type { Express, Request, Response } from 'express'
1010
import serveIndex from 'serve-index'
@@ -141,10 +141,11 @@ export class Server extends (EventEmitter as new () => TypedEmitter<Server.Event
141141
}
142142

143143
private async preprocess(req: Request, res: Response) {
144-
const { pathname, query } = url.parse(req.url)
144+
const requestUrl = new URL(req.url, 'http://localhost')
145+
const { pathname } = requestUrl
145146
if (!pathname) return
146147

147-
const qs = querystring.parse(query || '')
148+
const qs = querystring.parse(requestUrl.search.slice(1))
148149
const response = async (fn: string) => {
149150
try {
150151
const { result, type } = await this.convertMarkdown(fn, qs)

0 commit comments

Comments
 (0)