From 3f0fcf4fa9dbc654f56f60863ca7058522202ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 18 Oct 2022 11:13:39 +0900 Subject: [PATCH] feat(es/minifier): Make sequential inliner self-repeat (#6168) --- .../computedPropertyNames12_ES5.2.minified.js | 7 +- .../src/compress/optimize/sequences.rs | 256 +++++++++--------- .../tests/benches-full/echarts.js | 26 +- .../tests/benches-full/moment.js | 2 +- .../tests/benches-full/react.js | 10 +- .../tests/benches-full/three.js | 10 +- .../tests/benches-full/victory.js | 59 ++-- crates/swc_ecma_minifier/tests/compress.rs | 1 + .../tests/fixture/issues/moment/1/output.js | 2 +- .../pages/index-cb36c1bf7f830e3c/output.js | 2 +- .../fixture/next/react-pdf-renderer/output.js | 30 +- .../tests/fixture/projects/react/12/output.js | 7 +- .../tests/pass-1/compute/1/input.js | 9 + .../tests/pass-1/compute/1/output.js | 4 + .../tests/pass-default/compute/1/input.js | 9 + .../tests/pass-default/compute/1/output.js | 4 + .../tests/pass-default/config.json | 5 + .../tests/projects/output/angular-1.2.5.js | 2 +- .../projects/output/jquery.mobile-1.4.2.js | 4 +- .../tests/projects/output/react-17.0.1.js | 10 +- .../tests/projects/output/react-dom-17.0.2.js | 155 ++++++----- .../issue_t161_top_retain_14/output.js | 2 +- 22 files changed, 336 insertions(+), 280 deletions(-) create mode 100644 crates/swc_ecma_minifier/tests/pass-1/compute/1/input.js create mode 100644 crates/swc_ecma_minifier/tests/pass-1/compute/1/output.js create mode 100644 crates/swc_ecma_minifier/tests/pass-default/compute/1/input.js create mode 100644 crates/swc_ecma_minifier/tests/pass-default/compute/1/output.js create mode 100644 crates/swc_ecma_minifier/tests/pass-default/config.json diff --git a/crates/swc/tests/tsc-references/computedPropertyNames12_ES5.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames12_ES5.2.minified.js index 183c909a57c..89e70ce9565 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames12_ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames12_ES5.2.minified.js @@ -1,4 +1,7 @@ //// [computedPropertyNames12_ES5.ts] -var a; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -"hello ".concat(a, " bye"); +var n, a, _ref = (void 0) + n; +(function C() { + "use strict"; + _class_call_check(this, C), this[n] = n, this[_ref] = 2, this["hello bye"] = 0; +})["hello ".concat(a, " bye")] = 0; diff --git a/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs b/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs index d7a83752eb2..9e532970a18 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs @@ -771,166 +771,178 @@ where ) }; - for idx in 0..exprs.len() { - for j in idx..exprs.len() { - let (a1, a2) = exprs.split_at_mut(idx); + loop { + let mut did_work = false; - if a1.is_empty() || a2.is_empty() { - break; - } + for idx in 0..exprs.len() { + for j in idx..exprs.len() { + let (a1, a2) = exprs.split_at_mut(idx); - let a = a1.last_mut().unwrap(); + if a1.is_empty() || a2.is_empty() { + break; + } - if self.options.unused && self.options.sequences() { - if let (Mergable::Var(av), Mergable::Var(bv)) = (&mut *a, &mut a2[j - idx]) { - // We try dropping variable assignments first. + let a = a1.last_mut().unwrap(); - // Currently, we only drop variable declarations if they have the same name. - if let (Pat::Ident(an), Pat::Ident(bn)) = (&av.name, &bv.name) { - if an.to_id() == bn.to_id() { - // We need to preserve side effect of `av.init` + if self.options.unused && self.options.sequences() { + if let (Mergable::Var(av), Mergable::Var(bv)) = (&mut *a, &mut a2[j - idx]) + { + // We try dropping variable assignments first. - match bv.init.as_deref_mut() { - Some(b_init) => { - if IdentUsageFinder::find(&an.to_id(), b_init) { - log_abort!( - "We can't duplicated binding because initializer \ - uses the previous declaration of the variable" - ); - break; + // Currently, we only drop variable declarations if they have the same + // name. + if let (Pat::Ident(an), Pat::Ident(bn)) = (&av.name, &bv.name) { + if an.to_id() == bn.to_id() { + // We need to preserve side effect of `av.init` + + match bv.init.as_deref_mut() { + Some(b_init) => { + if IdentUsageFinder::find(&an.to_id(), b_init) { + log_abort!( + "We can't duplicated binding because \ + initializer uses the previous declaration of \ + the variable" + ); + break; + } + + if let Some(a_init) = av.init.take() { + let b_seq = b_init.force_seq(); + b_seq.exprs.insert(0, a_init); + + self.changed = true; + report_change!( + "Moving initializer sequentially as they have \ + a same name" + ); + av.name.take(); + continue; + } else { + self.changed = true; + report_change!( + "Dropping the previous var declaration of {} \ + which does not have an initializer", + an.id + ); + av.name.take(); + continue; + } } + None => { + // As variable name is same, we can move initializer - if let Some(a_init) = av.init.take() { - let b_seq = b_init.force_seq(); - b_seq.exprs.insert(0, a_init); - + // Th code below + // + // var a = 5; + // var a; + // + // console.log(a) + // + // prints 5 + bv.init = av.init.take(); self.changed = true; report_change!( - "Moving initializer sequentially as they have a \ - same name" - ); - av.name.take(); - continue; - } else { - self.changed = true; - report_change!( - "Dropping the previous var declaration of {} \ - which does not have an initializer", - an.id + "Moving initializer to the next variable \ + declaration as they have the same name" ); av.name.take(); continue; } } - None => { - // As variable name is same, we can move initializer - - // Th code below - // - // var a = 5; - // var a; - // - // console.log(a) - // - // prints 5 - bv.init = av.init.take(); - self.changed = true; - report_change!( - "Moving initializer to the next variable declaration \ - as they have the same name" - ); - av.name.take(); - continue; - } } } } } - } - // Merge sequentially + // Merge sequentially - if self.merge_sequential_expr( - a, - match &mut a2[j - idx] { - Mergable::Var(b) => match b.init.as_deref_mut() { - Some(v) => v, - None => continue, + if self.merge_sequential_expr( + a, + match &mut a2[j - idx] { + Mergable::Var(b) => match b.init.as_deref_mut() { + Some(v) => v, + None => continue, + }, + Mergable::Expr(e) => e, }, - Mergable::Expr(e) => e, - }, - )? { - break; - } - - // This logic is required to handle - // - // var b; - // (function () { - // function f() { - // a++; - // } - // f(); - // var c = f(); - // var a = void 0; - // c || (b = a); - // })(); - // console.log(b); - // - // - // at the code above, c cannot be shifted to `c` in `c || (b = a)` - // - - match a { - Mergable::Var(VarDeclarator { - init: Some(init), .. - }) => { - if !self.is_skippable_for_seq(None, init) { - break; - } + )? { + did_work = true; + break; } - Mergable::Expr(Expr::Assign(a)) => { - if let Some(a) = a.left.as_expr() { - if !self.is_skippable_for_seq(None, a) { + + // This logic is required to handle + // + // var b; + // (function () { + // function f() { + // a++; + // } + // f(); + // var c = f(); + // var a = void 0; + // c || (b = a); + // })(); + // console.log(b); + // + // + // at the code above, c cannot be shifted to `c` in `c || (b = a)` + // + + match a { + Mergable::Var(VarDeclarator { + init: Some(init), .. + }) => { + if !self.is_skippable_for_seq(None, init) { break; } } + Mergable::Expr(Expr::Assign(a)) => { + if let Some(a) = a.left.as_expr() { + if !self.is_skippable_for_seq(None, a) { + break; + } + } - if !self.is_skippable_for_seq(None, &a.right) { - break; + if !self.is_skippable_for_seq(None, &a.right) { + break; + } } + _ => {} } - _ => {} - } - match &a2[j - idx] { - Mergable::Var(e2) => { - if let Some(e2) = &e2.init { + match &a2[j - idx] { + Mergable::Var(e2) => { + if let Some(e2) = &e2.init { + if !self.is_skippable_for_seq(Some(a), e2) { + break; + } + } + + if let Some(id) = a1.last_mut().unwrap().id() { + if IdentUsageFinder::find(&id, &**e2) { + break; + } + } + } + Mergable::Expr(e2) => { if !self.is_skippable_for_seq(Some(a), e2) { break; } - } - if let Some(id) = a1.last_mut().unwrap().id() { - if IdentUsageFinder::find(&id, &**e2) { - break; - } - } - } - Mergable::Expr(e2) => { - if !self.is_skippable_for_seq(Some(a), e2) { - break; - } - - if let Some(id) = a1.last_mut().unwrap().id() { - // TODO(kdy1): Optimize - if IdentUsageFinder::find(&id, &**e2) { - break; + if let Some(id) = a1.last_mut().unwrap().id() { + // TODO(kdy1): Optimize + if IdentUsageFinder::find(&id, &**e2) { + break; + } } } } } } + + if !did_work { + break; + } } Ok(()) diff --git a/crates/swc_ecma_minifier/tests/benches-full/echarts.js b/crates/swc_ecma_minifier/tests/benches-full/echarts.js index 46bef8543fe..3fa43dbf3bc 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/echarts.js +++ b/crates/swc_ecma_minifier/tests/benches-full/echarts.js @@ -5004,7 +5004,7 @@ }(cx, cy, rx, ry, startAngle, endAngle, anticlockwise, min2, max2), xi = mathCos$1(endAngle) * rx + cx, yi = mathSin$1(endAngle) * ry + cy; break; case CMD.R: - x0 = xi = data[i++], fromLine(x0, y0 = yi = data[i++], x0 + data[i++], y0 + data[i++], min2, max2); + fromLine(x0 = xi = data[i++], y0 = yi = data[i++], x0 + data[i++], y0 + data[i++], min2, max2); break; case CMD.Z: xi = x0, yi = y0; @@ -6228,10 +6228,10 @@ ctlPtx = cpx, ctlPty = cpy, len = path.len(), pathData = path.data, prevCmd === CMD.Q && (ctlPtx += cpx - pathData[len - 4], ctlPty += cpy - pathData[len - 3]), cpx += p[off++], cpy += p[off++], cmd = CMD.Q, path.addData(cmd, ctlPtx, ctlPty, cpx, cpy); break; case 'A': - rx = p[off++], ry = p[off++], psi = p[off++], fa = p[off++], fs = p[off++], x1 = cpx, y1 = cpy, processArc(x1, y1, cpx = p[off++], cpy = p[off++], fa, fs, rx, ry, psi, cmd = CMD.A, path); + rx = p[off++], ry = p[off++], psi = p[off++], fa = p[off++], fs = p[off++], processArc(x1 = cpx, y1 = cpy, cpx = p[off++], cpy = p[off++], fa, fs, rx, ry, psi, cmd = CMD.A, path); break; case 'a': - rx = p[off++], ry = p[off++], psi = p[off++], fa = p[off++], fs = p[off++], x1 = cpx, y1 = cpy, processArc(x1, y1, cpx += p[off++], cpy += p[off++], fa, fs, rx, ry, psi, cmd = CMD.A, path); + rx = p[off++], ry = p[off++], psi = p[off++], fa = p[off++], fs = p[off++], processArc(x1 = cpx, y1 = cpy, cpx += p[off++], cpy += p[off++], fa, fs, rx, ry, psi, cmd = CMD.A, path); } } ('z' === cmdStr || 'Z' === cmdStr) && (cmd = CMD.Z, path.addData(cmd), cpx = subpathX, cpy = subpathY), prevCmd = cmd; @@ -10820,7 +10820,7 @@ }(cx, cy, ry, theta, theta + dTheta, anticlockwise, _x, y, tmpPt), xi = Math.cos(theta + dTheta) * rx + cx, yi = Math.sin(theta + dTheta) * ry + cy; break; case CMD$3.R: - x0 = xi = data[i++], d = projectPointToRect(x0, y0 = yi = data[i++], data[i++], data[i++], x, y, tmpPt); + d = projectPointToRect(x0 = xi = data[i++], y0 = yi = data[i++], data[i++], data[i++], x, y, tmpPt); break; case CMD$3.Z: d = projectPointToLine(xi, yi, x0, y0, x, y, tmpPt, !0), xi = x0, yi = y0; @@ -15580,9 +15580,9 @@ return __extends(LogScale, _super), LogScale.prototype.getTicks = function(expandToNicedExtent) { var originalScale = this._originalScale, extent = this._extent, originalExtent = originalScale.getExtent(); return map(intervalScaleProto.getTicks.call(this, expandToNicedExtent), function(tick) { - var originalVal, originalVal1, val = tick.value, powVal = round(mathPow$1(this.base, val)); - return powVal = val === extent[0] && this._fixMin ? round(powVal, getPrecisionSafe(originalExtent[0])) : powVal, { - value: powVal = val === extent[1] && this._fixMax ? round(powVal, getPrecisionSafe(originalExtent[1])) : powVal + var val, originalVal, val1, originalVal1, val2 = tick.value, powVal = round(mathPow$1(this.base, val2)); + return powVal = val2 === extent[0] && this._fixMin ? round(powVal, getPrecisionSafe(originalExtent[0])) : powVal, { + value: powVal = val2 === extent[1] && this._fixMax ? round(powVal, getPrecisionSafe(originalExtent[1])) : powVal }; }, this); }, LogScale.prototype.setExtent = function(start, end) { @@ -18595,13 +18595,13 @@ } var getLayout = { cartesian2d: function(data, dataIndex, itemModel) { - var itemModel1, rawLayout, borderColor, layout = data.getItemLayout(dataIndex), fixedLineWidth = itemModel ? (itemModel1 = itemModel, rawLayout = layout, (borderColor = itemModel1.get([ + var borderColor, layout = data.getItemLayout(dataIndex), fixedLineWidth = itemModel && (borderColor = itemModel.get([ 'itemStyle', 'borderColor' - ])) && 'none' !== borderColor ? Math.min(itemModel1.get([ + ])) && 'none' !== borderColor ? Math.min(itemModel.get([ 'itemStyle', 'borderWidth' - ]) || 0, isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width), isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height)) : 0) : 0, signX = layout.width > 0 ? 1 : -1, signY = layout.height > 0 ? 1 : -1; + ]) || 0, isNaN(layout.width) ? Number.MAX_VALUE : Math.abs(layout.width), isNaN(layout.height) ? Number.MAX_VALUE : Math.abs(layout.height)) : 0, signX = layout.width > 0 ? 1 : -1, signY = layout.height > 0 ? 1 : -1; return { x: layout.x + signX * fixedLineWidth / 2, y: layout.y + signY * fixedLineWidth / 2, @@ -27367,7 +27367,7 @@ }(SeriesModel); function sankeyLayout(ecModel, api) { ecModel.eachSeriesByType('sankey', function(seriesModel) { - var keyAttr, nodeWidth = seriesModel.get('nodeWidth'), nodeGap = seriesModel.get('nodeGap'), layoutInfo = getLayoutRect(seriesModel.getBoxLayoutParams(), { + var orient, keyAttr, nodeWidth = seriesModel.get('nodeWidth'), nodeGap = seriesModel.get('nodeGap'), layoutInfo = getLayoutRect(seriesModel.getBoxLayoutParams(), { width: api.getWidth(), height: api.getHeight() }); @@ -27381,7 +27381,7 @@ }); var iterations = 0 !== filter(nodes, function(node) { return 0 === node.getLayout().value; - }).length ? 0 : seriesModel.get('layoutIterations'), orient = seriesModel.get('orient'); + }).length ? 0 : seriesModel.get('layoutIterations'); (function(nodes, edges, nodeWidth, width, height, orient, nodeAlign) { for(var kx, remainEdges = [], indegreeArr = [], zeroIndegrees = [], nextTargetNode = [], x = 0, i = 0; i < edges.length; i++)remainEdges[i] = 1; for(var i = 0; i < nodes.length; i++)indegreeArr[i] = nodes[i].inEdges.length, 0 === indegreeArr[i] && zeroIndegrees.push(nodes[i]); @@ -27439,7 +27439,7 @@ x: nodeDepth }, !0); }); - })(nodes, edges, nodeWidth, width, height, orient, seriesModel.get('nodeAlign')), function(nodes, edges, height, width, nodeGap, iterations, orient) { + })(nodes, edges, nodeWidth, width, height, orient = seriesModel.get('orient'), seriesModel.get('nodeAlign')), function(nodes, edges, height, width, nodeGap, iterations, orient) { var nodesByBreadth, keyAttr, groupResult, minKy, nodesByBreadth1 = (nodesByBreadth = [], keyAttr = 'vertical' === orient ? 'y' : 'x', (groupResult = groupData(nodes, function(node) { return node.getLayout()[keyAttr]; })).keys.sort(function(a, b) { diff --git a/crates/swc_ecma_minifier/tests/benches-full/moment.js b/crates/swc_ecma_minifier/tests/benches-full/moment.js index b378a43a63a..96bf7c10e42 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/moment.js +++ b/crates/swc_ecma_minifier/tests/benches-full/moment.js @@ -737,7 +737,7 @@ } else config._isValid = !1; } function configFromRFC2822(config) { - var year, weekdayStr, config1, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr, result, match = rfc2822.exec(config._i.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '')); + var year, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr, result, weekdayStr, config1, match = rfc2822.exec(config._i.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '')); if (match) { if (yearStr = match[4], monthStr = match[3], dayStr = match[2], hourStr = match[5], minuteStr = match[6], secondStr = match[7], result = [ (year = parseInt(yearStr, 10)) <= 49 ? 2000 + year : year <= 999 ? 1900 + year : year, diff --git a/crates/swc_ecma_minifier/tests/benches-full/react.js b/crates/swc_ecma_minifier/tests/benches-full/react.js index 35bb7619bcd..607ae98c6ce 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/react.js +++ b/crates/swc_ecma_minifier/tests/benches-full/react.js @@ -574,9 +574,15 @@ function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); if (!validType) { - var source, typeString, info = ''; + var typeString, info = ''; (void 0 === type || 'object' == typeof type && null !== type && 0 === Object.keys(type).length) && (info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); - var sourceInfo = null != props && void 0 !== (source = props.__source) ? '\n\nCheck your code at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + '.' : ''; + var sourceInfo = function(elementProps) { + if (null != elementProps) { + var source; + return void 0 !== (source = elementProps.__source) ? '\n\nCheck your code at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + '.' : ''; + } + return ''; + }(props); sourceInfo ? info += sourceInfo : info += getDeclarationErrorAddendum(), null === type ? typeString = 'null' : Array.isArray(type) ? typeString = 'array' : void 0 !== type && type.$$typeof === REACT_ELEMENT_TYPE ? (typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />", info = ' Did you accidentally export a JSX literal instead of a component?') : typeString = typeof type, error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info); } var element = createElement.apply(this, arguments); diff --git a/crates/swc_ecma_minifier/tests/benches-full/three.js b/crates/swc_ecma_minifier/tests/benches-full/three.js index c28f7fda688..2e641758f8a 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/three.js +++ b/crates/swc_ecma_minifier/tests/benches-full/three.js @@ -1406,8 +1406,8 @@ var te = this.elements; return te[0] *= s, te[4] *= s, te[8] *= s, te[12] *= s, te[1] *= s, te[5] *= s, te[9] *= s, te[13] *= s, te[2] *= s, te[6] *= s, te[10] *= s, te[14] *= s, te[3] *= s, te[7] *= s, te[11] *= s, te[15] *= s, this; }, _proto.determinant = function() { - var te = this.elements, n11 = te[0], n12 = te[4], n13 = te[8], n14 = te[12], n21 = te[1], n22 = te[5], n23 = te[9], n24 = te[13], n31 = te[2], n32 = te[6], n33 = te[10], n34 = te[14], n41 = te[3]; - return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + te[7] * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + te[11] * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + te[15] * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31); + var te = this.elements, n11 = te[0], n12 = te[4], n13 = te[8], n14 = te[12], n21 = te[1], n22 = te[5], n23 = te[9], n24 = te[13], n31 = te[2], n32 = te[6], n33 = te[10], n34 = te[14]; + return te[3] * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + te[7] * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + te[11] * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + te[15] * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31); }, _proto.transpose = function() { var tmp, te = this.elements; return tmp = te[1], te[1] = te[4], te[4] = tmp, tmp = te[2], te[2] = te[8], te[8] = tmp, tmp = te[6], te[6] = te[9], te[9] = tmp, tmp = te[3], te[3] = te[12], te[12] = tmp, tmp = te[7], te[7] = te[13], te[13] = tmp, tmp = te[11], te[11] = te[14], te[14] = tmp, this; @@ -8915,12 +8915,12 @@ var _j2 = i, _k2 = i - 1; _k2 < 0 && (_k2 = contour.length - 1); for(var _s = 0, sl = steps + 2 * bevelSegments; _s < sl; _s++){ - var slen1 = vlen * _s, slen2 = vlen * (_s + 1), a = layeroffset + _j2 + slen1; + var slen1 = vlen * _s, slen2 = vlen * (_s + 1); !function(a, b, c, d) { addVertex(a), addVertex(b), addVertex(d), addVertex(b), addVertex(c), addVertex(d); var nextIndex = verticesArray.length / 3, uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1); addUV(uvs[0]), addUV(uvs[1]), addUV(uvs[3]), addUV(uvs[1]), addUV(uvs[2]), addUV(uvs[3]); - }(a, layeroffset + _k2 + slen1, layeroffset + _k2 + slen2, layeroffset + _j2 + slen2); + }(layeroffset + _j2 + slen1, layeroffset + _k2 + slen1, layeroffset + _k2 + slen2, layeroffset + _j2 + slen2); } } } @@ -12478,7 +12478,7 @@ } } }); - var _RESERVED_CHARS_RE = '\\[\\]\\.:\\/', _reservedRe = RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'), _wordChar = '[^' + _RESERVED_CHARS_RE + ']', _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']', _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar), _trackRe = RegExp("^" + _directoryRe + /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot) + /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar) + /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar) + '$'), _supportedObjectNames = [ + var _RESERVED_CHARS_RE = '\\[\\]\\.:\\/', _reservedRe = RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'), _wordChar = '[^' + _RESERVED_CHARS_RE + ']', _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']', _trackRe = RegExp("^" + /((?:WC+[\/:])*)/.source.replace('WC', _wordChar) + /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot) + /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar) + /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar) + '$'), _supportedObjectNames = [ 'material', 'materials', 'bones' diff --git a/crates/swc_ecma_minifier/tests/benches-full/victory.js b/crates/swc_ecma_minifier/tests/benches-full/victory.js index d3225965f9e..cc5a24251b4 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/victory.js +++ b/crates/swc_ecma_minifier/tests/benches-full/victory.js @@ -1118,7 +1118,7 @@ }), __webpack_require__.d(__webpack_exports__, "Hcl", function() { return Hcl; }); - var _define_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../../node_modules/d3-color/src/define.js"), _color_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../../node_modules/d3-color/src/color.js"), _math_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../../node_modules/d3-color/src/math.js"), t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * (6 / 29) * (6 / 29), t3 = 6 / 29 * t1 * t1; + var _define_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../../node_modules/d3-color/src/define.js"), _color_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../../node_modules/d3-color/src/color.js"), _math_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../../node_modules/d3-color/src/math.js"), t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * (6 / 29) * (6 / 29), t3 = 6 / 29 * (6 / 29) * (6 / 29); function labConvert(o) { if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); if (o instanceof Hcl) return hcl2lab(o); @@ -13446,32 +13446,27 @@ childComponents = childComponents || getChildComponents(props); var baseStyle = (calculatedProps = calculatedProps || getCalculatedProps(props, childComponents)).style.parent, height = props.height, polar = props.polar, theme = props.theme, width = props.width, _calculatedProps = calculatedProps, origin = _calculatedProps.origin, horizontal = _calculatedProps.horizontal, parentName = props.name || "chart"; return childComponents.map(function(child, index) { - var role = child.type && child.type.role, style = Array.isArray(child.props.style) ? child.props.style : lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, child.props.style, { + var child1, props1, calculatedProps1, domain, scale, stringMap, categories, axisChild, role = child.type && child.type.role, style = Array.isArray(child.props.style) ? child.props.style : lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, child.props.style, { parent: baseStyle - }), childProps = function(child, props, calculatedProps) { - var domain, scale, stringMap, categories, axisChild = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.findAxisComponents([ - child - ]); - if (axisChild.length > 0) return axisChild[0], domain = calculatedProps.domain, scale = calculatedProps.scale, stringMap = calculatedProps.stringMap, categories = calculatedProps.categories, { - stringMap: stringMap, - horizontal: calculatedProps.horizontal, - categories: categories, - startAngle: props.startAngle, - endAngle: props.endAngle, - innerRadius: props.innerRadius, - domain: domain, - scale: scale - }; - var categories1 = calculatedProps.categories, domain1 = calculatedProps.domain, range = calculatedProps.range; - return { - categories: categories1, - domain: domain1, - range: range, - scale: calculatedProps.scale, - stringMap: calculatedProps.stringMap, - horizontal: calculatedProps.horizontal - }; - }(child, props, calculatedProps), name = child.props.name || "".concat(parentName, "-").concat(role, "-").concat(index), newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({ + }), childProps = (child1 = child, props1 = props, calculatedProps1 = calculatedProps, (axisChild = victory_core__WEBPACK_IMPORTED_MODULE_3__.Axis.findAxisComponents([ + child1 + ])).length > 0 ? (axisChild[0], domain = calculatedProps1.domain, scale = calculatedProps1.scale, stringMap = calculatedProps1.stringMap, categories = calculatedProps1.categories, { + stringMap: stringMap, + horizontal: calculatedProps1.horizontal, + categories: categories, + startAngle: props1.startAngle, + endAngle: props1.endAngle, + innerRadius: props1.innerRadius, + domain: domain, + scale: scale + }) : { + categories: calculatedProps1.categories, + domain: calculatedProps1.domain, + range: calculatedProps1.range, + scale: calculatedProps1.scale, + stringMap: calculatedProps1.stringMap, + horizontal: calculatedProps1.horizontal + }), name = child.props.name || "".concat(parentName, "-").concat(role, "-").concat(index), newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({ horizontal: horizontal, height: height, polar: polar, @@ -22861,10 +22856,10 @@ }); }, getDataFromChildren: function(props, childComponents) { - var polar = props.polar, startAngle = props.startAngle, endAngle = props.endAngle, parentProps = { - polar: polar, - startAngle: startAngle, - endAngle: endAngle, + var parentProps = { + polar: props.polar, + startAngle: props.startAngle, + endAngle: props.endAngle, categories: props.categories, minDomain: props.minDomain, maxDomain: props.maxDomain @@ -27841,8 +27836,8 @@ evt.preventDefault(); var activateSelectedData = targetProps.activateSelectedData, allowSelection = targetProps.allowSelection, polar = targetProps.polar, selectedData = targetProps.selectedData; if (!allowSelection) return {}; - var dimension = this.getDimension(targetProps), parentSVG = targetProps.parentSVG || victory_core__WEBPACK_IMPORTED_MODULE_5__.Selection.getParentSVG(evt), _Selection$getSVGEven = victory_core__WEBPACK_IMPORTED_MODULE_5__.Selection.getSVGEventCoordinates(evt, parentSVG), x = _Selection$getSVGEven.x, y = _Selection$getSVGEven.y, x1 = polar || "y" !== dimension ? x : victory_core__WEBPACK_IMPORTED_MODULE_5__.Selection.getDomainCoordinates(targetProps).x[0], mutatedProps = { - x1: x1, + var dimension = this.getDimension(targetProps), parentSVG = targetProps.parentSVG || victory_core__WEBPACK_IMPORTED_MODULE_5__.Selection.getParentSVG(evt), _Selection$getSVGEven = victory_core__WEBPACK_IMPORTED_MODULE_5__.Selection.getSVGEventCoordinates(evt, parentSVG), x = _Selection$getSVGEven.x, y = _Selection$getSVGEven.y, mutatedProps = { + x1: polar || "y" !== dimension ? x : victory_core__WEBPACK_IMPORTED_MODULE_5__.Selection.getDomainCoordinates(targetProps).x[0], y1: polar || "x" !== dimension ? y : victory_core__WEBPACK_IMPORTED_MODULE_5__.Selection.getDomainCoordinates(targetProps).y[0], select: !0, x2: polar || "y" !== dimension ? x : victory_core__WEBPACK_IMPORTED_MODULE_5__.Selection.getDomainCoordinates(targetProps).x[1], diff --git a/crates/swc_ecma_minifier/tests/compress.rs b/crates/swc_ecma_minifier/tests/compress.rs index 6ed4b452ef5..9912e704de2 100644 --- a/crates/swc_ecma_minifier/tests/compress.rs +++ b/crates/swc_ecma_minifier/tests/compress.rs @@ -292,6 +292,7 @@ fn find_config(dir: &Path) -> String { #[testing::fixture("tests/fixture/**/input.js")] #[testing::fixture("tests/pass-1/**/input.js")] +#[testing::fixture("tests/pass-default/**/input.js")] fn custom_fixture(input: PathBuf) { let dir = input.parent().unwrap(); let config = find_config(dir); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js index ad6f98fa51d..fc47dc46b92 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js @@ -737,7 +737,7 @@ } else config._isValid = !1; } function configFromRFC2822(config) { - var year, weekdayStr, config1, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr, result, match = rfc2822.exec(config._i.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "")); + var year, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr, result, weekdayStr, config1, match = rfc2822.exec(config._i.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "")); if (match) { if (yearStr = match[4], monthStr = match[3], dayStr = match[2], hourStr = match[5], minuteStr = match[6], secondStr = match[7], result = [ (year = parseInt(yearStr, 10)) <= 49 ? 2000 + year : year <= 999 ? 1900 + year : year, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js index 3307dcbd9e5..35e1e7a1861 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js @@ -1988,7 +1988,7 @@ domBuilder.startDocument(), _copy(defaultNSMap, defaultNSMap = {}), function(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) { function entityReplacer(a) { var code, k = a.slice(1, -1); - return k in entityMap ? entityMap[k] : "#" === k.charAt(0) ? (code = parseInt(k.substr(1).replace("x", "0x"))) > 0xffff ? String.fromCharCode(0xd800 + ((code -= 0x10000) >> 10), 0xdc00 + (0x3ff & code)) : String.fromCharCode(code) : (errorHandler.error("entity not found:" + a), a); + return k in entityMap ? entityMap[k] : "#" !== k.charAt(0) ? (errorHandler.error("entity not found:" + a), a) : (code = parseInt(k.substr(1).replace("x", "0x"))) > 0xffff ? String.fromCharCode(0xd800 + ((code -= 0x10000) >> 10), 0xdc00 + (0x3ff & code)) : String.fromCharCode(code); } function appendText(end) { if (end > start) { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js index ab78ed92c47..12b63ce093d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js @@ -2209,8 +2209,8 @@ fontFamily: c, fontWeight: f, fontStyle: d - }) : null, S = x ? x.data : c, A = { - font: S, + }) : null, S = { + font: x ? x.data : c, color: l, opacity: _, fontSize: h, @@ -2224,25 +2224,25 @@ strike: "line-through" === v || "underline line-through" === v || "line-through underline" === v, strikeColor: b || l, underlineColor: b || l, - link: n || (null === (O = r.props) || void 0 === O ? void 0 : O.src) || (null === (C = r.props) || void 0 === C ? void 0 : C.href), + link: n || (null === (k = r.props) || void 0 === k ? void 0 : k.src) || (null === (O = r.props) || void 0 === O ? void 0 : O.href), lineHeight: g ? g * h : null - }, k = 0; k < r.children.length; k += 1){ - var O, C, P, F = r.children[k]; - F.type === T.Image ? o.push({ + }, A = 0; A < r.children.length; A += 1){ + var k, O, C, P = r.children[A]; + P.type === T.Image ? o.push({ string: String.fromCharCode(0xfffc), - attributes: U.default({}, A, { + attributes: U.default({}, S, { attachment: { - width: F.style.width || h, - height: F.style.height || h, - image: F.image.data + width: P.style.width || h, + height: P.style.height || h, + image: P.image.data } }) - }) : F.type === T.TextInstance ? o.push({ - string: Z(F.value, D), - attributes: A - }) : F && (P = o).push.apply(P, e(t, F, A.link, i + 1)); + }) : P.type === T.TextInstance ? o.push({ + string: Z(P.value, D), + attributes: S + }) : P && (C = o).push.apply(C, e(t, P, S.link, i + 1)); } - for(var R = 0; R < tT.length; R += 1)o = (0, tT[R])(o); + for(var F = 0; F < tT.length; F += 1)o = (0, tT[F])(o); return o; }, tC = function(e, t) { var r = tO(e, t); diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/react/12/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/react/12/output.js index 28ad049957e..84f9e185c94 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/react/12/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/react/12/output.js @@ -1,4 +1,7 @@ function getSourceInfoErrorAddendumForProps(elementProps) { - var source; - return null != elementProps && void 0 !== (source = elementProps.__source) ? "\n\nCheck your code at " + source.fileName.replace(/^.*[\\\/]/, "") + ":" + source.lineNumber + "." : ""; + if (null != elementProps) { + var source; + return void 0 !== (source = elementProps.__source) ? "\n\nCheck your code at " + source.fileName.replace(/^.*[\\\/]/, "") + ":" + source.lineNumber + "." : ""; + } + return ""; } diff --git a/crates/swc_ecma_minifier/tests/pass-1/compute/1/input.js b/crates/swc_ecma_minifier/tests/pass-1/compute/1/input.js new file mode 100644 index 00000000000..881e2edf89f --- /dev/null +++ b/crates/swc_ecma_minifier/tests/pass-1/compute/1/input.js @@ -0,0 +1,9 @@ +console.log((function () { + var a = [ + 94, + 173, + 190, + 239 + ], b = 0; + return b |= 94, b <<= 8, b |= 173, b <<= 8, b |= 190, b <<= 8, b |= 239; +})().toString(16)); \ No newline at end of file diff --git a/crates/swc_ecma_minifier/tests/pass-1/compute/1/output.js b/crates/swc_ecma_minifier/tests/pass-1/compute/1/output.js new file mode 100644 index 00000000000..09539e895c8 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/pass-1/compute/1/output.js @@ -0,0 +1,4 @@ +console.log((function() { + var b; + return b = 94, b <<= 8, b |= 173, b <<= 8, b |= 190, b <<= 8, b |= 239; +})().toString(16)); diff --git a/crates/swc_ecma_minifier/tests/pass-default/compute/1/input.js b/crates/swc_ecma_minifier/tests/pass-default/compute/1/input.js new file mode 100644 index 00000000000..881e2edf89f --- /dev/null +++ b/crates/swc_ecma_minifier/tests/pass-default/compute/1/input.js @@ -0,0 +1,9 @@ +console.log((function () { + var a = [ + 94, + 173, + 190, + 239 + ], b = 0; + return b |= 94, b <<= 8, b |= 173, b <<= 8, b |= 190, b <<= 8, b |= 239; +})().toString(16)); \ No newline at end of file diff --git a/crates/swc_ecma_minifier/tests/pass-default/compute/1/output.js b/crates/swc_ecma_minifier/tests/pass-default/compute/1/output.js new file mode 100644 index 00000000000..09539e895c8 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/pass-default/compute/1/output.js @@ -0,0 +1,4 @@ +console.log((function() { + var b; + return b = 94, b <<= 8, b |= 173, b <<= 8, b |= 190, b <<= 8, b |= 239; +})().toString(16)); diff --git a/crates/swc_ecma_minifier/tests/pass-default/config.json b/crates/swc_ecma_minifier/tests/pass-default/config.json new file mode 100644 index 00000000000..4e7eff41a7a --- /dev/null +++ b/crates/swc_ecma_minifier/tests/pass-default/config.json @@ -0,0 +1,5 @@ +{ + "defaults": true, + "toplevel": true, + "passes": 3 +} diff --git a/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js b/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js index 7871999a3ee..5eea8d87636 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js +++ b/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js @@ -3352,7 +3352,7 @@ var descending = !1, get = predicate || identity; return isString(predicate) && (("+" == predicate.charAt(0) || "-" == predicate.charAt(0)) && (descending = "-" == predicate.charAt(0), predicate = predicate.substring(1)), get = $parse(predicate)), reverseComparator(function(a, b) { var v1, v2, t1, t2; - return v1 = get(a), v2 = get(b), t1 = typeof v1, t1 != (t2 = typeof v2) ? t1 < t2 ? -1 : 1 : ("string" == t1 && (v1 = v1.toLowerCase(), v2 = v2.toLowerCase()), v1 === v2) ? 0 : v1 < v2 ? -1 : 1; + return v1 = get(a), v2 = get(b), (t1 = typeof v1) != (t2 = typeof v2) ? t1 < t2 ? -1 : 1 : ("string" == t1 && (v1 = v1.toLowerCase(), v2 = v2.toLowerCase()), v1 === v2) ? 0 : v1 < v2 ? -1 : 1; }, descending); }, results = [], forEach(obj, function(value, index, list) { results.push(iterator.call(void 0, value, index, list)); diff --git a/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js b/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js index b74a39ce4f7..276f43ef316 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js @@ -730,8 +730,8 @@ makeUrlAbsolute: function(relUrl, absUrl) { if (!path.isRelativeUrl(relUrl)) return relUrl; undefined2 === absUrl && (absUrl = this.documentBase); - var relObj = path.parseUrl(relUrl), absObj = path.parseUrl(absUrl), protocol = relObj.protocol || absObj.protocol, doubleSlash = relObj.protocol ? relObj.doubleSlash : relObj.doubleSlash || absObj.doubleSlash, authority = relObj.authority || absObj.authority, hasPath = "" !== relObj.pathname, pathname = path.makePathAbsolute(relObj.pathname || absObj.filename, absObj.pathname); - return protocol + doubleSlash + authority + pathname + (relObj.search || !hasPath && absObj.search || "") + relObj.hash; + var relObj = path.parseUrl(relUrl), absObj = path.parseUrl(absUrl), protocol = relObj.protocol || absObj.protocol, doubleSlash = relObj.protocol ? relObj.doubleSlash : relObj.doubleSlash || absObj.doubleSlash, authority = relObj.authority || absObj.authority, hasPath = "" !== relObj.pathname; + return protocol + doubleSlash + authority + path.makePathAbsolute(relObj.pathname || absObj.filename, absObj.pathname) + (relObj.search || !hasPath && absObj.search || "") + relObj.hash; }, addSearchParams: function(url, params) { var u = path.parseUrl(url), p = "object" == typeof params ? jQuery.param(params) : params, s = u.search || "?"; diff --git a/crates/swc_ecma_minifier/tests/projects/output/react-17.0.1.js b/crates/swc_ecma_minifier/tests/projects/output/react-17.0.1.js index c7c316f8226..67f8d1f24d9 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/react-17.0.1.js +++ b/crates/swc_ecma_minifier/tests/projects/output/react-17.0.1.js @@ -574,9 +574,15 @@ function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); if (!validType) { - var source, typeString, info = ""; + var typeString, info = ""; (void 0 === type || "object" == typeof type && null !== type && 0 === Object.keys(type).length) && (info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); - var sourceInfo = null != props ? void 0 !== (source = props.__source) ? "\n\nCheck your code at " + source.fileName.replace(/^.*[\\\/]/, "") + ":" + source.lineNumber + "." : "" : ""; + var sourceInfo = function(elementProps) { + if (null != elementProps) { + var source; + return void 0 !== (source = elementProps.__source) ? "\n\nCheck your code at " + source.fileName.replace(/^.*[\\\/]/, "") + ":" + source.lineNumber + "." : ""; + } + return ""; + }(props); sourceInfo ? info += sourceInfo : info += getDeclarationErrorAddendum(), null === type ? typeString = "null" : Array.isArray(type) ? typeString = "array" : void 0 !== type && type.$$typeof === REACT_ELEMENT_TYPE ? (typeString = "<" + (getComponentName(type.type) || "Unknown") + " />", info = " Did you accidentally export a JSX literal instead of a component?") : typeString = typeof type, error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info); } var element = createElement.apply(this, arguments); diff --git a/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js b/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js index 1da23d6735e..a11706d7984 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js @@ -4403,7 +4403,7 @@ callback: update.callback, next: null }; - null === newLastBaseUpdate ? (newFirstBaseUpdate = newLastBaseUpdate = clone, newBaseState = newState) : newLastBaseUpdate = newLastBaseUpdate.next = clone, newLanes = newLanes | updateLane; + null === newLastBaseUpdate ? (newFirstBaseUpdate = newLastBaseUpdate = clone, newBaseState = newState) : newLastBaseUpdate = newLastBaseUpdate.next = clone, newLanes |= updateLane; } if (null === (update = update.next)) { if (null === (pendingQueue = queue.shared.pending)) break; @@ -4411,7 +4411,9 @@ _lastPendingUpdate.next = null, update = _firstPendingUpdate, queue.lastBaseUpdate = _lastPendingUpdate, queue.shared.pending = null; } } - null === newLastBaseUpdate && (newBaseState = newState), queue.baseState = newBaseState, queue.firstBaseUpdate = newFirstBaseUpdate, queue.lastBaseUpdate = newLastBaseUpdate, markSkippedUpdateLanes(newLanes), workInProgress.lanes = newLanes, workInProgress.memoizedState = newState; + null === newLastBaseUpdate && (newBaseState = newState), queue.baseState = newBaseState, queue.firstBaseUpdate = newFirstBaseUpdate, queue.lastBaseUpdate = newLastBaseUpdate, function(lane) { + workInProgressRootSkippedLanes |= lane; + }(newLanes), workInProgress.lanes = newLanes, workInProgress.memoizedState = newState; } currentlyProcessingQueue = null; } @@ -4908,7 +4910,7 @@ } function pushHostContext(fiber) { requiredContext(rootInstanceStackCursor.current); - var type, namespace, context = requiredContext(contextStackCursor$1.current), nextContext = (type = fiber.type, { + var type, context = requiredContext(contextStackCursor$1.current), nextContext = (type = fiber.type, { namespace: getChildNamespace(context.namespace, type), ancestorInfo: updatedAncestorInfo(context.ancestorInfo, type) }); @@ -5204,7 +5206,9 @@ eagerState: update.eagerState, next: null }; - null === newBaseQueueLast ? (newBaseQueueFirst = newBaseQueueLast = clone, newBaseState = newState) : newBaseQueueLast = newBaseQueueLast.next = clone, currentlyRenderingFiber$1.lanes = currentlyRenderingFiber$1.lanes | updateLane, markSkippedUpdateLanes(updateLane); + null === newBaseQueueLast ? (newBaseQueueFirst = newBaseQueueLast = clone, newBaseState = newState) : newBaseQueueLast = newBaseQueueLast.next = clone, currentlyRenderingFiber$1.lanes = currentlyRenderingFiber$1.lanes | updateLane, function(lane) { + workInProgressRootSkippedLanes |= lane; + }(updateLane); } update = update.next; }while (null !== update && update !== first) @@ -6104,7 +6108,7 @@ } function updateMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) { if (null === current) { - var a, type, type1 = Component.type; + var type, type1 = Component.type; if ("function" == typeof (type = type1) && !shouldConstruct$1(type) && void 0 === type.defaultProps && null === Component.compare && void 0 === Component.defaultProps) { var resolvedType = type1; return resolvedType = resolveFunctionForHotReloading(type1), workInProgress.tag = 15, workInProgress.type = resolvedType, validateFunctionComponentInDev(workInProgress, type1), updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, updateLanes, renderLanes); @@ -6117,7 +6121,7 @@ var _type = Component.type, _innerPropTypes = _type.propTypes; _innerPropTypes && checkPropTypes(_innerPropTypes, nextProps, "prop", getComponentName(_type)); var currentChild = current.child; - if (a = updateLanes, (a & renderLanes) == 0) { + if (!((updateLanes & renderLanes) != 0)) { var prevProps = currentChild.memoizedProps, compare = Component.compare; if ((compare = null !== compare ? compare : shallowEqual)(prevProps, nextProps) && current.ref === workInProgress.ref) return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } @@ -6127,7 +6131,7 @@ } function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) { if (workInProgress.type !== workInProgress.elementType) { - var a, outerMemoType = workInProgress.elementType; + var outerMemoType = workInProgress.elementType; if (outerMemoType.$$typeof === REACT_LAZY_TYPE) { var lazyComponent = outerMemoType, payload = lazyComponent._payload, init = lazyComponent._init; try { @@ -6140,7 +6144,7 @@ } } if (null !== current && shallowEqual(current.memoizedProps, nextProps) && current.ref === workInProgress.ref && workInProgress.type === current.type) { - if (didReceiveUpdate = !1, a = renderLanes, (a & updateLanes) == 0) return workInProgress.lanes = current.lanes, bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + if (didReceiveUpdate = !1, !((renderLanes & updateLanes) != 0)) return workInProgress.lanes = current.lanes, bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); (16384 & current.flags) != 0 && (didReceiveUpdate = !0); } return updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes); @@ -6458,7 +6462,9 @@ } var hasWarnedAboutUsingNoValuePropOnContextProvider = !1, hasWarnedAboutUsingContextAsConsumer = !1; function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) { - return (null !== current && (workInProgress.dependencies = current.dependencies), profilerStartTime = -1, markSkippedUpdateLanes(workInProgress.lanes), (renderLanes & workInProgress.childLanes) != 0) ? (!function(current, workInProgress) { + return (null !== current && (workInProgress.dependencies = current.dependencies), profilerStartTime = -1, function(lane) { + workInProgressRootSkippedLanes |= lane; + }(workInProgress.lanes), (renderLanes & workInProgress.childLanes) != 0) ? (!function(current, workInProgress) { if (!(null === current || workInProgress.child === current.child)) throw Error("Resuming work not yet implemented."); if (null !== workInProgress.child) { var currentChild = workInProgress.child, newChild = createWorkInProgress(currentChild, currentChild.pendingProps); @@ -6484,56 +6490,54 @@ }(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes)); if (null !== current) { if (current.memoizedProps !== workInProgress.pendingProps || hasContextChanged() || workInProgress.type !== current.type) didReceiveUpdate = !0; + else if ((renderLanes & updateLanes) != 0) didReceiveUpdate = (16384 & current.flags) != 0; else { - if (a = renderLanes, (a & updateLanes) != 0) didReceiveUpdate = (16384 & current.flags) != 0; - else { - switch(didReceiveUpdate = !1, workInProgress.tag){ - case 3: - pushHostRootContext(workInProgress), resetHydrationState(); - break; - case 5: - pushHostContext(workInProgress); - break; - case 1: - isContextProvider(workInProgress.type) && pushContextProvider(workInProgress); - break; - case 4: - pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); - break; - case 10: - var newValue = workInProgress.memoizedProps.value; - pushProvider(workInProgress, newValue); - break; - case 12: - a1 = renderLanes, (a1 & workInProgress.childLanes) != 0 && (workInProgress.flags |= 4); - var a, a1, stateNode = workInProgress.stateNode; - stateNode.effectDuration = 0, stateNode.passiveEffectDuration = 0; - break; - case 13: - if (null !== workInProgress.memoizedState) { - if (a2 = renderLanes, (a2 & workInProgress.child.childLanes) != 0) return updateSuspenseComponent(current, workInProgress, renderLanes); - newContext1 = 1 & suspenseStackCursor.current, push(suspenseStackCursor, newContext1, workInProgress); - var a2, newContext, newContext1, child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - if (null !== child) return child.sibling; - return null; - } - newContext = 1 & suspenseStackCursor.current, push(suspenseStackCursor, newContext, workInProgress); - break; - case 19: - var a3, newContext2, didSuspendBefore = (64 & current.flags) != 0, _hasChildWork = (a3 = renderLanes, (a3 & workInProgress.childLanes) != 0); - if (didSuspendBefore) { - if (_hasChildWork) return updateSuspenseListComponent(current, workInProgress, renderLanes); - workInProgress.flags |= 64; - } - var renderState = workInProgress.memoizedState; - if (null !== renderState && (renderState.rendering = null, renderState.tail = null, renderState.lastEffect = null), newContext2 = suspenseStackCursor.current, push(suspenseStackCursor, newContext2, workInProgress), !_hasChildWork) return null; - break; - case 23: - case 24: - return workInProgress.lanes = 0, updateOffscreenComponent(current, workInProgress, renderLanes); - } - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + switch(didReceiveUpdate = !1, workInProgress.tag){ + case 3: + pushHostRootContext(workInProgress), resetHydrationState(); + break; + case 5: + pushHostContext(workInProgress); + break; + case 1: + isContextProvider(workInProgress.type) && pushContextProvider(workInProgress); + break; + case 4: + pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); + break; + case 10: + var newValue = workInProgress.memoizedProps.value; + pushProvider(workInProgress, newValue); + break; + case 12: + (renderLanes & workInProgress.childLanes) != 0 && (workInProgress.flags |= 4); + var stateNode = workInProgress.stateNode; + stateNode.effectDuration = 0, stateNode.passiveEffectDuration = 0; + break; + case 13: + if (null !== workInProgress.memoizedState) { + if ((renderLanes & workInProgress.child.childLanes) != 0) return updateSuspenseComponent(current, workInProgress, renderLanes); + newContext1 = 1 & suspenseStackCursor.current, push(suspenseStackCursor, newContext1, workInProgress); + var newContext, newContext1, child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + if (null !== child) return child.sibling; + return null; + } + newContext = 1 & suspenseStackCursor.current, push(suspenseStackCursor, newContext, workInProgress); + break; + case 19: + var newContext2, didSuspendBefore = (64 & current.flags) != 0, _hasChildWork = (renderLanes & workInProgress.childLanes) != 0; + if (didSuspendBefore) { + if (_hasChildWork) return updateSuspenseListComponent(current, workInProgress, renderLanes); + workInProgress.flags |= 64; + } + var renderState = workInProgress.memoizedState; + if (null !== renderState && (renderState.rendering = null, renderState.tail = null, renderState.lastEffect = null), newContext2 = suspenseStackCursor.current, push(suspenseStackCursor, newContext2, workInProgress), !_hasChildWork) return null; + break; + case 23: + case 24: + return workInProgress.lanes = 0, updateOffscreenComponent(current, workInProgress, renderLanes); } + return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } } else didReceiveUpdate = !1; switch(workInProgress.lanes = 0, workInProgress.tag){ @@ -7174,7 +7178,7 @@ }, updateHostContainer = function(workInProgress) {}, updateHostComponent$1 = function(current, workInProgress, type, newProps, rootContainerInstance) { var oldProps = current.memoizedProps; if (oldProps !== newProps) { - var domElement, type1, oldProps1, newProps1, rootContainerInstance1, hostContext, updatePayload = (domElement = workInProgress.stateNode, type1 = type, oldProps1 = oldProps, newProps1 = newProps, rootContainerInstance1 = 0, hostContext = getHostContext(), typeof newProps1.children != typeof oldProps1.children && ("string" == typeof newProps1.children || "number" == typeof newProps1.children) && validateDOMNesting(null, "" + newProps1.children, updatedAncestorInfo(hostContext.ancestorInfo, type1)), function(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) { + var instance = workInProgress.stateNode, currentHostContext = getHostContext(), updatePayload = (typeof newProps.children != typeof oldProps.children && ("string" == typeof newProps.children || "number" == typeof newProps.children) && validateDOMNesting(null, "" + newProps.children, updatedAncestorInfo(currentHostContext.ancestorInfo, type)), function(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) { validatePropertiesInDevelopment(tag, nextRawProps); var lastProps, nextProps, propKey, styleName, updatePayload = null; switch(tag){ @@ -7228,7 +7232,7 @@ } } }(styleUpdates, nextProps[STYLE]), (updatePayload = updatePayload || []).push(STYLE, styleUpdates)), updatePayload; - }(domElement, type1, oldProps1, newProps1)); + }(instance, type, oldProps, newProps)); workInProgress.updateQueue = updatePayload, updatePayload && markUpdate(workInProgress); } }, updateHostText$1 = function(current, workInProgress, oldText, newText) { @@ -7631,7 +7635,7 @@ } } }(fiber), null; - markRootUpdated(root, lane, eventTime), root === workInProgressRoot && (workInProgressRootUpdatedLanes = workInProgressRootUpdatedLanes | lane, 4 === workInProgressRootExitStatus && markRootSuspended$1(root, workInProgressRootRenderLanes)); + markRootUpdated(root, lane, eventTime), root === workInProgressRoot && (workInProgressRootUpdatedLanes |= lane, 4 === workInProgressRootExitStatus && markRootSuspended$1(root, workInProgressRootRenderLanes)); var priorityLevel = getCurrentPriorityLevel(); 1 === lane ? (8 & executionContext) != 0 && (48 & executionContext) == 0 ? (schedulePendingInteractions(root, lane), performSyncWorkOnRoot(root)) : (ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, lane), 0 === executionContext && (resetRenderTimer(), flushSyncCallbackQueue())) : ((4 & executionContext) != 0 && (98 === priorityLevel || 99 === priorityLevel) && (null === rootsWithPendingDiscreteUpdates ? rootsWithPendingDiscreteUpdates = new Set([ root @@ -7697,7 +7701,7 @@ } function performConcurrentWorkOnRoot(root) { if (currentEventTime = -1, currentEventWipLanes = 0, currentEventPendingLanes = 0, (48 & executionContext) != 0) throw Error("Should not already be working."); - var a, originalCallbackNode = root.callbackNode; + var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) return null; var lanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : 0); if (0 === lanes) return null; @@ -7716,7 +7720,7 @@ } return (resetContextDependencies(), popInteractions(prevInteractions), ReactCurrentDispatcher$2.current = prevDispatcher, executionContext = prevExecutionContext, null !== workInProgress) ? 0 : (workInProgressRoot = null, workInProgressRootRenderLanes = 0, workInProgressRootExitStatus); }(root, lanes); - if (a = workInProgressRootIncludedLanes, (a & workInProgressRootUpdatedLanes) != 0) prepareFreshStack(root, 0); + if ((workInProgressRootIncludedLanes & workInProgressRootUpdatedLanes) != 0) prepareFreshStack(root, 0); else if (0 !== exitStatus) { if (2 === exitStatus && (executionContext |= 64, root.hydrate && (root.hydrate = !1, clearContainer(root.containerInfo)), 0 !== (lanes = getLanesToRetrySynchronouslyOnError(root)) && (exitStatus = renderRootSync(root, lanes))), 1 === exitStatus) { var fatalError = workInProgressRootFatalError; @@ -7783,12 +7787,12 @@ var index = pickArbitraryLaneIndex(lanes), lane = 1 << index; expirationTimes[index] = -1, lanes &= ~lane; } - }(root, suspendedLanes = (suspendedLanes = suspendedLanes & ~workInProgressRootPingedLanes) & ~workInProgressRootUpdatedLanes); + }(root, suspendedLanes = (suspendedLanes &= ~workInProgressRootPingedLanes) & ~workInProgressRootUpdatedLanes); } function performSyncWorkOnRoot(root) { if ((48 & executionContext) != 0) throw Error("Should not already be working."); - if (flushPassiveEffects(), root === workInProgressRoot && (a = root.expiredLanes, (a & workInProgressRootRenderLanes) != 0) ? (exitStatus = renderRootSync(root, lanes = workInProgressRootRenderLanes), a1 = workInProgressRootIncludedLanes, (a1 & workInProgressRootUpdatedLanes) != 0 && (lanes = getNextLanes(root, lanes), exitStatus = renderRootSync(root, lanes))) : (lanes = getNextLanes(root, 0), exitStatus = renderRootSync(root, lanes)), 0 !== root.tag && 2 === exitStatus && (executionContext |= 64, root.hydrate && (root.hydrate = !1, clearContainer(root.containerInfo)), 0 !== (lanes = getLanesToRetrySynchronouslyOnError(root)) && (exitStatus = renderRootSync(root, lanes))), 1 === exitStatus) { - var a, a1, lanes, exitStatus, fatalError = workInProgressRootFatalError; + if (flushPassiveEffects(), root === workInProgressRoot && (a = root.expiredLanes, (a & workInProgressRootRenderLanes) != 0) ? (exitStatus = renderRootSync(root, lanes = workInProgressRootRenderLanes), (workInProgressRootIncludedLanes & workInProgressRootUpdatedLanes) != 0 && (lanes = getNextLanes(root, lanes), exitStatus = renderRootSync(root, lanes))) : (lanes = getNextLanes(root, 0), exitStatus = renderRootSync(root, lanes)), 0 !== root.tag && 2 === exitStatus && (executionContext |= 64, root.hydrate && (root.hydrate = !1, clearContainer(root.containerInfo)), 0 !== (lanes = getLanesToRetrySynchronouslyOnError(root)) && (exitStatus = renderRootSync(root, lanes))), 1 === exitStatus) { + var a, lanes, exitStatus, fatalError = workInProgressRootFatalError; throw prepareFreshStack(root, 0), markRootSuspended$1(root, lanes), ensureRootIsScheduled(root, now()), fatalError; } var finishedWork = root.current.alternate; @@ -7824,7 +7828,7 @@ } } function pushRenderLanes(fiber, lanes) { - push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber), subtreeRenderLanes = subtreeRenderLanes | lanes, workInProgressRootIncludedLanes = workInProgressRootIncludedLanes | lanes; + push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber), subtreeRenderLanes |= lanes, workInProgressRootIncludedLanes |= lanes; } function popRenderLanes(fiber) { subtreeRenderLanes = subtreeRenderLanesCursor.current, pop(subtreeRenderLanesCursor, fiber); @@ -7970,13 +7974,13 @@ if (24 !== completedWork.tag && 23 !== completedWork.tag || null === completedWork.memoizedState || (1073741824 & subtreeRenderLanes) != 0 || (4 & completedWork.mode) == 0) { var newChildLanes = 0; if ((8 & completedWork.mode) != 0) { - for(var actualDuration = completedWork.actualDuration, treeBaseDuration = completedWork.selfBaseDuration, shouldBubbleActualDurations = null === completedWork.alternate || completedWork.child !== completedWork.alternate.child, child = completedWork.child; null !== child;)newChildLanes = newChildLanes | (child.lanes | child.childLanes), shouldBubbleActualDurations && (actualDuration += child.actualDuration), treeBaseDuration += child.treeBaseDuration, child = child.sibling; + for(var actualDuration = completedWork.actualDuration, treeBaseDuration = completedWork.selfBaseDuration, shouldBubbleActualDurations = null === completedWork.alternate || completedWork.child !== completedWork.alternate.child, child = completedWork.child; null !== child;)newChildLanes |= child.lanes | child.childLanes, shouldBubbleActualDurations && (actualDuration += child.actualDuration), treeBaseDuration += child.treeBaseDuration, child = child.sibling; if (13 === completedWork.tag && null !== completedWork.memoizedState) { var primaryChildFragment = completedWork.child; null !== primaryChildFragment && (treeBaseDuration -= primaryChildFragment.treeBaseDuration); } completedWork.actualDuration = actualDuration, completedWork.treeBaseDuration = treeBaseDuration; - } else for(var _child = completedWork.child; null !== _child;)newChildLanes = newChildLanes | (_child.lanes | _child.childLanes), _child = _child.sibling; + } else for(var _child = completedWork.child; null !== _child;)newChildLanes |= _child.lanes | _child.childLanes, _child = _child.sibling; completedWork.childLanes = newChildLanes; } })(completedWork), null !== returnFiber && (2048 & returnFiber.flags) == 0 && (null === returnFiber.firstEffect && (returnFiber.firstEffect = completedWork.firstEffect), null !== completedWork.lastEffect && (null !== returnFiber.lastEffect && (returnFiber.lastEffect.nextEffect = completedWork.firstEffect), returnFiber.lastEffect = completedWork.lastEffect), completedWork.flags > 1 && (null !== returnFiber.lastEffect ? returnFiber.lastEffect.nextEffect = completedWork : returnFiber.firstEffect = completedWork, returnFiber.lastEffect = completedWork)); @@ -8325,10 +8329,7 @@ return; case 5: var _instance2 = finishedWork.stateNode; - if (null === current && 4 & finishedWork.flags) { - var type = finishedWork.type; - shouldAutoFocusHostComponent(type, finishedWork.memoizedProps) && _instance2.focus(); - } + if (null === current && 4 & finishedWork.flags) shouldAutoFocusHostComponent(finishedWork.type, finishedWork.memoizedProps) && _instance2.focus(); return; case 6: case 4: @@ -8467,7 +8468,7 @@ var pingCache = root.pingCache; null !== pingCache && pingCache.delete(wakeable); var eventTime = requestEventTime(); - markRootPinged(root, pingedLanes), workInProgressRoot === root && (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || 3 === workInProgressRootExitStatus && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < 500 ? prepareFreshStack(root, 0) : workInProgressRootPingedLanes = workInProgressRootPingedLanes | pingedLanes), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, pingedLanes); + markRootPinged(root, pingedLanes), workInProgressRoot === root && (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || 3 === workInProgressRootExitStatus && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < 500 ? prepareFreshStack(root, 0) : workInProgressRootPingedLanes |= pingedLanes), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, pingedLanes); } function resolveRetryWakeable(boundaryFiber, wakeable) { var retryCache, retryLane, eventTime, root, lane, mode; @@ -8562,8 +8563,7 @@ function startWorkOnPendingInteractions(root, lanes) { var interactions = new Set(); if (root.pendingInteractionMap.forEach(function(scheduledInteractions, scheduledLane) { - var a; - a = lanes, (a & scheduledLane) != 0 && scheduledInteractions.forEach(function(interaction) { + (lanes & scheduledLane) != 0 && scheduledInteractions.forEach(function(interaction) { return interactions.add(interaction); }); }), root.memoizedInteractions = interactions, interactions.size > 0) { @@ -8594,8 +8594,7 @@ } finally{ var pendingInteractionMap = root.pendingInteractionMap; pendingInteractionMap.forEach(function(scheduledInteractions, lane) { - var a; - a = remainingLanesAfterCommit, (a & lane) != 0 || (pendingInteractionMap.delete(lane), scheduledInteractions.forEach(function(interaction) { + (remainingLanesAfterCommit & lane) != 0 || (pendingInteractionMap.delete(lane), scheduledInteractions.forEach(function(interaction) { if (interaction.__count--, null !== subscriber && 0 === interaction.__count) try { subscriber.onInteractionScheduledWorkCompleted(interaction); } catch (error) { @@ -8840,7 +8839,7 @@ function createFiberFromElement(element, mode, lanes) { var owner = null; owner = element._owner; - var type = element.type, fiber = createFiberFromTypeAndProps(type, element.key, element.props, owner, mode, lanes); + var fiber = createFiberFromTypeAndProps(element.type, element.key, element.props, owner, mode, lanes); return fiber._debugSource = element._source, fiber._debugOwner = element._owner, fiber; } function createFiberFromFragment(elements, mode, lanes, key) { diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_t161_top_retain_14/output.js b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_t161_top_retain_14/output.js index 99edc19c1b5..ffc28776651 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_t161_top_retain_14/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_t161_top_retain_14/output.js @@ -4,7 +4,7 @@ class Alpha { } } let x = 2, z = 4; -console.log(2, 3, 4, 6, 4 * x, 3 * z, x, 3, z, new Alpha().num(), new class { +console.log(2, 3, 4, 6, 8, 12, 2, 3, 4, new Alpha().num(), new class { num() { return 3; }