Skip to content

Commit

Permalink
partial external_js_files
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Nov 21, 2024
1 parent ee1ed21 commit 0dd580d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
10 changes: 10 additions & 0 deletions fastn-resolved/src/web_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,14 @@ impl WebComponentDefinition {
line_number,
}
}

pub fn js(&self) -> Option<&str> {
match self.js {
fastn_resolved::PropertyValue::Value { ref value, .. } => match value {
fastn_resolved::Value::String { text } => Some(text),
_ => None,
},
_ => None,
}
}
}
13 changes: 10 additions & 3 deletions v0.5/fastn-compiler/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,17 @@ impl fastn_compiler::Compiler {

pub(crate) fn external_js_files(
&self,
_needed_symbols: &indexmap::IndexMap<String, &fastn_resolved::Definition>,
used_definitions: &indexmap::IndexMap<String, &fastn_resolved::Definition>,
) -> Vec<String> {
// go through needed_symbols and get the external js files
todo!()
used_definitions
.values()
.filter_map(|definition| match definition {
fastn_resolved::Definition::WebComponent(web_component) => {
web_component.js().map(ToOwned::to_owned)
}
_ => None,
})
.collect()
}

pub(crate) fn external_css_files(
Expand Down

0 comments on commit 0dd580d

Please sign in to comment.