fix(es/minifier): Fix react-ace (#4183)

This commit is contained in:
Donny/강동윤 2022-03-29 19:13:30 +09:00 committed by GitHub
parent 9b63369d1e
commit 9a9a4f37d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 227188 additions and 19 deletions

View File

@ -1,2 +1,4 @@
var M; var M;
M || (M = {}), this.bar; !function(M) {
this.bar;
}(M || (M = {}));

View File

@ -1,3 +1,5 @@
var M; var M;
import * as swcHelpers from "@swc/helpers"; import * as swcHelpers from "@swc/helpers";
M || (M = {}), swcHelpers.defineProperty({}, this.bar, 0); !function(M) {
swcHelpers.defineProperty({}, this.bar, 0);
}(M || (M = {}));

View File

@ -1,2 +1,4 @@
var M; var M;
M || (M = {}), this.bar; !function(M) {
this.bar;
}(M || (M = {}));

View File

@ -1,3 +1,5 @@
var M; var M;
import * as swcHelpers from "@swc/helpers"; import * as swcHelpers from "@swc/helpers";
M || (M = {}), swcHelpers.defineProperty({}, this.bar, 0); !function(M) {
swcHelpers.defineProperty({}, this.bar, 0);
}(M || (M = {}));

View File

@ -4,7 +4,9 @@ use rustc_hash::FxHashMap;
use swc_atoms::js_word; use swc_atoms::js_word;
use swc_common::{pass::Either, util::take::Take, Spanned, DUMMY_SP}; use swc_common::{pass::Either, util::take::Take, Spanned, DUMMY_SP};
use swc_ecma_ast::*; use swc_ecma_ast::*;
use swc_ecma_utils::{contains_arguments, ident::IdentLike, undefined, ExprFactory, Id}; use swc_ecma_utils::{
contains_arguments, contains_this_expr, ident::IdentLike, undefined, ExprFactory, Id,
};
use swc_ecma_visit::VisitMutWith; use swc_ecma_visit::VisitMutWith;
use super::{util::MultiReplacer, Optimizer}; use super::{util::MultiReplacer, Optimizer};
@ -586,7 +588,7 @@ where
return false; return false;
} }
if contains_arguments(body) { if contains_this_expr(body) || contains_arguments(body) {
return false; return false;
} }

View File

@ -3819,7 +3819,9 @@
var check = function(it) { var check = function(it) {
return it && it.Math == Math && it; return it && it.Math == Math && it;
}; };
module.exports = check('object' == typeof globalThis && globalThis) || check('object' == typeof window && window) || check('object' == typeof self && self) || check('object' == typeof __webpack_require__.g && __webpack_require__.g) || this || Function('return this')(); module.exports = check('object' == typeof globalThis && globalThis) || check('object' == typeof window && window) || check('object' == typeof self && self) || check('object' == typeof __webpack_require__.g && __webpack_require__.g) || function() {
return this;
}() || Function('return this')();
}, },
1521: function(module, __unused_webpack_exports, __webpack_require__) { 1521: function(module, __unused_webpack_exports, __webpack_require__) {
var toObject = __webpack_require__(89343), hasOwnProperty = {}.hasOwnProperty; var toObject = __webpack_require__(89343), hasOwnProperty = {}.hasOwnProperty;

View File

@ -1167,7 +1167,9 @@
}, },
function(module, exports) { function(module, exports) {
var g; var g;
g = this; g = function() {
return this;
}();
try { try {
g = g || new Function("return this")(); g = g || new Function("return this")();
} catch (e) { } catch (e) {

View File

@ -1844,22 +1844,26 @@ Elements.prototype = {
return document.id(Slick.find(this, expression)); return document.id(Slick.find(this, expression));
} }
}); });
var set, translations, types, search, find, match, pseudos, addSlickPseudos, contains = { var set, translations, contains = {
contains: function(element) { contains: function(element) {
return Slick.contains(this, element); return Slick.contains(this, element);
} }
}; };
document.contains || Document.implement(contains), document.createElement('div').contains || Element.implement(contains), Element.implement('hasChild', function(element) { document.contains || Document.implement(contains), document.createElement('div').contains || Element.implement(contains), Element.implement('hasChild', function(element) {
return this !== element && this.contains(element); return this !== element && this.contains(element);
}), search = Slick.search, find = Slick.find, match = Slick.match, this.Selectors = {}, pseudos = this.Selectors.Pseudo = new Hash(), addSlickPseudos = function() { }), function(search, find, match) {
for(var name in pseudos)pseudos.hasOwnProperty(name) && (Slick.definePseudo(name, pseudos[name]), delete pseudos[name]); this.Selectors = {};
}, Slick.search = function(context, expression, append) { var pseudos = this.Selectors.Pseudo = new Hash(), addSlickPseudos = function() {
return addSlickPseudos(), search.call(this, context, expression, append); for(var name in pseudos)pseudos.hasOwnProperty(name) && (Slick.definePseudo(name, pseudos[name]), delete pseudos[name]);
}, Slick.find = function(context, expression) { };
return addSlickPseudos(), find.call(this, context, expression); Slick.search = function(context, expression, append) {
}, Slick.match = function(node, selector) { return addSlickPseudos(), search.call(this, context, expression, append);
return addSlickPseudos(), match.call(this, node, selector); }, Slick.find = function(context, expression) {
}; return addSlickPseudos(), find.call(this, context, expression);
}, Slick.match = function(node, selector) {
return addSlickPseudos(), match.call(this, node, selector);
};
}(Slick.search, Slick.find, Slick.match);
var injectCombinator = function(expression, combinator) { var injectCombinator = function(expression, combinator) {
if (!expression) return combinator; if (!expression) return combinator;
for(var expressions = (expression = Object.clone(Slick.parse(expression))).expressions, i = expressions.length; i--;)expressions[i][0].combinator = combinator; for(var expressions = (expression = Object.clone(Slick.parse(expression))).expressions, i = expressions.length; i--;)expressions[i][0].combinator = combinator;
@ -2019,7 +2023,7 @@ Elements.prototype = {
'button' != el1.type && (propertySetters.type = function(node, value) { 'button' != el1.type && (propertySetters.type = function(node, value) {
node.setAttribute('type', value); node.setAttribute('type', value);
}), el1 = null; }), el1 = null;
var div, input = document.createElement('input'); var types, div, input = document.createElement('input');
input.value = 't', input.type = 'submit', 't' != input.value && (propertySetters.type = function(node, type) { input.value = 't', input.type = 'submit', 't' != input.value && (propertySetters.type = function(node, type) {
var value = node.value; var value = node.value;
node.type = type, node.value = value; node.type = type, node.value = value;