Skip to content

Commit

Permalink
chore: add node ref
Browse files Browse the repository at this point in the history
  • Loading branch information
underfin committed Nov 12, 2023
1 parent 53e56be commit 63fd917
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
2 changes: 2 additions & 0 deletions crates/rolldown_binding/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export interface OutputOptions {
export interface OutputChunk {
code: string
fileName: string
isEntry: boolean
facadeModuleId?: string
}
export class Bundler {
constructor(inputOpts: InputOptions)
Expand Down
10 changes: 2 additions & 8 deletions crates/rolldown_binding/src/bundler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ impl Bundler {
}
};

let output_chunks = outputs
.into_iter()
.map(|asset| OutputChunk { code: asset.code, file_name: asset.file_name })
.collect::<Vec<_>>();
let output_chunks = outputs.into_iter().map(Into::into).collect::<Vec<_>>();
Ok(output_chunks)
}

Expand All @@ -95,10 +92,7 @@ impl Bundler {
}
};

let output_chunks = outputs
.into_iter()
.map(|asset| OutputChunk { code: asset.code, file_name: asset.file_name })
.collect::<Vec<_>>();
let output_chunks = outputs.into_iter().map(Into::into).collect::<Vec<_>>();
Ok(output_chunks)
}
}
13 changes: 13 additions & 0 deletions crates/rolldown_binding/src/output_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@ use serde::Deserialize;
pub struct OutputChunk {
pub code: String,
pub file_name: String,
pub is_entry: bool,
pub facade_module_id: Option<String>,
}

impl From<rolldown::OutputChunk> for OutputChunk {
fn from(chunk: rolldown::OutputChunk) -> Self {
Self {
code: chunk.code,
file_name: chunk.file_name,
is_entry: chunk.is_entry,
facade_module_id: chunk.facade_module_id,
}
}
}
4 changes: 2 additions & 2 deletions packages/core/src/utils/transform-to-rollup-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ function transformToRollupOutputChunk(chunk: OutputChunk): RollupOutputChunk {
return unimplemented()
},
get facadeModuleId() {
return unimplemented()
return chunk.facadeModuleId || null
},
get isDynamicEntry() {
return unimplemented()
},
get isEntry() {
return unimplemented()
return chunk.isEntry
},
get isImplicitEntry() {
return unimplemented()
Expand Down

0 comments on commit 63fd917

Please sign in to comment.