160 breaking releases

new 0.163.0 Jul 26, 2024
0.161.0 Jul 12, 2024
0.143.0 Mar 28, 2024
0.129.0 Dec 21, 2023
0.2.0 Mar 21, 2021

#8 in #spec

Download history 4284/week @ 2024-04-05 5902/week @ 2024-04-12 6338/week @ 2024-04-19 5029/week @ 2024-04-26 6995/week @ 2024-05-03 7113/week @ 2024-05-10 7525/week @ 2024-05-17 5861/week @ 2024-05-24 5039/week @ 2024-05-31 5308/week @ 2024-06-07 7589/week @ 2024-06-14 5370/week @ 2024-06-21 4732/week @ 2024-06-28 5273/week @ 2024-07-05 5379/week @ 2024-07-12 4697/week @ 2024-07-19

20,912 downloads per month
Used in 57 crates (23 directly)

MIT license

59KB
1.5K SLoC

JavaScript 1K SLoC // 0.2% comments Rust 233 SLoC // 0.0% comments TypeScript 100 SLoC // 0.7% 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

~97MB
~2M SLoC