feat(es/minifier): Ignore return values of ignored IIFEs (#6020)

**Description:**

As we are not using the return value of the function, we can call `ignore_return_value` on the argument of the return statements of IIFE.
This commit is contained in:
Donny/강동윤 2022-10-02 20:01:56 +09:00 committed by GitHub
parent 5000d05af1
commit 2b627524ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 292 additions and 250 deletions

View File

@ -1,6 +1,4 @@
//// [stringLiteralTypesAndTuples01.ts]
!function(dino) {
if ("t-rex" === dino) return "ROAAAAR!";
if ("raptor" === dino) return "yip yip!";
throw "Unexpected " + dino;
if ("t-rex" !== dino && "raptor" !== dino) throw "Unexpected " + dino;
}("t-rex");

View File

@ -3,8 +3,6 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
var co2, cnd1, or1, or2, or3, and1, and3, propAcc1, M2, varInit = varInit;
!function fnReturn1() {
return fnReturn1();
}(), function fnReturn2() {
return fnReturn2;
}();
var co2 = co2, cnd1 = cnd1 ? 0 : 1, or1 = or1 || "", or2 = or2, or3 = or3 || or3, and1 = and1 && "", and3 = and3 && and3;
!function fnCall() {

View File

@ -1867,18 +1867,11 @@ impl VisitMut for Prefixer {
}
"flex-flow" => {
let is_single_flex_wrap = match n.value.get(0) {
Some(ComponentValue::Ident(Ident { value, .. }))
if n.value.len() == 1
&& matches!(
&*value.to_lowercase(),
"wrap" | "nowrap" | "wrap-reverse"
) =>
{
true
}
_ => false,
};
let is_single_flex_wrap = matches!(n.value.get(0), Some(ComponentValue::Ident(Ident { value, .. })) if n.value.len() == 1
&& matches!(
&*value.to_lowercase(),
"wrap" | "nowrap" | "wrap-reverse"
));
let old_values = match is_single_flex_wrap {
true => None,
@ -1943,14 +1936,7 @@ impl VisitMut for Prefixer {
}
"justify-content" => {
let need_old_spec = match n.value.get(0) {
Some(ComponentValue::Ident(Ident { value, .. }))
if value.as_ref().eq_ignore_ascii_case("space-around") =>
{
false
}
_ => true,
};
let need_old_spec = !matches!(n.value.get(0), Some(ComponentValue::Ident(Ident { value, .. })) if value.as_ref().eq_ignore_ascii_case("space-around"));
if need_old_spec {
add_declaration!(

View File

@ -647,6 +647,50 @@ impl Pure<'_> {
}))
}
/// Calls [`Self::ignore_return_value`] on the arguments of return
/// statemetns.
///
/// This function is recursive but does not go into nested scopes.
pub(super) fn ignore_return_value_of_return_stmt(&mut self, s: &mut Stmt, opts: DropOpts) {
match s {
Stmt::Return(s) => {
if let Some(arg) = &mut s.arg {
self.ignore_return_value(arg, opts);
if arg.is_invalid() {
report_change!(
"Dropped the argument of a return statement because the return value \
is ignored"
);
s.arg = None;
}
}
}
Stmt::Block(s) => {
for stmt in &mut s.stmts {
self.ignore_return_value_of_return_stmt(stmt, opts);
}
}
Stmt::If(s) => {
self.ignore_return_value_of_return_stmt(&mut s.cons, opts);
if let Some(alt) = &mut s.alt {
self.ignore_return_value_of_return_stmt(alt, opts);
}
}
Stmt::Switch(s) => {
for case in &mut s.cases {
for stmt in &mut case.cons {
self.ignore_return_value_of_return_stmt(stmt, opts);
}
}
}
_ => {}
}
}
pub(super) fn ignore_return_value(&mut self, e: &mut Expr, opts: DropOpts) {
self.optimize_expr_in_bool_ctx(e, true);
@ -1002,6 +1046,40 @@ impl Pure<'_> {
_ => {}
}
if self.options.side_effects {
if let Expr::Call(CallExpr {
callee: Callee::Expr(callee),
..
}) = e
{
match &mut **callee {
Expr::Fn(callee) => {
if let Some(body) = &mut callee.function.body {
for stmt in &mut body.stmts {
self.ignore_return_value_of_return_stmt(stmt, opts);
}
}
}
Expr::Arrow(callee) => match &mut callee.body {
BlockStmtOrExpr::BlockStmt(body) => {
for stmt in &mut body.stmts {
self.ignore_return_value_of_return_stmt(stmt, opts);
}
}
BlockStmtOrExpr::Expr(body) => {
self.ignore_return_value(body, opts);
if body.is_invalid() {
*body = 0.into();
return;
}
}
},
_ => {}
}
}
}
if self.options.side_effects && self.options.pristine_globals {
match e {
Expr::New(NewExpr { callee, args, .. })

View File

@ -13321,7 +13321,6 @@
var textGuideLineConfig = el.textGuideLineConfig;
labelLine.z = z, labelLine.zlevel = zlevel, isFinite(maxZ2) && (labelLine.z2 = maxZ2 + (textGuideLineConfig && textGuideLineConfig.showAbove ? 1 : -1));
}
return maxZ2;
}(view.group, model.get('z') || 0, model.get('zlevel') || 0, -1 / 0);
}
function clearStates(model, view) {

View File

@ -1554,14 +1554,15 @@
];
if (data && function(data, source) {
var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < 131, isCombo = 128 == srcBitmask && 8 == bitmask || 128 == srcBitmask && 256 == bitmask && data[7].length <= source[8] || 384 == srcBitmask && source[7].length <= source[8] && 8 == bitmask;
if (!(isCommon || isCombo)) return data;
1 & srcBitmask && (data[2] = source[2], newBitmask |= 1 & bitmask ? 0 : 4);
var value = source[3];
if (value) {
var partials = data[3];
data[3] = partials ? composeArgs(partials, value, source[4]) : value, data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
if (isCommon || isCombo) {
1 & srcBitmask && (data[2] = source[2], newBitmask |= 1 & bitmask ? 0 : 4);
var value = source[3];
if (value) {
var partials = data[3];
data[3] = partials ? composeArgs(partials, value, source[4]) : value, data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
}
(value = source[5]) && (partials = data[5], data[5] = partials ? composeArgsRight(partials, value, source[6]) : value, data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]), (value = source[7]) && (data[7] = value), 128 & srcBitmask && (data[8] = null == data[8] ? source[8] : nativeMin(data[8], source[8])), null == data[9] && (data[9] = source[9]), data[0] = source[0], data[1] = newBitmask;
}
(value = source[5]) && (partials = data[5], data[5] = partials ? composeArgsRight(partials, value, source[6]) : value, data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]), (value = source[7]) && (data[7] = value), 128 & srcBitmask && (data[8] = null == data[8] ? source[8] : nativeMin(data[8], source[8])), null == data[9] && (data[9] = source[9]), data[0] = source[0], data[1] = newBitmask;
}(newData, data), func = newData[0], bitmask = newData[1], thisArg = newData[2], partials = newData[3], holders = newData[4], (arity = newData[9] = undefined === newData[9] ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0)) || !(24 & bitmask) || (bitmask &= -25), bitmask && 1 != bitmask) 8 == bitmask || 16 == bitmask ? (func1 = func, bitmask1 = bitmask, arity1 = arity, Ctor = createCtor(func1), result = function wrapper() {
for(var length = arguments.length, args = Array1(length), index = length, placeholder = getHolder(wrapper); index--;)args[index] = arguments[index];
var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);

View File

@ -291,7 +291,7 @@
return c;
});
} else null != mappedChild && (isValidElement(mappedChild) && (oldElement = mappedChild, newKey = escapedPrefix + (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey, mappedChild = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props)), array.push(mappedChild));
return 1;
return;
}
var subtreeCount = 0, nextNamePrefix = '' === nameSoFar ? '.' : nameSoFar + ':';
if (Array.isArray(children)) for(var i = 0; i < children.length; i++)nextName = nextNamePrefix + getElementKey(child = children[i], i), subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
@ -306,7 +306,6 @@
throw Error("Objects are not valid as a React child (found: " + ('[object Object]' === childrenString ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead.");
}
}
return subtreeCount;
}(children, result, '', '', function(child) {
return func.call(context, child, count++);
}), result;

View File

@ -6917,8 +6917,7 @@
}
statements.length = j + 1;
}(statements), compressor.option("collapse_vars") && function(statements, compressor) {
if (scope.pinned()) return statements;
for(var args, candidates = [], stat_index = statements.length, scanner = new TreeTransformer(function(node) {
if (!scope.pinned()) for(var args, candidates = [], stat_index = statements.length, scanner = new TreeTransformer(function(node) {
if (abort) return node;
if (!hit) return node !== hit_stack[hit_index] ? node : ++hit_index < hit_stack.length ? handle_custom_scan_order(node) : (hit = !0, (stop_after = function find_stop(node, level, write_only) {
var parent = scanner.parent(level);

View File

@ -16544,14 +16544,13 @@
ref: a1.ref,
props: a1.props,
_owner: a1._owner
}), b.push(d)), 1;
}), b.push(d));
if (h = 0, e = "" === e ? "." : e + ":", Array.isArray(a)) for(var g = 0; g < a.length; g++){
var f = e + N(k = a[g], g);
h += O(k, b, c, f, d);
}
else if ("function" == typeof (f = null === (a2 = a) || "object" != typeof a2 ? null : "function" == typeof (a2 = x && a2[x] || a2["@@iterator"]) ? a2 : null)) for(a = f.call(a), g = 0; !(k = a.next()).done;)f = e + N(k = k.value, g++), h += O(k, b, c, f, d);
else if ("object" === k) throw Error(z(31, "[object Object]" == (b = "" + a) ? "object with keys {" + Object.keys(a).join(", ") + "}" : b));
return h;
}(a, e, "", "", function(a) {
return b.call(c, a, d++);
}), e;

View File

@ -1,39 +1,22 @@
import _JSXStyle from "styled-jsx/style";
(({ right =!1 , top =!1 , sidebar , sidebarWidth =230 , hideOnMobile =!1 , breakpoint =730 , children , })=>React.createElement("main", {
className: _JSXStyle.dynamic([
(({ right =!1 , top =!1 , sidebar , sidebarWidth =230 , hideOnMobile =!1 , breakpoint =730 , children , })=>(_JSXStyle.dynamic([
[
"4507deac72c40d6c",
[
"4507deac72c40d6c",
[
right ? "row-reverse" : "row",
sidebarWidth,
breakpoint,
top ? "column" : "column-reverse"
]
right ? "row-reverse" : "row",
sidebarWidth,
breakpoint,
top ? "column" : "column-reverse"
]
])
}, React.createElement(Sidebar, {
width: sidebarWidth,
right: right,
hide: hideOnMobile,
breakpoint: breakpoint
}, sidebar), React.createElement("div", {
className: _JSXStyle.dynamic([
[
"4507deac72c40d6c",
[
right ? "row-reverse" : "row",
sidebarWidth,
breakpoint,
top ? "column" : "column-reverse"
]
]
])
}, children), React.createElement(_JSXStyle, {
id: "4507deac72c40d6c",
dynamic: [
right ? "row-reverse" : "row",
sidebarWidth,
breakpoint,
top ? "column" : "column-reverse"
]
}, `main.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-flex-direction:${right ? "row-reverse" : "row"};-ms-flex-direction:${right ? "row-reverse" : "row"};flex-direction:${right ? "row-reverse" : "row"};-webkit-box-pack:justify;-webkit-justify-content:space-between;-moz-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;margin-bottom:var(--geist-gap-double)}div.__jsx-style-dynamic-selector{width:100%;max-width:-webkit-calc(100% - ${sidebarWidth}px - var(--geist-gap-double));max-width:-moz-calc(100% - ${sidebarWidth}px - var(--geist-gap-double));max-width:calc(100% - ${sidebarWidth}px - var(--geist-gap-double))}@media(max-width:${breakpoint}px){main.__jsx-style-dynamic-selector{-webkit-flex-direction:${top ? "column" : "column-reverse"};-ms-flex-direction:${top ? "column" : "column-reverse"};flex-direction:${top ? "column" : "column-reverse"}}div.__jsx-style-dynamic-selector{max-width:unset}}`)))({});
]), _JSXStyle.dynamic([
[
"4507deac72c40d6c",
[
right ? "row-reverse" : "row",
sidebarWidth,
breakpoint,
top ? "column" : "column-reverse"
]
]
]), top ? "column" : "column-reverse"))({});

View File

@ -4740,155 +4740,156 @@
if (0 != (6 & W)) throw Error(p(327));
c = a.finishedWork;
var e = a.finishedLanes;
if (null === c) return null;
if (a.finishedWork = null, a.finishedLanes = 0, c === a.current) throw Error(p(177));
a.callbackNode = null, a.callbackPriority = 0;
var f = c.lanes | c.childLanes;
if (function(a, b) {
var c = a.pendingLanes & ~b;
a.pendingLanes = b, a.suspendedLanes = 0, a.pingedLanes = 0, a.expiredLanes &= b, a.mutableReadLanes &= b, a.entangledLanes &= b, b = a.entanglements;
var d = a.eventTimes;
for(a = a.expirationTimes; 0 < c;){
var e = 31 - nc(c), f = 1 << e;
b[e] = 0, d[e] = -1, a[e] = -1, c &= ~f;
}
}(a, f), a === P && (X = P = null, Y = 0), 0 == (2064 & c.subtreeFlags) && 0 == (2064 & c.flags) || tk || (tk = !0, a1 = gc, b1 = function() {
return Gk(), null;
}, $b(a1, b1)), f = 0 != (15990 & c.flags), 0 != (15990 & c.subtreeFlags) || f) {
f = mk.transition, mk.transition = null;
var a1, b1, a2, b2, g = C;
C = 1;
var h = W;
W |= 4, lk.current = null, function(a, b) {
if (Bf = cd, a = Le(), Me(a)) {
if ("selectionStart" in a) var c = {
start: a.selectionStart,
end: a.selectionEnd
};
else a: {
var d = (c = (c = a.ownerDocument) && c.defaultView || window).getSelection && c.getSelection();
if (d && 0 !== d.rangeCount) {
c = d.anchorNode;
var y, e = d.anchorOffset, f = d.focusNode;
d = d.focusOffset;
try {
c.nodeType, f.nodeType;
} catch (Z) {
c = null;
break a;
if (null !== c) {
if (a.finishedWork = null, a.finishedLanes = 0, c === a.current) throw Error(p(177));
a.callbackNode = null, a.callbackPriority = 0;
var f = c.lanes | c.childLanes;
if (function(a, b) {
var c = a.pendingLanes & ~b;
a.pendingLanes = b, a.suspendedLanes = 0, a.pingedLanes = 0, a.expiredLanes &= b, a.mutableReadLanes &= b, a.entangledLanes &= b, b = a.entanglements;
var d = a.eventTimes;
for(a = a.expirationTimes; 0 < c;){
var e = 31 - nc(c), f = 1 << e;
b[e] = 0, d[e] = -1, a[e] = -1, c &= ~f;
}
}(a, f), a === P && (X = P = null, Y = 0), 0 == (2064 & c.subtreeFlags) && 0 == (2064 & c.flags) || tk || (tk = !0, a1 = gc, b1 = function() {
return Gk(), null;
}, $b(a1, b1)), f = 0 != (15990 & c.flags), 0 != (15990 & c.subtreeFlags) || f) {
f = mk.transition, mk.transition = null;
var a1, b1, a2, b2, g = C;
C = 1;
var h = W;
W |= 4, lk.current = null, function(a, b) {
if (Bf = cd, a = Le(), Me(a)) {
if ("selectionStart" in a) var c = {
start: a.selectionStart,
end: a.selectionEnd
};
else a: {
var d = (c = (c = a.ownerDocument) && c.defaultView || window).getSelection && c.getSelection();
if (d && 0 !== d.rangeCount) {
c = d.anchorNode;
var y, e = d.anchorOffset, f = d.focusNode;
d = d.focusOffset;
try {
c.nodeType, f.nodeType;
} catch (Z) {
c = null;
break a;
}
var g = 0, h = -1, k = -1, l = 0, n = 0, u = a, q = null;
b: for(;;){
for(; u !== c || 0 !== e && 3 !== u.nodeType || (h = g + e), u !== f || 0 !== d && 3 !== u.nodeType || (k = g + d), 3 === u.nodeType && (g += u.nodeValue.length), null !== (y = u.firstChild);)q = u, u = y;
for(;;){
if (u === a) break b;
if (q === c && ++l === e && (h = g), q === f && ++n === d && (k = g), null !== (y = u.nextSibling)) break;
q = (u = q).parentNode;
}
u = y;
}
c = -1 === h || -1 === k ? null : {
start: h,
end: k
};
} else c = null;
}
c = c || {
start: 0,
end: 0
};
} else c = null;
for(Cf = {
focusedElem: a,
selectionRange: c
}, cd = !1, T = b; null !== T;)if (a = (b = T).child, 0 != (1028 & b.subtreeFlags) && null !== a) a.return = b, T = a;
else for(; null !== T;){
b = T;
try {
var m = b.alternate;
if (0 != (1024 & b.flags)) switch(b.tag){
case 0:
case 11:
case 15:
case 5:
case 6:
case 4:
case 17:
break;
case 1:
if (null !== m) {
var w = m.memoizedProps, J = m.memoizedState, v = b.stateNode, x = v.getSnapshotBeforeUpdate(b.elementType === b.type ? w : kg(b.type, w), J);
v.__reactInternalSnapshotBeforeUpdate = x;
}
break;
case 3:
var r = b.stateNode.containerInfo;
if (1 === r.nodeType) r.textContent = "";
else if (9 === r.nodeType) {
var F = r.body;
null != F && (F.textContent = "");
}
break;
default:
throw Error(p(163));
}
var g = 0, h = -1, k = -1, l = 0, n = 0, u = a, q = null;
b: for(;;){
for(; u !== c || 0 !== e && 3 !== u.nodeType || (h = g + e), u !== f || 0 !== d && 3 !== u.nodeType || (k = g + d), 3 === u.nodeType && (g += u.nodeValue.length), null !== (y = u.firstChild);)q = u, u = y;
for(;;){
if (u === a) break b;
if (q === c && ++l === e && (h = g), q === f && ++n === d && (k = g), null !== (y = u.nextSibling)) break;
q = (u = q).parentNode;
}
u = y;
} catch (Z1) {
U(b, b.return, Z1);
}
if (null !== (a = b.sibling)) {
a.return = b.return, T = a;
break;
}
T = b.return;
}
m = Lj, Lj = !1;
}(a, c), bk(c, a), function(a) {
var b = Le(), c = a.focusedElem, d = a.selectionRange;
if (b !== c && c && c.ownerDocument && function Ke(a, b) {
return !!a && !!b && (a === b || (!a || 3 !== a.nodeType) && (b && 3 === b.nodeType ? Ke(a, b.parentNode) : "contains" in a ? a.contains(b) : !!a.compareDocumentPosition && !!(16 & a.compareDocumentPosition(b))));
}(c.ownerDocument.documentElement, c)) {
if (null !== d && Me(c)) {
if (b = d.start, void 0 === (a = d.end) && (a = b), "selectionStart" in c) c.selectionStart = b, c.selectionEnd = Math.min(a, c.value.length);
else if ((a = (b = c.ownerDocument || document) && b.defaultView || window).getSelection) {
a = a.getSelection();
var e = c.textContent.length, f = Math.min(d.start, e);
d = void 0 === d.end ? f : Math.min(d.end, e), !a.extend && f > d && (e = d, d = f, f = e), e = Je(c, f);
var g = Je(c, d);
e && g && (1 !== a.rangeCount || a.anchorNode !== e.node || a.anchorOffset !== e.offset || a.focusNode !== g.node || a.focusOffset !== g.offset) && ((b = b.createRange()).setStart(e.node, e.offset), a.removeAllRanges(), f > d ? (a.addRange(b), a.extend(g.node, g.offset)) : (b.setEnd(g.node, g.offset), a.addRange(b)));
}
c = -1 === h || -1 === k ? null : {
start: h,
end: k
};
} else c = null;
}
c = c || {
start: 0,
end: 0
};
} else c = null;
for(Cf = {
focusedElem: a,
selectionRange: c
}, cd = !1, T = b; null !== T;)if (a = (b = T).child, 0 != (1028 & b.subtreeFlags) && null !== a) a.return = b, T = a;
else for(; null !== T;){
b = T;
try {
var m = b.alternate;
if (0 != (1024 & b.flags)) switch(b.tag){
case 0:
case 11:
case 15:
case 5:
case 6:
case 4:
case 17:
break;
case 1:
if (null !== m) {
var w = m.memoizedProps, J = m.memoizedState, v = b.stateNode, x = v.getSnapshotBeforeUpdate(b.elementType === b.type ? w : kg(b.type, w), J);
v.__reactInternalSnapshotBeforeUpdate = x;
}
break;
case 3:
var r = b.stateNode.containerInfo;
if (1 === r.nodeType) r.textContent = "";
else if (9 === r.nodeType) {
var F = r.body;
null != F && (F.textContent = "");
}
break;
default:
throw Error(p(163));
}
} catch (Z1) {
U(b, b.return, Z1);
for(b = [], a = c; a = a.parentNode;)1 === a.nodeType && b.push({
element: a,
left: a.scrollLeft,
top: a.scrollTop
});
for("function" == typeof c.focus && c.focus(), c = 0; c < b.length; c++)(a = b[c]).element.scrollLeft = a.left, a.element.scrollTop = a.top;
}
if (null !== (a = b.sibling)) {
a.return = b.return, T = a;
break;
}(Cf), cd = !!Bf, Cf = Bf = null, a.current = c, a2 = c, b2 = a, T = a2, function gk(a, b, c) {
for(var d = 0 != (1 & a.mode); null !== T;){
var e = T, f = e.child;
if (22 === e.tag && d) {
var g = null !== e.memoizedState || Hj;
if (!g) {
var h = e.alternate, k = null !== h && null !== h.memoizedState || S;
h = Hj;
var l = S;
if (Hj = g, (S = k) && !l) for(T = e; null !== T;)k = (g = T).child, 22 === g.tag && null !== g.memoizedState ? hk(e) : null !== k ? (k.return = g, T = k) : hk(e);
for(; null !== f;)T = f, gk(f, b, c), f = f.sibling;
T = e, Hj = h, S = l;
}
ik(a, b, c);
} else 0 != (8772 & e.subtreeFlags) && null !== f ? (f.return = e, T = f) : ik(a, b, c);
}
T = b.return;
}
m = Lj, Lj = !1;
}(a, c), bk(c, a), function(a) {
var b = Le(), c = a.focusedElem, d = a.selectionRange;
if (b !== c && c && c.ownerDocument && function Ke(a, b) {
return !!a && !!b && (a === b || (!a || 3 !== a.nodeType) && (b && 3 === b.nodeType ? Ke(a, b.parentNode) : "contains" in a ? a.contains(b) : !!a.compareDocumentPosition && !!(16 & a.compareDocumentPosition(b))));
}(c.ownerDocument.documentElement, c)) {
if (null !== d && Me(c)) {
if (b = d.start, void 0 === (a = d.end) && (a = b), "selectionStart" in c) c.selectionStart = b, c.selectionEnd = Math.min(a, c.value.length);
else if ((a = (b = c.ownerDocument || document) && b.defaultView || window).getSelection) {
a = a.getSelection();
var e = c.textContent.length, f = Math.min(d.start, e);
d = void 0 === d.end ? f : Math.min(d.end, e), !a.extend && f > d && (e = d, d = f, f = e), e = Je(c, f);
var g = Je(c, d);
e && g && (1 !== a.rangeCount || a.anchorNode !== e.node || a.anchorOffset !== e.offset || a.focusNode !== g.node || a.focusOffset !== g.offset) && ((b = b.createRange()).setStart(e.node, e.offset), a.removeAllRanges(), f > d ? (a.addRange(b), a.extend(g.node, g.offset)) : (b.setEnd(g.node, g.offset), a.addRange(b)));
}
}
for(b = [], a = c; a = a.parentNode;)1 === a.nodeType && b.push({
element: a,
left: a.scrollLeft,
top: a.scrollTop
});
for("function" == typeof c.focus && c.focus(), c = 0; c < b.length; c++)(a = b[c]).element.scrollLeft = a.left, a.element.scrollTop = a.top;
}
}(Cf), cd = !!Bf, Cf = Bf = null, a.current = c, a2 = c, b2 = a, T = a2, function gk(a, b, c) {
for(var d = 0 != (1 & a.mode); null !== T;){
var e = T, f = e.child;
if (22 === e.tag && d) {
var g = null !== e.memoizedState || Hj;
if (!g) {
var h = e.alternate, k = null !== h && null !== h.memoizedState || S;
h = Hj;
var l = S;
if (Hj = g, (S = k) && !l) for(T = e; null !== T;)k = (g = T).child, 22 === g.tag && null !== g.memoizedState ? hk(e) : null !== k ? (k.return = g, T = k) : hk(e);
for(; null !== f;)T = f, gk(f, b, c), f = f.sibling;
T = e, Hj = h, S = l;
}
ik(a, b, c);
} else 0 != (8772 & e.subtreeFlags) && null !== f ? (f.return = e, T = f) : ik(a, b, c);
}
}(a2, b2, e), cc(), W = h, C = g, mk.transition = f;
} else a.current = c;
if (tk && (tk = !1, uk = a, vk = e), 0 === (f = a.pendingLanes) && (Oi = null), function(a) {
if (kc && "function" == typeof kc.onCommitFiberRoot) try {
kc.onCommitFiberRoot(jc, a, void 0, 128 == (128 & a.current.flags));
} catch (b) {}
}(c.stateNode, d), Ck(a, B()), null !== b) for(d = a.onRecoverableError, c = 0; c < b.length; c++)d(b[c]);
if (Li) throw Li = !1, a = Mi, Mi = null, a;
0 != (1 & vk) && 0 !== a.tag && Gk(), 0 != (1 & (f = a.pendingLanes)) ? a === xk ? wk++ : (wk = 0, xk = a) : wk = 0, ig();
}(a2, b2, e), cc(), W = h, C = g, mk.transition = f;
} else a.current = c;
if (tk && (tk = !1, uk = a, vk = e), 0 === (f = a.pendingLanes) && (Oi = null), function(a) {
if (kc && "function" == typeof kc.onCommitFiberRoot) try {
kc.onCommitFiberRoot(jc, a, void 0, 128 == (128 & a.current.flags));
} catch (b) {}
}(c.stateNode, d), Ck(a, B()), null !== b) for(d = a.onRecoverableError, c = 0; c < b.length; c++)d(b[c]);
if (Li) throw Li = !1, a = Mi, Mi = null, a;
0 != (1 & vk) && 0 !== a.tag && Gk(), 0 != (1 & (f = a.pendingLanes)) ? a === xk ? wk++ : (wk = 0, xk = a) : wk = 0, ig();
}
}(a, b, c, d);
} finally{
mk.transition = e, C = d;
@ -5955,14 +5956,13 @@
ref: a1.ref,
props: a1.props,
_owner: a1._owner
}), b.push(c)), 1;
}), b.push(c));
if (h = 0, d = "" === d ? "." : d + ":", I(a)) for(var g = 0; g < a.length; g++){
var f = d + Q(k = a[g], g);
h += R(k, b, e, f, c);
}
else if ("function" == typeof (f = null === (a2 = a) || "object" != typeof a2 ? null : "function" == typeof (a2 = z && a2[z] || a2["@@iterator"]) ? a2 : null)) for(a = f.call(a), g = 0; !(k = a.next()).done;)f = d + Q(k = k.value, g++), h += R(k, b, e, f, c);
else if ("object" === k) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
return h;
}(a, d, "", "", function(a) {
return b.call(e, a, c++);
}), d;

View File

@ -202,12 +202,13 @@
var result = copied && 'object' == typeof copied ? copied : {}, length = arguments.length;
deep && (length -= 1);
for(var arguments_1 = arguments, i = 1; i < length; i++)!function(i) {
if (!arguments_1[i]) return "continue";
var obj1 = arguments_1[i];
Object.keys(obj1).forEach(function(key) {
var clone, src = result[key], copy = obj1[key];
Array.isArray(copy) && Array.isArray(src) && (copy.length, src.length), deep && (util_isObject(copy) || Array.isArray(copy)) ? util_isObject(copy) ? Array.isArray(clone = src || {}) && clone.hasOwnProperty('isComplexArray') ? util_extend(clone, {}, copy, deep) : result[key] = util_extend(clone, {}, copy, deep) : (clone = src || [], result[key] = util_extend([], clone, copy, clone && clone.length || copy && copy.length)) : result[key] = copy;
});
if (arguments_1[i]) {
var obj1 = arguments_1[i];
Object.keys(obj1).forEach(function(key) {
var clone, src = result[key], copy = obj1[key];
Array.isArray(copy) && Array.isArray(src) && (copy.length, src.length), deep && (util_isObject(copy) || Array.isArray(copy)) ? util_isObject(copy) ? Array.isArray(clone = src || {}) && clone.hasOwnProperty('isComplexArray') ? util_extend(clone, {}, copy, deep) : result[key] = util_extend(clone, {}, copy, deep) : (clone = src || [], result[key] = util_extend([], clone, copy, clone && clone.length || copy && copy.length)) : result[key] = copy;
});
}
}(i);
return result;
}

View File

@ -461,7 +461,7 @@
resolvePromise();
}
!function() {
if (!styleSheets) return !1;
if (!styleSheets) return;
const currentStyleTags = looseToArray(document.querySelectorAll("style[data-n-href]")), currentHrefs = new Set(currentStyleTags.map((tag)=>tag.getAttribute("data-n-href"))), noscript = document.querySelector("noscript[data-n-css]"), nonce = null == noscript ? void 0 : noscript.getAttribute("data-n-css");
styleSheets.forEach((param)=>{
let { href , text } = param;

View File

@ -291,7 +291,7 @@
return c;
});
} else null != mappedChild && (isValidElement(mappedChild) && (oldElement = mappedChild, newKey = escapedPrefix + (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey("" + mappedChild.key) + "/" : "") + childKey, mappedChild = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props)), array.push(mappedChild));
return 1;
return;
}
var subtreeCount = 0, nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
if (Array.isArray(children)) for(var i = 0; i < children.length; i++)nextName = nextNamePrefix + getElementKey(child = children[i], i), subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
@ -306,7 +306,6 @@
throw Error("Objects are not valid as a React child (found: " + ("[object Object]" === childrenString ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
}
}
return subtreeCount;
}(children, result, "", "", function(child) {
return func.call(context, child, count++);
}), result;

View File

@ -3400,22 +3400,23 @@
var domEventName1, nativeEvent1;
"keydown" === domEventName && 229 === nativeEvent.keyCode && (eventType = "onCompositionStart");
}
if (!eventType) return null;
useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) && (isComposing || "onCompositionStart" !== eventType ? "onCompositionEnd" === eventType && isComposing && (fallbackData = getData()) : (root = nativeEventTarget, startText = getText(), isComposing = !0));
var eventType, fallbackData, listeners = accumulateTwoPhaseListeners(targetInst, eventType);
if (listeners.length > 0) {
var event = new SyntheticCompositionEvent(eventType, domEventName, null, nativeEvent, nativeEventTarget);
if (dispatchQueue.push({
event: event,
listeners: listeners
}), fallbackData) event.data = fallbackData;
else {
var customData = getDataFromCustomEvent(nativeEvent);
null !== customData && (event.data = customData);
if (eventType) {
useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) && (isComposing || "onCompositionStart" !== eventType ? "onCompositionEnd" === eventType && isComposing && (fallbackData = getData()) : (root = nativeEventTarget, startText = getText(), isComposing = !0));
var eventType, fallbackData, listeners = accumulateTwoPhaseListeners(targetInst, eventType);
if (listeners.length > 0) {
var event = new SyntheticCompositionEvent(eventType, domEventName, null, nativeEvent, nativeEventTarget);
if (dispatchQueue.push({
event: event,
listeners: listeners
}), fallbackData) event.data = fallbackData;
else {
var customData = getDataFromCustomEvent(nativeEvent);
null !== customData && (event.data = customData);
}
}
}
}(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget), function(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget) {
if (!(chars = canUseTextInputEvent ? function(domEventName, nativeEvent) {
if (chars = canUseTextInputEvent ? function(domEventName, nativeEvent) {
switch(domEventName){
case "compositionend":
return getDataFromCustomEvent(nativeEvent);
@ -3450,14 +3451,15 @@
case "compositionend":
return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
}
}(domEventName, nativeEvent))) return null;
var chars, listeners = accumulateTwoPhaseListeners(targetInst, "onBeforeInput");
if (listeners.length > 0) {
var event = new SyntheticCompositionEvent("onBeforeInput", "beforeinput", null, nativeEvent, nativeEventTarget);
dispatchQueue.push({
event: event,
listeners: listeners
}), event.data = chars;
}(domEventName, nativeEvent)) {
var chars, listeners = accumulateTwoPhaseListeners(targetInst, "onBeforeInput");
if (listeners.length > 0) {
var event = new SyntheticCompositionEvent("onBeforeInput", "beforeinput", null, nativeEvent, nativeEventTarget);
dispatchQueue.push({
event: event,
listeners: listeners
}), event.data = chars;
}
}
}(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
}