173 breaking releases

new 0.176.0 Nov 6, 2024
0.174.0 Oct 25, 2024
0.164.0 Jul 31, 2024
0.143.0 Mar 28, 2024
0.2.0 Mar 21, 2021

#1457 in Web programming

Download history 5476/week @ 2024-07-18 5067/week @ 2024-07-25 3733/week @ 2024-08-01 3766/week @ 2024-08-08 2887/week @ 2024-08-15 4591/week @ 2024-08-22 4345/week @ 2024-08-29 4480/week @ 2024-09-05 3603/week @ 2024-09-12 4599/week @ 2024-09-19 5234/week @ 2024-09-26 3796/week @ 2024-10-03 3957/week @ 2024-10-10 4665/week @ 2024-10-17 3937/week @ 2024-10-24 3795/week @ 2024-10-31

17,175 downloads per month
Used in 64 crates (24 directly)

MIT license

61KB
1.5K SLoC

JavaScript 1K SLoC // 0.2% comments Rust 234 SLoC // 0.0% comments TypeScript 109 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

~88MB
~1.5M SLoC