deno/ext/url
denobot 6c6ee02dfd
chore: forward v1.44.4 release commit to main (#24271)
This is the release commit being forwarded back to main for 1.44.4

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-06-19 20:29:53 +02:00
..
benches chore: bump deno core (#22243) 2024-02-04 17:03:14 -07:00
01_urlpattern.js refactor: migrate extensions to virtual ops module (#22135) 2024-01-26 23:46:46 +01:00
00_url.js feat(ext/url): add URL.parse (#23318) 2024-04-16 17:11:57 +02:00
Cargo.toml chore: forward v1.44.4 release commit to main (#24271) 2024-06-19 20:29:53 +02:00
internal.d.ts chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
lib.deno_url.d.ts docs: update categories to match new planned sitemap (#23677) 2024-05-05 18:56:55 -07:00
lib.rs chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
README.md docs: Add documentation to a subset of available extensions (#24138) 2024-06-18 00:07:48 +02:00
urlpattern.rs chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00

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