188 breaking releases

new 0.191.0 Feb 18, 2025
0.189.0 Jan 31, 2025
0.184.0 Dec 19, 2024
0.180.0 Nov 28, 2024
0.2.0 Mar 21, 2021

#1892 in Web programming

Download history 4155/week @ 2024-10-30 4365/week @ 2024-11-06 3829/week @ 2024-11-13 4692/week @ 2024-11-20 4138/week @ 2024-11-27 4811/week @ 2024-12-04 5199/week @ 2024-12-11 3738/week @ 2024-12-18 1574/week @ 2024-12-25 2572/week @ 2025-01-01 5074/week @ 2025-01-08 5374/week @ 2025-01-15 5433/week @ 2025-01-22 5183/week @ 2025-01-29 4869/week @ 2025-02-05 4891/week @ 2025-02-12

21,182 downloads per month
Used in 65 crates (26 directly)

MIT license

67KB
1.5K SLoC

JavaScript 1K SLoC // 0.2% comments Rust 227 SLoC // 0.0% comments TypeScript 109 SLoC // 0.8% comments

deno_url

This crate implements the URL, and URLPattern APIs for Deno.

URL Spec: https://url.spec.whatwg.org/ URLPattern Spec: https://wicg.github.io/urlpattern/

Usage Example

From javascript, include the extension's source, and assign URL, URLPattern, and URLSearchParams to the global scope:

import * as url from "ext:deno_url/00_url.js";
import * as urlPattern from "ext:deno_url/01_urlpattern.js";

Object.defineProperty(globalThis, "URL", {
  value: url.URL,
  enumerable: false,
  configurable: true,
  writable: true,
});

Object.defineProperty(globalThis, "URLPattern", {
  value: url.URLPattern,
  enumerable: false,
  configurable: true,
  writable: true,
});

Object.defineProperty(globalThis, "URLSearchParams", {
  value: url.URLSearchParams,
  enumerable: false,
  configurable: true,
  writable: true,
});

Then from rust, provide deno_url::deno_url::init_ops_and_esm() in the extensions field of your RuntimeOptions

Dependencies

  • deno_webidl: Provided by the deno_webidl crate

Provided ops

Following ops are provided, which can be accessed through Deno.ops:

  • op_url_reparse
  • op_url_parse
  • op_url_get_serialization
  • op_url_parse_with_base
  • op_url_parse_search_params
  • op_url_stringify_search_params
  • op_urlpattern_parse
  • op_urlpattern_process_match_input

Dependencies

~6–25MB
~413K SLoC