mirror of
https://codeberg.org/demostf/frontend.git
synced 2026-06-03 18:24:12 +02:00
swc updates
This commit is contained in:
parent
ce59b3d867
commit
49a100bb61
11 changed files with 2759 additions and 2515 deletions
|
|
@ -71,10 +71,7 @@ pub fn bundle_script(script: &str) -> Vec<u8> {
|
|||
fn write<W: Write>(minify: bool, cm: Arc<SourceMap>, module: &Module, out: W) {
|
||||
let wr = JsWriter::new(cm.clone(), "\n", out, None);
|
||||
let mut emitter = Emitter {
|
||||
cfg: swc_ecma_codegen::Config {
|
||||
minify,
|
||||
..Default::default()
|
||||
},
|
||||
cfg: swc_ecma_codegen::Config::default().with_minify(minify),
|
||||
cm: cm.clone(),
|
||||
comments: None,
|
||||
wr: if minify {
|
||||
|
|
@ -152,15 +149,17 @@ impl Load for Loader {
|
|||
panic!("failed to parse")
|
||||
});
|
||||
|
||||
let program = Program::Module(module);
|
||||
|
||||
let top_level_mark = Mark::new();
|
||||
|
||||
let module = module
|
||||
let program = program
|
||||
.fold_with(&mut strip(top_level_mark))
|
||||
.fold_with(&mut as_folder(InlineVisitor {}))
|
||||
.fold_with(&mut as_folder(TransformVisitor::new(
|
||||
jsx_dom_expressions::config::Config {
|
||||
module_name: "solid-js/web".to_string(),
|
||||
builtins: vec![
|
||||
built_ins: vec![
|
||||
"For".into(),
|
||||
"Show".into(),
|
||||
"Switch".into(),
|
||||
|
|
@ -179,6 +178,8 @@ impl Load for Loader {
|
|||
.fold_with(&mut hygiene())
|
||||
.fold_with(&mut fixer(None));
|
||||
|
||||
let module = program.module().unwrap();
|
||||
|
||||
// if let FileName::Real(path) = &f {
|
||||
// let mut out = vec![];
|
||||
// write(false, self.cm.clone(), &module, &mut out);
|
||||
|
|
|
|||
|
|
@ -14,10 +14,7 @@ pub fn bundle_style(style: &str) -> Vec<u8> {
|
|||
let mut bundler = Bundler::new(
|
||||
&fs,
|
||||
None,
|
||||
ParserOptions {
|
||||
nesting: true,
|
||||
..ParserOptions::default()
|
||||
},
|
||||
ParserOptions::default(),
|
||||
);
|
||||
let mut stylesheet = bundler
|
||||
.bundle(Path::new(style))
|
||||
|
|
@ -26,7 +23,7 @@ pub fn bundle_style(style: &str) -> Vec<u8> {
|
|||
Browsers::from_browserslist(["last 2 versions"]).expect("failed to parse browserlist");
|
||||
stylesheet
|
||||
.minify(MinifyOptions {
|
||||
targets: browsers.clone(),
|
||||
targets: browsers.into(),
|
||||
..MinifyOptions::default()
|
||||
})
|
||||
.expect("failed to minify css");
|
||||
|
|
@ -40,7 +37,7 @@ pub fn bundle_style(style: &str) -> Vec<u8> {
|
|||
|
||||
stylesheet
|
||||
.to_css(PrinterOptions {
|
||||
targets: browsers,
|
||||
targets: browsers.into(),
|
||||
minify,
|
||||
..PrinterOptions::default()
|
||||
})
|
||||
|
|
@ -54,7 +51,9 @@ struct InlineUrlVisitor;
|
|||
impl<'i> Visitor<'i> for InlineUrlVisitor {
|
||||
type Error = Infallible;
|
||||
|
||||
const TYPES: VisitTypes = visit_types!(URLS);
|
||||
fn visit_types(&self) -> VisitTypes {
|
||||
visit_types!(URLS)
|
||||
}
|
||||
|
||||
fn visit_url(&mut self, url: &mut Url<'i>) -> Result<(), Self::Error> {
|
||||
if let Some(path) = url.url.strip_prefix("inline://") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue