Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Thank you for contributing! --> ### Description <!-- Please insert your description here and provide especially info about the "what" this PR is solving --> ### Test Plan <!-- e.g. is there anything you'd like reviewers to focus on? --> ---
- Loading branch information
Showing
8 changed files
with
98 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use derivative::Derivative; | ||
use serde::Deserialize; | ||
|
||
#[napi_derive::napi(object)] | ||
#[derive(Deserialize, Default, Derivative)] | ||
#[serde(rename_all = "camelCase")] | ||
#[derivative(Debug)] | ||
pub struct BindingOutputAsset { | ||
pub file_name: String, | ||
pub source: String, | ||
} | ||
|
||
impl From<Box<rolldown_common::OutputAsset>> for BindingOutputAsset { | ||
fn from(chunk: Box<rolldown_common::OutputAsset>) -> Self { | ||
Self { source: chunk.source, file_name: chunk.file_name } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use std::collections::HashMap; | ||
|
||
use derivative::Derivative; | ||
use serde::Deserialize; | ||
|
||
use crate::types::binding_rendered_module::BindingRenderedModule; | ||
|
||
#[napi_derive::napi(object)] | ||
#[derive(Deserialize, Default, Derivative)] | ||
#[serde(rename_all = "camelCase")] | ||
#[derivative(Debug)] | ||
pub struct BindingOutputChunk { | ||
// PreRenderedChunk | ||
pub is_entry: bool, | ||
pub is_dynamic_entry: bool, | ||
pub facade_module_id: Option<String>, | ||
pub module_ids: Vec<String>, | ||
pub exports: Vec<String>, | ||
// RenderedChunk | ||
pub file_name: String, | ||
#[serde(skip_deserializing)] | ||
pub modules: HashMap<String, BindingRenderedModule>, | ||
// OutputChunk | ||
pub code: String, | ||
} | ||
|
||
impl From<Box<rolldown_common::OutputChunk>> for BindingOutputChunk { | ||
fn from(chunk: Box<rolldown_common::OutputChunk>) -> Self { | ||
Self { | ||
code: chunk.code, | ||
file_name: chunk.file_name, | ||
is_entry: chunk.is_entry, | ||
is_dynamic_entry: chunk.is_dynamic_entry, | ||
facade_module_id: chunk.facade_module_id, | ||
modules: chunk.modules.into_iter().map(|(key, value)| (key, value.into())).collect(), | ||
exports: chunk.exports, | ||
module_ids: chunk.module_ids, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use derivative::Derivative; | ||
use serde::Deserialize; | ||
|
||
use super::{binding_output_asset::BindingOutputAsset, binding_output_chunk::BindingOutputChunk}; | ||
|
||
#[napi_derive::napi(object)] | ||
#[derive(Deserialize, Default, Derivative)] | ||
#[serde(rename_all = "camelCase")] | ||
#[derivative(Debug)] | ||
pub struct BindingOutputs { | ||
pub chunks: Vec<BindingOutputChunk>, | ||
pub assets: Vec<BindingOutputAsset>, | ||
} | ||
|
||
impl From<Vec<rolldown_common::Output>> for BindingOutputs { | ||
fn from(outputs: Vec<rolldown_common::Output>) -> Self { | ||
let mut chunks: Vec<BindingOutputChunk> = vec![]; | ||
let mut assets: Vec<BindingOutputAsset> = vec![]; | ||
|
||
outputs.into_iter().for_each(|o| match o { | ||
rolldown_common::Output::Chunk(chunk) => chunks.push(chunk.into()), | ||
rolldown_common::Output::Asset(asset) => assets.push(asset.into()), | ||
}); | ||
|
||
Self { chunks, assets } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
pub mod binding_output_asset; | ||
pub mod binding_output_chunk; | ||
pub mod binding_outputs; | ||
pub mod binding_rendered_module; |