Skip to content

Commit

Permalink
Fix: Remove ftd#main-package from global map
Browse files Browse the repository at this point in the history
This allows to use the following in ftd code:

```ftd
-- ftd.text: $ftd.main-package
```
  • Loading branch information
siddhantk232 committed Jan 31, 2025
1 parent 1ff5f6b commit 5806e7a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ftd/src/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,15 @@ pub fn document_into_js_ast(document: ftd::interpreter::Document) -> JSAstData {
if let ftd::interpreter::Thing::Component(c) = thing {
document_asts.push(c.to_ast(&doc, &mut has_rive_components));
} else if let ftd::interpreter::Thing::Variable(v) = thing {
let prefix = if v.name == "ftd#main-package" {
None
} else {
Some(fastn_js::GLOBAL_VARIABLE_MAP.to_string())
};

document_asts.push(v.to_ast(
&doc,
Some(fastn_js::GLOBAL_VARIABLE_MAP.to_string()),
prefix,
&mut has_rive_components,
));
} else if let ftd::interpreter::Thing::WebComponent(web_component) = thing {
Expand Down

0 comments on commit 5806e7a

Please sign in to comment.