Skip to content

Commit

Permalink
external_js_files implmented
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Nov 21, 2024
1 parent 1937468 commit db1241a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions fastn-resolved/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ impl Function {
external_implementation: false,
}
}

pub fn js(&self) -> Option<&str> {
match self.js {
Some(fastn_resolved::PropertyValue::Value {
value: fastn_resolved::Value::String { ref text },
..
}) => Some(text),
_ => None,
}
}
}

#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
Expand Down
6 changes: 3 additions & 3 deletions v0.5/fastn-compiler/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ impl fastn_compiler::Compiler {
used_definitions
.values()
.filter_map(|definition| match definition {
fastn_resolved::Definition::WebComponent(web_component) => {
web_component.js().map(ToOwned::to_owned)
}
fastn_resolved::Definition::WebComponent(web_component) => web_component.js(),
fastn_resolved::Definition::Function(f) => f.js(),
_ => None,
})
.map(ToOwned::to_owned)
.collect()
}

Expand Down

0 comments on commit db1241a

Please sign in to comment.