mirror of
https://github.com/denoland/deno.git
synced 2024-12-26 17:19:06 -05:00
41a70898ad
Aligns the error messages in the ext folder to be in-line with the Deno style guide. https://github.com/denoland/deno/issues/25269 <!-- Before submitting a PR, please read https://docs.deno.com/runtime/manual/references/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. --> |
||
---|---|---|
.. | ||
benches | ||
00_url.js | ||
01_urlpattern.js | ||
Cargo.toml | ||
internal.d.ts | ||
lib.deno_url.d.ts | ||
lib.rs | ||
README.md | ||
urlpattern.rs |
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