[package] name = "rustyscript" authors = ["@rscarson"] description = "Effortless JS Integration for Rust" edition = "2021" license = "MIT OR Apache-2.0" version = "0.11.0" repository = "https://github.com/rscarson/rustyscript" keywords = ["rust", "javascript", "deno", "runtime", "embedding"] categories = ["web-programming", "network-programming", "api-bindings", "compilers", "development-tools::ffi"] readme = "readme.md" [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] [features] default = ["worker", "safe_extensions"] # # Feature groups # # # Extensions that are safe to use in a sandboxed environment # These extensions do not provide access to the network or filesystem safe_extensions = ["web_stub", "console", "url", "crypto"] # # Enables all available extensions, except for node support # These extensions are not safe to use in a sandboxed environment without additional restrictions # (See [WebPermissions] all_extensions = ["network_extensions", "io_extensions"] # # Extensions that provide access to the network. Also enables URL imports from JS # These extensions are not safe to use in a sandboxed environment without additional restrictions # (See [WebPermissions] network_extensions = ["web", "webstorage", "websocket", "http", "url", "crypto", "console", "broadcast_channel", "url_import"] # # Extensions that provide access to the filesystem. Also enables file imports from JS # These extensions are not safe to use in a sandboxed environment without additional restrictions # (See [FsPermissions] io_extensions = ["web", "webstorage", "fs", "io", "cache", "console", "ffi", "webgpu", "kv", "cron", "fs_import"] # # Additional features that are not part of the core runtime # These features are safe to use in a sandboxed environment without additional restrictions extra_features = ["worker", "snapshot_builder"] # # Highly experimental NodeJS compatibility layer. Enables all other extensions # Enables the use of the node and npm modules # CJS support not yet implemented # These extensions are not safe to use in a sandboxed environment without additional restrictions # (See [NodePermissions] node_experimental = [ "deno_node", "deno_resolver", "node_resolver", "deno_npm", "deno_semver", "deno_napi", "deno_runtime", "checksum", "all_extensions" ] # By default, an extension stub is included in the runtime if the `web` feature is disabled # It provides a minimal set of APIs for parts of the runtime, such as timers and the DOM exception class # It maintains sandboxing by not providing access to the network or filesystem # # It does however require the webidl extension to be enabled # By disabling this feature, you can opt out of the web stub extension, and the webidl extension # # The primary use-case for this is for creating a runtime using a deno_core version incompatible with the deno extensions # # Note that by turning off both web_stub and web, btoa/atob and timer APIs will not be available web_stub = ["webidl", "base64-simd"] # # Each feature in this section corresponds to a different deno extension # I have annotated each with the section of the w3c spec that it implements # # [https://html.spec.whatwg.org/multipage/web-messaging.html] broadcast_channel = ["deno_broadcast_channel", "web", "webidl"] # [https://w3c.github.io/ServiceWorker/#cache-interface] cache = ["deno_cache", "webidl", "web"] # [https://console.spec.whatwg.org/] console = ["deno_console", "deno_terminal"] # Implements scheduled tasks (crons) API cron = ["deno_cron", "console"] # [https://www.w3.org/TR/WebCryptoAPI/] crypto = ["deno_crypto", "webidl"] # Dynamic library ffi ffi = ["deno_ffi"] # Provides ops for interacting with the file system. fs = ["deno_fs", "web", "io"] # [https://fetch.spec.whatwg.org/] http = ["deno_http", "web", "websocket"] # [https://github.com/denoland/denokv/blob/main/proto/kv-connect.md] kv = ["deno_kv", "web", "console"] # Provides IO primitives for other Deno extensions (stdio streams, etc) io = ["deno_io", "web", "rustyline", "winapi", "nix", "libc", "once_cell"] # [https://url.spec.whatwg.org/] # [https://wicg.github.io/urlpattern/] url = ["deno_url", "webidl"] # Timers, events, text encoder/decoder, telemetry # [https://w3c.github.io/FileAPI] # [https://fetch.spec.whatwg.org/] web = [ "deno_web", "deno_tls", "deno_fetch", "deno_net", "dep:http", "deno_permissions", "deno_telemetry", "webidl", "console", "url", "crypto", "url_import", "fs_import", "hyper-util" ] # [https://gpuweb.github.io/gpuweb/] webgpu = ["deno_webgpu", "web"] # [https://webidl.spec.whatwg.org/] webidl = ["deno_webidl"] # [https://html.spec.whatwg.org/multipage/webstorage.html] webstorage = ["deno_webstorage", "webidl"] # [https://websockets.spec.whatwg.org/] websocket = ["deno_websocket", "web"] # Features for the module loader # - fs_import allows arbitrary file imports # - url_import allows importing from the web # # Both fs_import and url_import will break sandboxing fs_import = [] url_import = ["reqwest"] # Enables the use of the SnapshotBuilder runtime # It is used to create a snapshot of a runtime for faster startup times snapshot_builder = [] # Enables the threaded worker API worker = [] # # End of feature definitions # [dependencies] maybe_path = "0.1.3" thiserror = "2.0.4" serde = "1.0.215" # Used for NodeJS compatibility and other features async-trait = "0.1.83" # Used to generate identifiers for callbacks paste = "1.0.15" # The deno runtime itself, and the webidl extension for the web APIs deno_core = "0.323.0" # For transpiling typescript deno_ast = { version = "=0.43.3", features = ["transpiling", "cjs"] } # Runtime for async tasks tokio = "1.42.0" tokio-util = "0.7.13" # For web hyper-util = {version = "=0.1.7", optional = true} # For URL imports # Pinned for now due to upstream issues reqwest = { version = "=0.12.8", optional = true, default-features = false, features = ["blocking", "rustls-tls"] } http = { version = "1.0", optional = true } deno_permissions = { version = "0.40.0", optional = true } # # Dependencies for the various extension features # deno_broadcast_channel = { version = "0.174.0", optional = true } deno_cache = { version = "0.112.0", optional = true } deno_console = { version = "0.180.0", optional = true } deno_cron = { version = "0.60.0", optional = true } deno_crypto = { version = "0.194.0", optional = true } deno_fetch = { version = "0.204.0", optional = true } deno_ffi = { version = "0.167.0", optional = true } deno_fs = { version = "0.90.0", optional = true, features = ["sync_fs"] } deno_http = { version = "0.178.0", optional = true } deno_kv = { version = "0.88.0", optional = true } deno_net = { version = "0.172.0", optional = true } deno_node = { version = "0.117.0", optional = true } deno_telemetry = { version = "0.2.0", optional = true } deno_tls = { version = "0.167.0", optional = true } deno_url = { version = "0.180.0", optional = true } deno_web = { version = "0.211.0", optional = true } deno_webidl = { version = "0.180.0", optional = true } deno_webstorage = { version = "0.175.0", optional = true } deno_websocket = { version = "0.185.0", optional = true } deno_webgpu = { version = "0.147.0", optional = true } deno_io = { version = "0.90.0", optional = true } # Dependencies for the IO feature rustyline = {version = "=15.0.0", optional = true} winapi = {version = "=0.3.9", optional = true, features = [ "commapi", "knownfolders", "mswsock", "objbase", "psapi", "shlobj", "tlhelp32", "winbase", "winerror", "winuser", "winsock2", "processenv", "wincon", "wincontypes", "consoleapi" ]} nix = {version = "=0.29.0", optional = true, features = ["term"]} libc = {version = "0.2.167", optional = true} once_cell = {version = "1.20.2", optional = true} # Dependencies for the web stub feature base64-simd = {version = "0.8.0", optional = true} # Dependencies for the node feature deno_resolver = { version = "0.12.0", optional = true } node_resolver = { version = "0.19.0", optional = true, features = ["sync"] } deno_runtime = { version = "0.189.0", optional = true, features = ["exclude_runtime_main_js"] } deno_terminal = { version = "0.2.0", optional = true } deno_semver = { version = "0.5.16", optional = true } deno_napi = { version = "0.111.0", optional = true } deno_npm = { version = "0.26.0", optional = true } checksum = { version = "0.2.1", optional = true } [dev-dependencies] version-sync = "0.9.5" criterion = "0.5.1" [[example]] name = "custom_threaded_worker" required-features = ["worker"] [[example]] name = "default_threaded_worker" required-features = ["worker"] [[example]] name = "worker_pool" required-features = ["worker"] [[example]] name = "create_snapshot" required-features = ["snapshot_builder"] [[example]] name = "url_import" required-features = ["fs_import", "url_import"] [[example]] name = "custom_import_logic" required-features = ["url_import"] [[example]] name = "async_javascript" required-features = ["web_stub"] [[example]] name = "websocket" required-features = ["websocket", "web"] [[example]] name = "node_import" required-features = ["node_experimental"] [[example]] name = "background_tasks" required-features = ["web"] [[bench]] name = "runtime" harness = false