From a558492bf98b1729ddc11b9645505db9cd0718e1 Mon Sep 17 00:00:00 2001 From: Boshen <1430279+Boshen@users.noreply.github.com> Date: Wed, 31 Jul 2024 12:44:19 +0000 Subject: [PATCH] feat(codegen): implement `BinaryExpressionVisitor` (#4548) part of https://github.com/oxc-project/backlog/issues/58 `monitor-oxc` run: https://github.com/oxc-project/monitor-oxc/actions/runs/10179047831 binary expression stack length tally using `counts` in top 100 npm packages from monitor-oxc: ``` 29772 counts ( 1) 17652 (59.3%, 59.3%): 0 ( 2) 5772 (19.4%, 78.7%): 1 ( 3) 3204 (10.8%, 89.4%): 2 ( 4) 1276 ( 4.3%, 93.7%): 3 ( 5) 616 ( 2.1%, 95.8%): 4 ( 6) 308 ( 1.0%, 96.8%): 5 ( 7) 202 ( 0.7%, 97.5%): 6 ( 8) 168 ( 0.6%, 98.1%): 7 ( 9) 114 ( 0.4%, 98.5%): 9 ( 10) 90 ( 0.3%, 98.8%): 8 ( 11) 84 ( 0.3%, 99.0%): 13 ( 12) 58 ( 0.2%, 99.2%): 10 ( 13) 48 ( 0.2%, 99.4%): 12 ( 14) 32 ( 0.1%, 99.5%): 11 ( 15) 20 ( 0.1%, 99.6%): 134 ( 16) 16 ( 0.1%, 99.6%): 18 ( 17) 16 ( 0.1%, 99.7%): 20 ( 18) 12 ( 0.0%, 99.7%): 19 ( 19) 12 ( 0.0%, 99.8%): 35 ( 20) 12 ( 0.0%, 99.8%): 51 ( 21) 10 ( 0.0%, 99.8%): 15 ( 22) 6 ( 0.0%, 99.9%): 17 ( 23) 6 ( 0.0%, 99.9%): 21 ( 24) 6 ( 0.0%, 99.9%): 45 ( 25) 4 ( 0.0%, 99.9%): 14 ( 26) 4 ( 0.0%, 99.9%): 26 ( 27) 4 ( 0.0%, 99.9%): 53 ( 28) 2 ( 0.0%, 99.9%): 172 ( 29) 2 ( 0.0%, 99.9%): 214 ( 30) 2 ( 0.0%,100.0%): 22 ( 31) 2 ( 0.0%,100.0%): 27 ( 32) 2 ( 0.0%,100.0%): 28 ( 33) 2 ( 0.0%,100.0%): 29 ( 34) 2 ( 0.0%,100.0%): 31 ( 35) 2 ( 0.0%,100.0%): 36 ( 36) 2 ( 0.0%,100.0%): 46 ( 37) 2 ( 0.0%,100.0%): 55 ``` --- crates/oxc_codegen/src/binary_expr_visitor.rs | 193 ++++++++++ crates/oxc_codegen/src/gen.rs | 96 +++-- crates/oxc_codegen/src/lib.rs | 8 +- .../oxc_codegen/tests/integration/esbuild.rs | 12 +- crates/oxc_codegen/tests/integration/unit.rs | 161 ++++++++- crates/oxc_minifier/tests/oxc/mod.rs | 3 +- crates/oxc_minifier/tests/oxc/precedence.rs | 163 --------- crates/oxc_syntax/src/operator.rs | 8 + crates/oxc_syntax/src/precedence.rs | 46 +-- tasks/coverage/codegen_sourcemap.snap | 330 +++++++++--------- tasks/minsize/minsize.snap | 24 +- 11 files changed, 624 insertions(+), 420 deletions(-) create mode 100644 crates/oxc_codegen/src/binary_expr_visitor.rs delete mode 100644 crates/oxc_minifier/tests/oxc/precedence.rs diff --git a/crates/oxc_codegen/src/binary_expr_visitor.rs b/crates/oxc_codegen/src/binary_expr_visitor.rs new file mode 100644 index 0000000000000..bb30d2c2c87bf --- /dev/null +++ b/crates/oxc_codegen/src/binary_expr_visitor.rs @@ -0,0 +1,193 @@ +//! Visit binary and logical expression in a loop without recursion. +//! +//! Reference: +use std::ops::Not; + +use oxc_ast::ast::{BinaryExpression, Expression, LogicalExpression}; +use oxc_syntax::operator::{BinaryOperator, LogicalOperator}; +use oxc_syntax::precedence::{GetPrecedence, Precedence}; + +use crate::{ + gen::{Gen, GenExpr}, + Codegen, Context, +}; + +#[derive(Clone, Copy)] +pub enum Binaryish<'a> { + Binary(&'a BinaryExpression<'a>), + Logical(&'a LogicalExpression<'a>), +} + +impl<'a> Binaryish<'a> { + pub fn left(&self) -> &'a Expression<'a> { + match self { + Self::Binary(e) => e.left.without_parenthesized(), + Self::Logical(e) => e.left.without_parenthesized(), + } + } + + pub fn right(&self) -> &'a Expression<'a> { + match self { + Self::Binary(e) => e.right.without_parenthesized(), + Self::Logical(e) => e.right.without_parenthesized(), + } + } + + pub fn operator(&self) -> BinaryishOperator { + match self { + Self::Binary(e) => BinaryishOperator::Binary(e.operator), + Self::Logical(e) => BinaryishOperator::Logical(e.operator), + } + } +} + +#[derive(Debug, Clone, Copy, Eq, PartialEq)] +pub enum BinaryishOperator { + Binary(BinaryOperator), + Logical(LogicalOperator), +} + +impl Gen for BinaryishOperator { + fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) { + match self { + Self::Binary(op) => op.gen(p, ctx), + Self::Logical(op) => op.gen(p, ctx), + } + } +} + +impl GetPrecedence for BinaryishOperator { + fn precedence(&self) -> Precedence { + match self { + Self::Binary(op) => op.precedence(), + Self::Logical(op) => op.precedence(), + } + } +} + +impl BinaryishOperator { + pub fn lower_precedence(self) -> Precedence { + match self { + Self::Binary(op) => op.lower_precedence(), + Self::Logical(op) => op.lower_precedence(), + } + } +} + +#[derive(Clone, Copy)] +pub struct BinaryExpressionVisitor<'a> { + pub e: Binaryish<'a>, + pub precedence: Precedence, + pub ctx: Context, + + pub left_precedence: Precedence, + pub left_ctx: Context, + + pub operator: BinaryishOperator, + pub wrap: bool, + pub right_precedence: Precedence, +} + +impl<'a> BinaryExpressionVisitor<'a> { + pub fn gen_expr(v: Self, p: &mut Codegen<'a, { MINIFY }>) { + let mut v = v; + let stack_bottom = p.binary_expr_stack.len(); + loop { + if !v.check_and_prepare(p) { + break; + } + + let left = v.e.left(); + let left_binary = match left { + Expression::BinaryExpression(e) => Some(Binaryish::Binary(e)), + Expression::LogicalExpression(e) => Some(Binaryish::Logical(e)), + _ => None, + }; + + let Some(left_binary) = left_binary else { + left.gen_expr(p, v.left_precedence, v.left_ctx); + v.visit_right_and_finish(p); + break; + }; + + p.binary_expr_stack.push(v); + v = BinaryExpressionVisitor { + e: left_binary, + precedence: v.left_precedence, + ctx: v.left_ctx, + left_precedence: Precedence::Lowest, + left_ctx: Context::empty(), + operator: v.operator, + wrap: false, + right_precedence: Precedence::Lowest, + }; + } + + loop { + let len = p.binary_expr_stack.len(); + if len == 0 || len - 1 < stack_bottom { + break; + } + let v = p.binary_expr_stack.pop().unwrap(); + v.visit_right_and_finish(p); + } + } + + pub fn check_and_prepare(&mut self, p: &mut Codegen<{ MINIFY }>) -> bool { + let e = self.e; + self.operator = e.operator(); + + self.wrap = self.precedence >= self.operator.precedence() + || (self.operator == BinaryishOperator::Binary(BinaryOperator::In) + && self.ctx.intersects(Context::FORBID_IN)); + + if self.wrap { + p.print_char(b'('); + self.ctx &= Context::FORBID_IN.not(); + } + + self.left_precedence = self.operator.lower_precedence(); + self.right_precedence = self.operator.lower_precedence(); + + if self.operator.precedence().is_right_associative() { + self.left_precedence = self.operator.precedence(); + } + + if self.operator.precedence().is_left_associative() { + self.right_precedence = self.operator.precedence(); + } + + match self.operator { + BinaryishOperator::Logical(LogicalOperator::Coalesce) => { + if let Expression::LogicalExpression(logical_expr) = e.left() { + if matches!(logical_expr.operator, LogicalOperator::And | LogicalOperator::Or) { + self.left_precedence = Precedence::Prefix; + } + } + if let Expression::LogicalExpression(logical_expr) = e.right() { + if matches!(logical_expr.operator, LogicalOperator::And | LogicalOperator::Or) { + self.right_precedence = Precedence::Prefix; + } + } + } + BinaryishOperator::Binary(BinaryOperator::Exponential) => { + if matches!(e.left(), Expression::UnaryExpression(_)) { + self.left_precedence = Precedence::Call; + } + } + _ => {} + } + + true + } + + pub fn visit_right_and_finish(&self, p: &mut Codegen<{ MINIFY }>) { + p.print_soft_space(); + self.operator.gen(p, Context::empty()); + p.print_soft_space(); + self.e.right().gen_expr(p, self.right_precedence, self.ctx & Context::FORBID_IN); + if self.wrap { + p.print_char(b')'); + } + } +} diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index af23c3bf1ca09..4edf53841139a 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -8,11 +8,14 @@ use oxc_syntax::{ identifier::{LS, PS}, keyword::is_reserved_keyword_or_global_object, number::NumberBase, - operator::{BinaryOperator, UnaryOperator}, + operator::{BinaryOperator, LogicalOperator, UnaryOperator}, precedence::{GetPrecedence, Precedence}, }; -use crate::{Codegen, Context, Operator}; +use crate::{ + binary_expr_visitor::{BinaryExpressionVisitor, Binaryish, BinaryishOperator}, + Codegen, Context, Operator, +}; pub trait Gen { fn gen(&self, _p: &mut Codegen<{ MINIFY }>, _ctx: Context) {} @@ -627,11 +630,12 @@ impl<'a, const MINIFY: bool> Gen for VariableDeclarator<'a> { impl<'a, const MINIFY: bool> Gen for Function<'a> { fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) { - p.add_source_mapping(self.span.start); let n = p.code_len(); - p.gen_comment(self.span.start); let wrap = self.is_expression() && (p.start_of_stmt == n || p.start_of_default_export == n); + p.gen_comment(self.span.start); p.wrap(wrap, |p| { + p.print_space_before_identifier(); + p.add_source_mapping(self.span.start); if self.declare { p.print_str("declare "); } @@ -1101,6 +1105,7 @@ impl<'a, const MINIFY: bool> GenExpr for ParenthesizedExpression<'a> { impl<'a, const MINIFY: bool> Gen for IdentifierReference<'a> { fn gen(&self, p: &mut Codegen<{ MINIFY }>, _ctx: Context) { let name = p.get_identifier_reference_name(self); + p.print_space_before_identifier(); p.add_source_mapping_for_name(self.span, name); p.print_str(name); } @@ -1131,6 +1136,7 @@ impl<'a, const MINIFY: bool> Gen for LabelIdentifier<'a> { impl Gen for BooleanLiteral { fn gen(&self, p: &mut Codegen<{ MINIFY }>, _ctx: Context) { p.add_source_mapping(self.span.start); + p.print_space_before_identifier(); p.print_str(self.as_str()); } } @@ -1729,37 +1735,27 @@ impl<'a, const MINIFY: bool> GenExpr for UnaryExpression<'a> { impl<'a, const MINIFY: bool> GenExpr for BinaryExpression<'a> { fn gen_expr(&self, p: &mut Codegen<{ MINIFY }>, precedence: Precedence, ctx: Context) { - let mut ctx = ctx; - let wrap = precedence >= self.precedence() - || (self.operator == BinaryOperator::In && ctx.intersects(Context::FORBID_IN)); - if wrap { - ctx &= Context::FORBID_IN.not(); - } - p.wrap(wrap, |p| { - let left_precedence = if self.operator.precedence().is_right_associative() { - // "**" can't contain certain unary expressions - if matches!(self.left.without_parenthesized(), Expression::UnaryExpression(_)) { - Precedence::Call - } else { - self.precedence() - } - } else { - self.operator.lower_precedence() - }; - self.left.gen_expr(p, left_precedence, ctx); - if self.operator.is_keyword() { - p.print_space_before_identifier(); - } else { - p.print_soft_space(); - } - self.operator.gen(p, ctx); - let right_precedence = if self.operator.precedence().is_left_associative() { - self.precedence() - } else { - self.operator.lower_precedence() - }; - self.right.gen_expr(p, right_precedence, ctx & Context::FORBID_IN); - }); + let v = BinaryExpressionVisitor { + // SAFETY: + // The pointer is stored on the heap and all will be consumed in the binary expression visitor. + e: Binaryish::Binary(unsafe { + std::mem::transmute::<&BinaryExpression<'_>, &BinaryExpression<'_>>(self) + }), + precedence, + ctx, + left_precedence: Precedence::Lowest, + left_ctx: Context::empty(), + operator: BinaryishOperator::Binary(self.operator), + wrap: false, + right_precedence: Precedence::Lowest, + }; + BinaryExpressionVisitor::gen_expr(v, p); + } +} + +impl Gen for LogicalOperator { + fn gen(&self, p: &mut Codegen<{ MINIFY }>, _ctx: Context) { + p.print_str(self.as_str()); } } @@ -1767,13 +1763,12 @@ impl Gen for BinaryOperator { fn gen(&self, p: &mut Codegen<{ MINIFY }>, _ctx: Context) { let operator = self.as_str(); if self.is_keyword() { + p.print_space_before_identifier(); p.print_str(operator); - p.print_hard_space(); } else { let op: Operator = (*self).into(); p.print_space_before_operator(op); p.print_str(operator); - p.print_soft_space(); p.prev_op = Some(op); p.prev_op_end = p.code().len(); } @@ -1790,18 +1785,21 @@ impl<'a, const MINIFY: bool> Gen for PrivateInExpression<'a> { impl<'a, const MINIFY: bool> GenExpr for LogicalExpression<'a> { fn gen_expr(&self, p: &mut Codegen<{ MINIFY }>, precedence: Precedence, ctx: Context) { - // Logical expressions and coalesce expressions cannot be mixed (Syntax Error). - let mixed = matches!( - (precedence, self.precedence()), - (Precedence::NullishCoalescing, Precedence::LogicalAnd | Precedence::LogicalOr) - ); - p.wrap(mixed || (precedence >= self.precedence()), |p| { - self.left.gen_expr(p, self.precedence(), ctx); - p.print_soft_space(); - p.print_str(self.operator.as_str()); - p.print_soft_space(); - self.right.gen_expr(p, self.precedence(), ctx); - }); + let v = BinaryExpressionVisitor { + // SAFETY: + // The pointer is stored on the heap and all will be consumed in the binary expression visitor. + e: Binaryish::Logical(unsafe { + std::mem::transmute::<&LogicalExpression<'_>, &LogicalExpression<'_>>(self) + }), + precedence, + ctx, + left_precedence: Precedence::Lowest, + left_ctx: Context::empty(), + operator: BinaryishOperator::Logical(self.operator), + wrap: false, + right_precedence: Precedence::Lowest, + }; + BinaryExpressionVisitor::gen_expr(v, p); } } diff --git a/crates/oxc_codegen/src/lib.rs b/crates/oxc_codegen/src/lib.rs index 38675ae2d9d11..3e81005c37bf8 100644 --- a/crates/oxc_codegen/src/lib.rs +++ b/crates/oxc_codegen/src/lib.rs @@ -4,6 +4,7 @@ //! * [esbuild](https://github.com/evanw/esbuild/blob/main/internal/js_printer/js_printer.go) mod annotation_comment; +mod binary_expr_visitor; mod context; mod gen; mod operator; @@ -25,11 +26,14 @@ use oxc_syntax::{ precedence::Precedence, }; +use crate::{ + binary_expr_visitor::BinaryExpressionVisitor, operator::Operator, + sourcemap_builder::SourcemapBuilder, +}; pub use crate::{ context::Context, gen::{Gen, GenExpr}, }; -use crate::{operator::Operator, sourcemap_builder::SourcemapBuilder}; /// Code generator without whitespace removal. pub type CodeGenerator<'a> = Codegen<'a, false>; @@ -72,6 +76,7 @@ pub struct Codegen<'a, const MINIFY: bool> { prev_reg_exp_end: usize, need_space_before_dot: usize, print_next_indent_as_space: bool, + binary_expr_stack: Vec>, /// For avoiding `;` if the previous statement ends with `}`. needs_semicolon: bool, @@ -130,6 +135,7 @@ impl<'a, const MINIFY: bool> Codegen<'a, MINIFY> { needs_semicolon: false, need_space_before_dot: 0, print_next_indent_as_space: false, + binary_expr_stack: Vec::with_capacity(5), prev_op_end: 0, prev_reg_exp_end: 0, prev_op: None, diff --git a/crates/oxc_codegen/tests/integration/esbuild.rs b/crates/oxc_codegen/tests/integration/esbuild.rs index d65fe0faf7477..88b3cae8698ed 100644 --- a/crates/oxc_codegen/tests/integration/esbuild.rs +++ b/crates/oxc_codegen/tests/integration/esbuild.rs @@ -1066,15 +1066,19 @@ fn test_infinity() { } #[test] -#[ignore] fn test_binary_operator_visitor() { // Make sure the inner "/*b*/" comment doesn't disappear due to weird binary visitor stuff // testMangle(t, "x = (0, /*a*/ (0, /*b*/ (0, /*c*/ 1 == 2) + 3) * 4)", "x = /*a*/\n/*b*/\n(/*c*/\n!1 + 3) * 4;\n"); // Make sure deeply-nested ASTs don't cause a stack overflow - // FIXME: - // let x = format!("x = f(){};\n", " || f()".repeat(2)); // TODO: change this to 10_000 - // test(&x, &x); + let x = format!("x = f(){};\n", " + f()".repeat(10_000)); + test(&x, &x); + + let x = format!("x = f(){};\n", " && f()".repeat(10_000)); + test(&x, &x); + + let x = format!("x = f(){};\n", " && f() + f()".repeat(10_000)); + test(&x, &x); } // See: https://github.com/tc39/proposal-explicit-resource-management diff --git a/crates/oxc_codegen/tests/integration/unit.rs b/crates/oxc_codegen/tests/integration/unit.rs index 0d3ca122f77e6..d638c6a99215f 100644 --- a/crates/oxc_codegen/tests/integration/unit.rs +++ b/crates/oxc_codegen/tests/integration/unit.rs @@ -1,4 +1,4 @@ -use crate::tester::test; +use crate::tester::{test, test_minify}; #[test] fn module_decl() { @@ -52,3 +52,162 @@ fn unicode_escape() { test("console.log('안녕하세요');", "console.log(\"안녕하세요\");\n"); test("console.log('🧑‍🤝‍🧑');", "console.log(\"🧑‍🤝‍🧑\");\n"); } + +#[test] +fn comma() { + test_minify("1, 2, 3", "1,2,3;"); + test_minify("1, a = b, 3", "1,a=b,3;"); + test_minify("1, (2, 3), 4", "1,2,3,4;"); +} + +#[test] +fn assignment() { + test_minify("a = b ? c : d", "a=b?c:d;"); + test_minify("[a,b] = (1, 2)", "[a,b]=(1,2);"); + // `{a,b}` is a block, must wrap the whole expression to be an assignment expression + test_minify("({a,b} = (1, 2))", "({a,b}=(1,2));"); + test_minify("a *= yield b", "a*=yield b;"); + test_minify("a /= () => {}", "a/=()=>{};"); + test_minify("a %= async () => {}", "a%=async ()=>{};"); + test_minify("a -= (1, 2)", "a-=(1,2);"); + test_minify("a >>= b >>= c", "a>>=b>>=c;"); +} + +#[test] +fn r#yield() { + test_minify("function *foo() { yield }", "function*foo(){yield}"); + test_minify("function *foo() { yield * a ? b : c }", "function*foo(){yield*a?b:c}"); + test_minify("function *foo() { yield * yield * a }", "function*foo(){yield*yield*a}"); + test_minify("function *foo() { yield * () => {} }", "function*foo(){yield*()=>{}}"); + test_minify("function *foo() { yield * async () => {} }", "function*foo(){yield*async ()=>{}}"); + test_minify("function *foo() { yield a ? b : c }", "function*foo(){yield a?b:c}"); + test_minify("function *foo() { yield yield a }", "function*foo(){yield yield a}"); + test_minify("function *foo() { yield () => {} }", "function*foo(){yield ()=>{}}"); + test_minify("function *foo() { yield async () => {} }", "function*foo(){yield async ()=>{}}"); + test_minify( + "function *foo() { yield { a } = [ b ] = c ? b : d }", + "function*foo(){yield {a}=[b]=c?b:d}", + ); + // TODO: remove the extra space in `yield (a,b)` + test_minify("function *foo() { yield (a, b) }", "function*foo(){yield (a,b)}"); + test_minify("function *foo() { yield a, b }", "function*foo(){yield a,b}"); +} + +#[test] +fn arrow() { + test_minify("x => a, b", "(x)=>a,b;"); + test_minify("x => (a, b)", "(x)=>(a,b);"); + test_minify("x => (a => b)", "(x)=>(a)=>b;"); + test_minify("x => y => a, b", "(x)=>(y)=>a,b;"); + test_minify("x => y => (a = b)", "(x)=>(y)=>a=b;"); + test_minify("x => y => z => a = b, c", "(x)=>(y)=>(z)=>a=b,c;"); + test_minify("x => y => z => a = (b, c)", "(x)=>(y)=>(z)=>a=(b,c);"); + test_minify("x => ({} + 0)", "(x)=>({})+0;"); +} + +#[test] +fn conditional() { + test_minify("a ? b : c", "a?b:c;"); + test_minify("a ? (b, c) : (d, e)", "a?(b,c):(d,e);"); + test_minify("a ? b : c ? b : c", "a?b:c?b:c;"); + test_minify("(a ? b : c) ? b : c", "(a?b:c)?b:c;"); + test_minify("a, b ? c : d", "a,b?c:d;"); + test_minify("(a, b) ? c : d", "(a,b)?c:d;"); + test_minify("a = b ? c : d", "a=b?c:d;"); + test_minify("(a = b) ? c : d", "(a=b)?c:d;"); +} + +#[test] +fn coalesce() { + test_minify("a ?? b", "a??b;"); + test_minify("a ?? b ?? c ?? d", "a??b??c??d;"); + test_minify("a ?? (b ?? (c ?? d))", "a??(b??(c??d));"); + test_minify("(a ?? (b ?? (c ?? d)))", "a??(b??(c??d));"); + test_minify("a, b ?? c", "a,b??c;"); + test_minify("(a, b) ?? c", "(a,b)??c;"); + test_minify("a, b ?? c, d", "a,b??c,d;"); + test_minify("a, b ?? (c, d)", "a,b??(c,d);"); + test_minify("a = b ?? c", "a=b??c;"); + test_minify("a ?? (b = c)", "a??(b=c);"); + test_minify("(a | b) ?? (c | d)", "a|b??c|d;"); +} + +#[test] +fn logical_or() { + test_minify("a || b || c", "a||b||c;"); + test_minify("(a || (b || c)) || d", "a||(b||c)||d;"); + test_minify("a || (b || (c || d))", "a||(b||(c||d));"); + test_minify("a || b && c", "a||b&&c;"); + test_minify("(a || b) && c", "(a||b)&&c;"); + test_minify("a, b || c, d", "a,b||c,d;"); + test_minify("(a, b) || (c, d)", "(a,b)||(c,d);"); + test_minify("(a && b) || (c && d)", "a&&b||c&&d;"); + test_minify("a && b || c && d", "a&&b||c&&d;"); +} + +#[test] +fn logical_and() { + test_minify("a && b && c", "a&&b&&c;"); + test_minify("a && ((b && c) && d)", "a&&(b&&c&&d);"); + test_minify("((a && b) && c) && d", "a&&b&&c&&d;"); + test_minify("(a || b) && (c || d)", "(a||b)&&(c||d);"); + test_minify("a, b && c, d", "a,b&&c,d;"); + test_minify("(a, b) && (c, d)", "(a,b)&&(c,d);"); + test_minify("a || b && c || d", "a||b&&c||d;"); +} + +#[test] +fn bitwise_or() { + test_minify("a | b | c", "a|b|c;"); + test_minify("(a | b) | c", "a|b|c;"); + test_minify("a | (b | c)", "a|(b|c);"); + test_minify("a | b ^ c", "a|b^c;"); + test_minify("a | (b ^ c)", "a|b^c;"); + test_minify("a | (b && c)", "a|(b&&c);"); + test_minify("a | b && c", "a|b&&c;"); + test_minify("(a ^ b) | (c ^ d)", "a^b|c^d;"); + test_minify("(a, b) | (c, d)", "(a,b)|(c,d);"); + test_minify("a, b | c, d", "a,b|c,d;"); +} + +#[test] +fn bitwise_xor() { + test_minify("a ^ b ^ c", "a^b^c;"); + test_minify("(a ^ b) ^ c", "a^b^c;"); + test_minify("a ^ (b ^ c)", "a^(b^c);"); + test_minify("a | b & c", "a|b&c;"); + test_minify("a | (b & c)", "a|b&c;"); + test_minify("a | (b || c)", "a|(b||c);"); + test_minify("a | b || c", "a|b||c;"); + test_minify("(a, b) ^ (c, d)", "(a,b)^(c,d);"); + test_minify("(a | b) ^ (c | d)", "(a|b)^(c|d);"); + test_minify("a, b ^ c, d", "a,b^c,d;"); +} + +#[test] +fn bitwise_and() { + test_minify("a & b & c", "a&b&c;"); + test_minify("((a & b) & c) & d", "a&b&c&d;"); + test_minify("a & (b & (c & d))", "a&(b&(c&d));"); + test_minify("a & b == c", "a&b==c;"); + test_minify("a & (b == c)", "a&b==c;"); + test_minify("a == b & c", "a==b&c;"); + test_minify("(a == b) & c", "a==b&c;"); + test_minify("a ^ b & c", "a^b&c;"); + test_minify("(a ^ b) & c", "(a^b)&c;"); + test_minify("(a, b) & (c, d)", "(a,b)&(c,d);"); + test_minify("a, b & c, d", "a,b&c,d;"); +} + +#[test] +fn equality() { + test_minify("a == b != c === d !== e", "a==b!=c===d!==e;"); + test_minify("a == (b != (c === (d !== e)))", "a==(b!=(c===(d!==e)));"); + test_minify("(((a == b) != c) === d) !== e", "a==b!=c===d!==e;"); + test_minify("a > b == c < d", "a>b==c b) == (c < d)", "a>b==c {}", "a/=()=>{}"); - test("a %= async () => {}", "a%=async ()=>{}"); - test("a -= (1, 2)", "a-=(1,2)"); - test("a >>= b >>= c", "a>>=b>>=c"); -} - -#[test] -fn r#yield() { - test("function *foo() { yield }", "function*foo(){yield}"); - - test("function *foo() { yield * a ? b : c }", "function*foo(){yield*a?b:c}"); - test("function *foo() { yield * yield * a }", "function*foo(){yield*yield*a}"); - test("function *foo() { yield * () => {} }", "function*foo(){yield*()=>{}}"); - test("function *foo() { yield * async () => {} }", "function*foo(){yield*async ()=>{}}"); - - test("function *foo() { yield a ? b : c }", "function*foo(){yield a?b:c}"); - test("function *foo() { yield yield a }", "function*foo(){yield yield a}"); - test("function *foo() { yield () => {} }", "function*foo(){yield ()=>{}}"); - test("function *foo() { yield async () => {} }", "function*foo(){yield async ()=>{}}"); - - test( - "function *foo() { yield { a } = [ b ] = c ? b : d }", - "function*foo(){yield {a}=[b]=c?b:d}", - ); - // TODO: remove the extra space in `yield (a,b)` - test("function *foo() { yield (a, b) }", "function*foo(){yield (a,b)}"); - test("function *foo() { yield a, b }", "function*foo(){yield a,b}"); -} - -#[test] -fn arrow() { - test("x => a, b", "(x)=>a,b"); - test("x => (a, b)", "(x)=>(a,b)"); - test("x => (a => b)", "(x)=>(a)=>b"); - test("x => y => a, b", "(x)=>(y)=>a,b"); - test("x => y => (a = b)", "(x)=>(y)=>a=b"); - test("x => y => z => a = b, c", "(x)=>(y)=>(z)=>a=b,c"); - test("x => y => z => a = (b, c)", "(x)=>(y)=>(z)=>a=(b,c)"); - test("x => ({} + 0)", "(x)=>({})+0"); -} - -#[test] -fn conditional() { - test("a ? b : c", "a?b:c"); - test("a ? (b, c) : (d, e)", "a?(b,c):(d,e)"); - test("a ? b : c ? b : c", "a?b:c?b:c"); - test("(a ? b : c) ? b : c", "a?b:c?b:c"); - test("a, b ? c : d", "a,b?c:d"); - test("(a, b) ? c : d", "(a,b)?c:d"); - test("a = b ? c : d", "a=b?c:d"); - test("(a = b) ? c : d", "(a=b)?c:d"); -} - -#[test] -fn coalesce() { - test("a ?? b", "a??b"); - test("a ?? b ?? c ?? d", "a??b??c??d"); - test("a ?? (b ?? (c ?? d))", "a??b??c??d"); - test("(a ?? (b ?? (c ?? d)))", "a??b??c??d"); - test("a, b ?? c", "a,b??c"); - test("(a, b) ?? c", "(a,b)??c"); - test("a, b ?? c, d", "a,b??c,d"); - test("a, b ?? (c, d)", "a,b??(c,d)"); - test("a = b ?? c", "a=b??c"); - test("a ?? (b = c)", "a??(b=c)"); - test("(a | b) ?? (c | d)", "a|b??c|d"); -} - -#[test] -fn logical_or() { - test("a || b || c", "a||b||c"); - test("(a || (b || c)) || d", "a||b||c||d"); - test("a || (b || (c || d))", "a||b||c||d"); - test("a || b && c", "a||b&&c"); - test("(a || b) && c", "(a||b)&&c"); - test("a, b || c, d", "a,b||c,d"); - test("(a, b) || (c, d)", "(a,b)||(c,d)"); - test("(a && b) || (c && d)", "a&&b||c&&d"); - test("a && b || c && d", "a&&b||c&&d"); -} - -#[test] -fn logical_and() { - test("a && b && c", "a&&b&&c"); - test("a && ((b && c) && d)", "a&&b&&c&&d"); - test("((a && b) && c) && d", "a&&b&&c&&d"); - test("(a || b) && (c || d)", "(a||b)&&(c||d)"); - test("a, b && c, d", "a,b&&c,d"); - test("(a, b) && (c, d)", "(a,b)&&(c,d)"); - test("a || b && c || d", "a||b&&c||d"); -} - -#[test] -fn bitwise_or() { - test("a | b | c", "a|b|c"); - test("(a | b) | c", "a|b|c"); - test("a | (b | c)", "a|(b|c)"); - test("a | b ^ c", "a|b^c"); - test("a | (b ^ c)", "a|b^c"); - test("a | (b && c)", "a|(b&&c)"); - test("a | b && c", "a|b&&c"); - test("(a ^ b) | (c ^ d)", "a^b|c^d"); - test("(a, b) | (c, d)", "(a,b)|(c,d)"); - test("a, b | c, d", "a,b|c,d"); -} - -#[test] -fn bitwise_xor() { - test("a ^ b ^ c", "a^b^c"); - test("(a ^ b) ^ c", "a^b^c"); - test("a ^ (b ^ c)", "a^(b^c)"); - test("a | b & c", "a|b&c"); - test("a | (b & c)", "a|b&c"); - test("a | (b || c)", "a|(b||c)"); - test("a | b || c", "a|b||c"); - test("(a, b) ^ (c, d)", "(a,b)^(c,d)"); - test("(a | b) ^ (c | d)", "(a|b)^(c|d)"); - test("a, b ^ c, d", "a,b^c,d"); -} - -#[test] -fn bitwise_and() { - test("a & b & c", "a&b&c"); - test("((a & b) & c) & d", "a&b&c&d"); - test("a & (b & (c & d))", "a&(b&(c&d))"); - test("a & b == c", "a&b==c"); - test("a & (b == c)", "a&b==c"); - test("a == b & c", "a==b&c"); - test("(a == b) & c", "a==b&c"); - test("a ^ b & c", "a^b&c"); - test("(a ^ b) & c", "(a^b)&c"); - test("(a, b) & (c, d)", "(a,b)&(c,d)"); - test("a, b & c, d", "a,b&c,d"); -} - -#[test] -fn equality() { - test("a == b != c === d !== e", "a==b!=c===d!==e"); - test("a == (b != (c === (d !== e)))", "a==(b!=(c===(d!==e)))"); - test("(((a == b) != c) === d) !== e", "a==b!=c===d!==e"); - test("a > b == c < d", "a>b==c b) == (c < d)", "a>b==c "??", } } + + pub fn lower_precedence(&self) -> Precedence { + match self { + Self::Or => Precedence::NullishCoalescing, + Self::And => Precedence::LogicalOr, + Self::Coalesce => Precedence::Conditional, + } + } } impl GetPrecedence for LogicalOperator { diff --git a/crates/oxc_syntax/src/precedence.rs b/crates/oxc_syntax/src/precedence.rs index 7286cb93d9413..0077aa46f431b 100644 --- a/crates/oxc_syntax/src/precedence.rs +++ b/crates/oxc_syntax/src/precedence.rs @@ -16,29 +16,29 @@ pub trait GetPrecedence { #[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd)] #[repr(u8)] pub enum Precedence { - Lowest, - Comma, - Spread, - Yield, - Assign, - Conditional, - NullishCoalescing, - LogicalOr, - LogicalAnd, - BitwiseOr, - BitwiseXor, - BitwiseAnd, - Equals, - Compare, - Shift, - Add, - Multiply, - Exponentiation, - Prefix, - Postfix, - New, - Call, - Member, + Lowest = 0, + Comma = 1, + Spread = 2, + Yield = 3, + Assign = 4, + Conditional = 5, + NullishCoalescing = 6, + LogicalOr = 7, + LogicalAnd = 8, + BitwiseOr = 9, + BitwiseXor = 10, + BitwiseAnd = 11, + Equals = 12, + Compare = 13, + Shift = 14, + Add = 15, + Multiply = 16, + Exponentiation = 17, + Prefix = 18, + Postfix = 19, + New = 20, + Call = 21, + Member = 22, } impl Precedence { diff --git a/tasks/coverage/codegen_sourcemap.snap b/tasks/coverage/codegen_sourcemap.snap index b477cef43d9f9..68777ec09ceba 100644 --- a/tasks/coverage/codegen_sourcemap.snap +++ b/tasks/coverage/codegen_sourcemap.snap @@ -362,8 +362,8 @@ Unexpected token (49:8-49:20) " function ()" --> (43:8-43:19) " function()" (49:20-49:22) " {" --> (43:19-43:20) " " (49:22-51:0) "};\n" --> (43:20-44:0) "{};" -(51:0-51:1) "\n" --> (44:0-44:0) "" -(51:1-51:10) "(function" --> (44:0-44:10) "\n(function" +(51:0-51:1) "\n" --> (44:0-44:1) "\n" +(51:1-51:10) "(function" --> (44:1-44:10) "(function" (51:10-51:15) " fn()" --> (44:10-44:15) " fn()" (51:15-51:17) " {" --> (44:15-44:16) " " (51:17-53:0) "});\n" --> (44:16-45:0) "{});" @@ -423,8 +423,8 @@ Invalid Character `[` (11:16-11:29) ".NODE_ENV !==" --> (1:16-1:29) ".NODE_ENV !==" (11:29-11:43) " \"production\")" --> (1:29-1:43) " \"production\")" (11:43-12:2) " {\n " --> (1:43-2:0) " {" -(12:2-12:3) " " --> (2:0-2:1) "\n" -(12:3-12:14) "(function()" --> (2:1-2:13) "\t(function()" +(12:2-12:3) " " --> (2:0-2:2) "\n\t" +(12:3-12:14) "(function()" --> (2:2-2:13) "(function()" (12:14-13:0) " {" --> (2:13-3:0) " {" (13:0-15:0) "\n'use strict';\n" --> (3:0-4:2) "\n\t\t\"use strict\";\n\t" (15:0-15:4) "\nvar" --> (4:2-4:6) "\tvar" @@ -993,14 +993,14 @@ Invalid Character `[` (357:41-357:55) "(partialState," --> (170:42-170:56) "(partialState," (357:55-357:65) " callback)" --> (170:56-170:66) " callback)" (357:65-358:2) " {\n " --> (170:66-171:0) " {" -(358:2-358:15) " if (!(typeof" --> (171:0-171:17) "\n\t\t\tif (!((typeof" -(358:15-358:32) " partialState ===" --> (171:17-171:34) " partialState ===" -(358:32-358:51) " 'object' || typeof" --> (171:34-171:53) " \"object\" || typeof" -(358:51-358:68) " partialState ===" --> (171:53-171:70) " partialState ===" -(358:68-358:82) " 'function' ||" --> (171:70-171:85) " \"function\") ||" -(358:82-358:98) " partialState ==" --> (171:85-171:101) " partialState ==" -(358:98-358:105) " null))" --> (171:101-171:108) " null))" -(358:105-359:4) " {\n " --> (171:108-172:4) " {\n\t\t\t" +(358:2-358:15) " if (!(typeof" --> (171:0-171:16) "\n\t\t\tif (!(typeof" +(358:15-358:32) " partialState ===" --> (171:16-171:33) " partialState ===" +(358:32-358:51) " 'object' || typeof" --> (171:33-171:52) " \"object\" || typeof" +(358:51-358:68) " partialState ===" --> (171:52-171:69) " partialState ===" +(358:68-358:82) " 'function' ||" --> (171:69-171:83) " \"function\" ||" +(358:82-358:98) " partialState ==" --> (171:83-171:99) " partialState ==" +(358:98-358:105) " null))" --> (171:99-171:106) " null))" +(358:105-359:4) " {\n " --> (171:106-172:4) " {\n\t\t\t" (359:4-360:6) " {\n " --> (172:4-173:0) "\t{" (360:6-360:12) " throw" --> (173:0-173:11) "\n\t\t\t\t\tthrow" (360:12-360:19) " Error(" --> (173:11-173:17) " Error" @@ -1165,12 +1165,12 @@ Invalid Character `[` (450:46-450:59) " wrapperName)" --> (217:48-217:61) " wrapperName)" (450:59-451:2) " {\n " --> (217:61-218:3) " {\n\t\t" (451:2-451:6) " var" --> (218:3-218:7) "\tvar" -(451:6-451:21) " functionName =" --> (218:7-218:23) " functionName = " -(451:21-451:31) " innerType" --> (218:23-218:33) "(innerType" -(451:31-451:46) ".displayName ||" --> (218:33-218:48) ".displayName ||" -(451:46-451:56) " innerType" --> (218:48-218:58) " innerType" -(451:56-451:64) ".name ||" --> (218:58-218:67) ".name) ||" -(451:64-452:2) " '';\n " --> (218:67-219:0) " \"\";" +(451:6-451:21) " functionName =" --> (218:7-218:22) " functionName =" +(451:21-451:31) " innerType" --> (218:22-218:32) " innerType" +(451:31-451:46) ".displayName ||" --> (218:32-218:47) ".displayName ||" +(451:46-451:56) " innerType" --> (218:47-218:57) " innerType" +(451:56-451:64) ".name ||" --> (218:57-218:65) ".name ||" +(451:64-452:2) " '';\n " --> (218:65-219:0) " \"\";" (452:2-452:9) " return" --> (219:0-219:10) "\n\t\t\treturn" (452:9-452:19) " outerType" --> (219:10-219:20) " outerType" (452:19-452:35) ".displayName || " --> (219:20-219:36) ".displayName || " @@ -1218,12 +1218,12 @@ Invalid Character `[` (471:13-471:22) " type ===" --> (233:14-233:23) " type ===" (471:22-471:34) " 'function')" --> (233:23-233:35) " \"function\")" (471:34-472:4) " {\n " --> (233:35-234:0) " {" -(472:4-472:11) " return" --> (234:0-234:12) "\n\t\t\t\treturn " -(472:11-472:16) " type" --> (234:12-234:17) "(type" -(472:16-472:31) ".displayName ||" --> (234:17-234:32) ".displayName ||" -(472:31-472:36) " type" --> (234:32-234:37) " type" -(472:36-472:44) ".name ||" --> (234:37-234:46) ".name) ||" -(472:44-473:3) " null;\n " --> (234:46-235:3) " null;\n\t\t" +(472:4-472:11) " return" --> (234:0-234:11) "\n\t\t\t\treturn" +(472:11-472:16) " type" --> (234:11-234:16) " type" +(472:16-472:31) ".displayName ||" --> (234:16-234:31) ".displayName ||" +(472:31-472:36) " type" --> (234:31-234:36) " type" +(472:36-472:44) ".name ||" --> (234:36-234:44) ".name ||" +(472:44-473:3) " null;\n " --> (234:44-235:3) " null;\n\t\t" (473:3-475:2) "}\n\n " --> (235:3-236:0) "\t}" (475:2-475:13) " if (typeof" --> (236:0-236:14) "\n\t\t\tif (typeof" (475:13-475:22) " type ===" --> (236:14-236:23) " type ===" @@ -1531,20 +1531,20 @@ Invalid Character `[` (613:46-613:54) "(config)" --> (335:48-335:56) "(config)" (613:54-614:2) " {\n " --> (335:56-336:3) " {\n\t\t" (614:2-615:4) " {\n " --> (336:3-337:0) "\t{" -(615:4-615:15) " if (typeof" --> (337:0-337:17) "\n\t\t\t\tif (((typeof" -(615:15-615:22) " config" --> (337:17-337:24) " config" -(615:22-615:30) ".ref ===" --> (337:24-337:32) ".ref ===" -(615:30-615:42) " 'string' &&" --> (337:32-337:44) " \"string\" &&" -(615:42-615:60) " ReactCurrentOwner" --> (337:44-337:62) " ReactCurrentOwner" -(615:60-615:71) ".current &&" --> (337:62-337:74) ".current) &&" -(615:71-615:78) " config" --> (337:74-337:81) " config" -(615:78-615:88) ".__self &&" --> (337:81-337:92) ".__self) &&" -(615:88-615:106) " ReactCurrentOwner" --> (337:92-337:110) " ReactCurrentOwner" -(615:106-615:114) ".current" --> (337:110-337:118) ".current" -(615:114-615:128) ".stateNode !==" --> (337:118-337:132) ".stateNode !==" -(615:128-615:135) " config" --> (337:132-337:139) " config" -(615:135-615:143) ".__self)" --> (337:139-337:147) ".__self)" -(615:143-616:6) " {\n " --> (337:147-338:5) " {\n\t\t\t\t" +(615:4-615:15) " if (typeof" --> (337:0-337:15) "\n\t\t\t\tif (typeof" +(615:15-615:22) " config" --> (337:15-337:22) " config" +(615:22-615:30) ".ref ===" --> (337:22-337:30) ".ref ===" +(615:30-615:42) " 'string' &&" --> (337:30-337:42) " \"string\" &&" +(615:42-615:60) " ReactCurrentOwner" --> (337:42-337:60) " ReactCurrentOwner" +(615:60-615:71) ".current &&" --> (337:60-337:71) ".current &&" +(615:71-615:78) " config" --> (337:71-337:78) " config" +(615:78-615:88) ".__self &&" --> (337:78-337:88) ".__self &&" +(615:88-615:106) " ReactCurrentOwner" --> (337:88-337:106) " ReactCurrentOwner" +(615:106-615:114) ".current" --> (337:106-337:114) ".current" +(615:114-615:128) ".stateNode !==" --> (337:114-337:128) ".stateNode !==" +(615:128-615:135) " config" --> (337:128-337:135) " config" +(615:135-615:143) ".__self)" --> (337:135-337:143) ".__self)" +(615:143-616:6) " {\n " --> (337:143-338:5) " {\n\t\t\t\t" (616:6-616:10) " var" --> (338:5-338:9) "\tvar" (616:10-616:26) " componentName =" --> (338:9-338:25) " componentName =" (616:26-616:43) " getComponentName" --> (338:25-338:42) " getComponentName" @@ -1837,13 +1837,13 @@ Invalid Character `[` (773:6-773:10) " var" --> (432:5-432:9) "\tvar" (773:10-773:31) " displayName = typeof" --> (432:9-432:30) " displayName = typeof" (773:31-773:40) " type ===" --> (432:30-432:39) " type ===" -(773:40-773:53) " 'function' ?" --> (432:39-432:53) " \"function\" ? " -(773:53-773:58) " type" --> (432:53-432:58) "(type" -(773:58-773:73) ".displayName ||" --> (432:58-432:73) ".displayName ||" -(773:73-773:78) " type" --> (432:73-432:78) " type" -(773:78-773:86) ".name ||" --> (432:78-432:87) ".name) ||" -(773:86-773:98) " 'Unknown' :" --> (432:87-432:99) " \"Unknown\" :" -(773:98-775:6) " type;\n\n " --> (432:99-433:0) " type;" +(773:40-773:53) " 'function' ?" --> (432:39-432:52) " \"function\" ?" +(773:53-773:58) " type" --> (432:52-432:57) " type" +(773:58-773:73) ".displayName ||" --> (432:57-432:72) ".displayName ||" +(773:73-773:78) " type" --> (432:72-432:77) " type" +(773:78-773:86) ".name ||" --> (432:77-432:85) ".name ||" +(773:86-773:98) " 'Unknown' :" --> (432:85-432:97) " \"Unknown\" :" +(773:98-775:6) " type;\n\n " --> (432:97-433:0) " type;" (775:6-775:10) " if " --> (433:0-433:9) "\n\t\t\t\t\tif " (775:10-775:15) "(key)" --> (433:9-433:14) "(key)" (775:15-776:8) " {\n " --> (433:14-434:0) " {" @@ -2081,14 +2081,14 @@ Invalid Character `[` (875:9-875:24) " isValidElement" --> (494:11-494:26) " isValidElement" (875:24-875:32) "(object)" --> (494:26-494:34) "(object)" (875:32-876:2) " {\n " --> (494:34-495:0) " {" -(876:2-876:16) " return typeof" --> (495:0-495:18) "\n\t\t\treturn (typeof" -(876:16-876:27) " object ===" --> (495:18-495:29) " object ===" -(876:27-876:39) " 'object' &&" --> (495:29-495:41) " \"object\" &&" -(876:39-876:50) " object !==" --> (495:41-495:52) " object !==" -(876:50-876:58) " null &&" --> (495:52-495:61) " null) &&" -(876:58-876:65) " object" --> (495:61-495:68) " object" -(876:65-876:78) ".$$typeof ===" --> (495:68-495:81) ".$$typeof ===" -(876:78-877:1) " REACT_ELEMENT_TYPE;\n" --> (495:81-496:2) " REACT_ELEMENT_TYPE;\n\t" +(876:2-876:16) " return typeof" --> (495:0-495:17) "\n\t\t\treturn typeof" +(876:16-876:27) " object ===" --> (495:17-495:28) " object ===" +(876:27-876:39) " 'object' &&" --> (495:28-495:40) " \"object\" &&" +(876:39-876:50) " object !==" --> (495:40-495:51) " object !==" +(876:50-876:58) " null &&" --> (495:51-495:59) " null &&" +(876:58-876:65) " object" --> (495:59-495:66) " object" +(876:65-876:78) ".$$typeof ===" --> (495:66-495:79) ".$$typeof ===" +(876:78-877:1) " REACT_ELEMENT_TYPE;\n" --> (495:79-496:2) " REACT_ELEMENT_TYPE;\n\t" (877:1-879:0) "}\n" --> (496:2-497:2) "\t}\n\t" (879:0-879:4) "\nvar" --> (497:2-497:6) "\tvar" (879:4-879:16) " SEPARATOR =" --> (497:6-497:18) " SEPARATOR =" @@ -2150,15 +2150,15 @@ Invalid Character `[` (920:23-920:32) "(element," --> (515:25-515:34) "(element," (920:32-920:39) " index)" --> (515:34-515:41) " index)" (920:39-923:2) " {\n // Do some typechecking here since we call this blindly. We want to ensure\n // that we don't block potential future ES APIs.\n " --> (515:41-516:0) " {" -(923:2-923:13) " if (typeof" --> (516:0-516:15) "\n\t\t\tif ((typeof" -(923:13-923:25) " element ===" --> (516:15-516:27) " element ===" -(923:25-923:37) " 'object' &&" --> (516:27-516:39) " \"object\" &&" -(923:37-923:49) " element !==" --> (516:39-516:51) " element !==" -(923:49-923:57) " null &&" --> (516:51-516:60) " null) &&" -(923:57-923:65) " element" --> (516:60-516:68) " element" -(923:65-923:72) ".key !=" --> (516:68-516:75) ".key !=" -(923:72-923:78) " null)" --> (516:75-516:81) " null)" -(923:78-925:4) " {\n // Explicit key\n " --> (516:81-517:0) " {" +(923:2-923:13) " if (typeof" --> (516:0-516:14) "\n\t\t\tif (typeof" +(923:13-923:25) " element ===" --> (516:14-516:26) " element ===" +(923:25-923:37) " 'object' &&" --> (516:26-516:38) " \"object\" &&" +(923:37-923:49) " element !==" --> (516:38-516:50) " element !==" +(923:49-923:57) " null &&" --> (516:50-516:58) " null &&" +(923:57-923:65) " element" --> (516:58-516:66) " element" +(923:65-923:72) ".key !=" --> (516:66-516:73) ".key !=" +(923:72-923:78) " null)" --> (516:73-516:79) " null)" +(923:78-925:4) " {\n // Explicit key\n " --> (516:79-517:0) " {" (925:4-925:11) " return" --> (517:0-517:11) "\n\t\t\t\treturn" (925:11-925:18) " escape" --> (517:11-517:18) " escape" (925:18-925:23) "('' +" --> (517:18-517:23) "(\"\" +" @@ -3147,27 +3147,27 @@ Invalid Character `[` (1419:4-1419:11) " return" --> (853:0-853:11) "\n\t\t\t\treturn" (1419:11-1420:3) " true;\n " --> (853:11-854:3) " true;\n\t\t" (1420:3-1423:2) "} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).\n\n\n " --> (854:3-855:0) "\t}" -(1423:2-1423:6) " if " --> (855:0-855:13) "\n\t\t\tif ((((((" -(1423:6-1423:15) "(type ===" --> (855:13-855:22) "(type ===" -(1423:15-1423:23) " exports" --> (855:22-855:30) " exports" -(1423:23-1423:35) ".Fragment ||" --> (855:30-855:42) ".Fragment ||" -(1423:35-1423:44) " type ===" --> (855:42-855:51) " type ===" -(1423:44-1423:52) " exports" --> (855:51-855:59) " exports" -(1423:52-1423:64) ".Profiler ||" --> (855:59-855:72) ".Profiler) ||" -(1423:64-1423:73) " type ===" --> (855:72-855:81) " type ===" -(1423:73-1423:106) " REACT_DEBUG_TRACING_MODE_TYPE ||" --> (855:81-855:115) " REACT_DEBUG_TRACING_MODE_TYPE) ||" -(1423:106-1423:115) " type ===" --> (855:115-855:124) " type ===" -(1423:115-1423:123) " exports" --> (855:124-855:132) " exports" -(1423:123-1423:137) ".StrictMode ||" --> (855:132-855:147) ".StrictMode) ||" -(1423:137-1423:146) " type ===" --> (855:147-855:156) " type ===" -(1423:146-1423:154) " exports" --> (855:156-855:164) " exports" -(1423:154-1423:166) ".Suspense ||" --> (855:164-855:177) ".Suspense) ||" -(1423:166-1423:175) " type ===" --> (855:177-855:186) " type ===" -(1423:175-1423:203) " REACT_SUSPENSE_LIST_TYPE ||" --> (855:186-855:215) " REACT_SUSPENSE_LIST_TYPE) ||" -(1423:203-1423:212) " type ===" --> (855:215-855:224) " type ===" -(1423:212-1423:240) " REACT_LEGACY_HIDDEN_TYPE ||" --> (855:224-855:253) " REACT_LEGACY_HIDDEN_TYPE) ||" -(1423:240-1423:257) " enableScopeAPI )" --> (855:253-855:269) " enableScopeAPI)" -(1423:257-1424:4) " {\n " --> (855:269-856:0) " {" +(1423:2-1423:6) " if " --> (855:0-855:7) "\n\t\t\tif " +(1423:6-1423:15) "(type ===" --> (855:7-855:16) "(type ===" +(1423:15-1423:23) " exports" --> (855:16-855:24) " exports" +(1423:23-1423:35) ".Fragment ||" --> (855:24-855:36) ".Fragment ||" +(1423:35-1423:44) " type ===" --> (855:36-855:45) " type ===" +(1423:44-1423:52) " exports" --> (855:45-855:53) " exports" +(1423:52-1423:64) ".Profiler ||" --> (855:53-855:65) ".Profiler ||" +(1423:64-1423:73) " type ===" --> (855:65-855:74) " type ===" +(1423:73-1423:106) " REACT_DEBUG_TRACING_MODE_TYPE ||" --> (855:74-855:107) " REACT_DEBUG_TRACING_MODE_TYPE ||" +(1423:106-1423:115) " type ===" --> (855:107-855:116) " type ===" +(1423:115-1423:123) " exports" --> (855:116-855:124) " exports" +(1423:123-1423:137) ".StrictMode ||" --> (855:124-855:138) ".StrictMode ||" +(1423:137-1423:146) " type ===" --> (855:138-855:147) " type ===" +(1423:146-1423:154) " exports" --> (855:147-855:155) " exports" +(1423:154-1423:166) ".Suspense ||" --> (855:155-855:167) ".Suspense ||" +(1423:166-1423:175) " type ===" --> (855:167-855:176) " type ===" +(1423:175-1423:203) " REACT_SUSPENSE_LIST_TYPE ||" --> (855:176-855:204) " REACT_SUSPENSE_LIST_TYPE ||" +(1423:203-1423:212) " type ===" --> (855:204-855:213) " type ===" +(1423:212-1423:240) " REACT_LEGACY_HIDDEN_TYPE ||" --> (855:213-855:241) " REACT_LEGACY_HIDDEN_TYPE ||" +(1423:240-1423:257) " enableScopeAPI )" --> (855:241-855:257) " enableScopeAPI)" +(1423:257-1424:4) " {\n " --> (855:257-856:0) " {" (1424:4-1424:11) " return" --> (856:0-856:11) "\n\t\t\t\treturn" (1424:11-1425:3) " true;\n " --> (856:11-857:3) " true;\n\t\t" (1425:3-1427:2) "}\n\n " --> (857:3-858:0) "\t}" @@ -3177,32 +3177,32 @@ Invalid Character `[` (1427:34-1427:43) " type !==" --> (858:35-858:44) " type !==" (1427:43-1427:49) " null)" --> (858:44-858:50) " null)" (1427:49-1428:4) " {\n " --> (858:50-859:0) " {" -(1428:4-1428:8) " if " --> (859:0-859:14) "\n\t\t\t\tif ((((((" -(1428:8-1428:13) "(type" --> (859:14-859:19) "(type" -(1428:13-1428:26) ".$$typeof ===" --> (859:19-859:32) ".$$typeof ===" -(1428:26-1428:45) " REACT_LAZY_TYPE ||" --> (859:32-859:51) " REACT_LAZY_TYPE ||" -(1428:45-1428:50) " type" --> (859:51-859:56) " type" -(1428:50-1428:63) ".$$typeof ===" --> (859:56-859:69) ".$$typeof ===" -(1428:63-1428:82) " REACT_MEMO_TYPE ||" --> (859:69-859:89) " REACT_MEMO_TYPE) ||" -(1428:82-1428:87) " type" --> (859:89-859:94) " type" -(1428:87-1428:100) ".$$typeof ===" --> (859:94-859:107) ".$$typeof ===" -(1428:100-1428:123) " REACT_PROVIDER_TYPE ||" --> (859:107-859:131) " REACT_PROVIDER_TYPE) ||" -(1428:123-1428:128) " type" --> (859:131-859:136) " type" -(1428:128-1428:141) ".$$typeof ===" --> (859:136-859:149) ".$$typeof ===" -(1428:141-1428:163) " REACT_CONTEXT_TYPE ||" --> (859:149-859:172) " REACT_CONTEXT_TYPE) ||" -(1428:163-1428:168) " type" --> (859:172-859:177) " type" -(1428:168-1428:181) ".$$typeof ===" --> (859:177-859:190) ".$$typeof ===" -(1428:181-1428:207) " REACT_FORWARD_REF_TYPE ||" --> (859:190-859:217) " REACT_FORWARD_REF_TYPE) ||" -(1428:207-1428:212) " type" --> (859:217-859:222) " type" -(1428:212-1428:225) ".$$typeof ===" --> (859:222-859:235) ".$$typeof ===" -(1428:225-1428:251) " REACT_FUNDAMENTAL_TYPE ||" --> (859:235-859:262) " REACT_FUNDAMENTAL_TYPE) ||" -(1428:251-1428:256) " type" --> (859:262-859:267) " type" -(1428:256-1428:269) ".$$typeof ===" --> (859:267-859:280) ".$$typeof ===" -(1428:269-1428:289) " REACT_BLOCK_TYPE ||" --> (859:280-859:301) " REACT_BLOCK_TYPE) ||" -(1428:289-1428:294) " type" --> (859:301-859:306) " type" -(1428:294-1428:301) "[0] ===" --> (859:306-859:313) "[0] ===" -(1428:301-1428:326) " REACT_SERVER_BLOCK_TYPE)" --> (859:313-859:338) " REACT_SERVER_BLOCK_TYPE)" -(1428:326-1429:6) " {\n " --> (859:338-860:0) " {" +(1428:4-1428:8) " if " --> (859:0-859:8) "\n\t\t\t\tif " +(1428:8-1428:13) "(type" --> (859:8-859:13) "(type" +(1428:13-1428:26) ".$$typeof ===" --> (859:13-859:26) ".$$typeof ===" +(1428:26-1428:45) " REACT_LAZY_TYPE ||" --> (859:26-859:45) " REACT_LAZY_TYPE ||" +(1428:45-1428:50) " type" --> (859:45-859:50) " type" +(1428:50-1428:63) ".$$typeof ===" --> (859:50-859:63) ".$$typeof ===" +(1428:63-1428:82) " REACT_MEMO_TYPE ||" --> (859:63-859:82) " REACT_MEMO_TYPE ||" +(1428:82-1428:87) " type" --> (859:82-859:87) " type" +(1428:87-1428:100) ".$$typeof ===" --> (859:87-859:100) ".$$typeof ===" +(1428:100-1428:123) " REACT_PROVIDER_TYPE ||" --> (859:100-859:123) " REACT_PROVIDER_TYPE ||" +(1428:123-1428:128) " type" --> (859:123-859:128) " type" +(1428:128-1428:141) ".$$typeof ===" --> (859:128-859:141) ".$$typeof ===" +(1428:141-1428:163) " REACT_CONTEXT_TYPE ||" --> (859:141-859:163) " REACT_CONTEXT_TYPE ||" +(1428:163-1428:168) " type" --> (859:163-859:168) " type" +(1428:168-1428:181) ".$$typeof ===" --> (859:168-859:181) ".$$typeof ===" +(1428:181-1428:207) " REACT_FORWARD_REF_TYPE ||" --> (859:181-859:207) " REACT_FORWARD_REF_TYPE ||" +(1428:207-1428:212) " type" --> (859:207-859:212) " type" +(1428:212-1428:225) ".$$typeof ===" --> (859:212-859:225) ".$$typeof ===" +(1428:225-1428:251) " REACT_FUNDAMENTAL_TYPE ||" --> (859:225-859:251) " REACT_FUNDAMENTAL_TYPE ||" +(1428:251-1428:256) " type" --> (859:251-859:256) " type" +(1428:256-1428:269) ".$$typeof ===" --> (859:256-859:269) ".$$typeof ===" +(1428:269-1428:289) " REACT_BLOCK_TYPE ||" --> (859:269-859:289) " REACT_BLOCK_TYPE ||" +(1428:289-1428:294) " type" --> (859:289-859:294) " type" +(1428:294-1428:301) "[0] ===" --> (859:294-859:301) "[0] ===" +(1428:301-1428:326) " REACT_SERVER_BLOCK_TYPE)" --> (859:301-859:326) " REACT_SERVER_BLOCK_TYPE)" +(1428:326-1429:6) " {\n " --> (859:326-860:0) " {" (1429:6-1429:13) " return" --> (860:0-860:12) "\n\t\t\t\t\treturn" (1429:13-1430:5) " true;\n " --> (860:12-861:4) " true;\n\t\t\t" (1430:5-1431:3) "}\n " --> (861:4-862:3) "\t}\n\t\t" @@ -3921,13 +3921,13 @@ Invalid Character `[` (1738:3-1738:11) "} catch " --> (1093:3-1093:12) "\t} catch " (1738:11-1738:19) "(sample)" --> (1093:12-1093:20) "(sample)" (1738:19-1740:4) " {\n // This is inlined manually because closure doesn't do it for us.\n " --> (1093:20-1094:0) " {" -(1740:4-1740:8) " if " --> (1094:0-1094:9) "\n\t\t\t\tif (" -(1740:8-1740:18) "(sample &&" --> (1094:9-1094:19) "(sample &&" -(1740:18-1740:36) " control && typeof" --> (1094:19-1094:38) " control) && typeof" -(1740:36-1740:43) " sample" --> (1094:38-1094:45) " sample" -(1740:43-1740:53) ".stack ===" --> (1094:45-1094:55) ".stack ===" -(1740:53-1740:63) " 'string')" --> (1094:55-1094:65) " \"string\")" -(1740:63-1743:6) " {\n // This extracts the first frame from the sample that isn't also in the control.\n // Skipping one frame that we assume is the frame that calls the two.\n " --> (1094:65-1095:5) " {\n\t\t\t\t" +(1740:4-1740:8) " if " --> (1094:0-1094:8) "\n\t\t\t\tif " +(1740:8-1740:18) "(sample &&" --> (1094:8-1094:18) "(sample &&" +(1740:18-1740:36) " control && typeof" --> (1094:18-1094:36) " control && typeof" +(1740:36-1740:43) " sample" --> (1094:36-1094:43) " sample" +(1740:43-1740:53) ".stack ===" --> (1094:43-1094:53) ".stack ===" +(1740:53-1740:63) " 'string')" --> (1094:53-1094:63) " \"string\")" +(1740:63-1743:6) " {\n // This extracts the first frame from the sample that isn't also in the control.\n // Skipping one frame that we assume is the frame that calls the two.\n " --> (1094:63-1095:5) " {\n\t\t\t\t" (1743:6-1743:10) " var" --> (1095:5-1095:9) "\tvar" (1743:10-1743:24) " sampleLines =" --> (1095:9-1095:23) " sampleLines =" (1743:24-1743:31) " sample" --> (1095:23-1095:30) " sample" @@ -3952,16 +3952,16 @@ Invalid Character `[` (1746:14-1746:27) " controlLines" --> (1098:13-1098:26) " controlLines" (1746:27-1746:36) ".length -" --> (1098:26-1098:35) ".length -" (1746:36-1748:6) " 1;\n\n " --> (1098:35-1099:0) " 1;" -(1748:6-1748:13) " while " --> (1099:0-1099:13) "\n\t\t\t\t\twhile (" -(1748:13-1748:18) "(s >=" --> (1099:13-1099:18) "(s >=" -(1748:18-1748:23) " 1 &&" --> (1099:18-1099:23) " 1 &&" -(1748:23-1748:28) " c >=" --> (1099:23-1099:28) " c >=" -(1748:28-1748:33) " 0 &&" --> (1099:28-1099:34) " 0) &&" -(1748:33-1748:45) " sampleLines" --> (1099:34-1099:46) " sampleLines" -(1748:45-1748:52) "[s] !==" --> (1099:46-1099:53) "[s] !==" -(1748:52-1748:65) " controlLines" --> (1099:53-1099:66) " controlLines" -(1748:65-1748:69) "[c])" --> (1099:66-1099:70) "[c])" -(1748:69-1755:8) " {\n // We expect at least one stack frame to be shared.\n // Typically this will be the root most one. However, stack frames may be\n // cut off due to maximum stack limits. In this case, one maybe cut off\n // earlier than the other. We assume that the sample is longer or the same\n // and there for cut off earlier. So we should find the root most frame in\n // the sample somewhere in the control.\n " --> (1099:70-1100:0) " {" +(1748:6-1748:13) " while " --> (1099:0-1099:12) "\n\t\t\t\t\twhile " +(1748:13-1748:18) "(s >=" --> (1099:12-1099:17) "(s >=" +(1748:18-1748:23) " 1 &&" --> (1099:17-1099:22) " 1 &&" +(1748:23-1748:28) " c >=" --> (1099:22-1099:27) " c >=" +(1748:28-1748:33) " 0 &&" --> (1099:27-1099:32) " 0 &&" +(1748:33-1748:45) " sampleLines" --> (1099:32-1099:44) " sampleLines" +(1748:45-1748:52) "[s] !==" --> (1099:44-1099:51) "[s] !==" +(1748:52-1748:65) " controlLines" --> (1099:51-1099:64) " controlLines" +(1748:65-1748:69) "[c])" --> (1099:64-1099:68) "[c])" +(1748:69-1755:8) " {\n // We expect at least one stack frame to be shared.\n // Typically this will be the root most one. However, stack frames may be\n // cut off due to maximum stack limits. In this case, one maybe cut off\n // earlier than the other. We assume that the sample is longer or the same\n // and there for cut off earlier. So we should find the root most frame in\n // the sample somewhere in the control.\n " --> (1099:68-1100:0) " {" (1755:8-1756:7) " c--;\n " --> (1100:0-1101:5) "\n\t\t\t\t\t\tc--;\n\t\t\t\t" (1756:7-1758:6) "}\n\n " --> (1101:5-1102:0) "\t}" (1758:6-1758:13) " for (;" --> (1102:0-1102:12) "\n\t\t\t\t\tfor (;" @@ -4552,16 +4552,16 @@ Invalid Character `[` (2025:29-2025:38) "(element," --> (1276:31-1276:40) "(element," (2025:38-2025:50) " parentType)" --> (1276:40-1276:52) " parentType)" (2025:50-2026:2) " {\n " --> (1276:52-1277:0) " {" -(2026:2-2026:7) " if (" --> (1277:0-1277:9) "\n\t\t\tif ((" -(2026:7-2026:15) "!element" --> (1277:9-1277:17) "!element" -(2026:15-2026:25) "._store ||" --> (1277:17-1277:27) "._store ||" -(2026:25-2026:33) " element" --> (1277:27-1277:35) " element" -(2026:33-2026:40) "._store" --> (1277:35-1277:42) "._store" -(2026:40-2026:53) ".validated ||" --> (1277:42-1277:56) ".validated) ||" -(2026:53-2026:61) " element" --> (1277:56-1277:64) " element" -(2026:61-2026:68) ".key !=" --> (1277:64-1277:71) ".key !=" -(2026:68-2026:74) " null)" --> (1277:71-1277:77) " null)" -(2026:74-2027:4) " {\n " --> (1277:77-1278:0) " {" +(2026:2-2026:7) " if (" --> (1277:0-1277:8) "\n\t\t\tif (" +(2026:7-2026:15) "!element" --> (1277:8-1277:16) "!element" +(2026:15-2026:25) "._store ||" --> (1277:16-1277:26) "._store ||" +(2026:25-2026:33) " element" --> (1277:26-1277:34) " element" +(2026:33-2026:40) "._store" --> (1277:34-1277:41) "._store" +(2026:40-2026:53) ".validated ||" --> (1277:41-1277:54) ".validated ||" +(2026:53-2026:61) " element" --> (1277:54-1277:62) " element" +(2026:61-2026:68) ".key !=" --> (1277:62-1277:69) ".key !=" +(2026:68-2026:74) " null)" --> (1277:69-1277:75) " null)" +(2026:74-2027:4) " {\n " --> (1277:75-1278:0) " {" (2027:4-2028:3) " return;\n " --> (1278:0-1279:3) "\n\t\t\t\treturn;\n\t\t" (2028:3-2030:2) "}\n\n " --> (1279:3-1280:0) "\t}" (2030:2-2030:10) " element" --> (1280:0-1280:11) "\n\t\t\telement" @@ -4585,15 +4585,15 @@ Invalid Character `[` (2041:2-2041:6) " var" --> (1286:3-1286:7) "\tvar" (2041:6-2041:19) " childOwner =" --> (1286:7-1286:20) " childOwner =" (2041:19-2043:2) " '';\n\n " --> (1286:20-1287:0) " \"\";" -(2043:2-2043:6) " if " --> (1287:0-1287:8) "\n\t\t\tif (" -(2043:6-2043:17) "(element &&" --> (1287:8-1287:19) "(element &&" -(2043:17-2043:25) " element" --> (1287:19-1287:27) " element" -(2043:25-2043:35) "._owner &&" --> (1287:27-1287:38) "._owner) &&" -(2043:35-2043:43) " element" --> (1287:38-1287:46) " element" -(2043:43-2043:54) "._owner !==" --> (1287:46-1287:57) "._owner !==" -(2043:54-2043:72) " ReactCurrentOwner" --> (1287:57-1287:75) " ReactCurrentOwner" -(2043:72-2043:81) ".current)" --> (1287:75-1287:84) ".current)" -(2043:81-2045:4) " {\n // Give the component that originally created this child.\n " --> (1287:84-1288:0) " {" +(2043:2-2043:6) " if " --> (1287:0-1287:7) "\n\t\t\tif " +(2043:6-2043:17) "(element &&" --> (1287:7-1287:18) "(element &&" +(2043:17-2043:25) " element" --> (1287:18-1287:26) " element" +(2043:25-2043:35) "._owner &&" --> (1287:26-1287:36) "._owner &&" +(2043:35-2043:43) " element" --> (1287:36-1287:44) " element" +(2043:43-2043:54) "._owner !==" --> (1287:44-1287:55) "._owner !==" +(2043:54-2043:72) " ReactCurrentOwner" --> (1287:55-1287:73) " ReactCurrentOwner" +(2043:72-2043:81) ".current)" --> (1287:73-1287:82) ".current)" +(2043:81-2045:4) " {\n // Give the component that originally created this child.\n " --> (1287:82-1288:0) " {" (2045:4-2045:17) " childOwner =" --> (1288:0-1288:17) "\n\t\t\t\tchildOwner =" (2045:17-2045:50) " \" It was passed a child from \" +" --> (1288:17-1288:50) " \" It was passed a child from \" +" (2045:50-2045:67) " getComponentName" --> (1288:50-1288:67) " getComponentName" @@ -4731,14 +4731,14 @@ Invalid Character `[` (2114:8-2114:15) " type =" --> (1328:8-1328:15) " type =" (2114:15-2114:23) " element" --> (1328:15-1328:23) " element" (2114:23-2116:4) ".type;\n\n " --> (1328:23-1329:0) ".type;" -(2116:4-2116:8) " if " --> (1329:0-1329:9) "\n\t\t\t\tif (" -(2116:8-2116:17) "(type ===" --> (1329:9-1329:18) "(type ===" -(2116:17-2116:25) " null ||" --> (1329:18-1329:26) " null ||" -(2116:25-2116:34) " type ===" --> (1329:26-1329:35) " type ===" -(2116:34-2116:54) " undefined || typeof" --> (1329:35-1329:56) " undefined) || typeof" -(2116:54-2116:63) " type ===" --> (1329:56-1329:65) " type ===" -(2116:63-2116:73) " 'string')" --> (1329:65-1329:75) " \"string\")" -(2116:73-2117:6) " {\n " --> (1329:75-1330:0) " {" +(2116:4-2116:8) " if " --> (1329:0-1329:8) "\n\t\t\t\tif " +(2116:8-2116:17) "(type ===" --> (1329:8-1329:17) "(type ===" +(2116:17-2116:25) " null ||" --> (1329:17-1329:25) " null ||" +(2116:25-2116:34) " type ===" --> (1329:25-1329:34) " type ===" +(2116:34-2116:54) " undefined || typeof" --> (1329:34-1329:54) " undefined || typeof" +(2116:54-2116:63) " type ===" --> (1329:54-1329:63) " type ===" +(2116:63-2116:73) " 'string')" --> (1329:63-1329:73) " \"string\")" +(2116:73-2117:6) " {\n " --> (1329:73-1330:0) " {" (2117:6-2118:5) " return;\n " --> (1330:0-1331:4) "\n\t\t\t\t\treturn;\n\t\t\t" (2118:5-2120:4) "}\n\n " --> (1331:4-1332:4) "\t}\n\t\t\t" (2120:4-2120:8) " var" --> (1332:4-1332:8) "\tvar" @@ -4898,18 +4898,18 @@ Invalid Character `[` (2186:15-2188:4) " '';\n\n " --> (1375:15-1376:0) " \"\";" (2188:4-2188:8) " if " --> (1376:0-1376:8) "\n\t\t\t\tif " (2188:8-2188:17) "(type ===" --> (1376:8-1376:17) "(type ===" -(2188:17-2188:37) " undefined || typeof" --> (1376:17-1376:38) " undefined || (typeof" -(2188:37-2188:46) " type ===" --> (1376:38-1376:47) " type ===" -(2188:46-2188:58) " 'object' &&" --> (1376:47-1376:59) " \"object\" &&" -(2188:58-2188:67) " type !==" --> (1376:59-1376:68) " type !==" -(2188:67-2188:75) " null &&" --> (1376:68-1376:77) " null) &&" -(2188:75-2188:82) " Object" --> (1376:77-1376:84) " Object" -(2188:82-2188:87) ".keys" --> (1376:84-1376:89) ".keys" -(2188:87-2188:92) "(type" --> (1376:89-1376:94) "(type" -(2188:92-2188:93) ")" --> (1376:94-1376:95) ")" -(2188:93-2188:104) ".length ===" --> (1376:95-1376:106) ".length ===" -(2188:104-2188:107) " 0)" --> (1376:106-1376:109) " 0)" -(2188:107-2189:6) " {\n " --> (1376:109-1377:0) " {" +(2188:17-2188:37) " undefined || typeof" --> (1376:17-1376:37) " undefined || typeof" +(2188:37-2188:46) " type ===" --> (1376:37-1376:46) " type ===" +(2188:46-2188:58) " 'object' &&" --> (1376:46-1376:58) " \"object\" &&" +(2188:58-2188:67) " type !==" --> (1376:58-1376:67) " type !==" +(2188:67-2188:75) " null &&" --> (1376:67-1376:75) " null &&" +(2188:75-2188:82) " Object" --> (1376:75-1376:82) " Object" +(2188:82-2188:87) ".keys" --> (1376:82-1376:87) ".keys" +(2188:87-2188:92) "(type" --> (1376:87-1376:92) "(type" +(2188:92-2188:93) ")" --> (1376:92-1376:93) ")" +(2188:93-2188:104) ".length ===" --> (1376:93-1376:104) ".length ===" +(2188:104-2188:107) " 0)" --> (1376:104-1376:107) " 0)" +(2188:107-2189:6) " {\n " --> (1376:107-1377:0) " {" (2189:6-2189:14) " info +=" --> (1377:0-1377:13) "\n\t\t\t\t\tinfo +=" (2189:14-2189:77) " ' You likely forgot to export your component from the file ' +" --> (1377:13-1377:76) " \" You likely forgot to export your component from the file \" +" (2189:77-2190:5) " \"it's defined in, or you might have mixed up default and named imports.\";\n " --> (1377:76-1378:4) " \"it's defined in, or you might have mixed up default and named imports.\";\n\t\t\t" diff --git a/tasks/minsize/minsize.snap b/tasks/minsize/minsize.snap index e463ab136853c..c4e8339c8b3ac 100644 --- a/tasks/minsize/minsize.snap +++ b/tasks/minsize/minsize.snap @@ -1,26 +1,26 @@ Original | Minified | esbuild | Gzip | esbuild -72.14 kB | 24.37 kB | 23.70 kB | 8.75 kB | 8.54 kB | react.development.js +72.14 kB | 24.32 kB | 23.70 kB | 8.72 kB | 8.54 kB | react.development.js -173.90 kB | 61.92 kB | 59.82 kB | 19.63 kB | 19.33 kB | moment.js +173.90 kB | 61.80 kB | 59.82 kB | 19.57 kB | 19.33 kB | moment.js -287.63 kB | 93.16 kB | 90.07 kB | 32.49 kB | 31.95 kB | jquery.js +287.63 kB | 92.91 kB | 90.07 kB | 32.33 kB | 31.95 kB | jquery.js -342.15 kB | 123.22 kB | 118.14 kB | 45.26 kB | 44.37 kB | vue.js +342.15 kB | 122.97 kB | 118.14 kB | 45.08 kB | 44.37 kB | vue.js -544.10 kB | 74.95 kB | 72.48 kB | 26.39 kB | 26.20 kB | lodash.js +544.10 kB | 74.71 kB | 72.48 kB | 26.24 kB | 26.20 kB | lodash.js -555.77 kB | 275.03 kB | 270.13 kB | 91.56 kB | 90.80 kB | d3.js +555.77 kB | 274.92 kB | 270.13 kB | 91.50 kB | 90.80 kB | d3.js -1.01 MB | 472.78 kB | 458.89 kB | 128.17 kB | 126.71 kB | bundle.min.js +1.01 MB | 471.72 kB | 458.89 kB | 127.60 kB | 126.71 kB | bundle.min.js -1.25 MB | 674.16 kB | 646.76 kB | 167.01 kB | 163.73 kB | three.js +1.25 MB | 673.73 kB | 646.76 kB | 166.77 kB | 163.73 kB | three.js -2.14 MB | 743.99 kB | 724.14 kB | 182.43 kB | 181.07 kB | victory.js +2.14 MB | 743.50 kB | 724.14 kB | 182.06 kB | 181.07 kB | victory.js -3.20 MB | 1.03 MB | 1.01 MB | 333.51 kB | 331.56 kB | echarts.js +3.20 MB | 1.03 MB | 1.01 MB | 332.77 kB | 331.56 kB | echarts.js -6.69 MB | 2.42 MB | 2.31 MB | 504.07 kB | 488.28 kB | antd.js +6.69 MB | 2.42 MB | 2.31 MB | 503.31 kB | 488.28 kB | antd.js -10.95 MB | 3.57 MB | 3.49 MB | 916.72 kB | 915.50 kB | typescript.js +10.95 MB | 3.57 MB | 3.49 MB | 912.65 kB | 915.50 kB | typescript.js