Repository navigation
feat(bundle): runtime API for deno bundle - #29949
Conversation
dd83789 to
84cf2b6
Compare
lucacasonato
left a comment
There was a problem hiding this comment.
Still needs an unstable flag
d827f21 to
d9b55ad
Compare
57ac076 to
4409779
Compare
6bf0ad7 to
fadec6a
Compare
| self, | ||
| scope: &mut v8::HandleScope<'s>, | ||
| ) -> Result<Vec<v8::Local<'s, v8::Value>>, PluginExecError> { | ||
| let mut v8_args = Vec::new(); |
There was a problem hiding this comment.
| let mut v8_args = Vec::new(); | |
| let mut v8_args = Vec::with_capacity(5); |
eff51bc to
dff7012
Compare
| /// V8 code cache for module and script source code. | ||
| pub v8_code_cache: Option<Arc<dyn CodeCache>>, | ||
|
|
||
| pub bundle_provider: Option<Arc<dyn crate::ops::bundle::BundleProvider>>, |
There was a problem hiding this comment.
Is it actually optional? What happens if it's None?
There was a problem hiding this comment.
It falls back to a default implementation that errors out when you call it
| ops::permissions::deno_permissions::init(), | ||
| ops::tty::deno_tty::init(), | ||
| ops::http::deno_http_runtime::init(), | ||
| ops::bundle::deno_bundle_runtime::lazy_init(), |
There was a problem hiding this comment.
Why is it lazy_init() here but init() in web_worker.rs?
There was a problem hiding this comment.
Not entirely sure, I was matching the rest of the extensions that have args (for instance deno_node and a bunch of others are the same)
| TranspileResult::Owned(source) => source, | ||
| TranspileResult::Cloned(source) => { | ||
| debug_assert!(false, "Transpile owned failed."); | ||
| // debug_assert!(false, "Transpile owned failed."); |
There was a problem hiding this comment.
This should be reverted I think?
There was a problem hiding this comment.
This assertion was failing during bundling and I'm not sure why
|
|
||
| /** **UNSTABLE**: New API, yet to be vetted. | ||
| * | ||
| * Bundle Typescript/Javascript code |
There was a problem hiding this comment.
Can be done in a follow up, but please open an issue about it to improve these JS docks
| let flags = Arc::new(flags_clone); | ||
| let bundler = match super::bundle_init(flags, &bundle_flags).await { |
There was a problem hiding this comment.
Ooof, this feels super hacky - are we sure that all the permissions are upheld? Feels like it would use permissions defined in flags, not the current permission set after Deno.permissions.request()/revoke()
There was a problem hiding this comment.
Consider factoring out a higher level function that doesn't work off of flags
There was a problem hiding this comment.
The issue isn't that bundle_init needs flags, it's that the CliFactory needs flags. For instance, the resolver and other things change based on the subcommand on the Flags. For the main clifactory the resolver and the rest are made for the run subcommand, so we need a new CliFactory with the bundle subcommand. That means making new flags
In its current state, it works, but it isn't pretty and has rough edges just about all over