-
-
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
50 changed files
with
4,037 additions
and
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use rustc_hash::FxHashSet as HashSet; | ||
use swc_core::atoms::Atom; | ||
|
||
use crate::ExportInfoId; | ||
|
||
#[derive(Debug, PartialEq, Eq, Clone, Copy)] | ||
pub enum ExportModeType { | ||
Missing, | ||
Unused, | ||
EmptyStar, | ||
ReexportDynamicDefault, | ||
ReexportNamedDefault, | ||
ReexportNamespaceObject, | ||
ReexportFakeNamespaceObject, | ||
ReexportUndefined, | ||
NormalReexport, | ||
DynamicReexport, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct NormalReexportItem { | ||
pub name: Atom, | ||
pub ids: Vec<Atom>, | ||
pub hidden: bool, | ||
pub checked: bool, | ||
pub export_info: ExportInfoId, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct ExportMode { | ||
/// corresponding to `type` field in webpack's `EpxortMode` | ||
pub ty: ExportModeType, | ||
pub items: Option<Vec<NormalReexportItem>>, | ||
pub name: Option<Atom>, | ||
pub fake_type: u8, | ||
pub partial_namespace_export_info: Option<ExportInfoId>, | ||
pub ignored: Option<HashSet<Atom>>, | ||
pub hidden: Option<HashSet<Atom>>, | ||
} | ||
|
||
impl ExportMode { | ||
pub fn new(ty: ExportModeType) -> Self { | ||
Self { | ||
ty, | ||
items: None, | ||
name: None, | ||
fake_type: 0, | ||
partial_namespace_export_info: None, | ||
ignored: None, | ||
hidden: None, | ||
} | ||
} | ||
} |
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.