Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Add wasm_modules config field for bundling arbitrary WebAssembly modules. #1803

Merged
merged 2 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/commands/kv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ mod tests {
text_blobs: None,
usage_model: None,
build: None,
wasm_modules: None,
};
assert!(kv::get_namespace_id(&target_with_dup_kv_bindings, "").is_err());
}
Expand Down
2 changes: 2 additions & 0 deletions src/settings/toml/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub struct Manifest {
pub env: Option<HashMap<String, Environment>>,
pub vars: Option<HashMap<String, String>>,
pub text_blobs: Option<HashMap<String, PathBuf>>,
pub wasm_modules: Option<HashMap<String, PathBuf>>,
pub triggers: Option<Triggers>,
#[serde(default, with = "string_empty_as_none")]
pub usage_model: Option<UsageModel>,
Expand Down Expand Up @@ -354,6 +355,7 @@ impl Manifest {
vars: self.vars.clone(), // Not inherited
text_blobs: self.text_blobs.clone(), // Inherited
usage_model: self.usage_model, // Top level
wasm_modules: self.wasm_modules.clone(),
};

let environment = self.get_environment(environment_name)?;
Expand Down
1 change: 1 addition & 0 deletions src/settings/toml/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct Target {
pub vars: Option<HashMap<String, String>>,
pub text_blobs: Option<HashMap<String, PathBuf>>,
pub usage_model: Option<UsageModel>,
pub wasm_modules: Option<HashMap<String, PathBuf>>,
}

impl Target {
Expand Down
1 change: 1 addition & 0 deletions src/sites/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ mod tests {
vars: None,
text_blobs: None,
usage_model: None,
wasm_modules: None,
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/upload/form/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ pub fn build(
}
}

if let Some(modules) = &target.wasm_modules {
for (key, module_path) in modules.iter() {
wasm_modules.push(WasmModule::new(module_path.clone(), key.clone())?);
}
}

if let Some(vars) = &target.vars {
for (key, value) in vars.iter() {
plain_texts.push(PlainText::new(key.clone(), value.clone())?)
Expand Down