mirror of
https://github.com/denoland/deno.git
synced 2024-12-26 09:10:40 -05:00
0260b488fb
Extensions allow declarative extensions to "JsRuntime" (ops, state, JS or middleware). This allows for: - `op_crates` to be plug-and-play & self-contained, reducing complexity leaked to consumers - op middleware (like metrics_op) to be opt-in and for new middleware (unstable, tracing,...) - `MainWorker` and `WebWorker` to be composable, allowing users to extend workers with their ops whilst benefiting from the other infrastructure (inspector, etc...) In short extensions improve deno's modularity, reducing complexity and leaky abstractions for embedders and the internal codebase.
17 lines
429 B
Rust
17 lines
429 B
Rust
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
|
|
|
use deno_core::include_js_files;
|
|
use deno_core::Extension;
|
|
use std::path::PathBuf;
|
|
|
|
pub fn init() -> Extension {
|
|
Extension::pure_js(include_js_files!(
|
|
prefix "deno:op_crates/console",
|
|
"01_colors.js",
|
|
"02_console.js",
|
|
))
|
|
}
|
|
|
|
pub fn get_declaration() -> PathBuf {
|
|
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_console.d.ts")
|
|
}
|