mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-21 13:15:50 +00:00
Implement PluginChain
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use plugin::{Plugin, PluginResult};
|
||||
use plugin::{Plugin, PluginChain, PluginResult};
|
||||
use rbx::{RbxItem, RbxValue};
|
||||
use vfs::VfsItem;
|
||||
|
||||
pub struct DefaultPlugin;
|
||||
|
||||
impl DefaultPlugin {
|
||||
pub fn new() -> DefaultPlugin {
|
||||
DefaultPlugin
|
||||
}
|
||||
}
|
||||
|
||||
impl Plugin for DefaultPlugin {
|
||||
fn transform(item: &VfsItem) -> PluginResult {
|
||||
match item {
|
||||
fn transform_file(&self, plugins: &PluginChain, vfs_item: &VfsItem) -> PluginResult {
|
||||
match vfs_item {
|
||||
&VfsItem::File { ref contents, ref name } => {
|
||||
let mut properties = HashMap::new();
|
||||
|
||||
@@ -24,13 +30,11 @@ impl Plugin for DefaultPlugin {
|
||||
}))
|
||||
},
|
||||
&VfsItem::Dir { ref children, ref name } => {
|
||||
// TODO: call back into plugin list and transform there instead
|
||||
|
||||
let mut rbx_children = Vec::new();
|
||||
|
||||
for (_, child_item) in children {
|
||||
match Self::transform(child_item) {
|
||||
PluginResult::Value(Some(rbx_item)) => {
|
||||
match plugins.transform_file(child_item) {
|
||||
Some(rbx_item) => {
|
||||
rbx_children.push(rbx_item);
|
||||
},
|
||||
_ => {},
|
||||
|
||||
Reference in New Issue
Block a user