-
-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
2,740 additions
and
96 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
40 changes: 40 additions & 0 deletions
40
crates/rspack_binding_options/src/options/raw_builtins/raw_css_extract.rs
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 napi_derive::napi; | ||
use rspack_plugin_extract_css::plugin::{CssExtractOptions, InsertType}; | ||
|
||
#[napi(object)] | ||
pub struct RawCssExtractPluginOption { | ||
pub filename: String, | ||
pub chunk_filename: String, | ||
pub ignore_order: bool, | ||
pub insert: Option<String>, | ||
pub attributes: HashMap<String, String>, | ||
pub link_type: Option<String>, | ||
pub runtime: bool, | ||
pub pathinfo: bool, | ||
} | ||
|
||
impl From<RawCssExtractPluginOption> for CssExtractOptions { | ||
fn from(value: RawCssExtractPluginOption) -> Self { | ||
Self { | ||
filename: value.filename, | ||
chunk_filename: value.chunk_filename, | ||
ignore_order: value.ignore_order, | ||
insert: value | ||
.insert | ||
.map(|insert| { | ||
if insert.starts_with("function") || insert.starts_with('(') { | ||
InsertType::Fn(insert) | ||
} else { | ||
InsertType::Selector(insert) | ||
} | ||
}) | ||
.unwrap_or(InsertType::Default), | ||
attributes: value.attributes.into_iter().collect(), | ||
link_type: value.link_type, | ||
runtime: value.runtime, | ||
pathinfo: value.pathinfo, | ||
} | ||
} | ||
} |
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 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
Oops, something went wrong.