mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
feat(compile): unstable npm and node specifier support (#19005)
This is the initial support for npm and node specifiers in `deno compile`. The npm packages are included in the binary and read from it via a virtual file system. This also supports the `--node-modules-dir` flag, dependencies specified in a package.json, and npm binary commands (ex. `deno compile --unstable npm:cowsay`) Closes #16632
This commit is contained in:
parent
5fd74bfa1c
commit
28aa489de9
44 changed files with 2733 additions and 261 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::FsModuleLoader;
|
||||
use deno_core::ModuleSpecifier;
|
||||
use deno_runtime::permissions::PermissionsContainer;
|
||||
use deno_runtime::worker::MainWorker;
|
||||
use deno_runtime::worker::WorkerOptions;
|
||||
|
@ -14,10 +15,7 @@ deno_core::extension!(hello_runtime, esm = ["hello_runtime_bootstrap.js"]);
|
|||
async fn main() -> Result<(), AnyError> {
|
||||
let js_path =
|
||||
Path::new(env!("CARGO_MANIFEST_DIR")).join("examples/hello_runtime.js");
|
||||
let main_module = deno_core::resolve_path(
|
||||
&js_path.to_string_lossy(),
|
||||
&std::env::current_dir()?,
|
||||
)?;
|
||||
let main_module = ModuleSpecifier::from_file_path(js_path).unwrap();
|
||||
let mut worker = MainWorker::bootstrap_from_options(
|
||||
main_module.clone(),
|
||||
PermissionsContainer::allow_all(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue