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

Commit

Permalink
add __STATIC_CONTENT_MANIFEST as a text module for modules workers (#…
Browse files Browse the repository at this point in the history
…2126)

* add __STATIC_CONTENT_MANIFEST in vars

* push manifest as a text module for modules workers

Co-authored-by: Sunil Pai <[email protected]>
  • Loading branch information
g45t345rt and threepointone authored Nov 8, 2021
1 parent 05be611 commit 5e8ba9d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/upload/form/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ pub fn build(
kv_namespaces.to_vec(),
durable_object_classes,
migration,
text_blobs,
plain_texts,
usage_model,
)?;
Expand Down
9 changes: 9 additions & 0 deletions src/upload/form/modules_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ fn add_files(mut form: Form, assets: &ModulesAssets) -> Result<Form> {
.file_name(name.clone());
form = form.part(name.clone(), part);
}

for text_blob in &assets.text_blobs {
let part = Part::text(text_blob.data.clone())
.file_name(text_blob.binding.clone())
.mime_str("text/plain")?;

form = form.part(text_blob.binding.clone(), part);
}

Ok(form)
}

Expand Down
3 changes: 3 additions & 0 deletions src/upload/form/project_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ pub struct ModulesAssets {
pub kv_namespaces: Vec<KvNamespace>,
pub durable_object_classes: Vec<DurableObjectsClass>,
pub migration: Option<ApiMigration>,
pub text_blobs: Vec<TextBlob>,
pub plain_texts: Vec<PlainText>,
pub usage_model: Option<UsageModel>,
}
Expand All @@ -331,6 +332,7 @@ impl ModulesAssets {
kv_namespaces: Vec<KvNamespace>,
durable_object_classes: Vec<DurableObjectsClass>,
migration: Option<ApiMigration>,
text_blobs: Vec<TextBlob>,
plain_texts: Vec<PlainText>,
usage_model: Option<UsageModel>,
) -> Result<Self> {
Expand All @@ -341,6 +343,7 @@ impl ModulesAssets {
kv_namespaces,
durable_object_classes,
migration,
text_blobs,
plain_texts,
usage_model,
})
Expand Down

0 comments on commit 5e8ba9d

Please sign in to comment.