mirror of
https://github.com/swc-project/swc.git
synced 2024-10-04 20:28:43 +03:00
feat(es/minifier): Implement correct hoist_props
(#8593)
**Description:**
- The option `hoist_props` now does what it's supposed to do.
- Dropping of unused properties now does not drop properties too aggressively.
- The initializer of a dropped variable declaration is now properly visited.
- Indexing with string literals is not marked as a dynamic index anymore. This is required to handle codes like c3f67ceb1e/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_1/input.js (L1-L7)
.
This commit is contained in:
parent
be55633273
commit
3122e944a8
@ -2,9 +2,5 @@
|
|||||||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
||||||
var c, i, a, f = function(x) {}, f2 = function(x, y) {};
|
var c, i, a, f = function(x) {}, f2 = function(x, y) {};
|
||||||
f(1), f(), f2(1), f2(1, 2), c.foo(), c.foo(1), i(), i(1), i.foo(1), i.foo(1, 2), a(), a(1), a.foo(), a.foo(1);
|
f(1), f(), f2(1), f2(1, 2), c.foo(), c.foo(1), i(), i(1), i.foo(1), i.foo(1, 2), a(), a(1), a.foo(), a.foo(1);
|
||||||
var b = {
|
var b_foo = function(x) {}, b_a = function(x, y) {}, b_b = function(x) {};
|
||||||
foo: function(x) {},
|
b_foo(), b_foo(1), b_a(1), b_a(1, 2), b_b(), b_b(1);
|
||||||
a: function(x, y) {},
|
|
||||||
b: function(x) {}
|
|
||||||
};
|
|
||||||
b.foo(), b.foo(1), b.a(1), b.a(1, 2), b.b(), b.b(1);
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
//// [/a.js]
|
//// [/a.js]
|
||||||
var p = {
|
var p = {
|
||||||
a: 0,
|
a: 0,
|
||||||
b: "hello"
|
b: "hello",
|
||||||
|
x: 8
|
||||||
};
|
};
|
||||||
p.a.toFixed(), p.b.substring(1), p.d;
|
p.a.toFixed(), p.b.substring(1), p.d;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
//// [/a.js]
|
//// [/a.js]
|
||||||
var p = {
|
var p = {
|
||||||
a: 0,
|
a: 0,
|
||||||
b: "hello"
|
b: "hello",
|
||||||
|
x: 8
|
||||||
};
|
};
|
||||||
p.a.toFixed(), p.b.substring(1), p.d;
|
p.a.toFixed(), p.b.substring(1), p.d;
|
||||||
|
@ -1,17 +1,2 @@
|
|||||||
//// [checkJsdocTypeTagOnObjectProperty2.ts]
|
//// [checkJsdocTypeTagOnObjectProperty2.ts]
|
||||||
//// [0.js]
|
//// [0.js]
|
||||||
var lol, obj = {
|
|
||||||
bar: 42,
|
|
||||||
method1: function(n1) {
|
|
||||||
return "42";
|
|
||||||
},
|
|
||||||
method2: function(n1) {
|
|
||||||
return "lol";
|
|
||||||
},
|
|
||||||
arrowFunc: function() {
|
|
||||||
var num = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "0";
|
|
||||||
return num + 42;
|
|
||||||
},
|
|
||||||
lol: lol
|
|
||||||
};
|
|
||||||
lol = "string", obj.method1(0), obj.method2("0");
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
//// [destructuringObjectBindingPatternAndAssignment8.ts]
|
//// [destructuringObjectBindingPatternAndAssignment8.ts]
|
||||||
const K = {
|
const { a: aVal, b: bVal } = {
|
||||||
a: "a",
|
a: 1,
|
||||||
b: "b"
|
b: 1
|
||||||
}, { [K.a]: aVal, [K.b]: bVal } = {
|
|
||||||
[K.a]: 1,
|
|
||||||
[K.b]: 1
|
|
||||||
};
|
};
|
||||||
console.log(aVal, bVal);
|
console.log(aVal, bVal);
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
//// [destructuringObjectBindingPatternAndAssignment8.ts]
|
//// [destructuringObjectBindingPatternAndAssignment8.ts]
|
||||||
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
||||||
var _obj, K = {
|
var _obj, _ref = (_define_property(_obj = {}, "a", 1), _define_property(_obj, "b", 1), _obj);
|
||||||
a: "a",
|
console.log(_ref.a, _ref.b);
|
||||||
b: "b"
|
|
||||||
}, _ref = (_define_property(_obj = {}, K.a, 1), _define_property(_obj, K.b, 1), _obj);
|
|
||||||
console.log(_ref[K.a], _ref[K.b]);
|
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
//// [destructuringVariableDeclaration1ES5.ts]
|
//// [destructuringVariableDeclaration1ES5.ts]
|
||||||
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
||||||
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
||||||
var _ref = {
|
|
||||||
a1: 10,
|
|
||||||
a2: "world"
|
|
||||||
};
|
|
||||||
_ref.a1, _ref.a2;
|
|
||||||
var tmp = {
|
var tmp = {
|
||||||
b11: "world"
|
b11: "world"
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
//// [destructuringVariableDeclaration1ES5iterable.ts]
|
//// [destructuringVariableDeclaration1ES5iterable.ts]
|
||||||
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
||||||
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
||||||
var _ref = {
|
|
||||||
a1: 10,
|
|
||||||
a2: "world"
|
|
||||||
};
|
|
||||||
_ref.a1, _ref.a2;
|
|
||||||
var tmp = {
|
var tmp = {
|
||||||
b11: "world"
|
b11: "world"
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
//// [destructuringVariableDeclaration2.ts]
|
//// [destructuringVariableDeclaration2.ts]
|
||||||
var _ref = {
|
|
||||||
a1: !0,
|
|
||||||
a2: 1
|
|
||||||
};
|
|
||||||
_ref.a1, _ref.a2;
|
|
||||||
var _ref1 = [
|
var _ref1 = [
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
//// [logicalNotOperatorWithAnyOtherType.ts]
|
//// [logicalNotOperatorWithAnyOtherType.ts]
|
||||||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
||||||
var M, obj1 = {
|
var M, A = function() {
|
||||||
x: "",
|
|
||||||
y: function() {}
|
|
||||||
}, A = function() {
|
|
||||||
function A() {
|
function A() {
|
||||||
_class_call_check(this, A);
|
_class_call_check(this, A);
|
||||||
}
|
}
|
||||||
@ -11,4 +8,4 @@ var M, obj1 = {
|
|||||||
}();
|
}();
|
||||||
M || (M = {});
|
M || (M = {});
|
||||||
var objA = new A();
|
var objA = new A();
|
||||||
obj1.x, obj1.y, objA.a, M.n, A.foo(), objA.a, M.n;
|
objA.a, M.n, A.foo(), objA.a, M.n;
|
||||||
|
@ -33,14 +33,11 @@ var b2 = _object_spread_props(_object_spread({}, b1), {
|
|||||||
z: 55
|
z: 55
|
||||||
});
|
});
|
||||||
_object_spread({}, b2), opts;
|
_object_spread({}, b2), opts;
|
||||||
var d1 = {
|
var d1_pos = {
|
||||||
kind: "a",
|
x: 0,
|
||||||
pos: {
|
y: 0
|
||||||
x: 0,
|
|
||||||
y: 0
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
d1.kind, d1.pos, d1.pos.x, d1.pos.y, d1.pos.a, d1.pos.b, f({
|
d1_pos.x, d1_pos.y, d1_pos.a, d1_pos.b, f({
|
||||||
a: 1,
|
a: 1,
|
||||||
b: 2
|
b: 2
|
||||||
}, {
|
}, {
|
||||||
|
@ -1,6 +1,2 @@
|
|||||||
//// [parserNotHexLiteral1.ts]
|
//// [parserNotHexLiteral1.ts]
|
||||||
var x = {
|
console.info("dog"), console.info("cat");
|
||||||
e0: "cat",
|
|
||||||
x0: "dog"
|
|
||||||
};
|
|
||||||
console.info(x.x0), console.info(x.e0);
|
|
||||||
|
@ -6,7 +6,9 @@ import { _ as _inherits } from "@swc/helpers/_/_inherits";
|
|||||||
import { _ as _create_super } from "@swc/helpers/_/_create_super";
|
import { _ as _create_super } from "@swc/helpers/_/_create_super";
|
||||||
export var inModule = 1;
|
export var inModule = 1;
|
||||||
inmodule.toFixed();
|
inmodule.toFixed();
|
||||||
var object = {};
|
var object = {
|
||||||
|
spaaace: 3
|
||||||
|
};
|
||||||
object.spaaaace, object.spaace = 12, object.fresh = 12, other.puuuce, new Date().getGMTDate(), setIntegral(function() {
|
object.spaaaace, object.spaace = 12, object.fresh = 12, other.puuuce, new Date().getGMTDate(), setIntegral(function() {
|
||||||
return console.log("ok");
|
return console.log("ok");
|
||||||
}, 500), AudioBuffin, Jimmy, Jon;
|
}, 500), AudioBuffin, Jimmy, Jon;
|
||||||
|
@ -1,5 +1 @@
|
|||||||
//// [stringLiteralTypesAsTags01.ts]
|
//// [stringLiteralTypesAsTags01.ts]
|
||||||
var x = {
|
|
||||||
kind: "A"
|
|
||||||
};
|
|
||||||
x.kind, x.kind;
|
|
||||||
|
@ -1,5 +1 @@
|
|||||||
//// [stringLiteralTypesAsTags02.ts]
|
//// [stringLiteralTypesAsTags02.ts]
|
||||||
var x = {
|
|
||||||
kind: "A"
|
|
||||||
};
|
|
||||||
x.kind, x.kind;
|
|
||||||
|
@ -1,5 +1 @@
|
|||||||
//// [stringLiteralTypesAsTags03.ts]
|
//// [stringLiteralTypesAsTags03.ts]
|
||||||
var x = {
|
|
||||||
kind: "A"
|
|
||||||
};
|
|
||||||
x.kind, x.kind;
|
|
||||||
|
@ -28,11 +28,7 @@ var b, crate, RoyalGuard = function() {
|
|||||||
}
|
}
|
||||||
return FollowerGuard.prototype.follow = function() {}, FollowerGuard;
|
return FollowerGuard.prototype.follow = function() {}, FollowerGuard;
|
||||||
}(RoyalGuard), a = new FollowerGuard();
|
}(RoyalGuard), a = new FollowerGuard();
|
||||||
a.isLeader() ? a.lead() : a.isFollower() && a.follow(), b.isLeader() ? b.lead() : b.isFollower() && b.follow();
|
a.isLeader() ? a.lead() : a.isFollower() && a.follow(), b.isLeader() ? b.lead() : b.isFollower() && b.follow(), a.isLeader();
|
||||||
var holder2 = {
|
|
||||||
a: a
|
|
||||||
};
|
|
||||||
holder2.a.isLeader(), holder2.a;
|
|
||||||
var ArrowGuard = function ArrowGuard() {
|
var ArrowGuard = function ArrowGuard() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
_class_call_check(this, ArrowGuard), this.isElite = function() {
|
_class_call_check(this, ArrowGuard), this.isElite = function() {
|
||||||
|
@ -1,8 +1 @@
|
|||||||
//// [typeTagOnPropertyAssignment.js]
|
//// [typeTagOnPropertyAssignment.js]
|
||||||
var o = {
|
|
||||||
a: "a",
|
|
||||||
n: function() {
|
|
||||||
return "b";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
o.a, o.n;
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
//// [typedefTagExtraneousProperty.js]
|
//// [typedefTagExtraneousProperty.js]
|
||||||
var y = {};
|
var y = {
|
||||||
|
bye: "no"
|
||||||
|
};
|
||||||
y.ignoreMe = "ok but just because of the index signature", y.hi = "yes";
|
y.ignoreMe = "ok but just because of the index signature", y.hi = "yes";
|
||||||
|
@ -1,7 +1 @@
|
|||||||
//// [a.js]
|
//// [a.js]
|
||||||
var sala = {
|
|
||||||
name: "uppsala",
|
|
||||||
not: 0,
|
|
||||||
nested: "ok"
|
|
||||||
};
|
|
||||||
sala.name, sala.not, sala.nested;
|
|
||||||
|
@ -7,8 +7,3 @@ var C = function() {
|
|||||||
return C.prototype.m = function(x) {}, C.m = function(x) {}, C;
|
return C.prototype.m = function(x) {}, C.m = function(x) {}, C;
|
||||||
}();
|
}();
|
||||||
C.m(), new C().m(), new C().p();
|
C.m(), new C().m(), new C().p();
|
||||||
var obj = {
|
|
||||||
m: function(x) {},
|
|
||||||
p: function(x) {}
|
|
||||||
};
|
|
||||||
obj.m(), obj.p();
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
//// [voidOperatorWithAnyOtherType.ts]
|
//// [voidOperatorWithAnyOtherType.ts]
|
||||||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
||||||
var M, obj1 = {
|
var M, A = function() {
|
||||||
x: "",
|
|
||||||
y: 1
|
|
||||||
}, A = function() {
|
|
||||||
function A() {
|
function A() {
|
||||||
_class_call_check(this, A);
|
_class_call_check(this, A);
|
||||||
}
|
}
|
||||||
@ -11,4 +8,4 @@ var M, obj1 = {
|
|||||||
}();
|
}();
|
||||||
M || (M = {});
|
M || (M = {});
|
||||||
var objA = new A();
|
var objA = new A();
|
||||||
obj1.x, obj1.y, objA.a, M.n, A.foo(), objA.a, M.n;
|
objA.a, M.n, A.foo(), objA.a, M.n;
|
||||||
|
@ -75,6 +75,8 @@ impl Optimizer<'_> {
|
|||||||
|
|
||||||
// No use => dropped
|
// No use => dropped
|
||||||
if ref_count == 0 {
|
if ref_count == 0 {
|
||||||
|
self.mode.store(ident.to_id(), &*init);
|
||||||
|
|
||||||
if init.may_have_side_effects(&self.expr_ctx) {
|
if init.may_have_side_effects(&self.expr_ctx) {
|
||||||
// TODO: Inline partially
|
// TODO: Inline partially
|
||||||
return;
|
return;
|
||||||
|
@ -89,8 +89,6 @@ pub(super) fn optimizer<'a>(
|
|||||||
prepend_stmts: Default::default(),
|
prepend_stmts: Default::default(),
|
||||||
append_stmts: Default::default(),
|
append_stmts: Default::default(),
|
||||||
vars: Default::default(),
|
vars: Default::default(),
|
||||||
vars_for_prop_hoisting: Default::default(),
|
|
||||||
simple_props: Default::default(),
|
|
||||||
typeofs: Default::default(),
|
typeofs: Default::default(),
|
||||||
data,
|
data,
|
||||||
ctx,
|
ctx,
|
||||||
@ -209,10 +207,6 @@ struct Optimizer<'a> {
|
|||||||
|
|
||||||
vars: Vars,
|
vars: Vars,
|
||||||
|
|
||||||
/// Used for `hoist_props`.
|
|
||||||
vars_for_prop_hoisting: Box<FxHashMap<Id, Box<Expr>>>,
|
|
||||||
/// Used for `hoist_props`.
|
|
||||||
simple_props: Box<FxHashMap<(Id, JsWord), Box<Expr>>>,
|
|
||||||
typeofs: Box<AHashMap<Id, JsWord>>,
|
typeofs: Box<AHashMap<Id, JsWord>>,
|
||||||
/// This information is created by analyzing identifier usages.
|
/// This information is created by analyzing identifier usages.
|
||||||
///
|
///
|
||||||
@ -236,6 +230,9 @@ struct Vars {
|
|||||||
/// Used for inlining.
|
/// Used for inlining.
|
||||||
lits: FxHashMap<Id, Box<Expr>>,
|
lits: FxHashMap<Id, Box<Expr>>,
|
||||||
|
|
||||||
|
/// Used for `hoist_props`.
|
||||||
|
hoisted_props: Box<FxHashMap<(Id, JsWord), Ident>>,
|
||||||
|
|
||||||
/// Literals which are cheap to clone, but not sure if we can inline without
|
/// Literals which are cheap to clone, but not sure if we can inline without
|
||||||
/// making output bigger.
|
/// making output bigger.
|
||||||
///
|
///
|
||||||
@ -279,6 +276,7 @@ impl Vars {
|
|||||||
lits_for_cmp: &self.lits_for_cmp,
|
lits_for_cmp: &self.lits_for_cmp,
|
||||||
lits_for_array_access: &self.lits_for_array_access,
|
lits_for_array_access: &self.lits_for_array_access,
|
||||||
lits: &self.lits,
|
lits: &self.lits,
|
||||||
|
hoisted_props: &self.hoisted_props,
|
||||||
vars_to_remove: &self.removed,
|
vars_to_remove: &self.removed,
|
||||||
changed: false,
|
changed: false,
|
||||||
};
|
};
|
||||||
@ -2920,8 +2918,6 @@ impl VisitMut for Optimizer<'_> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.store_var_for_prop_hoisting(var);
|
|
||||||
|
|
||||||
self.drop_unused_properties(var);
|
self.drop_unused_properties(var);
|
||||||
|
|
||||||
debug_assert_valid(&var.init);
|
debug_assert_valid(&var.init);
|
||||||
@ -2948,6 +2944,8 @@ impl VisitMut for Optimizer<'_> {
|
|||||||
true
|
true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self.hoist_props_of_vars(vars);
|
||||||
|
|
||||||
let uses_eval = self.data.scopes.get(&self.ctx.scope).unwrap().has_eval_call;
|
let uses_eval = self.data.scopes.get(&self.ctx.scope).unwrap().has_eval_call;
|
||||||
|
|
||||||
if !uses_eval && !self.ctx.dont_use_prepend_nor_append {
|
if !uses_eval && !self.ctx.dont_use_prepend_nor_append {
|
||||||
@ -2967,6 +2965,9 @@ impl VisitMut for Optimizer<'_> {
|
|||||||
for v in vars.iter_mut() {
|
for v in vars.iter_mut() {
|
||||||
let mut storage = None;
|
let mut storage = None;
|
||||||
self.drop_unused_var_declarator(v, &mut storage);
|
self.drop_unused_var_declarator(v, &mut storage);
|
||||||
|
if let Some(expr) = &mut storage {
|
||||||
|
expr.visit_mut_with(self);
|
||||||
|
}
|
||||||
side_effects.extend(storage);
|
side_effects.extend(storage);
|
||||||
|
|
||||||
// Dropped. Side effects of the initializer is stored in `side_effects`.
|
// Dropped. Side effects of the initializer is stored in `side_effects`.
|
||||||
|
@ -1,45 +1,70 @@
|
|||||||
use swc_common::DUMMY_SP;
|
use swc_common::{util::take::Take, DUMMY_SP};
|
||||||
use swc_ecma_ast::*;
|
use swc_ecma_ast::*;
|
||||||
use swc_ecma_utils::{contains_this_expr, prop_name_eq, ExprExt};
|
use swc_ecma_utils::{private_ident, prop_name_eq, ExprExt};
|
||||||
|
|
||||||
use super::{unused::PropertyAccessOpts, Optimizer};
|
use super::{unused::PropertyAccessOpts, Optimizer};
|
||||||
use crate::util::deeply_contains_this_expr;
|
use crate::util::deeply_contains_this_expr;
|
||||||
|
|
||||||
/// Methods related to the option `hoist_props`.
|
/// Methods related to the option `hoist_props`.
|
||||||
impl Optimizer<'_> {
|
impl Optimizer<'_> {
|
||||||
/// Store values of properties so we can replace property accesses with the
|
pub(super) fn hoist_props_of_vars(&mut self, n: &mut Vec<VarDeclarator>) {
|
||||||
/// values.
|
|
||||||
pub(super) fn store_var_for_prop_hoisting(&mut self, n: &mut VarDeclarator) {
|
|
||||||
if !self.options.hoist_props {
|
if !self.options.hoist_props {
|
||||||
|
log_abort!("hoist_props: option is disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if self.ctx.is_exported {
|
if self.ctx.is_exported {
|
||||||
|
log_abort!("hoist_props: Exported variable is not hoisted");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if self.ctx.in_top_level() && !self.options.top_level() {
|
||||||
|
log_abort!("hoist_props: Top-level variable is not hoisted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut new = Vec::with_capacity(n.len());
|
||||||
|
for mut n in n.take() {
|
||||||
|
let new_vars = self.hoist_props_of_var(&mut n);
|
||||||
|
|
||||||
|
if let Some(new_vars) = new_vars {
|
||||||
|
new.extend(new_vars);
|
||||||
|
} else {
|
||||||
|
new.push(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*n = new;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn hoist_props_of_var(&mut self, n: &mut VarDeclarator) -> Option<Vec<VarDeclarator>> {
|
||||||
if let Pat::Ident(name) = &mut n.name {
|
if let Pat::Ident(name) = &mut n.name {
|
||||||
if self.options.top_retain.contains(&name.id.sym) {
|
if name.id.span.ctxt == self.marks.top_level_ctxt
|
||||||
return;
|
&& self.options.top_retain.contains(&name.id.sym)
|
||||||
|
{
|
||||||
|
log_abort!("hoist_props: Variable `{}` is retained", name.id.sym);
|
||||||
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a variable is initialized multiple time, we currently don't do anything
|
// If a variable is initialized multiple time, we currently don't do anything
|
||||||
// smart.
|
// smart.
|
||||||
if !self
|
let usage = self.data.vars.get(&name.to_id())?;
|
||||||
.data
|
if usage.mutated()
|
||||||
.vars
|
|| usage.used_in_cond
|
||||||
.get(&name.to_id())
|
|| usage.used_above_decl
|
||||||
.map(|v| {
|
|| usage.used_as_ref
|
||||||
!v.mutated()
|
|| usage.used_as_arg
|
||||||
&& !v.used_as_ref
|
|| usage.indexed_with_dynamic_key
|
||||||
&& !v.used_as_arg
|
|| usage.used_recursively
|
||||||
&& !v.used_in_cond
|
|
||||||
&& (!v.is_fn_local || !self.mode.should_be_very_correct())
|
|
||||||
&& !v.is_infected()
|
|
||||||
})
|
|
||||||
.unwrap_or(false)
|
|
||||||
{
|
{
|
||||||
log_abort!("[x] bad usage");
|
log_abort!("hoist_props: Variable `{}` is not a candidate", name.id);
|
||||||
return;
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
if usage.accessed_props.is_empty() {
|
||||||
|
log_abort!(
|
||||||
|
"hoist_props: Variable `{}` is not accessed with known keys",
|
||||||
|
name.id
|
||||||
|
);
|
||||||
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should abort if unknown property is used.
|
// We should abort if unknown property is used.
|
||||||
@ -53,145 +78,115 @@ impl Optimizer<'_> {
|
|||||||
if let Some(Expr::Object(init)) = n.init.as_deref() {
|
if let Some(Expr::Object(init)) = n.init.as_deref() {
|
||||||
for prop in &init.props {
|
for prop in &init.props {
|
||||||
let prop = match prop {
|
let prop = match prop {
|
||||||
PropOrSpread::Spread(_) => continue,
|
PropOrSpread::Spread(_) => return None,
|
||||||
PropOrSpread::Prop(prop) => prop,
|
PropOrSpread::Prop(prop) => prop,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Prop::KeyValue(p) = &**prop {
|
match &**prop {
|
||||||
match &*p.value {
|
Prop::KeyValue(p) => {
|
||||||
Expr::Lit(..) | Expr::Arrow(..) => {}
|
if !is_expr_fine_for_hoist_props(&p.value) {
|
||||||
Expr::Fn(f) => {
|
return None;
|
||||||
if contains_this_expr(&f.function.body) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => continue,
|
|
||||||
};
|
|
||||||
|
|
||||||
match &p.key {
|
match &p.key {
|
||||||
PropName::Str(s) => {
|
PropName::Str(s) => {
|
||||||
if let Some(v) = unknown_used_props.get_mut(&s.value) {
|
if let Some(v) = unknown_used_props.get_mut(&s.value) {
|
||||||
*v -= 1;
|
*v = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
PropName::Ident(i) => {
|
||||||
PropName::Ident(i) => {
|
if let Some(v) = unknown_used_props.get_mut(&i.sym) {
|
||||||
if let Some(v) = unknown_used_props.get_mut(&i.sym) {
|
*v = 0;
|
||||||
*v -= 1;
|
}
|
||||||
}
|
}
|
||||||
|
_ => return None,
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
Prop::Shorthand(p) => {
|
||||||
|
if let Some(v) = unknown_used_props.get_mut(&p.sym) {
|
||||||
|
*v = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => return None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if self.mode.should_be_very_correct() {
|
if self.mode.should_be_very_correct() {
|
||||||
return;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !unknown_used_props.iter().all(|(_, v)| *v == 0) {
|
if !unknown_used_props.iter().all(|(_, v)| *v == 0) {
|
||||||
log_abort!("[x] unknown used props: {:?}", unknown_used_props);
|
log_abort!("[x] unknown used props: {:?}", unknown_used_props);
|
||||||
return;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(init) = n.init.as_deref() {
|
if let Some(init) = n.init.as_deref() {
|
||||||
self.mode.store(name.to_id(), init);
|
self.mode.store(name.to_id(), init);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(Expr::Object(init)) = n.init.as_deref_mut() {
|
let mut new_vars = vec![];
|
||||||
for prop in &mut init.props {
|
|
||||||
let prop = match prop {
|
|
||||||
PropOrSpread::Spread(_) => continue,
|
|
||||||
PropOrSpread::Prop(prop) => prop,
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Prop::KeyValue(p) = &mut **prop {
|
let object = n.init.as_mut()?.as_mut_object()?;
|
||||||
self.vars.inline_with_multi_replacer(&mut p.value);
|
|
||||||
|
|
||||||
let value = match &*p.value {
|
self.changed = true;
|
||||||
Expr::Lit(..) => p.value.clone(),
|
report_change!(
|
||||||
Expr::Fn(..) | Expr::Arrow(..) => {
|
"hoist_props: Hoisting properties of a variable `{}`",
|
||||||
if self.options.hoist_props {
|
name.id.sym
|
||||||
p.value.clone()
|
);
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => continue,
|
|
||||||
};
|
|
||||||
|
|
||||||
match &p.key {
|
for prop in &mut object.props {
|
||||||
PropName::Str(s) => {
|
let prop = match prop {
|
||||||
trace_op!(
|
PropOrSpread::Spread(_) => unreachable!(),
|
||||||
"hoist_props: Storing a variable (`{}`) to inline properties",
|
PropOrSpread::Prop(prop) => prop,
|
||||||
name.id
|
};
|
||||||
);
|
|
||||||
self.simple_props
|
let value = match &mut **prop {
|
||||||
.insert((name.to_id(), s.value.clone()), value);
|
Prop::KeyValue(p) => p.value.take(),
|
||||||
}
|
Prop::Shorthand(p) => p.clone().into(),
|
||||||
PropName::Ident(i) => {
|
_ => unreachable!(),
|
||||||
trace_op!(
|
};
|
||||||
"hoist_props: Storing a variable(`{}`) to inline properties",
|
|
||||||
name.id
|
let (key, suffix) = match &**prop {
|
||||||
);
|
Prop::KeyValue(p) => match &p.key {
|
||||||
self.simple_props
|
PropName::Ident(i) => (i.sym.clone(), i.sym.clone()),
|
||||||
.insert((name.to_id(), i.sym.clone()), value);
|
PropName::Str(s) => (
|
||||||
}
|
s.value.clone(),
|
||||||
_ => {}
|
s.value
|
||||||
}
|
.clone()
|
||||||
}
|
.replace(|c: char| !Ident::is_valid_continue(c), "$")
|
||||||
}
|
.into(),
|
||||||
|
),
|
||||||
|
_ => unreachable!(),
|
||||||
|
},
|
||||||
|
Prop::Shorthand(p) => (p.sym.clone(), p.sym.clone()),
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let new_var_name = private_ident!(format!("{}_{}", name.id.sym, suffix));
|
||||||
|
|
||||||
|
let new_var = VarDeclarator {
|
||||||
|
span: DUMMY_SP,
|
||||||
|
name: new_var_name.clone().into(),
|
||||||
|
init: Some(value),
|
||||||
|
definite: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
self.vars
|
||||||
|
.hoisted_props
|
||||||
|
.insert((name.to_id(), key), new_var_name);
|
||||||
|
|
||||||
|
new_vars.push(new_var);
|
||||||
}
|
}
|
||||||
|
// Mark the variable as dropped.
|
||||||
|
n.name.take();
|
||||||
|
|
||||||
// If the variable is used multiple time, just ignore it.
|
return Some(new_vars);
|
||||||
if !self
|
|
||||||
.data
|
|
||||||
.vars
|
|
||||||
.get(&name.to_id())
|
|
||||||
.map(|v| {
|
|
||||||
v.ref_count == 1
|
|
||||||
&& v.has_property_access
|
|
||||||
&& !v.mutated()
|
|
||||||
&& v.is_fn_local
|
|
||||||
&& !v.executed_multiple_time
|
|
||||||
&& !v.used_as_arg
|
|
||||||
&& !v.used_in_cond
|
|
||||||
})
|
|
||||||
.unwrap_or(false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let init = match n.init.take() {
|
|
||||||
Some(v) => v,
|
|
||||||
None => return,
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Expr::This(..) = &*init {
|
|
||||||
n.init = Some(init);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
match self.vars_for_prop_hoisting.insert(name.to_id(), init) {
|
|
||||||
Some(prev) => {
|
|
||||||
panic!(
|
|
||||||
"two variable with same name and same span hygiene is invalid\nPrevious \
|
|
||||||
value: {:?}",
|
|
||||||
prev
|
|
||||||
);
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
trace_op!(
|
|
||||||
"hoist_props: Stored {}{:?} to inline property access",
|
|
||||||
name.id.sym,
|
|
||||||
name.id.span.ctxt
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Replace property accesses to known values.
|
|
||||||
pub(super) fn replace_props(&mut self, e: &mut Expr) {
|
pub(super) fn replace_props(&mut self, e: &mut Expr) {
|
||||||
let member = match e {
|
let member = match e {
|
||||||
Expr::Member(m) => m,
|
Expr::Member(m) => m,
|
||||||
@ -202,32 +197,56 @@ impl Optimizer<'_> {
|
|||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
if let Expr::Ident(obj) = &*member.obj {
|
if let Expr::Ident(obj) = &*member.obj {
|
||||||
if let MemberProp::Ident(prop) = &member.prop {
|
let sym = match &member.prop {
|
||||||
if let Some(mut value) = self
|
MemberProp::Ident(i) => &i.sym,
|
||||||
.simple_props
|
MemberProp::Computed(e) => match &*e.expr {
|
||||||
.get(&(obj.to_id(), prop.sym.clone()))
|
Expr::Lit(Lit::Str(s)) => &s.value,
|
||||||
.cloned()
|
_ => return,
|
||||||
{
|
},
|
||||||
if let Expr::Fn(f) = &mut *value {
|
_ => return,
|
||||||
f.function.span = DUMMY_SP;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
report_change!("hoist_props: Inlining `{}.{}`", obj.sym, prop.sym);
|
if let Some(value) = self
|
||||||
self.changed = true;
|
.vars
|
||||||
*e = *value;
|
.hoisted_props
|
||||||
return;
|
.get(&(obj.to_id(), sym.clone()))
|
||||||
}
|
.cloned()
|
||||||
}
|
{
|
||||||
|
report_change!("hoist_props: Inlining `{}.{}`", obj.sym, sym);
|
||||||
if let Some(value) = self.vars_for_prop_hoisting.remove(&obj.to_id()) {
|
|
||||||
member.obj = value;
|
|
||||||
self.changed = true;
|
self.changed = true;
|
||||||
report_change!("hoist_props: Inlined a property");
|
*e = value.into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_expr_fine_for_hoist_props(value: &Expr) -> bool {
|
||||||
|
match value {
|
||||||
|
Expr::Ident(..) | Expr::Lit(..) | Expr::Arrow(..) | Expr::Fn(..) | Expr::Class(..) => true,
|
||||||
|
|
||||||
|
Expr::Unary(u) => match u.op {
|
||||||
|
op!("void") | op!("typeof") | op!("!") => is_expr_fine_for_hoist_props(&u.arg),
|
||||||
|
_ => false,
|
||||||
|
},
|
||||||
|
|
||||||
|
Expr::Array(a) => a.elems.iter().all(|elem| match elem {
|
||||||
|
Some(elem) => elem.spread.is_none() && is_expr_fine_for_hoist_props(&elem.expr),
|
||||||
|
None => true,
|
||||||
|
}),
|
||||||
|
|
||||||
|
Expr::Object(o) => o.props.iter().all(|prop| match prop {
|
||||||
|
PropOrSpread::Spread(_) => false,
|
||||||
|
PropOrSpread::Prop(p) => match &**p {
|
||||||
|
Prop::Shorthand(..) => true,
|
||||||
|
Prop::KeyValue(p) => is_expr_fine_for_hoist_props(&p.value),
|
||||||
|
_ => false,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Optimizer<'_> {
|
impl Optimizer<'_> {
|
||||||
/// Converts `{ a: 1 }.a` into `1`.
|
/// Converts `{ a: 1 }.a` into `1`.
|
||||||
pub(super) fn handle_property_access(&mut self, e: &mut Expr) {
|
pub(super) fn handle_property_access(&mut self, e: &mut Expr) {
|
||||||
|
@ -3,7 +3,7 @@ use swc_atoms::JsWord;
|
|||||||
use swc_common::{util::take::Take, DUMMY_SP};
|
use swc_common::{util::take::Take, DUMMY_SP};
|
||||||
use swc_ecma_ast::*;
|
use swc_ecma_ast::*;
|
||||||
use swc_ecma_usage_analyzer::util::is_global_var_with_pure_property_access;
|
use swc_ecma_usage_analyzer::util::is_global_var_with_pure_property_access;
|
||||||
use swc_ecma_utils::{contains_ident_ref, ExprExt};
|
use swc_ecma_utils::{contains_ident_ref, contains_this_expr, ExprExt};
|
||||||
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
||||||
|
|
||||||
use super::Optimizer;
|
use super::Optimizer;
|
||||||
@ -26,6 +26,9 @@ impl Optimizer<'_> {
|
|||||||
var: &mut VarDeclarator,
|
var: &mut VarDeclarator,
|
||||||
storage_for_side_effects: &mut Option<Box<Expr>>,
|
storage_for_side_effects: &mut Option<Box<Expr>>,
|
||||||
) {
|
) {
|
||||||
|
if self.mode.preserve_vars() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if var.name.is_invalid() {
|
if var.name.is_invalid() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -732,7 +735,7 @@ impl Optimizer<'_> {
|
|||||||
|
|
||||||
/// `var Parser = function Parser() {};` => `var Parser = function () {}`
|
/// `var Parser = function Parser() {};` => `var Parser = function () {}`
|
||||||
pub(super) fn remove_duplicate_name_of_function(&mut self, v: &mut VarDeclarator) {
|
pub(super) fn remove_duplicate_name_of_function(&mut self, v: &mut VarDeclarator) {
|
||||||
if !self.options.unused {
|
if !self.options.unused || self.options.hoist_props {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,9 +793,59 @@ impl Optimizer<'_> {
|
|||||||
let properties_used_via_this = {
|
let properties_used_via_this = {
|
||||||
let mut v = ThisPropertyVisitor::default();
|
let mut v = ThisPropertyVisitor::default();
|
||||||
obj.visit_with(&mut v);
|
obj.visit_with(&mut v);
|
||||||
|
if v.should_abort {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
v.properties
|
v.properties
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut unknown_used_props = self
|
||||||
|
.data
|
||||||
|
.vars
|
||||||
|
.get(&name.to_id())
|
||||||
|
.map(|v| v.accessed_props.clone())
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
// If there's an access to an unknown property, we should preserve all
|
||||||
|
// properties.
|
||||||
|
for prop in &obj.props {
|
||||||
|
let prop = match prop {
|
||||||
|
PropOrSpread::Spread(_) => return None,
|
||||||
|
PropOrSpread::Prop(prop) => prop,
|
||||||
|
};
|
||||||
|
|
||||||
|
if contains_this_expr(prop) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
match &**prop {
|
||||||
|
Prop::KeyValue(p) => match &p.key {
|
||||||
|
PropName::Str(s) => {
|
||||||
|
if let Some(v) = unknown_used_props.get_mut(&s.value) {
|
||||||
|
*v = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PropName::Ident(i) => {
|
||||||
|
if let Some(v) = unknown_used_props.get_mut(&i.sym) {
|
||||||
|
*v = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => return None,
|
||||||
|
},
|
||||||
|
Prop::Shorthand(p) => {
|
||||||
|
if let Some(v) = unknown_used_props.get_mut(&p.sym) {
|
||||||
|
*v = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => return None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !unknown_used_props.iter().all(|(_, v)| *v == 0) {
|
||||||
|
log_abort!("[x] unknown used props: {:?}", unknown_used_props);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let should_preserve_property = |sym: &JsWord| {
|
let should_preserve_property = |sym: &JsWord| {
|
||||||
if let "toString" = &**sym {
|
if let "toString" = &**sym {
|
||||||
return true;
|
return true;
|
||||||
@ -843,6 +896,43 @@ struct ThisPropertyVisitor {
|
|||||||
impl Visit for ThisPropertyVisitor {
|
impl Visit for ThisPropertyVisitor {
|
||||||
noop_visit_type!();
|
noop_visit_type!();
|
||||||
|
|
||||||
|
fn visit_assign_expr(&mut self, e: &AssignExpr) {
|
||||||
|
if self.should_abort {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.visit_children_with(self);
|
||||||
|
|
||||||
|
if self.should_abort {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Expr::This(..) = &*e.right {
|
||||||
|
if e.op == op!("=") || e.op.may_short_circuit() {
|
||||||
|
self.should_abort = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_call_expr(&mut self, n: &CallExpr) {
|
||||||
|
if self.should_abort {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
n.visit_children_with(self);
|
||||||
|
|
||||||
|
if self.should_abort {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for arg in &n.args {
|
||||||
|
if arg.expr.is_this() {
|
||||||
|
self.should_abort = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn visit_member_expr(&mut self, e: &MemberExpr) {
|
fn visit_member_expr(&mut self, e: &MemberExpr) {
|
||||||
if self.should_abort {
|
if self.should_abort {
|
||||||
return;
|
return;
|
||||||
@ -850,6 +940,10 @@ impl Visit for ThisPropertyVisitor {
|
|||||||
|
|
||||||
e.visit_children_with(self);
|
e.visit_children_with(self);
|
||||||
|
|
||||||
|
if self.should_abort {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if let Expr::This(..) = &*e.obj {
|
if let Expr::This(..) = &*e.obj {
|
||||||
match &e.prop {
|
match &e.prop {
|
||||||
MemberProp::Ident(p) => {
|
MemberProp::Ident(p) => {
|
||||||
|
@ -224,6 +224,7 @@ pub(crate) struct Finalizer<'a> {
|
|||||||
pub lits: &'a FxHashMap<Id, Box<Expr>>,
|
pub lits: &'a FxHashMap<Id, Box<Expr>>,
|
||||||
pub lits_for_cmp: &'a FxHashMap<Id, Box<Expr>>,
|
pub lits_for_cmp: &'a FxHashMap<Id, Box<Expr>>,
|
||||||
pub lits_for_array_access: &'a FxHashMap<Id, Box<Expr>>,
|
pub lits_for_array_access: &'a FxHashMap<Id, Box<Expr>>,
|
||||||
|
pub hoisted_props: &'a FxHashMap<(Id, JsWord), Ident>,
|
||||||
|
|
||||||
pub vars_to_remove: &'a FxHashSet<Id>,
|
pub vars_to_remove: &'a FxHashSet<Id>,
|
||||||
|
|
||||||
@ -411,6 +412,17 @@ impl VisitMut for Finalizer<'_> {
|
|||||||
} else {
|
} else {
|
||||||
n.visit_mut_children_with(self);
|
n.visit_mut_children_with(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Expr::Member(e) = n {
|
||||||
|
if let Expr::Ident(obj) = &*e.obj {
|
||||||
|
if let MemberProp::Ident(prop) = &e.prop {
|
||||||
|
if let Some(ident) = self.hoisted_props.get(&(obj.to_id(), prop.sym.clone())) {
|
||||||
|
self.changed = true;
|
||||||
|
*n = ident.clone().into();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_mut_stmts(&mut self, n: &mut Vec<Stmt>) {
|
fn visit_mut_stmts(&mut self, n: &mut Vec<Stmt>) {
|
||||||
|
@ -63,16 +63,21 @@ impl Mode for Eval {
|
|||||||
w.cache.insert(id, Box::new(value.clone()));
|
w.cache.insert(id, Box::new(value.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn force_str_for_tpl(&self) -> bool {
|
fn preserve_vars(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_be_very_correct(&self) -> bool {
|
fn should_be_very_correct(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn force_str_for_tpl(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Evaluator {
|
impl Evaluator {
|
||||||
|
#[tracing::instrument(name = "Evaluator::run", level = "debug", skip_all)]
|
||||||
fn run(&mut self) {
|
fn run(&mut self) {
|
||||||
if !self.done {
|
if !self.done {
|
||||||
self.done = true;
|
self.done = true;
|
||||||
@ -83,7 +88,8 @@ impl Evaluator {
|
|||||||
self.module.visit_mut_with(&mut compressor(
|
self.module.visit_mut_with(&mut compressor(
|
||||||
marks,
|
marks,
|
||||||
&CompressOptions {
|
&CompressOptions {
|
||||||
hoist_props: true,
|
// We should not drop unused variables.
|
||||||
|
unused: false,
|
||||||
top_level: Some(TopLevelOptions { functions: true }),
|
top_level: Some(TopLevelOptions { functions: true }),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
@ -3,6 +3,8 @@ use swc_ecma_ast::*;
|
|||||||
pub(crate) trait Mode: Send + Sync {
|
pub(crate) trait Mode: Send + Sync {
|
||||||
fn store(&self, id: Id, value: &Expr);
|
fn store(&self, id: Id, value: &Expr);
|
||||||
|
|
||||||
|
fn preserve_vars(&self) -> bool;
|
||||||
|
|
||||||
fn should_be_very_correct(&self) -> bool;
|
fn should_be_very_correct(&self) -> bool;
|
||||||
|
|
||||||
/// If this returns true, template literals with `\n` or `\r` will be
|
/// If this returns true, template literals with `\n` or `\r` will be
|
||||||
@ -15,11 +17,15 @@ pub struct Minification;
|
|||||||
impl Mode for Minification {
|
impl Mode for Minification {
|
||||||
fn store(&self, _: Id, _: &Expr) {}
|
fn store(&self, _: Id, _: &Expr) {}
|
||||||
|
|
||||||
fn force_str_for_tpl(&self) -> bool {
|
fn preserve_vars(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_be_very_correct(&self) -> bool {
|
fn should_be_very_correct(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn force_str_for_tpl(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ block_scope/issue_334/input.js
|
|||||||
class_properties/class_expression_constant/input.js
|
class_properties/class_expression_constant/input.js
|
||||||
class_properties/mangle_class_properties_keep_quoted/input.js
|
class_properties/mangle_class_properties_keep_quoted/input.js
|
||||||
class_properties/static_means_execution/input.js
|
class_properties/static_means_execution/input.js
|
||||||
classes/pure_prop_assignment_for_classes/input.js
|
|
||||||
collapse_vars/cascade_statement/input.js
|
collapse_vars/cascade_statement/input.js
|
||||||
collapse_vars/chained_1/input.js
|
collapse_vars/chained_1/input.js
|
||||||
collapse_vars/chained_2/input.js
|
collapse_vars/chained_2/input.js
|
||||||
@ -185,6 +184,8 @@ harmony/issue_2874_2/input.js
|
|||||||
harmony/module_enabled/input.js
|
harmony/module_enabled/input.js
|
||||||
harmony/module_mangle_scope/input.js
|
harmony/module_mangle_scope/input.js
|
||||||
harmony/regression_cannot_use_of/input.js
|
harmony/regression_cannot_use_of/input.js
|
||||||
|
hoist_props/contains_this_3/input.js
|
||||||
|
hoist_props/hoist_function_with_call/input.js
|
||||||
if_return/if_return_same_value/input.js
|
if_return/if_return_same_value/input.js
|
||||||
if_return/if_var_return/input.js
|
if_return/if_var_return/input.js
|
||||||
if_return/issue_2747/input.js
|
if_return/issue_2747/input.js
|
||||||
|
@ -12842,33 +12842,28 @@
|
|||||||
specialAreas: this._specialAreas
|
specialAreas: this._specialAreas
|
||||||
};
|
};
|
||||||
}, GeoJSONResource;
|
}, GeoJSONResource;
|
||||||
}(), storage = createHashMap(), geoSourceManager = {
|
}(), storage = createHashMap(), geoSourceManager_registerMap = function(mapName, rawDef, rawSpecialAreas) {
|
||||||
registerMap: function(mapName, rawDef, rawSpecialAreas) {
|
if (rawDef.svg) {
|
||||||
if (rawDef.svg) {
|
var resource = new GeoSVGResource(mapName, rawDef.svg);
|
||||||
var resource = new GeoSVGResource(mapName, rawDef.svg);
|
storage.set(mapName, resource);
|
||||||
storage.set(mapName, resource);
|
} else {
|
||||||
} else {
|
var geoJSON = rawDef.geoJson || rawDef.geoJSON;
|
||||||
var geoJSON = rawDef.geoJson || rawDef.geoJSON;
|
geoJSON && !rawDef.features ? rawSpecialAreas = rawDef.specialAreas : geoJSON = rawDef;
|
||||||
geoJSON && !rawDef.features ? rawSpecialAreas = rawDef.specialAreas : geoJSON = rawDef;
|
var resource = new GeoJSONResource(mapName, geoJSON, rawSpecialAreas);
|
||||||
var resource = new GeoJSONResource(mapName, geoJSON, rawSpecialAreas);
|
storage.set(mapName, resource);
|
||||||
storage.set(mapName, resource);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getGeoResource: function(mapName) {
|
|
||||||
return storage.get(mapName);
|
|
||||||
},
|
|
||||||
getMapForUser: function(mapName) {
|
|
||||||
var resource = storage.get(mapName);
|
|
||||||
return resource && 'geoJSON' === resource.type && resource.getMapForUser();
|
|
||||||
},
|
|
||||||
load: function(mapName, nameMap, nameProperty) {
|
|
||||||
var resource = storage.get(mapName);
|
|
||||||
if (!resource) {
|
|
||||||
console.error('Map ' + mapName + ' not exists. The GeoJSON of the map must be provided.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return resource.load(nameMap, nameProperty);
|
|
||||||
}
|
}
|
||||||
|
}, geoSourceManager_getGeoResource = function(mapName) {
|
||||||
|
return storage.get(mapName);
|
||||||
|
}, geoSourceManager_getMapForUser = function(mapName) {
|
||||||
|
var resource = storage.get(mapName);
|
||||||
|
return resource && 'geoJSON' === resource.type && resource.getMapForUser();
|
||||||
|
}, geoSourceManager_load = function(mapName, nameMap, nameProperty) {
|
||||||
|
var resource = storage.get(mapName);
|
||||||
|
if (!resource) {
|
||||||
|
console.error('Map ' + mapName + ' not exists. The GeoJSON of the map must be provided.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return resource.load(nameMap, nameProperty);
|
||||||
}, isObject$2 = isObject, hasWindow = 'undefined' != typeof window, PRIORITY = {
|
}, isObject$2 = isObject, hasWindow = 'undefined' != typeof window, PRIORITY = {
|
||||||
PROCESSOR: {
|
PROCESSOR: {
|
||||||
FILTER: 1000,
|
FILTER: 1000,
|
||||||
@ -13727,7 +13722,7 @@
|
|||||||
loadingEffects[name] = loadingFx;
|
loadingEffects[name] = loadingFx;
|
||||||
}
|
}
|
||||||
function registerMap(mapName, geoJson, specialAreas) {
|
function registerMap(mapName, geoJson, specialAreas) {
|
||||||
geoSourceManager.registerMap(mapName, geoJson, specialAreas);
|
geoSourceManager_registerMap(mapName, geoJson, specialAreas);
|
||||||
}
|
}
|
||||||
var registerTransform = function(externalTransform) {
|
var registerTransform = function(externalTransform) {
|
||||||
var type = (externalTransform = clone(externalTransform)).type;
|
var type = (externalTransform = clone(externalTransform)).type;
|
||||||
@ -21235,7 +21230,7 @@
|
|||||||
}, MapDraw.prototype._svgResourceChanged = function(mapName) {
|
}, MapDraw.prototype._svgResourceChanged = function(mapName) {
|
||||||
return this._svgMapName !== mapName;
|
return this._svgMapName !== mapName;
|
||||||
}, MapDraw.prototype._useSVG = function(mapName) {
|
}, MapDraw.prototype._useSVG = function(mapName) {
|
||||||
var resource = geoSourceManager.getGeoResource(mapName);
|
var resource = geoSourceManager_getGeoResource(mapName);
|
||||||
if (resource && 'geoSVG' === resource.type) {
|
if (resource && 'geoSVG' === resource.type) {
|
||||||
var svgGraphic = resource.useGraphic(this.uid);
|
var svgGraphic = resource.useGraphic(this.uid);
|
||||||
this._svgGroup.add(svgGraphic.root), this._svgGraphicRecord = svgGraphic, this._svgMapName = mapName;
|
this._svgGroup.add(svgGraphic.root), this._svgGraphicRecord = svgGraphic, this._svgMapName = mapName;
|
||||||
@ -21243,7 +21238,7 @@
|
|||||||
}, MapDraw.prototype._freeSVG = function() {
|
}, MapDraw.prototype._freeSVG = function() {
|
||||||
var mapName = this._svgMapName;
|
var mapName = this._svgMapName;
|
||||||
if (null != mapName) {
|
if (null != mapName) {
|
||||||
var resource = geoSourceManager.getGeoResource(mapName);
|
var resource = geoSourceManager_getGeoResource(mapName);
|
||||||
resource && 'geoSVG' === resource.type && resource.freeGraphic(this.uid), this._svgGraphicRecord = null, this._svgDispatcherMap = null, this._svgGroup.removeAll(), this._svgMapName = null;
|
resource && 'geoSVG' === resource.type && resource.freeGraphic(this.uid), this._svgGraphicRecord = null, this._svgDispatcherMap = null, this._svgGroup.removeAll(), this._svgMapName = null;
|
||||||
}
|
}
|
||||||
}, MapDraw.prototype._updateController = function(mapOrGeoModel, ecModel, api) {
|
}, MapDraw.prototype._updateController = function(mapOrGeoModel, ecModel, api) {
|
||||||
@ -21432,7 +21427,7 @@
|
|||||||
var name_2 = data.getName(i);
|
var name_2 = data.getName(i);
|
||||||
dataNameMap.set(name_2, !0);
|
dataNameMap.set(name_2, !0);
|
||||||
}
|
}
|
||||||
return each(geoSourceManager.load(this.getMapType(), this.option.nameMap, this.option.nameProperty).regions, function(region) {
|
return each(geoSourceManager_load(this.getMapType(), this.option.nameMap, this.option.nameProperty).regions, function(region) {
|
||||||
var name = region.name;
|
var name = region.name;
|
||||||
dataNameMap.get(name) || toAppendNames.push(name);
|
dataNameMap.get(name) || toAppendNames.push(name);
|
||||||
}), data.appendValues([], toAppendNames), data;
|
}), data.appendValues([], toAppendNames), data;
|
||||||
@ -21668,7 +21663,7 @@
|
|||||||
'lng',
|
'lng',
|
||||||
'lat'
|
'lat'
|
||||||
], _this.type = 'geo', _this._nameCoordMap = createHashMap(), _this.map = map;
|
], _this.type = 'geo', _this._nameCoordMap = createHashMap(), _this.map = map;
|
||||||
var source = geoSourceManager.load(map, opt.nameMap, opt.nameProperty), resource = geoSourceManager.getGeoResource(map);
|
var source = geoSourceManager_load(map, opt.nameMap, opt.nameProperty), resource = geoSourceManager_getGeoResource(map);
|
||||||
_this.resourceType = resource ? resource.type : null;
|
_this.resourceType = resource ? resource.type : null;
|
||||||
var defaultParmas = GEO_DEFAULT_PARAMS[resource.type];
|
var defaultParmas = GEO_DEFAULT_PARAMS[resource.type];
|
||||||
_this._regionsMap = source.regionsMap, _this._invertLongitute = defaultParmas.invertLongitute, _this.regions = source.regions, _this.aspectScale = retrieve2(opt.aspectScale, defaultParmas.aspectScale);
|
_this._regionsMap = source.regionsMap, _this._invertLongitute = defaultParmas.invertLongitute, _this.regions = source.regions, _this.aspectScale = retrieve2(opt.aspectScale, defaultParmas.aspectScale);
|
||||||
@ -21772,7 +21767,7 @@
|
|||||||
}), geoList;
|
}), geoList;
|
||||||
}, GeoCreator.prototype.getFilledRegions = function(originRegionArr, mapName, nameMap, nameProperty) {
|
}, GeoCreator.prototype.getFilledRegions = function(originRegionArr, mapName, nameMap, nameProperty) {
|
||||||
for(var regionsArr = (originRegionArr || []).slice(), dataNameMap = createHashMap(), i = 0; i < regionsArr.length; i++)dataNameMap.set(regionsArr[i].name, regionsArr[i]);
|
for(var regionsArr = (originRegionArr || []).slice(), dataNameMap = createHashMap(), i = 0; i < regionsArr.length; i++)dataNameMap.set(regionsArr[i].name, regionsArr[i]);
|
||||||
return each(geoSourceManager.load(mapName, nameMap, nameProperty).regions, function(region) {
|
return each(geoSourceManager_load(mapName, nameMap, nameProperty).regions, function(region) {
|
||||||
var name = region.name;
|
var name = region.name;
|
||||||
dataNameMap.get(name) || regionsArr.push({
|
dataNameMap.get(name) || regionsArr.push({
|
||||||
name: name
|
name: name
|
||||||
@ -21785,7 +21780,7 @@
|
|||||||
return _this.type = GeoModel.type, _this;
|
return _this.type = GeoModel.type, _this;
|
||||||
}
|
}
|
||||||
return __extends(GeoModel, _super), GeoModel.prototype.init = function(option, parentModel, ecModel) {
|
return __extends(GeoModel, _super), GeoModel.prototype.init = function(option, parentModel, ecModel) {
|
||||||
var source = geoSourceManager.getGeoResource(option.map);
|
var source = geoSourceManager_getGeoResource(option.map);
|
||||||
if (source && 'geoJSON' === source.type) {
|
if (source && 'geoJSON' === source.type) {
|
||||||
var itemStyle = option.itemStyle = option.itemStyle || {};
|
var itemStyle = option.itemStyle = option.itemStyle || {};
|
||||||
'color' in itemStyle || (itemStyle.color = '#eee');
|
'color' in itemStyle || (itemStyle.color = '#eee');
|
||||||
@ -41277,7 +41272,7 @@
|
|||||||
}, exports1.getInstanceByDom = getInstanceByDom, exports1.getInstanceById = function(key) {
|
}, exports1.getInstanceByDom = getInstanceByDom, exports1.getInstanceById = function(key) {
|
||||||
return instances$1[key];
|
return instances$1[key];
|
||||||
}, exports1.getMap = function(mapName) {
|
}, exports1.getMap = function(mapName) {
|
||||||
return geoSourceManager.getMapForUser(mapName);
|
return geoSourceManager_getMapForUser(mapName);
|
||||||
}, exports1.graphic = graphic$1, exports1.helper = helper, exports1.init = function(dom, theme, opts) {
|
}, exports1.graphic = graphic$1, exports1.helper = helper, exports1.init = function(dom, theme, opts) {
|
||||||
if (!dom) throw Error('Initialize failed: invalid dom.');
|
if (!dom) throw Error('Initialize failed: invalid dom.');
|
||||||
var existInstance = getInstanceByDom(dom);
|
var existInstance = getInstanceByDom(dom);
|
||||||
|
File diff suppressed because one or more lines are too long
@ -3266,19 +3266,15 @@
|
|||||||
}
|
}
|
||||||
}), WebGLCubeRenderTarget.prototype = Object.create(WebGLRenderTarget.prototype), WebGLCubeRenderTarget.prototype.constructor = WebGLCubeRenderTarget, WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = !0, WebGLCubeRenderTarget.prototype.fromEquirectangularTexture = function(renderer, texture) {
|
}), WebGLCubeRenderTarget.prototype = Object.create(WebGLRenderTarget.prototype), WebGLCubeRenderTarget.prototype.constructor = WebGLCubeRenderTarget, WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = !0, WebGLCubeRenderTarget.prototype.fromEquirectangularTexture = function(renderer, texture) {
|
||||||
this.texture.type = texture.type, this.texture.format = 1023, this.texture.encoding = texture.encoding, this.texture.generateMipmaps = texture.generateMipmaps, this.texture.minFilter = texture.minFilter, this.texture.magFilter = texture.magFilter;
|
this.texture.type = texture.type, this.texture.format = 1023, this.texture.encoding = texture.encoding, this.texture.generateMipmaps = texture.generateMipmaps, this.texture.minFilter = texture.minFilter, this.texture.magFilter = texture.magFilter;
|
||||||
var shader = {
|
var geometry = new BoxBufferGeometry(5, 5, 5), material = new ShaderMaterial({
|
||||||
uniforms: {
|
name: 'CubemapFromEquirect',
|
||||||
|
uniforms: cloneUniforms({
|
||||||
tEquirect: {
|
tEquirect: {
|
||||||
value: null
|
value: null
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
vertexShader: "\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include <begin_vertex>\n\t\t\t\t#include <project_vertex>\n\n\t\t\t}\n\t\t",
|
vertexShader: "\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include <begin_vertex>\n\t\t\t\t#include <project_vertex>\n\n\t\t\t}\n\t\t",
|
||||||
fragmentShader: "\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t"
|
fragmentShader: "\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t",
|
||||||
}, geometry = new BoxBufferGeometry(5, 5, 5), material = new ShaderMaterial({
|
|
||||||
name: 'CubemapFromEquirect',
|
|
||||||
uniforms: cloneUniforms(shader.uniforms),
|
|
||||||
vertexShader: shader.vertexShader,
|
|
||||||
fragmentShader: shader.fragmentShader,
|
|
||||||
side: 1,
|
side: 1,
|
||||||
blending: 0
|
blending: 0
|
||||||
});
|
});
|
||||||
@ -8609,140 +8605,138 @@
|
|||||||
return _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)), _this;
|
return _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)), _this;
|
||||||
}
|
}
|
||||||
return _inheritsLoose(EdgesGeometry, _BufferGeometry), EdgesGeometry;
|
return _inheritsLoose(EdgesGeometry, _BufferGeometry), EdgesGeometry;
|
||||||
}(BufferGeometry), Earcut = {
|
}(BufferGeometry), Earcut_triangulate = function(data, holeIndices, dim) {
|
||||||
triangulate: function(data, holeIndices, dim) {
|
dim = dim || 2;
|
||||||
dim = dim || 2;
|
var minX, minY, maxX, maxY, x, y, invSize, hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, !0), triangles = [];
|
||||||
var minX, minY, maxX, maxY, x, y, invSize, hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, !0), triangles = [];
|
if (!outerNode || outerNode.next === outerNode.prev) return triangles;
|
||||||
if (!outerNode || outerNode.next === outerNode.prev) return triangles;
|
if (hasHoles && (outerNode = function(data, holeIndices, outerNode, dim) {
|
||||||
if (hasHoles && (outerNode = function(data, holeIndices, outerNode, dim) {
|
var i, len, start, end, list, queue = [];
|
||||||
var i, len, start, end, list, queue = [];
|
for(i = 0, len = holeIndices.length; i < len; i++)start = holeIndices[i] * dim, end = i < len - 1 ? holeIndices[i + 1] * dim : data.length, (list = linkedList(data, start, end, dim, !1)) === list.next && (list.steiner = !0), queue.push(function(start) {
|
||||||
for(i = 0, len = holeIndices.length; i < len; i++)start = holeIndices[i] * dim, end = i < len - 1 ? holeIndices[i + 1] * dim : data.length, (list = linkedList(data, start, end, dim, !1)) === list.next && (list.steiner = !0), queue.push(function(start) {
|
var p = start, leftmost = start;
|
||||||
var p = start, leftmost = start;
|
do (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) && (leftmost = p), p = p.next;
|
||||||
do (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) && (leftmost = p), p = p.next;
|
while (p !== start)
|
||||||
|
return leftmost;
|
||||||
|
}(list));
|
||||||
|
for(queue.sort(compareX), i = 0; i < queue.length; i++)(function(hole, outerNode) {
|
||||||
|
if (outerNode = function(hole, outerNode) {
|
||||||
|
var m, p, m1, p1 = outerNode, hx = hole.x, hy = hole.y, qx = -1 / 0;
|
||||||
|
do {
|
||||||
|
if (hy <= p1.y && hy >= p1.next.y && p1.next.y !== p1.y) {
|
||||||
|
var x = p1.x + (hy - p1.y) * (p1.next.x - p1.x) / (p1.next.y - p1.y);
|
||||||
|
if (x <= hx && x > qx) {
|
||||||
|
if (qx = x, x === hx) {
|
||||||
|
if (hy === p1.y) return p1;
|
||||||
|
if (hy === p1.next.y) return p1.next;
|
||||||
|
}
|
||||||
|
m1 = p1.x < p1.next.x ? p1 : p1.next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p1 = p1.next;
|
||||||
|
}while (p1 !== outerNode)
|
||||||
|
if (!m1) return null;
|
||||||
|
if (hx === qx) return m1;
|
||||||
|
var tan, stop = m1, mx = m1.x, my = m1.y, tanMin = 1 / 0;
|
||||||
|
p1 = m1;
|
||||||
|
do hx >= p1.x && p1.x >= mx && hx !== p1.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p1.x, p1.y) && (tan = Math.abs(hy - p1.y) / (hx - p1.x), locallyInside(p1, hole) && (tan < tanMin || tan === tanMin && (p1.x > m1.x || p1.x === m1.x && (m = m1, p = p1, 0 > area(m.prev, m, p.prev) && 0 > area(p.next, m, m.next)))) && (m1 = p1, tanMin = tan)), p1 = p1.next;
|
||||||
|
while (p1 !== stop)
|
||||||
|
return m1;
|
||||||
|
}(hole, outerNode)) {
|
||||||
|
var b = splitPolygon(outerNode, hole);
|
||||||
|
filterPoints(outerNode, outerNode.next), filterPoints(b, b.next);
|
||||||
|
}
|
||||||
|
})(queue[i], outerNode), outerNode = filterPoints(outerNode, outerNode.next);
|
||||||
|
return outerNode;
|
||||||
|
}(data, holeIndices, outerNode, dim)), data.length > 80 * dim) {
|
||||||
|
minX = maxX = data[0], minY = maxY = data[1];
|
||||||
|
for(var i = dim; i < outerLen; i += dim)x = data[i], y = data[i + 1], x < minX && (minX = x), y < minY && (minY = y), x > maxX && (maxX = x), y > maxY && (maxY = y);
|
||||||
|
invSize = 0 !== (invSize = Math.max(maxX - minX, maxY - minY)) ? 1 / invSize : 0;
|
||||||
|
}
|
||||||
|
return function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
|
||||||
|
if (ear) {
|
||||||
|
!pass && invSize && function(start, minX, minY, invSize) {
|
||||||
|
var p = start;
|
||||||
|
do null === p.z && (p.z = zOrder(p.x, p.y, minX, minY, invSize)), p.prevZ = p.prev, p.nextZ = p.next, p = p.next;
|
||||||
while (p !== start)
|
while (p !== start)
|
||||||
return leftmost;
|
p.prevZ.nextZ = null, p.prevZ = null, function(list) {
|
||||||
}(list));
|
var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;
|
||||||
for(queue.sort(compareX), i = 0; i < queue.length; i++)(function(hole, outerNode) {
|
|
||||||
if (outerNode = function(hole, outerNode) {
|
|
||||||
var m, p, m1, p1 = outerNode, hx = hole.x, hy = hole.y, qx = -1 / 0;
|
|
||||||
do {
|
do {
|
||||||
if (hy <= p1.y && hy >= p1.next.y && p1.next.y !== p1.y) {
|
for(p = list, list = null, tail = null, numMerges = 0; p;){
|
||||||
var x = p1.x + (hy - p1.y) * (p1.next.x - p1.x) / (p1.next.y - p1.y);
|
for(numMerges++, q = p, pSize = 0, i = 0; i < inSize && (pSize++, q = q.nextZ); i++);
|
||||||
if (x <= hx && x > qx) {
|
for(qSize = inSize; pSize > 0 || qSize > 0 && q;)0 !== pSize && (0 === qSize || !q || p.z <= q.z) ? (e = p, p = p.nextZ, pSize--) : (e = q, q = q.nextZ, qSize--), tail ? tail.nextZ = e : list = e, e.prevZ = tail, tail = e;
|
||||||
if (qx = x, x === hx) {
|
p = q;
|
||||||
if (hy === p1.y) return p1;
|
|
||||||
if (hy === p1.next.y) return p1.next;
|
|
||||||
}
|
|
||||||
m1 = p1.x < p1.next.x ? p1 : p1.next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
p1 = p1.next;
|
tail.nextZ = null, inSize *= 2;
|
||||||
}while (p1 !== outerNode)
|
}while (numMerges > 1)
|
||||||
if (!m1) return null;
|
}(p);
|
||||||
if (hx === qx) return m1;
|
}(ear, minX, minY, invSize);
|
||||||
var tan, stop = m1, mx = m1.x, my = m1.y, tanMin = 1 / 0;
|
for(var prev, next, stop = ear; ear.prev !== ear.next;){
|
||||||
p1 = m1;
|
if (prev = ear.prev, next = ear.next, invSize ? function(ear, minX, minY, invSize) {
|
||||||
do hx >= p1.x && p1.x >= mx && hx !== p1.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p1.x, p1.y) && (tan = Math.abs(hy - p1.y) / (hx - p1.x), locallyInside(p1, hole) && (tan < tanMin || tan === tanMin && (p1.x > m1.x || p1.x === m1.x && (m = m1, p = p1, 0 > area(m.prev, m, p.prev) && 0 > area(p.next, m, m.next)))) && (m1 = p1, tanMin = tan)), p1 = p1.next;
|
var a = ear.prev, c = ear.next;
|
||||||
while (p1 !== stop)
|
if (area(a, ear, c) >= 0) return !1;
|
||||||
return m1;
|
for(var minTX = a.x < ear.x ? a.x < c.x ? a.x : c.x : ear.x < c.x ? ear.x : c.x, minTY = a.y < ear.y ? a.y < c.y ? a.y : c.y : ear.y < c.y ? ear.y : c.y, maxTX = a.x > ear.x ? a.x > c.x ? a.x : c.x : ear.x > c.x ? ear.x : c.x, maxTY = a.y > ear.y ? a.y > c.y ? a.y : c.y : ear.y > c.y ? ear.y : c.y, minZ = zOrder(minTX, minTY, minX, minY, invSize), maxZ = zOrder(maxTX, maxTY, minX, minY, invSize), p = ear.prevZ, n = ear.nextZ; p && p.z >= minZ && n && n.z <= maxZ;){
|
||||||
}(hole, outerNode)) {
|
if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0 || (p = p.prevZ, n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0)) return !1;
|
||||||
var b = splitPolygon(outerNode, hole);
|
n = n.nextZ;
|
||||||
filterPoints(outerNode, outerNode.next), filterPoints(b, b.next);
|
}
|
||||||
|
for(; p && p.z >= minZ;){
|
||||||
|
if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return !1;
|
||||||
|
p = p.prevZ;
|
||||||
|
}
|
||||||
|
for(; n && n.z <= maxZ;){
|
||||||
|
if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return !1;
|
||||||
|
n = n.nextZ;
|
||||||
|
}
|
||||||
|
return !0;
|
||||||
|
}(ear, minX, minY, invSize) : function(ear) {
|
||||||
|
var a = ear.prev, c = ear.next;
|
||||||
|
if (area(a, ear, c) >= 0) return !1;
|
||||||
|
for(var p = ear.next.next; p !== ear.prev;){
|
||||||
|
if (pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return !1;
|
||||||
|
p = p.next;
|
||||||
|
}
|
||||||
|
return !0;
|
||||||
|
}(ear)) {
|
||||||
|
triangles.push(prev.i / dim), triangles.push(ear.i / dim), triangles.push(next.i / dim), removeNode(ear), ear = next.next, stop = next.next;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
})(queue[i], outerNode), outerNode = filterPoints(outerNode, outerNode.next);
|
if ((ear = next) === stop) {
|
||||||
return outerNode;
|
pass ? 1 === pass ? earcutLinked(ear = function(start, triangles, dim) {
|
||||||
}(data, holeIndices, outerNode, dim)), data.length > 80 * dim) {
|
var p = start;
|
||||||
minX = maxX = data[0], minY = maxY = data[1];
|
|
||||||
for(var i = dim; i < outerLen; i += dim)x = data[i], y = data[i + 1], x < minX && (minX = x), y < minY && (minY = y), x > maxX && (maxX = x), y > maxY && (maxY = y);
|
|
||||||
invSize = 0 !== (invSize = Math.max(maxX - minX, maxY - minY)) ? 1 / invSize : 0;
|
|
||||||
}
|
|
||||||
return function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
|
|
||||||
if (ear) {
|
|
||||||
!pass && invSize && function(start, minX, minY, invSize) {
|
|
||||||
var p = start;
|
|
||||||
do null === p.z && (p.z = zOrder(p.x, p.y, minX, minY, invSize)), p.prevZ = p.prev, p.nextZ = p.next, p = p.next;
|
|
||||||
while (p !== start)
|
|
||||||
p.prevZ.nextZ = null, p.prevZ = null, function(list) {
|
|
||||||
var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;
|
|
||||||
do {
|
do {
|
||||||
for(p = list, list = null, tail = null, numMerges = 0; p;){
|
var a = p.prev, b = p.next.next;
|
||||||
for(numMerges++, q = p, pSize = 0, i = 0; i < inSize && (pSize++, q = q.nextZ); i++);
|
!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a) && (triangles.push(a.i / dim), triangles.push(p.i / dim), triangles.push(b.i / dim), removeNode(p), removeNode(p.next), p = start = b), p = p.next;
|
||||||
for(qSize = inSize; pSize > 0 || qSize > 0 && q;)0 !== pSize && (0 === qSize || !q || p.z <= q.z) ? (e = p, p = p.nextZ, pSize--) : (e = q, q = q.nextZ, qSize--), tail ? tail.nextZ = e : list = e, e.prevZ = tail, tail = e;
|
}while (p !== start)
|
||||||
p = q;
|
return filterPoints(p);
|
||||||
}
|
}(filterPoints(ear), triangles, dim), triangles, dim, minX, minY, invSize, 2) : 2 === pass && function(start, triangles, dim, minX, minY, invSize) {
|
||||||
tail.nextZ = null, inSize *= 2;
|
var a = start;
|
||||||
}while (numMerges > 1)
|
do {
|
||||||
}(p);
|
for(var a1, b, b1 = a.next.next; b1 !== a.prev;){
|
||||||
}(ear, minX, minY, invSize);
|
if (a.i !== b1.i && (a1 = a, b = b1, a1.next.i !== b.i && a1.prev.i !== b.i && !function(a, b) {
|
||||||
for(var prev, next, stop = ear; ear.prev !== ear.next;){
|
var p = a;
|
||||||
if (prev = ear.prev, next = ear.next, invSize ? function(ear, minX, minY, invSize) {
|
do {
|
||||||
var a = ear.prev, c = ear.next;
|
if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return !0;
|
||||||
if (area(a, ear, c) >= 0) return !1;
|
p = p.next;
|
||||||
for(var minTX = a.x < ear.x ? a.x < c.x ? a.x : c.x : ear.x < c.x ? ear.x : c.x, minTY = a.y < ear.y ? a.y < c.y ? a.y : c.y : ear.y < c.y ? ear.y : c.y, maxTX = a.x > ear.x ? a.x > c.x ? a.x : c.x : ear.x > c.x ? ear.x : c.x, maxTY = a.y > ear.y ? a.y > c.y ? a.y : c.y : ear.y > c.y ? ear.y : c.y, minZ = zOrder(minTX, minTY, minX, minY, invSize), maxZ = zOrder(maxTX, maxTY, minX, minY, invSize), p = ear.prevZ, n = ear.nextZ; p && p.z >= minZ && n && n.z <= maxZ;){
|
}while (p !== a)
|
||||||
if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0 || (p = p.prevZ, n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0)) return !1;
|
return !1;
|
||||||
n = n.nextZ;
|
}(a1, b) && (locallyInside(a1, b) && locallyInside(b, a1) && function(a, b) {
|
||||||
}
|
var p = a, inside = !1, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;
|
||||||
for(; p && p.z >= minZ;){
|
do p.y > py != p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x && (inside = !inside), p = p.next;
|
||||||
if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return !1;
|
while (p !== a)
|
||||||
p = p.prevZ;
|
return inside;
|
||||||
}
|
}(a1, b) && (area(a1.prev, a1, b.prev) || area(a1, b.prev, b)) || equals(a1, b) && area(a1.prev, a1, a1.next) > 0 && area(b.prev, b, b.next) > 0))) {
|
||||||
for(; n && n.z <= maxZ;){
|
var c = splitPolygon(a, b1);
|
||||||
if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return !1;
|
a = filterPoints(a, a.next), c = filterPoints(c, c.next), earcutLinked(a, triangles, dim, minX, minY, invSize), earcutLinked(c, triangles, dim, minX, minY, invSize);
|
||||||
n = n.nextZ;
|
return;
|
||||||
}
|
|
||||||
return !0;
|
|
||||||
}(ear, minX, minY, invSize) : function(ear) {
|
|
||||||
var a = ear.prev, c = ear.next;
|
|
||||||
if (area(a, ear, c) >= 0) return !1;
|
|
||||||
for(var p = ear.next.next; p !== ear.prev;){
|
|
||||||
if (pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return !1;
|
|
||||||
p = p.next;
|
|
||||||
}
|
|
||||||
return !0;
|
|
||||||
}(ear)) {
|
|
||||||
triangles.push(prev.i / dim), triangles.push(ear.i / dim), triangles.push(next.i / dim), removeNode(ear), ear = next.next, stop = next.next;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((ear = next) === stop) {
|
|
||||||
pass ? 1 === pass ? earcutLinked(ear = function(start, triangles, dim) {
|
|
||||||
var p = start;
|
|
||||||
do {
|
|
||||||
var a = p.prev, b = p.next.next;
|
|
||||||
!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a) && (triangles.push(a.i / dim), triangles.push(p.i / dim), triangles.push(b.i / dim), removeNode(p), removeNode(p.next), p = start = b), p = p.next;
|
|
||||||
}while (p !== start)
|
|
||||||
return filterPoints(p);
|
|
||||||
}(filterPoints(ear), triangles, dim), triangles, dim, minX, minY, invSize, 2) : 2 === pass && function(start, triangles, dim, minX, minY, invSize) {
|
|
||||||
var a = start;
|
|
||||||
do {
|
|
||||||
for(var a1, b, b1 = a.next.next; b1 !== a.prev;){
|
|
||||||
if (a.i !== b1.i && (a1 = a, b = b1, a1.next.i !== b.i && a1.prev.i !== b.i && !function(a, b) {
|
|
||||||
var p = a;
|
|
||||||
do {
|
|
||||||
if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return !0;
|
|
||||||
p = p.next;
|
|
||||||
}while (p !== a)
|
|
||||||
return !1;
|
|
||||||
}(a1, b) && (locallyInside(a1, b) && locallyInside(b, a1) && function(a, b) {
|
|
||||||
var p = a, inside = !1, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;
|
|
||||||
do p.y > py != p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x && (inside = !inside), p = p.next;
|
|
||||||
while (p !== a)
|
|
||||||
return inside;
|
|
||||||
}(a1, b) && (area(a1.prev, a1, b.prev) || area(a1, b.prev, b)) || equals(a1, b) && area(a1.prev, a1, a1.next) > 0 && area(b.prev, b, b.next) > 0))) {
|
|
||||||
var c = splitPolygon(a, b1);
|
|
||||||
a = filterPoints(a, a.next), c = filterPoints(c, c.next), earcutLinked(a, triangles, dim, minX, minY, invSize), earcutLinked(c, triangles, dim, minX, minY, invSize);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
b1 = b1.next;
|
|
||||||
}
|
}
|
||||||
a = a.next;
|
b1 = b1.next;
|
||||||
}while (a !== start)
|
}
|
||||||
}(ear, triangles, dim, minX, minY, invSize) : earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
|
a = a.next;
|
||||||
break;
|
}while (a !== start)
|
||||||
}
|
}(ear, triangles, dim, minX, minY, invSize) : earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}(outerNode, triangles, dim, minX, minY, invSize), triangles;
|
}
|
||||||
}
|
}(outerNode, triangles, dim, minX, minY, invSize), triangles;
|
||||||
};
|
};
|
||||||
function linkedList(data, start, end, dim, clockwise) {
|
function linkedList(data, start, end, dim, clockwise) {
|
||||||
var i, last;
|
var i, last;
|
||||||
@ -8820,7 +8814,7 @@
|
|||||||
var holeIndex = contour.length;
|
var holeIndex = contour.length;
|
||||||
holes.forEach(removeDupEndPts);
|
holes.forEach(removeDupEndPts);
|
||||||
for(var i = 0; i < holes.length; i++)holeIndices.push(holeIndex), holeIndex += holes[i].length, addContour(vertices, holes[i]);
|
for(var i = 0; i < holes.length; i++)holeIndices.push(holeIndex), holeIndex += holes[i].length, addContour(vertices, holes[i]);
|
||||||
for(var triangles = Earcut.triangulate(vertices, holeIndices), _i = 0; _i < triangles.length; _i += 3)faces.push(triangles.slice(_i, _i + 3));
|
for(var triangles = Earcut_triangulate(vertices, holeIndices), _i = 0; _i < triangles.length; _i += 3)faces.push(triangles.slice(_i, _i + 3));
|
||||||
return faces;
|
return faces;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -12117,27 +12117,23 @@
|
|||||||
min > globalMax - size ? globalMax - size : Math.max(min, globalMin),
|
min > globalMax - size ? globalMax - size : Math.max(min, globalMin),
|
||||||
max < globalMin + size ? globalMin + size : Math.min(max, globalMax)
|
max < globalMin + size ? globalMin + size : Math.min(max, globalMax)
|
||||||
];
|
];
|
||||||
}, fallbackProps = {
|
}, fallbackProps_brushAreaStyle = {
|
||||||
brushAreaStyle: {
|
stroke: "none",
|
||||||
stroke: "none",
|
fill: "black",
|
||||||
fill: "black",
|
opacity: function(_ref) {
|
||||||
opacity: function(_ref) {
|
return _ref.active ? 0.2 : 0.1;
|
||||||
return _ref.active ? 0.2 : 0.1;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
brushStyle: {
|
|
||||||
pointerEvents: "none",
|
|
||||||
stroke: "none",
|
|
||||||
fill: "black",
|
|
||||||
opacity: function(_ref2) {
|
|
||||||
return _ref2.active ? 0.4 : 0.3;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleStyle: {
|
|
||||||
pointerEvents: "none",
|
|
||||||
stroke: "none",
|
|
||||||
fill: "none"
|
|
||||||
}
|
}
|
||||||
|
}, fallbackProps_brushStyle = {
|
||||||
|
pointerEvents: "none",
|
||||||
|
stroke: "none",
|
||||||
|
fill: "black",
|
||||||
|
opacity: function(_ref2) {
|
||||||
|
return _ref2.active ? 0.4 : 0.3;
|
||||||
|
}
|
||||||
|
}, fallbackProps_handleStyle = {
|
||||||
|
pointerEvents: "none",
|
||||||
|
stroke: "none",
|
||||||
|
fill: "none"
|
||||||
}, VictoryBrushLine = function(_React$Component) {
|
}, VictoryBrushLine = function(_React$Component) {
|
||||||
var protoProps;
|
var protoProps;
|
||||||
function VictoryBrushLine() {
|
function VictoryBrushLine() {
|
||||||
@ -12225,7 +12221,7 @@
|
|||||||
value: function(props) {
|
value: function(props) {
|
||||||
var handleComponent = props.handleComponent, handleStyle = props.handleStyle, id = props.id, brushDomain = props.brushDomain, _props$datum = props.datum, datum = void 0 === _props$datum ? {} : _props$datum, _props$activeBrushes2 = props.activeBrushes, activeBrushes = void 0 === _props$activeBrushes2 ? {} : _props$activeBrushes2;
|
var handleComponent = props.handleComponent, handleStyle = props.handleStyle, id = props.id, brushDomain = props.brushDomain, _props$datum = props.datum, datum = void 0 === _props$datum ? {} : _props$datum, _props$activeBrushes2 = props.activeBrushes, activeBrushes = void 0 === _props$activeBrushes2 ? {} : _props$activeBrushes2;
|
||||||
if (!brushDomain) return null;
|
if (!brushDomain) return null;
|
||||||
var handleDimensions = this.getHandleDimensions(props), style = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, fallbackProps.handleStyle, handleStyle), minDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({
|
var handleDimensions = this.getHandleDimensions(props), style = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, fallbackProps_handleStyle, handleStyle), minDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||||
handleValue: victory_core__WEBPACK_IMPORTED_MODULE_6__.Collection.getMinValue(brushDomain)
|
handleValue: victory_core__WEBPACK_IMPORTED_MODULE_6__.Collection.getMinValue(brushDomain)
|
||||||
}, datum), maxDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({
|
}, datum), maxDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||||
handleValue: victory_core__WEBPACK_IMPORTED_MODULE_6__.Collection.getMaxValue(brushDomain)
|
handleValue: victory_core__WEBPACK_IMPORTED_MODULE_6__.Collection.getMaxValue(brushDomain)
|
||||||
@ -12253,7 +12249,7 @@
|
|||||||
value: function(props) {
|
value: function(props) {
|
||||||
var brushComponent = props.brushComponent, brushStyle = props.brushStyle, _props$activeBrushes3 = props.activeBrushes, _props$datum2 = props.datum;
|
var brushComponent = props.brushComponent, brushStyle = props.brushStyle, _props$activeBrushes3 = props.activeBrushes, _props$datum2 = props.datum;
|
||||||
if (!props.brushDomain) return null;
|
if (!props.brushDomain) return null;
|
||||||
var brushWidth = props.brushWidth || props.width, rectDimensions = this.getRectDimensions(props, brushWidth), baseStyle = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, fallbackProps.brushStyle, brushStyle), style = victory_core__WEBPACK_IMPORTED_MODULE_6__.Helpers.evaluateStyle(baseStyle, {
|
var brushWidth = props.brushWidth || props.width, rectDimensions = this.getRectDimensions(props, brushWidth), baseStyle = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, fallbackProps_brushStyle, brushStyle), style = victory_core__WEBPACK_IMPORTED_MODULE_6__.Helpers.evaluateStyle(baseStyle, {
|
||||||
datum: void 0 === _props$datum2 ? {} : _props$datum2,
|
datum: void 0 === _props$datum2 ? {} : _props$datum2,
|
||||||
active: (void 0 === _props$activeBrushes3 ? {} : _props$activeBrushes3).brush
|
active: (void 0 === _props$activeBrushes3 ? {} : _props$activeBrushes3).brush
|
||||||
}), brushProps = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({
|
}), brushProps = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||||
@ -12267,7 +12263,7 @@
|
|||||||
value: function(props) {
|
value: function(props) {
|
||||||
var brushAreaComponent = props.brushAreaComponent, brushAreaStyle = props.brushAreaStyle, _props$activeBrushes4 = props.activeBrushes, _props$datum3 = props.datum, brushAreaWidth = props.brushAreaWidth || props.width, cursor = this.getCursor(props), rectDimensions = this.getRectDimensions(props, brushAreaWidth, getFullDomain(props)), baseStyle = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({
|
var brushAreaComponent = props.brushAreaComponent, brushAreaStyle = props.brushAreaStyle, _props$activeBrushes4 = props.activeBrushes, _props$datum3 = props.datum, brushAreaWidth = props.brushAreaWidth || props.width, cursor = this.getCursor(props), rectDimensions = this.getRectDimensions(props, brushAreaWidth, getFullDomain(props)), baseStyle = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||||
cursor: cursor
|
cursor: cursor
|
||||||
}, fallbackProps.brushAreaStyle, brushAreaStyle), style = victory_core__WEBPACK_IMPORTED_MODULE_6__.Helpers.evaluateStyle(baseStyle, {
|
}, fallbackProps_brushAreaStyle, brushAreaStyle), style = victory_core__WEBPACK_IMPORTED_MODULE_6__.Helpers.evaluateStyle(baseStyle, {
|
||||||
datum: void 0 === _props$datum3 ? {} : _props$datum3,
|
datum: void 0 === _props$datum3 ? {} : _props$datum3,
|
||||||
active: (void 0 === _props$activeBrushes4 ? {} : _props$activeBrushes4).brushArea
|
active: (void 0 === _props$activeBrushes4 ? {} : _props$activeBrushes4).brushArea
|
||||||
}), brushAreaProps = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({
|
}), brushAreaProps = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||||
|
@ -2094,6 +2094,7 @@ console.log(a, b);"###;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[ignore = "Function (anonymous)"]
|
||||||
fn terser_hoist_props_contains_this_2() {
|
fn terser_hoist_props_contains_this_2() {
|
||||||
let src = r###"var o = {
|
let src = r###"var o = {
|
||||||
u: function () {
|
u: function () {
|
||||||
|
@ -15,7 +15,37 @@ push({
|
|||||||
}();
|
}();
|
||||||
},
|
},
|
||||||
"App.jsx": function() {
|
"App.jsx": function() {
|
||||||
var ShaderChunk = {};
|
var ShaderChunk = {
|
||||||
|
shadowmap_pars_vertex: "",
|
||||||
|
shadowmap_vertex: "",
|
||||||
|
shadowmask_pars_fragment: "",
|
||||||
|
skinbase_vertex: "",
|
||||||
|
skinning_pars_vertex: "",
|
||||||
|
skinning_vertex: "",
|
||||||
|
skinnormal_vertex: "",
|
||||||
|
specularmap_fragment: "",
|
||||||
|
specularmap_pars_fragment: "",
|
||||||
|
tonemapping_fragment: "",
|
||||||
|
tonemapping_pars_fragment: "",
|
||||||
|
uv_pars_fragment: "",
|
||||||
|
uv_pars_vertex: "",
|
||||||
|
uv_vertex: "",
|
||||||
|
uv2_pars_fragment: "",
|
||||||
|
uv2_pars_vertex: "",
|
||||||
|
uv2_vertex: "",
|
||||||
|
worldpos_vertex: "",
|
||||||
|
cube_frag: "",
|
||||||
|
cube_vert: "",
|
||||||
|
depth_frag: "",
|
||||||
|
depth_vert: "",
|
||||||
|
distanceRGBA_frag: "",
|
||||||
|
distanceRGBA_vert: "",
|
||||||
|
equirect_frag: "",
|
||||||
|
equirect_vert: "",
|
||||||
|
linedashed_frag: "",
|
||||||
|
linedashed_vert: "",
|
||||||
|
meshphong_frag: ""
|
||||||
|
};
|
||||||
ShaderLib.physical = {
|
ShaderLib.physical = {
|
||||||
x: ShaderChunk.meshphysical_frag
|
x: ShaderChunk.meshphysical_frag
|
||||||
};
|
};
|
||||||
|
@ -4953,7 +4953,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]), Code39Reader;
|
]), Code39Reader;
|
||||||
}(barcode_reader), get = __webpack_require__(13), get_default = __webpack_require__.n(get), code_39_vin_reader = function(_Code39Reader) {
|
}(barcode_reader), get = __webpack_require__(13), get_default = __webpack_require__.n(get), patterns_IOQ = /[IOQ]/g, patterns_AZ09 = /[A-Z0-9]{17}/, code_39_vin_reader = function(_Code39Reader) {
|
||||||
inherits_default()(Code39VINReader, _Code39Reader);
|
inherits_default()(Code39VINReader, _Code39Reader);
|
||||||
var hasNativeReflectConstruct, _super = (hasNativeReflectConstruct = function() {
|
var hasNativeReflectConstruct, _super = (hasNativeReflectConstruct = function() {
|
||||||
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1;
|
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1;
|
||||||
@ -4988,7 +4988,7 @@
|
|||||||
var result = get_default()(getPrototypeOf_default()(Code39VINReader.prototype), "decode", this).call(this, row, start);
|
var result = get_default()(getPrototypeOf_default()(Code39VINReader.prototype), "decode", this).call(this, row, start);
|
||||||
if (!result) return null;
|
if (!result) return null;
|
||||||
var code = result.code;
|
var code = result.code;
|
||||||
return code ? (code = code.replace(/[IOQ]/g, "")).match(/[A-Z0-9]{17}/) ? this._checkChecksum(code) ? (result.code = code, result) : null : (console.log("Failed AZ09 pattern code:", code), null) : null;
|
return code ? (code = code.replace(patterns_IOQ, "")).match(patterns_AZ09) ? this._checkChecksum(code) ? (result.code = code, result) : null : (console.log("Failed AZ09 pattern code:", code), null) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]), Code39VINReader;
|
]), Code39VINReader;
|
||||||
@ -6249,7 +6249,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]), Code93Reader;
|
]), Code93Reader;
|
||||||
}(barcode_reader), code_32_reader = function(_Code39Reader) {
|
}(barcode_reader), code_32_reader_patterns_AEIO = /[AEIO]/g, code_32_reader = function(_Code39Reader) {
|
||||||
inherits_default()(Code32Reader, _Code39Reader);
|
inherits_default()(Code32Reader, _Code39Reader);
|
||||||
var hasNativeReflectConstruct, _super = (hasNativeReflectConstruct = function() {
|
var hasNativeReflectConstruct, _super = (hasNativeReflectConstruct = function() {
|
||||||
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1;
|
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1;
|
||||||
@ -6293,7 +6293,7 @@
|
|||||||
var result = get_default()(getPrototypeOf_default()(Code32Reader.prototype), "decode", this).call(this, row, start);
|
var result = get_default()(getPrototypeOf_default()(Code32Reader.prototype), "decode", this).call(this, row, start);
|
||||||
if (!result) return null;
|
if (!result) return null;
|
||||||
var code = result.code;
|
var code = result.code;
|
||||||
if (!code || (code = code.replace(/[AEIO]/g, ""), !this._checkChecksum(code))) return null;
|
if (!code || (code = code.replace(code_32_reader_patterns_AEIO, ""), !this._checkChecksum(code))) return null;
|
||||||
var code32 = this._decodeCode32(code);
|
var code32 = this._decodeCode32(code);
|
||||||
return code32 ? (result.code = code32, result) : null;
|
return code32 ? (result.code = code32, result) : null;
|
||||||
}
|
}
|
||||||
|
@ -1157,27 +1157,16 @@
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}, textTrackConverter = {
|
}, textTrackConverter_textTracksToJson = function(tech) {
|
||||||
textTracksToJson: function(tech) {
|
var trackEls = tech.$$("track"), trackObjs = Array.prototype.map.call(trackEls, function(t) {
|
||||||
var trackEls = tech.$$("track"), trackObjs = Array.prototype.map.call(trackEls, function(t) {
|
return t.track;
|
||||||
return t.track;
|
});
|
||||||
});
|
return Array.prototype.map.call(trackEls, function(trackEl) {
|
||||||
return Array.prototype.map.call(trackEls, function(trackEl) {
|
var json = trackToJson_(trackEl.track);
|
||||||
var json = trackToJson_(trackEl.track);
|
return trackEl.src && (json.src = trackEl.src), json;
|
||||||
return trackEl.src && (json.src = trackEl.src), json;
|
}).concat(Array.prototype.filter.call(tech.textTracks(), function(track) {
|
||||||
}).concat(Array.prototype.filter.call(tech.textTracks(), function(track) {
|
return -1 === trackObjs.indexOf(track);
|
||||||
return -1 === trackObjs.indexOf(track);
|
}).map(trackToJson_));
|
||||||
}).map(trackToJson_));
|
|
||||||
},
|
|
||||||
jsonToTextTracks: function(json, tech) {
|
|
||||||
return json.forEach(function(track) {
|
|
||||||
var addedTrack = tech.addRemoteTextTrack(track).track;
|
|
||||||
!track.src && track.cues && track.cues.forEach(function(cue) {
|
|
||||||
return addedTrack.addCue(cue);
|
|
||||||
});
|
|
||||||
}), tech.textTracks();
|
|
||||||
},
|
|
||||||
trackToJson_: trackToJson_
|
|
||||||
}, MODAL_CLASS_NAME = "vjs-modal-dialog", ModalDialog = function(_Component) {
|
}, MODAL_CLASS_NAME = "vjs-modal-dialog", ModalDialog = function(_Component) {
|
||||||
function ModalDialog(player, options) {
|
function ModalDialog(player, options) {
|
||||||
var _this;
|
var _this;
|
||||||
@ -5291,7 +5280,7 @@
|
|||||||
var ratioParts = (void 0 !== this.aspectRatio_ && "auto" !== this.aspectRatio_ ? this.aspectRatio_ : this.videoWidth() > 0 ? this.videoWidth() + ":" + this.videoHeight() : "16:9").split(":"), ratioMultiplier = ratioParts[1] / ratioParts[0];
|
var ratioParts = (void 0 !== this.aspectRatio_ && "auto" !== this.aspectRatio_ ? this.aspectRatio_ : this.videoWidth() > 0 ? this.videoWidth() + ":" + this.videoHeight() : "16:9").split(":"), ratioMultiplier = ratioParts[1] / ratioParts[0];
|
||||||
width = void 0 !== this.width_ ? this.width_ : void 0 !== this.height_ ? this.height_ / ratioMultiplier : this.videoWidth() || 300, height = void 0 !== this.height_ ? this.height_ : width * ratioMultiplier, idClass = /^[^a-zA-Z]/.test(this.id()) ? "dimensions-" + this.id() : this.id() + "-dimensions", this.addClass(idClass), setTextContent(this.styleEl_, "\n ." + idClass + " {\n width: " + width + "px;\n height: " + height + "px;\n }\n\n ." + idClass + ".vjs-fluid {\n padding-top: " + 100 * ratioMultiplier + "%;\n }\n ");
|
width = void 0 !== this.width_ ? this.width_ : void 0 !== this.height_ ? this.height_ / ratioMultiplier : this.videoWidth() || 300, height = void 0 !== this.height_ ? this.height_ : width * ratioMultiplier, idClass = /^[^a-zA-Z]/.test(this.id()) ? "dimensions-" + this.id() : this.id() + "-dimensions", this.addClass(idClass), setTextContent(this.styleEl_, "\n ." + idClass + " {\n width: " + width + "px;\n height: " + height + "px;\n }\n\n ." + idClass + ".vjs-fluid {\n padding-top: " + 100 * ratioMultiplier + "%;\n }\n ");
|
||||||
}, _proto.loadTech_ = function(techName, source) {
|
}, _proto.loadTech_ = function(techName, source) {
|
||||||
var _this4 = this;
|
var json, tech, _this4 = this;
|
||||||
this.tech_ && this.unloadTech_();
|
this.tech_ && this.unloadTech_();
|
||||||
var titleTechName = toTitleCase$1(techName), camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1);
|
var titleTechName = toTitleCase$1(techName), camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1);
|
||||||
"Html5" !== titleTechName && this.tag && (Tech.getTech("Html5").disposeMediaElement(this.tag), this.tag.player = null, this.tag = null), this.techName_ = titleTechName, this.isReady_ = !1;
|
"Html5" !== titleTechName && this.tag && (Tech.getTech("Html5").disposeMediaElement(this.tag), this.tag.player = null, this.tag = null), this.techName_ = titleTechName, this.isReady_ = !1;
|
||||||
@ -5322,7 +5311,12 @@
|
|||||||
}), assign(techOptions, this.options_[titleTechName]), assign(techOptions, this.options_[camelTechName]), assign(techOptions, this.options_[techName.toLowerCase()]), this.tag && (techOptions.tag = this.tag), source && source.src === this.cache_.src && this.cache_.currentTime > 0 && (techOptions.startTime = this.cache_.currentTime);
|
}), assign(techOptions, this.options_[titleTechName]), assign(techOptions, this.options_[camelTechName]), assign(techOptions, this.options_[techName.toLowerCase()]), this.tag && (techOptions.tag = this.tag), source && source.src === this.cache_.src && this.cache_.currentTime > 0 && (techOptions.startTime = this.cache_.currentTime);
|
||||||
var TechClass = Tech.getTech(techName);
|
var TechClass = Tech.getTech(techName);
|
||||||
if (!TechClass) throw Error("No Tech named '" + titleTechName + "' exists! '" + titleTechName + "' should be registered using videojs.registerTech()'");
|
if (!TechClass) throw Error("No Tech named '" + titleTechName + "' exists! '" + titleTechName + "' should be registered using videojs.registerTech()'");
|
||||||
this.tech_ = new TechClass(techOptions), this.tech_.ready(bind(this, this.handleTechReady_), !0), textTrackConverter.jsonToTextTracks(this.textTracksJson_ || [], this.tech_), TECH_EVENTS_RETRIGGER.forEach(function(event) {
|
this.tech_ = new TechClass(techOptions), this.tech_.ready(bind(this, this.handleTechReady_), !0), json = this.textTracksJson_ || [], tech = this.tech_, json.forEach(function(track) {
|
||||||
|
var addedTrack = tech.addRemoteTextTrack(track).track;
|
||||||
|
!track.src && track.cues && track.cues.forEach(function(cue) {
|
||||||
|
return addedTrack.addCue(cue);
|
||||||
|
});
|
||||||
|
}), tech.textTracks(), TECH_EVENTS_RETRIGGER.forEach(function(event) {
|
||||||
_this4.on(_this4.tech_, event, function(e) {
|
_this4.on(_this4.tech_, event, function(e) {
|
||||||
return _this4["handleTech" + toTitleCase$1(event) + "_"](e);
|
return _this4["handleTech" + toTitleCase$1(event) + "_"](e);
|
||||||
});
|
});
|
||||||
@ -5377,7 +5371,7 @@
|
|||||||
ALL.names.forEach(function(name) {
|
ALL.names.forEach(function(name) {
|
||||||
var props = ALL[name];
|
var props = ALL[name];
|
||||||
_this5[props.privateName] = _this5[props.getterName]();
|
_this5[props.privateName] = _this5[props.getterName]();
|
||||||
}), this.textTracksJson_ = textTrackConverter.textTracksToJson(this.tech_), this.isReady_ = !1, this.tech_.dispose(), this.tech_ = !1, this.isPosterFromTech_ && (this.poster_ = "", this.trigger("posterchange")), this.isPosterFromTech_ = !1;
|
}), this.textTracksJson_ = textTrackConverter_textTracksToJson(this.tech_), this.isReady_ = !1, this.tech_.dispose(), this.tech_ = !1, this.isPosterFromTech_ && (this.poster_ = "", this.trigger("posterchange")), this.isPosterFromTech_ = !1;
|
||||||
}, _proto.tech = function(safety) {
|
}, _proto.tech = function(safety) {
|
||||||
return void 0 === safety && log$1.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"), this.tech_;
|
return void 0 === safety && log$1.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"), this.tech_;
|
||||||
}, _proto.addTechControlsListeners_ = function() {
|
}, _proto.addTechControlsListeners_ = function() {
|
||||||
@ -7581,7 +7575,7 @@
|
|||||||
}, getWorkerString = function(fn) {
|
}, getWorkerString = function(fn) {
|
||||||
return fn.toString().replace(/^function.+?{/, "").slice(0, -1);
|
return fn.toString().replace(/^function.+?{/, "").slice(0, -1);
|
||||||
}, TransmuxWorker = factory(transform(getWorkerString(function() {
|
}, TransmuxWorker = factory(transform(getWorkerString(function() {
|
||||||
var _TransportPacketStream, _TransportParseStream, _ElementaryStream, _AdtsStream, ExpGolomb, _H264Stream, _NalByteStream, PROFILES_WITH_OPTIONAL_SPS_DATA, _AacStream, _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream, timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, Stream = function() {
|
var _TransportPacketStream, _TransportParseStream, _ElementaryStream, _AdtsStream, ExpGolomb, _H264Stream, _NalByteStream, PROFILES_WITH_OPTIONAL_SPS_DATA, _AacStream, _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream, startTime, getTimescaleFromMediaHeader, Stream = function() {
|
||||||
this.init = function() {
|
this.init = function() {
|
||||||
var listeners = {};
|
var listeners = {};
|
||||||
this.on = function(type, listener) {
|
this.on = function(type, listener) {
|
||||||
@ -8404,10 +8398,8 @@
|
|||||||
return "audio" === track.type ? audioTrun(track, offset) : videoTrun(track, offset);
|
return "audio" === track.type ? audioTrun(track, offset) : videoTrun(track, offset);
|
||||||
};
|
};
|
||||||
var mp4Generator = {
|
var mp4Generator = {
|
||||||
ftyp: ftyp,
|
|
||||||
mdat: mdat,
|
mdat: mdat,
|
||||||
moof: moof,
|
moof: moof,
|
||||||
moov: moov,
|
|
||||||
initSegment: function(tracks) {
|
initSegment: function(tracks) {
|
||||||
var result, fileType = ftyp(), movie = moov(tracks);
|
var result, fileType = ftyp(), movie = moov(tracks);
|
||||||
return (result = new Uint8Array(fileType.byteLength + movie.byteLength)).set(fileType), result.set(movie, fileType.byteLength), result;
|
return (result = new Uint8Array(fileType.byteLength + movie.byteLength)).set(fileType), result.set(movie, fileType.byteLength), result;
|
||||||
@ -8453,15 +8445,6 @@
|
|||||||
var h, i, j, currentGop, currentFrame, currentNal, dataOffset = 0, data = new Uint8Array(gops.byteLength + 4 * gops.nalCount), view = new DataView(data.buffer);
|
var h, i, j, currentGop, currentFrame, currentNal, dataOffset = 0, data = new Uint8Array(gops.byteLength + 4 * gops.nalCount), view = new DataView(data.buffer);
|
||||||
for(h = 0; h < gops.length; h++)for(i = 0, currentGop = gops[h]; i < currentGop.length; i++)for(j = 0, currentFrame = currentGop[i]; j < currentFrame.length; j++)currentNal = currentFrame[j], view.setUint32(dataOffset, currentNal.data.byteLength), dataOffset += 4, data.set(currentNal.data, dataOffset), dataOffset += currentNal.data.byteLength;
|
for(h = 0; h < gops.length; h++)for(i = 0, currentGop = gops[h]; i < currentGop.length; i++)for(j = 0, currentFrame = currentGop[i]; j < currentFrame.length; j++)currentNal = currentFrame[j], view.setUint32(dataOffset, currentNal.data.byteLength), dataOffset += 4, data.set(currentNal.data, dataOffset), dataOffset += currentNal.data.byteLength;
|
||||||
return data;
|
return data;
|
||||||
},
|
|
||||||
generateSampleTableForFrame: function(frame, baseDataOffset) {
|
|
||||||
var samples = [];
|
|
||||||
return samples.push(sampleForFrame(frame, baseDataOffset || 0)), samples;
|
|
||||||
},
|
|
||||||
concatenateNalDataForFrame: function(frame) {
|
|
||||||
var i, currentNal, dataOffset = 0, data = new Uint8Array(frame.byteLength + 4 * frame.length), view = new DataView(data.buffer);
|
|
||||||
for(i = 0; i < frame.length; i++)currentNal = frame[i], view.setUint32(dataOffset, currentNal.data.byteLength), dataOffset += 4, data.set(currentNal.data, dataOffset), dataOffset += currentNal.data.byteLength;
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
}, highPrefix = [
|
}, highPrefix = [
|
||||||
33,
|
33,
|
||||||
@ -8732,9 +8715,7 @@
|
|||||||
var clock = {
|
var clock = {
|
||||||
ONE_SECOND_IN_TS: 90000,
|
ONE_SECOND_IN_TS: 90000,
|
||||||
secondsToVideoTs: secondsToVideoTs,
|
secondsToVideoTs: secondsToVideoTs,
|
||||||
secondsToAudioTs: secondsToAudioTs,
|
|
||||||
videoTsToSeconds: videoTsToSeconds,
|
videoTsToSeconds: videoTsToSeconds,
|
||||||
audioTsToSeconds: audioTsToSeconds,
|
|
||||||
audioTsToVideoTs: audioTsToVideoTs,
|
audioTsToVideoTs: audioTsToVideoTs,
|
||||||
videoTsToAudioTs: videoTsToAudioTs,
|
videoTsToAudioTs: videoTsToAudioTs,
|
||||||
metadataTsToSeconds: metadataTsToSeconds
|
metadataTsToSeconds: metadataTsToSeconds
|
||||||
@ -8742,36 +8723,27 @@
|
|||||||
var i, sum = 0;
|
var i, sum = 0;
|
||||||
for(i = 0; i < array.length; i++)sum += array[i].data.byteLength;
|
for(i = 0; i < array.length; i++)sum += array[i].data.byteLength;
|
||||||
return sum;
|
return sum;
|
||||||
}, audioFrameUtils = {
|
}, audioFrameUtils_prefixWithSilence = function(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) {
|
||||||
prefixWithSilence: function(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) {
|
var baseMediaDecodeTimeTs, silentFrame, i, firstFrame, frameDuration = 0, audioFillFrameCount = 0, audioFillDuration = 0;
|
||||||
var baseMediaDecodeTimeTs, silentFrame, i, firstFrame, frameDuration = 0, audioFillFrameCount = 0, audioFillDuration = 0;
|
if (frames.length && (baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)), audioAppendStartTs && videoBaseMediaDecodeTime && (audioFillDuration = (audioFillFrameCount = Math.floor((baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime)) / frameDuration)) * frameDuration), !(audioFillFrameCount < 1) && !(audioFillDuration > clock.ONE_SECOND_IN_TS / 2))) {
|
||||||
if (frames.length && (baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)), audioAppendStartTs && videoBaseMediaDecodeTime && (audioFillDuration = (audioFillFrameCount = Math.floor((baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime)) / frameDuration)) * frameDuration), !(audioFillFrameCount < 1) && !(audioFillDuration > clock.ONE_SECOND_IN_TS / 2))) {
|
for((silentFrame = silence_1()[track.samplerate]) || (silentFrame = frames[0].data), i = 0; i < audioFillFrameCount; i++)firstFrame = frames[0], frames.splice(0, 0, {
|
||||||
for((silentFrame = silence_1()[track.samplerate]) || (silentFrame = frames[0].data), i = 0; i < audioFillFrameCount; i++)firstFrame = frames[0], frames.splice(0, 0, {
|
data: silentFrame,
|
||||||
data: silentFrame,
|
dts: firstFrame.dts - frameDuration,
|
||||||
dts: firstFrame.dts - frameDuration,
|
pts: firstFrame.pts - frameDuration
|
||||||
pts: firstFrame.pts - frameDuration
|
|
||||||
});
|
|
||||||
return track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)), audioFillDuration;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
trimAdtsFramesByEarliestDts: function(adtsFrames, track, earliestAllowedDts) {
|
|
||||||
return track.minSegmentDts >= earliestAllowedDts ? adtsFrames : (track.minSegmentDts = 1 / 0, adtsFrames.filter(function(currentFrame) {
|
|
||||||
return currentFrame.dts >= earliestAllowedDts && (track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts), track.minSegmentPts = track.minSegmentDts, !0);
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
generateSampleTable: function(frames) {
|
|
||||||
var i, samples = [];
|
|
||||||
for(i = 0; i < frames.length; i++)samples.push({
|
|
||||||
size: frames[i].data.byteLength,
|
|
||||||
duration: 1024
|
|
||||||
});
|
});
|
||||||
return samples;
|
return track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)), audioFillDuration;
|
||||||
},
|
|
||||||
concatenateFrameData: function(frames) {
|
|
||||||
var i, currentFrame, dataOffset = 0, data = new Uint8Array(sumFrameByteLengths(frames));
|
|
||||||
for(i = 0; i < frames.length; i++)currentFrame = frames[i], data.set(currentFrame.data, dataOffset), dataOffset += currentFrame.data.byteLength;
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
}, audioFrameUtils_generateSampleTable = function(frames) {
|
||||||
|
var i, samples = [];
|
||||||
|
for(i = 0; i < frames.length; i++)samples.push({
|
||||||
|
size: frames[i].data.byteLength,
|
||||||
|
duration: 1024
|
||||||
|
});
|
||||||
|
return samples;
|
||||||
|
}, audioFrameUtils_concatenateFrameData = function(frames) {
|
||||||
|
var i, currentFrame, dataOffset = 0, data = new Uint8Array(sumFrameByteLengths(frames));
|
||||||
|
for(i = 0; i < frames.length; i++)currentFrame = frames[i], data.set(currentFrame.data, dataOffset), dataOffset += currentFrame.data.byteLength;
|
||||||
|
return data;
|
||||||
}, ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS, trackDecodeInfo = {
|
}, ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS, trackDecodeInfo = {
|
||||||
clearDtsInfo: function(track) {
|
clearDtsInfo: function(track) {
|
||||||
delete track.minSegmentDts, delete track.maxSegmentDts, delete track.minSegmentPts, delete track.maxSegmentPts;
|
delete track.minSegmentDts, delete track.maxSegmentDts, delete track.minSegmentPts, delete track.maxSegmentPts;
|
||||||
@ -8783,46 +8755,31 @@
|
|||||||
collectDtsInfo: function(track, data) {
|
collectDtsInfo: function(track, data) {
|
||||||
"number" == typeof data.pts && (void 0 === track.timelineStartInfo.pts && (track.timelineStartInfo.pts = data.pts), void 0 === track.minSegmentPts ? track.minSegmentPts = data.pts : track.minSegmentPts = Math.min(track.minSegmentPts, data.pts), void 0 === track.maxSegmentPts ? track.maxSegmentPts = data.pts : track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts)), "number" == typeof data.dts && (void 0 === track.timelineStartInfo.dts && (track.timelineStartInfo.dts = data.dts), void 0 === track.minSegmentDts ? track.minSegmentDts = data.dts : track.minSegmentDts = Math.min(track.minSegmentDts, data.dts), void 0 === track.maxSegmentDts ? track.maxSegmentDts = data.dts : track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts));
|
"number" == typeof data.pts && (void 0 === track.timelineStartInfo.pts && (track.timelineStartInfo.pts = data.pts), void 0 === track.minSegmentPts ? track.minSegmentPts = data.pts : track.minSegmentPts = Math.min(track.minSegmentPts, data.pts), void 0 === track.maxSegmentPts ? track.maxSegmentPts = data.pts : track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts)), "number" == typeof data.dts && (void 0 === track.timelineStartInfo.dts && (track.timelineStartInfo.dts = data.dts), void 0 === track.minSegmentDts ? track.minSegmentDts = data.dts : track.minSegmentDts = Math.min(track.minSegmentDts, data.dts), void 0 === track.maxSegmentDts ? track.maxSegmentDts = data.dts : track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts));
|
||||||
}
|
}
|
||||||
}, captionPacketParser = {
|
}, captionPacketParser_parseSei = function(bytes) {
|
||||||
parseSei: function(bytes) {
|
for(var i = 0, result = {
|
||||||
for(var i = 0, result = {
|
payloadType: -1,
|
||||||
payloadType: -1,
|
payloadSize: 0
|
||||||
payloadSize: 0
|
}, payloadType = 0, payloadSize = 0; i < bytes.byteLength && 128 !== bytes[i];){
|
||||||
}, payloadType = 0, payloadSize = 0; i < bytes.byteLength && 128 !== bytes[i];){
|
for(; 0xff === bytes[i];)payloadType += 255, i++;
|
||||||
for(; 0xff === bytes[i];)payloadType += 255, i++;
|
for(payloadType += bytes[i++]; 0xff === bytes[i];)payloadSize += 255, i++;
|
||||||
for(payloadType += bytes[i++]; 0xff === bytes[i];)payloadSize += 255, i++;
|
if (payloadSize += bytes[i++], !result.payload && 4 === payloadType) {
|
||||||
if (payloadSize += bytes[i++], !result.payload && 4 === payloadType) {
|
if ("GA94" === String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6])) {
|
||||||
if ("GA94" === String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6])) {
|
result.payloadType = payloadType, result.payloadSize = payloadSize, result.payload = bytes.subarray(i, i + payloadSize);
|
||||||
result.payloadType = payloadType, result.payloadSize = payloadSize, result.payload = bytes.subarray(i, i + payloadSize);
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
result.payload = void 0;
|
|
||||||
}
|
}
|
||||||
i += payloadSize, payloadType = 0, payloadSize = 0;
|
result.payload = void 0;
|
||||||
}
|
}
|
||||||
return result;
|
i += payloadSize, payloadType = 0, payloadSize = 0;
|
||||||
},
|
}
|
||||||
parseUserData: function(sei) {
|
return result;
|
||||||
return 181 !== sei.payload[0] || (sei.payload[1] << 8 | sei.payload[2]) != 49 || "GA94" !== String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) || 0x03 !== sei.payload[7] ? null : sei.payload.subarray(8, sei.payload.length - 1);
|
}, captionPacketParser_parseCaptionPackets = function(pts, userData) {
|
||||||
},
|
var i, count, offset, data, results = [];
|
||||||
parseCaptionPackets: function(pts, userData) {
|
if (!(0x40 & userData[0])) return results;
|
||||||
var i, count, offset, data, results = [];
|
for(i = 0, count = 0x1f & userData[0]; i < count; i++)data = {
|
||||||
if (!(0x40 & userData[0])) return results;
|
type: 0x03 & userData[(offset = 3 * i) + 2],
|
||||||
for(i = 0, count = 0x1f & userData[0]; i < count; i++)data = {
|
pts: pts
|
||||||
type: 0x03 & userData[(offset = 3 * i) + 2],
|
}, 0x04 & userData[offset + 2] && (data.ccData = userData[offset + 3] << 8 | userData[offset + 4], results.push(data));
|
||||||
pts: pts
|
return results;
|
||||||
}, 0x04 & userData[offset + 2] && (data.ccData = userData[offset + 3] << 8 | userData[offset + 4], results.push(data));
|
|
||||||
return results;
|
|
||||||
},
|
|
||||||
discardEmulationPreventionBytes: function(data) {
|
|
||||||
for(var newLength, newData, length = data.byteLength, emulationPreventionBytesPositions = [], i = 1; i < length - 2;)0 === data[i] && 0 === data[i + 1] && 0x03 === data[i + 2] ? (emulationPreventionBytesPositions.push(i + 2), i += 2) : i++;
|
|
||||||
if (0 === emulationPreventionBytesPositions.length) return data;
|
|
||||||
newData = new Uint8Array(newLength = length - emulationPreventionBytesPositions.length);
|
|
||||||
var sourceIndex = 0;
|
|
||||||
for(i = 0; i < newLength; sourceIndex++, i++)sourceIndex === emulationPreventionBytesPositions[0] && (sourceIndex++, emulationPreventionBytesPositions.shift()), newData[i] = data[sourceIndex];
|
|
||||||
return newData;
|
|
||||||
},
|
|
||||||
USER_DATA_REGISTERED_ITU_T_T35: 4
|
|
||||||
}, CaptionStream$1 = function CaptionStream(options) {
|
}, CaptionStream$1 = function CaptionStream(options) {
|
||||||
options = options || {}, CaptionStream.prototype.init.call(this), this.parse708captions_ = "boolean" != typeof options.parse708captions || options.parse708captions, this.captionPackets_ = [], this.ccStreams_ = [
|
options = options || {}, CaptionStream.prototype.init.call(this), this.parse708captions_ = "boolean" != typeof options.parse708captions || options.parse708captions, this.captionPackets_ = [], this.ccStreams_ = [
|
||||||
new Cea608Stream(0, 0),
|
new Cea608Stream(0, 0),
|
||||||
@ -8836,8 +8793,8 @@
|
|||||||
}, this), this.parse708captions_ && (this.cc708Stream_.on("data", this.trigger.bind(this, "data")), this.cc708Stream_.on("partialdone", this.trigger.bind(this, "partialdone")), this.cc708Stream_.on("done", this.trigger.bind(this, "done")));
|
}, this), this.parse708captions_ && (this.cc708Stream_.on("data", this.trigger.bind(this, "data")), this.cc708Stream_.on("partialdone", this.trigger.bind(this, "partialdone")), this.cc708Stream_.on("done", this.trigger.bind(this, "done")));
|
||||||
};
|
};
|
||||||
CaptionStream$1.prototype = new Stream(), CaptionStream$1.prototype.push = function(event) {
|
CaptionStream$1.prototype = new Stream(), CaptionStream$1.prototype.push = function(event) {
|
||||||
var sei, userData, newCaptionPackets;
|
var sei, userData, newCaptionPackets, sei1;
|
||||||
if ("sei_rbsp" === event.nalUnitType && (sei = captionPacketParser.parseSei(event.escapedRBSP)).payload && sei.payloadType === captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35 && (userData = captionPacketParser.parseUserData(sei))) {
|
if ("sei_rbsp" === event.nalUnitType && (sei = captionPacketParser_parseSei(event.escapedRBSP)).payload && 4 === sei.payloadType && (userData = 181 !== (sei1 = sei).payload[0] || (sei1.payload[1] << 8 | sei1.payload[2]) != 49 || "GA94" !== String.fromCharCode(sei1.payload[3], sei1.payload[4], sei1.payload[5], sei1.payload[6]) || 0x03 !== sei1.payload[7] ? null : sei1.payload.subarray(8, sei1.payload.length - 1))) {
|
||||||
if (event.dts < this.latestDts_) {
|
if (event.dts < this.latestDts_) {
|
||||||
this.ignoreNextEqualDts_ = !0;
|
this.ignoreNextEqualDts_ = !0;
|
||||||
return;
|
return;
|
||||||
@ -8846,7 +8803,7 @@
|
|||||||
this.numSameDts_--, this.numSameDts_ || (this.ignoreNextEqualDts_ = !1);
|
this.numSameDts_--, this.numSameDts_ || (this.ignoreNextEqualDts_ = !1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData), this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets), this.latestDts_ !== event.dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = event.dts;
|
newCaptionPackets = captionPacketParser_parseCaptionPackets(event.pts, userData), this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets), this.latestDts_ !== event.dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = event.dts;
|
||||||
}
|
}
|
||||||
}, CaptionStream$1.prototype.flushCCStreams = function(flushType) {
|
}, CaptionStream$1.prototype.flushCCStreams = function(flushType) {
|
||||||
this.ccStreams_.forEach(function(cc) {
|
this.ccStreams_.forEach(function(cc) {
|
||||||
@ -9287,11 +9244,7 @@
|
|||||||
var baseRow = this.displayed_[this.row_];
|
var baseRow = this.displayed_[this.row_];
|
||||||
baseRow += text, this.displayed_[this.row_] = baseRow;
|
baseRow += text, this.displayed_[this.row_] = baseRow;
|
||||||
};
|
};
|
||||||
var captionStream = {
|
var streamTypes = {
|
||||||
CaptionStream: CaptionStream$1,
|
|
||||||
Cea608Stream: Cea608Stream,
|
|
||||||
Cea708Stream: Cea708Stream
|
|
||||||
}, streamTypes = {
|
|
||||||
H264_STREAM_TYPE: 0x1b,
|
H264_STREAM_TYPE: 0x1b,
|
||||||
ADTS_STREAM_TYPE: 0x0f,
|
ADTS_STREAM_TYPE: 0x0f,
|
||||||
METADATA_STREAM_TYPE: 0x15
|
METADATA_STREAM_TYPE: 0x15
|
||||||
@ -9314,10 +9267,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
TimestampRolloverStream$1.prototype = new Stream();
|
TimestampRolloverStream$1.prototype = new Stream();
|
||||||
var videoSample, audioSample, audioTrun, videoTrun, trunHeader, box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS, silence, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds, _MetadataStream, timestampRolloverStream = {
|
var videoSample, audioSample, audioTrun, videoTrun, trunHeader, box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS, silence, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds, _MetadataStream, percentEncode$1 = function(bytes, start, end) {
|
||||||
TimestampRolloverStream: TimestampRolloverStream$1,
|
|
||||||
handleRollover: handleRollover$1
|
|
||||||
}, percentEncode$1 = function(bytes, start, end) {
|
|
||||||
var i, result = "";
|
var i, result = "";
|
||||||
for(i = start; i < end; i++)result += "%" + ("00" + bytes[i].toString(16)).slice(-2);
|
for(i = start; i < end; i++)result += "%" + ("00" + bytes[i].toString(16)).slice(-2);
|
||||||
return result;
|
return result;
|
||||||
@ -9399,7 +9349,7 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}).prototype = new Stream();
|
}).prototype = new Stream();
|
||||||
var metadataStream = _MetadataStream, TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream;
|
var metadataStream = _MetadataStream;
|
||||||
(_TransportPacketStream = function() {
|
(_TransportPacketStream = function() {
|
||||||
var buffer = new Uint8Array(188), bytesInBuffer = 0;
|
var buffer = new Uint8Array(188), bytesInBuffer = 0;
|
||||||
_TransportPacketStream.prototype.init.call(this), this.push = function(bytes) {
|
_TransportPacketStream.prototype.init.call(this), this.push = function(bytes) {
|
||||||
@ -9553,10 +9503,10 @@
|
|||||||
TransportPacketStream: _TransportPacketStream,
|
TransportPacketStream: _TransportPacketStream,
|
||||||
TransportParseStream: _TransportParseStream,
|
TransportParseStream: _TransportParseStream,
|
||||||
ElementaryStream: _ElementaryStream,
|
ElementaryStream: _ElementaryStream,
|
||||||
TimestampRolloverStream: TimestampRolloverStream,
|
TimestampRolloverStream: TimestampRolloverStream$1,
|
||||||
CaptionStream: captionStream.CaptionStream,
|
CaptionStream: CaptionStream$1,
|
||||||
Cea608Stream: captionStream.Cea608Stream,
|
Cea608Stream: Cea608Stream,
|
||||||
Cea708Stream: captionStream.Cea708Stream,
|
Cea708Stream: Cea708Stream,
|
||||||
MetadataStream: metadataStream
|
MetadataStream: metadataStream
|
||||||
};
|
};
|
||||||
for(var type in streamTypes)streamTypes.hasOwnProperty(type) && (m2ts[type] = streamTypes[type]);
|
for(var type in streamTypes)streamTypes.hasOwnProperty(type) && (m2ts[type] = streamTypes[type]);
|
||||||
@ -9882,9 +9832,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}).prototype = new Stream();
|
}).prototype = new Stream();
|
||||||
var h264 = {
|
var h264_H264Stream = _H264Stream, ADTS_SAMPLING_FREQUENCIES = [
|
||||||
H264Stream: _H264Stream
|
|
||||||
}, ADTS_SAMPLING_FREQUENCIES = [
|
|
||||||
96000,
|
96000,
|
||||||
88200,
|
88200,
|
||||||
64000,
|
64000,
|
||||||
@ -9999,7 +9947,7 @@
|
|||||||
"levelIdc",
|
"levelIdc",
|
||||||
"profileCompatibility",
|
"profileCompatibility",
|
||||||
"sarRatio"
|
"sarRatio"
|
||||||
], H264Stream = h264.H264Stream, isLikelyAacData = utils.isLikelyAacData, ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS, retriggerForStream = function(key, event) {
|
], isLikelyAacData = utils.isLikelyAacData, ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS, retriggerForStream = function(key, event) {
|
||||||
event.stream = key, this.trigger("log", event);
|
event.stream = key, this.trigger("log", event);
|
||||||
}, addPipelineLogRetriggers = function(transmuxer, pipeline) {
|
}, addPipelineLogRetriggers = function(transmuxer, pipeline) {
|
||||||
for(var keys = Object.keys(pipeline), i = 0; i < keys.length; i++){
|
for(var keys = Object.keys(pipeline), i = 0; i < keys.length; i++){
|
||||||
@ -10038,12 +9986,14 @@
|
|||||||
}, this.setAudioAppendStart = function(timestamp) {
|
}, this.setAudioAppendStart = function(timestamp) {
|
||||||
audioAppendStartTs = timestamp;
|
audioAppendStartTs = timestamp;
|
||||||
}, this.flush = function() {
|
}, this.flush = function() {
|
||||||
var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed;
|
var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed, adtsFrames1, earliestAllowedDts1;
|
||||||
if (0 === adtsFrames.length) {
|
if (0 === adtsFrames.length) {
|
||||||
this.trigger("done", "AudioSegmentStream");
|
this.trigger("done", "AudioSegmentStream");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts), track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps), videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime), track.samples = audioFrameUtils.generateSampleTable(frames), mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)), adtsFrames = [], boxes = new Uint8Array((moof = mp4Generator.moof(sequenceNumber, [
|
adtsFrames1 = adtsFrames, earliestAllowedDts1 = earliestAllowedDts, frames = track.minSegmentDts >= earliestAllowedDts1 ? adtsFrames1 : (track.minSegmentDts = 1 / 0, adtsFrames1.filter(function(currentFrame) {
|
||||||
|
return currentFrame.dts >= earliestAllowedDts1 && (track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts), track.minSegmentPts = track.minSegmentDts, !0);
|
||||||
|
})), track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps), videoClockCyclesOfSilencePrefixed = audioFrameUtils_prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime), track.samples = audioFrameUtils_generateSampleTable(frames), mdat = mp4Generator.mdat(audioFrameUtils_concatenateFrameData(frames)), adtsFrames = [], boxes = new Uint8Array((moof = mp4Generator.moof(sequenceNumber, [
|
||||||
track
|
track
|
||||||
])).byteLength + mdat.byteLength), sequenceNumber++, boxes.set(moof), boxes.set(mdat, moof.byteLength), trackDecodeInfo.clearDtsInfo(track), frameDuration = Math.ceil(1024 * ONE_SECOND_IN_TS$1 / track.samplerate), frames.length && (segmentDuration = frames.length * frameDuration, this.trigger("segmentTimingInfo", generateSegmentTimingInfo(clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)), this.trigger("timingInfo", {
|
])).byteLength + mdat.byteLength), sequenceNumber++, boxes.set(moof), boxes.set(mdat, moof.byteLength), trackDecodeInfo.clearDtsInfo(track), frameDuration = Math.ceil(1024 * ONE_SECOND_IN_TS$1 / track.samplerate), frames.length && (segmentDuration = frames.length * frameDuration, this.trigger("segmentTimingInfo", generateSegmentTimingInfo(clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)), this.trigger("timingInfo", {
|
||||||
start: frames[0].pts,
|
start: frames[0].pts,
|
||||||
@ -10196,7 +10146,7 @@
|
|||||||
}), pipeline.coalesceStream.on("data", this.trigger.bind(this, "data")), pipeline.coalesceStream.on("done", this.trigger.bind(this, "done")), addPipelineLogRetriggers(this, pipeline);
|
}), pipeline.coalesceStream.on("data", this.trigger.bind(this, "data")), pipeline.coalesceStream.on("done", this.trigger.bind(this, "done")), addPipelineLogRetriggers(this, pipeline);
|
||||||
}, this.setupTsPipeline = function() {
|
}, this.setupTsPipeline = function() {
|
||||||
var pipeline = {};
|
var pipeline = {};
|
||||||
this.transmuxPipeline_ = pipeline, pipeline.type = "ts", pipeline.metadataStream = new m2ts.MetadataStream(), pipeline.packetStream = new m2ts.TransportPacketStream(), pipeline.parseStream = new m2ts.TransportParseStream(), pipeline.elementaryStream = new m2ts.ElementaryStream(), pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream(), pipeline.adtsStream = new adts(), pipeline.h264Stream = new H264Stream(), pipeline.captionStream = new m2ts.CaptionStream(options), pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream), pipeline.headOfPipeline = pipeline.packetStream, pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream), pipeline.timestampRolloverStream.pipe(pipeline.h264Stream), pipeline.timestampRolloverStream.pipe(pipeline.adtsStream), pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream), pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream), pipeline.elementaryStream.on("data", function(data) {
|
this.transmuxPipeline_ = pipeline, pipeline.type = "ts", pipeline.metadataStream = new m2ts.MetadataStream(), pipeline.packetStream = new m2ts.TransportPacketStream(), pipeline.parseStream = new m2ts.TransportParseStream(), pipeline.elementaryStream = new m2ts.ElementaryStream(), pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream(), pipeline.adtsStream = new adts(), pipeline.h264Stream = new h264_H264Stream(), pipeline.captionStream = new m2ts.CaptionStream(options), pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream), pipeline.headOfPipeline = pipeline.packetStream, pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream), pipeline.timestampRolloverStream.pipe(pipeline.h264Stream), pipeline.timestampRolloverStream.pipe(pipeline.adtsStream), pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream), pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream), pipeline.elementaryStream.on("data", function(data) {
|
||||||
var i;
|
var i;
|
||||||
if ("metadata" === data.type) {
|
if ("metadata" === data.type) {
|
||||||
for(i = data.tracks.length; i--;)videoTrack || "video" !== data.tracks[i].type ? audioTrack || "audio" !== data.tracks[i].type || ((audioTrack = data.tracks[i]).timelineStartInfo.baseMediaDecodeTime = self1.baseMediaDecodeTime) : (videoTrack = data.tracks[i]).timelineStartInfo.baseMediaDecodeTime = self1.baseMediaDecodeTime;
|
for(i = data.tracks.length; i--;)videoTrack || "video" !== data.tracks[i].type ? audioTrack || "audio" !== data.tracks[i].type || ((audioTrack = data.tracks[i]).timelineStartInfo.baseMediaDecodeTime = self1.baseMediaDecodeTime) : (videoTrack = data.tracks[i]).timelineStartInfo.baseMediaDecodeTime = self1.baseMediaDecodeTime;
|
||||||
@ -10243,29 +10193,22 @@
|
|||||||
this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset();
|
this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset();
|
||||||
};
|
};
|
||||||
}).prototype = new Stream();
|
}).prototype = new Stream();
|
||||||
var transmuxer = {
|
var transmuxer_Transmuxer = _Transmuxer, bin_toUnsigned = function(value) {
|
||||||
Transmuxer: _Transmuxer
|
return value >>> 0;
|
||||||
}, bin = {
|
|
||||||
toUnsigned: function(value) {
|
|
||||||
return value >>> 0;
|
|
||||||
},
|
|
||||||
toHexString: function(value) {
|
|
||||||
return ("00" + value.toString(16)).slice(-2);
|
|
||||||
}
|
|
||||||
}, parseType_1 = function(buffer) {
|
}, parseType_1 = function(buffer) {
|
||||||
return "" + (String.fromCharCode(buffer[0]) + String.fromCharCode(buffer[1]) + String.fromCharCode(buffer[2]) + String.fromCharCode(buffer[3]));
|
return "" + (String.fromCharCode(buffer[0]) + String.fromCharCode(buffer[1]) + String.fromCharCode(buffer[2]) + String.fromCharCode(buffer[3]));
|
||||||
}, toUnsigned$2 = bin.toUnsigned, findBox_1 = function findBox(data, path) {
|
}, findBox_1 = function findBox(data, path) {
|
||||||
var i, size, type, end, subresults, results = [];
|
var i, size, type, end, subresults, results = [];
|
||||||
if (!path.length) return null;
|
if (!path.length) return null;
|
||||||
for(i = 0; i < data.byteLength;)size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]), type = parseType_1(data.subarray(i + 4, i + 8)), end = size > 1 ? i + size : data.byteLength, type === path[0] && (1 === path.length ? results.push(data.subarray(i + 8, end)) : (subresults = findBox(data.subarray(i + 8, end), path.slice(1))).length && (results = results.concat(subresults))), i = end;
|
for(i = 0; i < data.byteLength;)size = bin_toUnsigned(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]), type = parseType_1(data.subarray(i + 4, i + 8)), end = size > 1 ? i + size : data.byteLength, type === path[0] && (1 === path.length ? results.push(data.subarray(i + 8, end)) : (subresults = findBox(data.subarray(i + 8, end), path.slice(1))).length && (results = results.concat(subresults))), i = end;
|
||||||
return results;
|
return results;
|
||||||
}, toUnsigned$1 = bin.toUnsigned, parseTfdt = function(data) {
|
}, parseTfdt = function(data) {
|
||||||
var result = {
|
var result = {
|
||||||
version: data[0],
|
version: data[0],
|
||||||
flags: new Uint8Array(data.subarray(1, 4)),
|
flags: new Uint8Array(data.subarray(1, 4)),
|
||||||
baseMediaDecodeTime: toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7])
|
baseMediaDecodeTime: bin_toUnsigned(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7])
|
||||||
};
|
};
|
||||||
return 1 === result.version && (result.baseMediaDecodeTime *= 4294967296, result.baseMediaDecodeTime += toUnsigned$1(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11])), result;
|
return 1 === result.version && (result.baseMediaDecodeTime *= 4294967296, result.baseMediaDecodeTime += bin_toUnsigned(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11])), result;
|
||||||
}, parseSampleFlags_1 = function(flags) {
|
}, parseSampleFlags_1 = function(flags) {
|
||||||
return {
|
return {
|
||||||
isLeading: (0x0c & flags[0]) >>> 2,
|
isLeading: (0x0c & flags[0]) >>> 2,
|
||||||
@ -10293,7 +10236,14 @@
|
|||||||
trackId: view.getUint32(4)
|
trackId: view.getUint32(4)
|
||||||
}, baseDataOffsetPresent = 0x01 & result.flags[2], sampleDescriptionIndexPresent = 0x02 & result.flags[2], defaultSampleDurationPresent = 0x08 & result.flags[2], defaultSampleSizePresent = 0x10 & result.flags[2], defaultSampleFlagsPresent = 0x20 & result.flags[2], durationIsEmpty = 0x010000 & result.flags[0], defaultBaseIsMoof = 0x020000 & result.flags[0];
|
}, baseDataOffsetPresent = 0x01 & result.flags[2], sampleDescriptionIndexPresent = 0x02 & result.flags[2], defaultSampleDurationPresent = 0x08 & result.flags[2], defaultSampleSizePresent = 0x10 & result.flags[2], defaultSampleFlagsPresent = 0x20 & result.flags[2], durationIsEmpty = 0x010000 & result.flags[0], defaultBaseIsMoof = 0x020000 & result.flags[0];
|
||||||
return i = 8, baseDataOffsetPresent && (i += 4, result.baseDataOffset = view.getUint32(12), i += 4), sampleDescriptionIndexPresent && (result.sampleDescriptionIndex = view.getUint32(i), i += 4), defaultSampleDurationPresent && (result.defaultSampleDuration = view.getUint32(i), i += 4), defaultSampleSizePresent && (result.defaultSampleSize = view.getUint32(i), i += 4), defaultSampleFlagsPresent && (result.defaultSampleFlags = view.getUint32(i)), durationIsEmpty && (result.durationIsEmpty = !0), !baseDataOffsetPresent && defaultBaseIsMoof && (result.baseDataOffsetIsMoof = !0), result;
|
return i = 8, baseDataOffsetPresent && (i += 4, result.baseDataOffset = view.getUint32(12), i += 4), sampleDescriptionIndexPresent && (result.sampleDescriptionIndex = view.getUint32(i), i += 4), defaultSampleDurationPresent && (result.defaultSampleDuration = view.getUint32(i), i += 4), defaultSampleSizePresent && (result.defaultSampleSize = view.getUint32(i), i += 4), defaultSampleFlagsPresent && (result.defaultSampleFlags = view.getUint32(i)), durationIsEmpty && (result.durationIsEmpty = !0), !baseDataOffsetPresent && defaultBaseIsMoof && (result.baseDataOffsetIsMoof = !0), result;
|
||||||
}, discardEmulationPreventionBytes = captionPacketParser.discardEmulationPreventionBytes, CaptionStream = captionStream.CaptionStream, mapToSample = function(offset, samples) {
|
}, discardEmulationPreventionBytes = function(data) {
|
||||||
|
for(var newLength, newData, length = data.byteLength, emulationPreventionBytesPositions = [], i = 1; i < length - 2;)0 === data[i] && 0 === data[i + 1] && 0x03 === data[i + 2] ? (emulationPreventionBytesPositions.push(i + 2), i += 2) : i++;
|
||||||
|
if (0 === emulationPreventionBytesPositions.length) return data;
|
||||||
|
newData = new Uint8Array(newLength = length - emulationPreventionBytesPositions.length);
|
||||||
|
var sourceIndex = 0;
|
||||||
|
for(i = 0; i < newLength; sourceIndex++, i++)sourceIndex === emulationPreventionBytesPositions[0] && (sourceIndex++, emulationPreventionBytesPositions.shift()), newData[i] = data[sourceIndex];
|
||||||
|
return newData;
|
||||||
|
}, mapToSample = function(offset, samples) {
|
||||||
for(var approximateOffset = offset, i = 0; i < samples.length; i++){
|
for(var approximateOffset = offset, i = 0; i < samples.length; i++){
|
||||||
var sample = samples[i];
|
var sample = samples[i];
|
||||||
if (approximateOffset < sample.size) return sample;
|
if (approximateOffset < sample.size) return sample;
|
||||||
@ -10373,7 +10323,7 @@
|
|||||||
this.isInitialized = function() {
|
this.isInitialized = function() {
|
||||||
return isInitialized;
|
return isInitialized;
|
||||||
}, this.init = function(options) {
|
}, this.init = function(options) {
|
||||||
captionStream = new CaptionStream(), isInitialized = !0, parsingPartial = !!options && options.isPartial, captionStream.on("data", function(event) {
|
captionStream = new CaptionStream$1(), isInitialized = !0, parsingPartial = !!options && options.isPartial, captionStream.on("data", function(event) {
|
||||||
event.startTime = event.startPts / timescale, event.endTime = event.endPts / timescale, parsedCaptions.captions.push(event), parsedCaptions.captionStreams[event.stream] = !0;
|
event.startTime = event.startPts / timescale, event.endTime = event.endPts / timescale, parsedCaptions.captions.push(event), parsedCaptions.captionStreams[event.stream] = !0;
|
||||||
}), captionStream.on("log", function(log) {
|
}), captionStream.on("log", function(log) {
|
||||||
parsedCaptions.logs.push(log);
|
parsedCaptions.logs.push(log);
|
||||||
@ -10416,21 +10366,10 @@
|
|||||||
logs: []
|
logs: []
|
||||||
}, this.resetCaptionStream();
|
}, this.resetCaptionStream();
|
||||||
}, this.reset();
|
}, this.reset();
|
||||||
}, toUnsigned = bin.toUnsigned, toHexString = bin.toHexString;
|
}, toHexString = function(value) {
|
||||||
timescale = function(init) {
|
return ("00" + value.toString(16)).slice(-2);
|
||||||
return findBox_1(init, [
|
};
|
||||||
"moov",
|
startTime = function(timescale, fragment) {
|
||||||
"trak"
|
|
||||||
]).reduce(function(result, trak) {
|
|
||||||
var tkhd, index, id, mdhd;
|
|
||||||
return (tkhd = findBox_1(trak, [
|
|
||||||
"tkhd"
|
|
||||||
])[0]) && (index = 0 === tkhd[0] ? 12 : 20, id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]), mdhd = findBox_1(trak, [
|
|
||||||
"mdia",
|
|
||||||
"mdhd"
|
|
||||||
])[0]) ? (index = 0 === mdhd[0] ? 12 : 20, result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]), result) : null;
|
|
||||||
}, {});
|
|
||||||
}, startTime = function(timescale, fragment) {
|
|
||||||
var trafs, baseTimes, result;
|
var trafs, baseTimes, result;
|
||||||
return trafs = findBox_1(fragment, [
|
return trafs = findBox_1(fragment, [
|
||||||
"moof",
|
"moof",
|
||||||
@ -10440,54 +10379,19 @@
|
|||||||
"tfhd"
|
"tfhd"
|
||||||
]).map(function(tfhd) {
|
]).map(function(tfhd) {
|
||||||
var scale, baseTime;
|
var scale, baseTime;
|
||||||
return scale = timescale[toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7])] || 90e3, (baseTime = "number" != typeof (baseTime = findBox_1(traf, [
|
return scale = timescale[bin_toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7])] || 90e3, (baseTime = "number" != typeof (baseTime = findBox_1(traf, [
|
||||||
"tfdt"
|
"tfdt"
|
||||||
]).map(function(tfdt) {
|
]).map(function(tfdt) {
|
||||||
var version, result;
|
var version, result;
|
||||||
return version = tfdt[0], result = toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]), 1 === version && (result *= 4294967296, result += toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11])), result;
|
return version = tfdt[0], result = bin_toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]), 1 === version && (result *= 4294967296, result += bin_toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11])), result;
|
||||||
})[0]) || isNaN(baseTime) ? 1 / 0 : baseTime) / scale;
|
})[0]) || isNaN(baseTime) ? 1 / 0 : baseTime) / scale;
|
||||||
});
|
});
|
||||||
})), isFinite(result = Math.min.apply(null, baseTimes)) ? result : 0;
|
})), isFinite(result = Math.min.apply(null, baseTimes)) ? result : 0;
|
||||||
}, compositionStartTime = function(timescales, fragment) {
|
|
||||||
var trackId, trafBoxes = findBox_1(fragment, [
|
|
||||||
"moof",
|
|
||||||
"traf"
|
|
||||||
]), baseMediaDecodeTime = 0, compositionTimeOffset = 0;
|
|
||||||
if (trafBoxes && trafBoxes.length) {
|
|
||||||
var tfhd = findBox_1(trafBoxes[0], [
|
|
||||||
"tfhd"
|
|
||||||
])[0], trun = findBox_1(trafBoxes[0], [
|
|
||||||
"trun"
|
|
||||||
])[0], tfdt = findBox_1(trafBoxes[0], [
|
|
||||||
"tfdt"
|
|
||||||
])[0];
|
|
||||||
if (tfhd && (trackId = parseTfhd(tfhd).trackId), tfdt && (baseMediaDecodeTime = parseTfdt(tfdt).baseMediaDecodeTime), trun) {
|
|
||||||
var parsedTrun = parseTrun(trun);
|
|
||||||
parsedTrun.samples && parsedTrun.samples.length && (compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (baseMediaDecodeTime + compositionTimeOffset) / (timescales[trackId] || 90e3);
|
|
||||||
}, getVideoTrackIds = function(init) {
|
|
||||||
var traks = findBox_1(init, [
|
|
||||||
"moov",
|
|
||||||
"trak"
|
|
||||||
]), videoTrackIds = [];
|
|
||||||
return traks.forEach(function(trak) {
|
|
||||||
var hdlrs = findBox_1(trak, [
|
|
||||||
"mdia",
|
|
||||||
"hdlr"
|
|
||||||
]), tkhds = findBox_1(trak, [
|
|
||||||
"tkhd"
|
|
||||||
]);
|
|
||||||
hdlrs.forEach(function(hdlr, index) {
|
|
||||||
var view, trackId, handlerType = parseType_1(hdlr.subarray(8, 12)), tkhd = tkhds[index];
|
|
||||||
"vide" === handlerType && (trackId = 0 === (view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength)).getUint8(0) ? view.getUint32(12) : view.getUint32(20), videoTrackIds.push(trackId));
|
|
||||||
});
|
|
||||||
}), videoTrackIds;
|
|
||||||
}, getTimescaleFromMediaHeader = function(mdhd) {
|
}, getTimescaleFromMediaHeader = function(mdhd) {
|
||||||
var index = 0 === mdhd[0] ? 12 : 20;
|
var index = 0 === mdhd[0] ? 12 : 20;
|
||||||
return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]);
|
return bin_toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]);
|
||||||
}, getTracks = function(init) {
|
};
|
||||||
|
var probe$2_tracks = function(init) {
|
||||||
var traks = findBox_1(init, [
|
var traks = findBox_1(init, [
|
||||||
"moov",
|
"moov",
|
||||||
"trak"
|
"trak"
|
||||||
@ -10525,16 +10429,6 @@
|
|||||||
])[0];
|
])[0];
|
||||||
mdhd && (track.timescale = getTimescaleFromMediaHeader(mdhd)), tracks.push(track);
|
mdhd && (track.timescale = getTimescaleFromMediaHeader(mdhd)), tracks.push(track);
|
||||||
}), tracks;
|
}), tracks;
|
||||||
};
|
|
||||||
var probe$2 = {
|
|
||||||
findBox: findBox_1,
|
|
||||||
parseType: parseType_1,
|
|
||||||
timescale: timescale,
|
|
||||||
startTime: startTime,
|
|
||||||
compositionStartTime: compositionStartTime,
|
|
||||||
videoTrackIds: getVideoTrackIds,
|
|
||||||
tracks: getTracks,
|
|
||||||
getTimescaleFromMediaHeader: getTimescaleFromMediaHeader
|
|
||||||
}, parsePid = function(packet) {
|
}, parsePid = function(packet) {
|
||||||
var pid = 0x1f & packet[1];
|
var pid = 0x1f & packet[1];
|
||||||
return pid <<= 8, pid |= packet[2];
|
return pid <<= 8, pid |= packet[2];
|
||||||
@ -10558,7 +10452,7 @@
|
|||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, handleRollover = timestampRolloverStream.handleRollover, probe = {};
|
}, probe = {};
|
||||||
probe.ts = {
|
probe.ts = {
|
||||||
parseType: function(packet, pmtPid) {
|
parseType: function(packet, pmtPid) {
|
||||||
var pid = parsePid(packet);
|
var pid = parsePid(packet);
|
||||||
@ -10702,16 +10596,16 @@
|
|||||||
if (segmentInfo.audio && segmentInfo.audio.length) {
|
if (segmentInfo.audio && segmentInfo.audio.length) {
|
||||||
var audioBaseTimestamp = baseTimestamp;
|
var audioBaseTimestamp = baseTimestamp;
|
||||||
(void 0 === audioBaseTimestamp || isNaN(audioBaseTimestamp)) && (audioBaseTimestamp = segmentInfo.audio[0].dts), segmentInfo.audio.forEach(function(info) {
|
(void 0 === audioBaseTimestamp || isNaN(audioBaseTimestamp)) && (audioBaseTimestamp = segmentInfo.audio[0].dts), segmentInfo.audio.forEach(function(info) {
|
||||||
info.dts = handleRollover(info.dts, audioBaseTimestamp), info.pts = handleRollover(info.pts, audioBaseTimestamp), info.dtsTime = info.dts / ONE_SECOND_IN_TS, info.ptsTime = info.pts / ONE_SECOND_IN_TS;
|
info.dts = handleRollover$1(info.dts, audioBaseTimestamp), info.pts = handleRollover$1(info.pts, audioBaseTimestamp), info.dtsTime = info.dts / ONE_SECOND_IN_TS, info.ptsTime = info.pts / ONE_SECOND_IN_TS;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (segmentInfo.video && segmentInfo.video.length) {
|
if (segmentInfo.video && segmentInfo.video.length) {
|
||||||
var videoBaseTimestamp = baseTimestamp;
|
var videoBaseTimestamp = baseTimestamp;
|
||||||
if ((void 0 === videoBaseTimestamp || isNaN(videoBaseTimestamp)) && (videoBaseTimestamp = segmentInfo.video[0].dts), segmentInfo.video.forEach(function(info) {
|
if ((void 0 === videoBaseTimestamp || isNaN(videoBaseTimestamp)) && (videoBaseTimestamp = segmentInfo.video[0].dts), segmentInfo.video.forEach(function(info) {
|
||||||
info.dts = handleRollover(info.dts, videoBaseTimestamp), info.pts = handleRollover(info.pts, videoBaseTimestamp), info.dtsTime = info.dts / ONE_SECOND_IN_TS, info.ptsTime = info.pts / ONE_SECOND_IN_TS;
|
info.dts = handleRollover$1(info.dts, videoBaseTimestamp), info.pts = handleRollover$1(info.pts, videoBaseTimestamp), info.dtsTime = info.dts / ONE_SECOND_IN_TS, info.ptsTime = info.pts / ONE_SECOND_IN_TS;
|
||||||
}), segmentInfo.firstKeyFrame) {
|
}), segmentInfo.firstKeyFrame) {
|
||||||
var frame = segmentInfo.firstKeyFrame;
|
var frame = segmentInfo.firstKeyFrame;
|
||||||
frame.dts = handleRollover(frame.dts, videoBaseTimestamp), frame.pts = handleRollover(frame.pts, videoBaseTimestamp), frame.dtsTime = frame.dts / ONE_SECOND_IN_TS, frame.ptsTime = frame.pts / ONE_SECOND_IN_TS;
|
frame.dts = handleRollover$1(frame.dts, videoBaseTimestamp), frame.pts = handleRollover$1(frame.pts, videoBaseTimestamp), frame.dtsTime = frame.dts / ONE_SECOND_IN_TS, frame.ptsTime = frame.pts / ONE_SECOND_IN_TS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, inspectAac_ = function(bytes) {
|
}, inspectAac_ = function(bytes) {
|
||||||
@ -10765,12 +10659,9 @@
|
|||||||
result.audio = [], parseAudioPes_(bytes, pmt, result), 0 === result.audio.length && delete result.audio;
|
result.audio = [], parseAudioPes_(bytes, pmt, result), 0 === result.audio.length && delete result.audio;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}, tsInspector = {
|
}, tsInspector_inspect = function(bytes, baseTimestamp) {
|
||||||
inspect: function(bytes, baseTimestamp) {
|
var result;
|
||||||
var result;
|
return (result = probe.aac.isLikelyAacData(bytes) ? inspectAac_(bytes) : inspectTs_(bytes)) && (result.audio || result.video) ? (adjustTimestamp_(result, baseTimestamp), result) : null;
|
||||||
return (result = probe.aac.isLikelyAacData(bytes) ? inspectAac_(bytes) : inspectTs_(bytes)) && (result.audio || result.video) ? (adjustTimestamp_(result, baseTimestamp), result) : null;
|
|
||||||
},
|
|
||||||
parseAudioPes_: parseAudioPes_
|
|
||||||
}, wireTransmuxerEvents = function(self1, transmuxer) {
|
}, wireTransmuxerEvents = function(self1, transmuxer) {
|
||||||
transmuxer.on("data", function(segment) {
|
transmuxer.on("data", function(segment) {
|
||||||
var initArray = segment.initSegment;
|
var initArray = segment.initSegment;
|
||||||
@ -10872,7 +10763,7 @@
|
|||||||
}
|
}
|
||||||
var _proto = MessageHandlers.prototype;
|
var _proto = MessageHandlers.prototype;
|
||||||
return _proto.init = function() {
|
return _proto.init = function() {
|
||||||
this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new transmuxer.Transmuxer(this.options), wireTransmuxerEvents(this.self, this.transmuxer);
|
this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new transmuxer_Transmuxer(this.options), wireTransmuxerEvents(this.self, this.transmuxer);
|
||||||
}, _proto.pushMp4Captions = function(data) {
|
}, _proto.pushMp4Captions = function(data) {
|
||||||
this.captionParser || (this.captionParser = new captionParser(), this.captionParser.init());
|
this.captionParser || (this.captionParser = new captionParser(), this.captionParser.init());
|
||||||
var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength), parsed = this.captionParser.parse(segment, data.trackIds, data.timescales);
|
var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength), parsed = this.captionParser.parse(segment, data.trackIds, data.timescales);
|
||||||
@ -10885,16 +10776,16 @@
|
|||||||
segment.buffer
|
segment.buffer
|
||||||
]);
|
]);
|
||||||
}, _proto.probeMp4StartTime = function(_ref) {
|
}, _proto.probeMp4StartTime = function(_ref) {
|
||||||
var timescales = _ref.timescales, data = _ref.data, startTime = probe$2.startTime(timescales, data);
|
var timescales = _ref.timescales, data = _ref.data, startTime1 = startTime(timescales, data);
|
||||||
this.self.postMessage({
|
this.self.postMessage({
|
||||||
action: "probeMp4StartTime",
|
action: "probeMp4StartTime",
|
||||||
startTime: startTime,
|
startTime: startTime1,
|
||||||
data: data
|
data: data
|
||||||
}, [
|
}, [
|
||||||
data.buffer
|
data.buffer
|
||||||
]);
|
]);
|
||||||
}, _proto.probeMp4Tracks = function(_ref2) {
|
}, _proto.probeMp4Tracks = function(_ref2) {
|
||||||
var data = _ref2.data, tracks = probe$2.tracks(data);
|
var data = _ref2.data, tracks = probe$2_tracks(data);
|
||||||
this.self.postMessage({
|
this.self.postMessage({
|
||||||
action: "probeMp4Tracks",
|
action: "probeMp4Tracks",
|
||||||
tracks: tracks,
|
tracks: tracks,
|
||||||
@ -10903,7 +10794,7 @@
|
|||||||
data.buffer
|
data.buffer
|
||||||
]);
|
]);
|
||||||
}, _proto.probeTs = function(_ref3) {
|
}, _proto.probeTs = function(_ref3) {
|
||||||
var data = _ref3.data, baseStartTime = _ref3.baseStartTime, tsStartTime = "number" != typeof baseStartTime || isNaN(baseStartTime) ? void 0 : baseStartTime * clock.ONE_SECOND_IN_TS, timeInfo = tsInspector.inspect(data, tsStartTime), result = null;
|
var data = _ref3.data, baseStartTime = _ref3.baseStartTime, timeInfo = tsInspector_inspect(data, "number" != typeof baseStartTime || isNaN(baseStartTime) ? void 0 : baseStartTime * clock.ONE_SECOND_IN_TS), result = null;
|
||||||
timeInfo && ((result = {
|
timeInfo && ((result = {
|
||||||
hasVideo: timeInfo.video && 2 === timeInfo.video.length || !1,
|
hasVideo: timeInfo.video && 2 === timeInfo.video.length || !1,
|
||||||
hasAudio: timeInfo.audio && 2 === timeInfo.audio.length || !1
|
hasAudio: timeInfo.audio && 2 === timeInfo.audio.length || !1
|
||||||
@ -11029,10 +10920,6 @@
|
|||||||
reset: function(transmuxer) {
|
reset: function(transmuxer) {
|
||||||
enqueueAction("reset", transmuxer);
|
enqueueAction("reset", transmuxer);
|
||||||
},
|
},
|
||||||
endTimeline: function(transmuxer) {
|
|
||||||
enqueueAction("endTimeline", transmuxer);
|
|
||||||
},
|
|
||||||
transmux: transmux,
|
|
||||||
createTransmuxer: function(options) {
|
createTransmuxer: function(options) {
|
||||||
var transmuxer = new TransmuxWorker();
|
var transmuxer = new TransmuxWorker();
|
||||||
transmuxer.currentTransmux = null, transmuxer.transmuxQueue = [];
|
transmuxer.currentTransmux = null, transmuxer.transmuxQueue = [];
|
||||||
|
@ -216,7 +216,31 @@
|
|||||||
};
|
};
|
||||||
var _extends = __webpack_require__(2769).Z, _interop_require_default = __webpack_require__(4507).Z, _interop_require_wildcard = __webpack_require__(8167).Z, _object_without_properties_loose = __webpack_require__(4719).Z, _react = _interop_require_wildcard(__webpack_require__(959)), _head = _interop_require_default(__webpack_require__(4357)), _imageConfig = __webpack_require__(1773), _useIntersection = __webpack_require__(757), _imageConfigContext = __webpack_require__(9664);
|
var _extends = __webpack_require__(2769).Z, _interop_require_default = __webpack_require__(4507).Z, _interop_require_wildcard = __webpack_require__(8167).Z, _object_without_properties_loose = __webpack_require__(4719).Z, _react = _interop_require_wildcard(__webpack_require__(959)), _head = _interop_require_default(__webpack_require__(4357)), _imageConfig = __webpack_require__(1773), _useIntersection = __webpack_require__(757), _imageConfigContext = __webpack_require__(9664);
|
||||||
__webpack_require__(8827);
|
__webpack_require__(8827);
|
||||||
var _normalizeTrailingSlash = __webpack_require__(8236), ref = {}, experimentalUnoptimized = (ref.experimentalRemotePatterns, ref.experimentalUnoptimized), configEnv = {
|
var _normalizeTrailingSlash = __webpack_require__(8236), ref = {
|
||||||
|
deviceSizes: [
|
||||||
|
640,
|
||||||
|
750,
|
||||||
|
828,
|
||||||
|
1080,
|
||||||
|
1200,
|
||||||
|
1920,
|
||||||
|
2048,
|
||||||
|
3840
|
||||||
|
],
|
||||||
|
imageSizes: [
|
||||||
|
16,
|
||||||
|
32,
|
||||||
|
48,
|
||||||
|
64,
|
||||||
|
96,
|
||||||
|
128,
|
||||||
|
256,
|
||||||
|
384
|
||||||
|
],
|
||||||
|
path: "/_next/image",
|
||||||
|
loader: "default",
|
||||||
|
dangerouslyAllowSVG: !1
|
||||||
|
}, experimentalUnoptimized = (ref.experimentalRemotePatterns, ref.experimentalUnoptimized), configEnv = {
|
||||||
deviceSizes: [
|
deviceSizes: [
|
||||||
640,
|
640,
|
||||||
750,
|
750,
|
||||||
|
@ -11,17 +11,17 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
var jsx_runtime = __webpack_require__(7437), react = __webpack_require__(2265);
|
var jsx_runtime = __webpack_require__(7437), react = __webpack_require__(2265);
|
||||||
const Context = (0, react.createContext)({}), ClientCompoenent = ()=>{
|
const Context = (0, react.createContext)({}), ContextDemo_Provider = (param)=>{
|
||||||
|
let { children } = param;
|
||||||
|
return (0, jsx_runtime.jsx)(Context.Provider, {
|
||||||
|
value: {},
|
||||||
|
children: children
|
||||||
|
});
|
||||||
|
}, ClientCompoenent = ()=>{
|
||||||
const [count, setCount] = (0, react.useState)(0);
|
const [count, setCount] = (0, react.useState)(0);
|
||||||
return (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
return (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
||||||
children: [
|
children: [
|
||||||
(0, jsx_runtime.jsx)((param)=>{
|
(0, jsx_runtime.jsx)(ContextDemo_Provider, {
|
||||||
let { children } = param;
|
|
||||||
return (0, jsx_runtime.jsx)(Context.Provider, {
|
|
||||||
value: {},
|
|
||||||
children: children
|
|
||||||
});
|
|
||||||
}, {
|
|
||||||
children: (0, jsx_runtime.jsx)("input", {})
|
children: (0, jsx_runtime.jsx)("input", {})
|
||||||
}),
|
}),
|
||||||
(0, jsx_runtime.jsx)("button", {
|
(0, jsx_runtime.jsx)("button", {
|
||||||
|
@ -2076,48 +2076,26 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}, size = {
|
}, size_lg = {
|
||||||
lg: {
|
fontSize: "lg",
|
||||||
fontSize: "lg",
|
px: 4,
|
||||||
px: 4,
|
h: 12,
|
||||||
h: 12,
|
borderRadius: "md"
|
||||||
borderRadius: "md"
|
}, size_md = {
|
||||||
},
|
fontSize: "md",
|
||||||
md: {
|
px: 4,
|
||||||
fontSize: "md",
|
h: 10,
|
||||||
px: 4,
|
borderRadius: "md"
|
||||||
h: 10,
|
}, size_sm = {
|
||||||
borderRadius: "md"
|
fontSize: "sm",
|
||||||
},
|
px: 3,
|
||||||
sm: {
|
h: 8,
|
||||||
fontSize: "sm",
|
borderRadius: "sm"
|
||||||
px: 3,
|
}, size_xs = {
|
||||||
h: 8,
|
fontSize: "xs",
|
||||||
borderRadius: "sm"
|
px: 2,
|
||||||
},
|
h: 6,
|
||||||
xs: {
|
borderRadius: "sm"
|
||||||
fontSize: "xs",
|
|
||||||
px: 2,
|
|
||||||
h: 6,
|
|
||||||
borderRadius: "sm"
|
|
||||||
}
|
|
||||||
}, sizes$e = {
|
|
||||||
lg: {
|
|
||||||
field: size.lg,
|
|
||||||
addon: size.lg
|
|
||||||
},
|
|
||||||
md: {
|
|
||||||
field: size.md,
|
|
||||||
addon: size.md
|
|
||||||
},
|
|
||||||
sm: {
|
|
||||||
field: size.sm,
|
|
||||||
addon: size.sm
|
|
||||||
},
|
|
||||||
xs: {
|
|
||||||
field: size.xs,
|
|
||||||
addon: size.xs
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
function getDefaults(props) {
|
function getDefaults(props) {
|
||||||
var fc = props.focusBorderColor, ec = props.errorBorderColor;
|
var fc = props.focusBorderColor, ec = props.errorBorderColor;
|
||||||
@ -2139,7 +2117,24 @@
|
|||||||
transitionDuration: "normal"
|
transitionDuration: "normal"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sizes: sizes$e,
|
sizes: {
|
||||||
|
lg: {
|
||||||
|
field: size_lg,
|
||||||
|
addon: size_lg
|
||||||
|
},
|
||||||
|
md: {
|
||||||
|
field: size_md,
|
||||||
|
addon: size_md
|
||||||
|
},
|
||||||
|
sm: {
|
||||||
|
field: size_sm,
|
||||||
|
addon: size_sm
|
||||||
|
},
|
||||||
|
xs: {
|
||||||
|
field: size_xs,
|
||||||
|
addon: size_xs
|
||||||
|
}
|
||||||
|
},
|
||||||
variants: {
|
variants: {
|
||||||
outline: function(props) {
|
outline: function(props) {
|
||||||
var theme = props.theme, _getDefaults = getDefaults(props), fc = _getDefaults.focusBorderColor, ec = _getDefaults.errorBorderColor;
|
var theme = props.theme, _getDefaults = getDefaults(props), fc = _getDefaults.focusBorderColor, ec = _getDefaults.errorBorderColor;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -5322,33 +5322,31 @@
|
|||||||
justifySelf: !0,
|
justifySelf: !0,
|
||||||
alignSelf: !0,
|
alignSelf: !0,
|
||||||
order: !0
|
order: !0
|
||||||
}), dist_index_esm_defaults = {
|
}), dist_index_esm_defaults_space = [
|
||||||
space: [
|
0,
|
||||||
0,
|
4,
|
||||||
4,
|
8,
|
||||||
8,
|
16,
|
||||||
16,
|
32,
|
||||||
32,
|
64,
|
||||||
64,
|
128,
|
||||||
128,
|
256,
|
||||||
256,
|
512
|
||||||
512
|
], grid = system({
|
||||||
]
|
|
||||||
}, grid = system({
|
|
||||||
gridGap: {
|
gridGap: {
|
||||||
property: "gridGap",
|
property: "gridGap",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: dist_index_esm_defaults.space
|
defaultScale: dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
gridColumnGap: {
|
gridColumnGap: {
|
||||||
property: "gridColumnGap",
|
property: "gridColumnGap",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: dist_index_esm_defaults.space
|
defaultScale: dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
gridRowGap: {
|
gridRowGap: {
|
||||||
property: "gridRowGap",
|
property: "gridRowGap",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: dist_index_esm_defaults.space
|
defaultScale: dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
gridColumn: !0,
|
gridColumn: !0,
|
||||||
gridRow: !0,
|
gridRow: !0,
|
||||||
@ -5484,19 +5482,17 @@
|
|||||||
backgroundRepeat: !0
|
backgroundRepeat: !0
|
||||||
};
|
};
|
||||||
background_dist_index_esm_config.bgImage = background_dist_index_esm_config.backgroundImage, background_dist_index_esm_config.bgSize = background_dist_index_esm_config.backgroundSize, background_dist_index_esm_config.bgPosition = background_dist_index_esm_config.backgroundPosition, background_dist_index_esm_config.bgRepeat = background_dist_index_esm_config.backgroundRepeat;
|
background_dist_index_esm_config.bgImage = background_dist_index_esm_config.backgroundImage, background_dist_index_esm_config.bgSize = background_dist_index_esm_config.backgroundSize, background_dist_index_esm_config.bgPosition = background_dist_index_esm_config.backgroundPosition, background_dist_index_esm_config.bgRepeat = background_dist_index_esm_config.backgroundRepeat;
|
||||||
var background = system(background_dist_index_esm_config), position_dist_index_esm_defaults = {
|
var background = system(background_dist_index_esm_config), position_dist_index_esm_defaults_space = [
|
||||||
space: [
|
0,
|
||||||
0,
|
4,
|
||||||
4,
|
8,
|
||||||
8,
|
16,
|
||||||
16,
|
32,
|
||||||
32,
|
64,
|
||||||
64,
|
128,
|
||||||
128,
|
256,
|
||||||
256,
|
512
|
||||||
512
|
], position = system({
|
||||||
]
|
|
||||||
}, position = system({
|
|
||||||
position: !0,
|
position: !0,
|
||||||
zIndex: {
|
zIndex: {
|
||||||
property: "zIndex",
|
property: "zIndex",
|
||||||
@ -5505,36 +5501,34 @@
|
|||||||
top: {
|
top: {
|
||||||
property: "top",
|
property: "top",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: position_dist_index_esm_defaults.space
|
defaultScale: position_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
right: {
|
right: {
|
||||||
property: "right",
|
property: "right",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: position_dist_index_esm_defaults.space
|
defaultScale: position_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
bottom: {
|
bottom: {
|
||||||
property: "bottom",
|
property: "bottom",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: position_dist_index_esm_defaults.space
|
defaultScale: position_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
left: {
|
left: {
|
||||||
property: "left",
|
property: "left",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: position_dist_index_esm_defaults.space
|
defaultScale: position_dist_index_esm_defaults_space
|
||||||
}
|
}
|
||||||
}), space_dist_index_esm_defaults = {
|
}), space_dist_index_esm_defaults_space = [
|
||||||
space: [
|
0,
|
||||||
0,
|
4,
|
||||||
4,
|
8,
|
||||||
8,
|
16,
|
||||||
16,
|
32,
|
||||||
32,
|
64,
|
||||||
64,
|
128,
|
||||||
128,
|
256,
|
||||||
256,
|
512
|
||||||
512
|
], index_esm_isNumber = function(n) {
|
||||||
]
|
|
||||||
}, index_esm_isNumber = function(n) {
|
|
||||||
return "number" == typeof n && !isNaN(n);
|
return "number" == typeof n && !isNaN(n);
|
||||||
}, getMargin = function(n, scale) {
|
}, getMargin = function(n, scale) {
|
||||||
if (!index_esm_isNumber(n)) return get(scale, n, n);
|
if (!index_esm_isNumber(n)) return get(scale, n, n);
|
||||||
@ -5546,31 +5540,31 @@
|
|||||||
property: "margin",
|
property: "margin",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
transform: getMargin,
|
transform: getMargin,
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
marginTop: {
|
marginTop: {
|
||||||
property: "marginTop",
|
property: "marginTop",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
transform: getMargin,
|
transform: getMargin,
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
marginRight: {
|
marginRight: {
|
||||||
property: "marginRight",
|
property: "marginRight",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
transform: getMargin,
|
transform: getMargin,
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
marginBottom: {
|
marginBottom: {
|
||||||
property: "marginBottom",
|
property: "marginBottom",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
transform: getMargin,
|
transform: getMargin,
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
marginLeft: {
|
marginLeft: {
|
||||||
property: "marginLeft",
|
property: "marginLeft",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
transform: getMargin,
|
transform: getMargin,
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
marginX: {
|
marginX: {
|
||||||
properties: [
|
properties: [
|
||||||
@ -5579,7 +5573,7 @@
|
|||||||
],
|
],
|
||||||
scale: "space",
|
scale: "space",
|
||||||
transform: getMargin,
|
transform: getMargin,
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
marginY: {
|
marginY: {
|
||||||
properties: [
|
properties: [
|
||||||
@ -5588,33 +5582,33 @@
|
|||||||
],
|
],
|
||||||
scale: "space",
|
scale: "space",
|
||||||
transform: getMargin,
|
transform: getMargin,
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
}
|
}
|
||||||
}, configs.margin.m = configs.margin.margin, configs.margin.mt = configs.margin.marginTop, configs.margin.mr = configs.margin.marginRight, configs.margin.mb = configs.margin.marginBottom, configs.margin.ml = configs.margin.marginLeft, configs.margin.mx = configs.margin.marginX, configs.margin.my = configs.margin.marginY, configs.padding = {
|
}, configs.margin.m = configs.margin.margin, configs.margin.mt = configs.margin.marginTop, configs.margin.mr = configs.margin.marginRight, configs.margin.mb = configs.margin.marginBottom, configs.margin.ml = configs.margin.marginLeft, configs.margin.mx = configs.margin.marginX, configs.margin.my = configs.margin.marginY, configs.padding = {
|
||||||
padding: {
|
padding: {
|
||||||
property: "padding",
|
property: "padding",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
paddingTop: {
|
paddingTop: {
|
||||||
property: "paddingTop",
|
property: "paddingTop",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
paddingRight: {
|
paddingRight: {
|
||||||
property: "paddingRight",
|
property: "paddingRight",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
paddingBottom: {
|
paddingBottom: {
|
||||||
property: "paddingBottom",
|
property: "paddingBottom",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
paddingLeft: {
|
paddingLeft: {
|
||||||
property: "paddingLeft",
|
property: "paddingLeft",
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
paddingX: {
|
paddingX: {
|
||||||
properties: [
|
properties: [
|
||||||
@ -5622,7 +5616,7 @@
|
|||||||
"paddingRight"
|
"paddingRight"
|
||||||
],
|
],
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
},
|
},
|
||||||
paddingY: {
|
paddingY: {
|
||||||
properties: [
|
properties: [
|
||||||
@ -5630,7 +5624,7 @@
|
|||||||
"paddingBottom"
|
"paddingBottom"
|
||||||
],
|
],
|
||||||
scale: "space",
|
scale: "space",
|
||||||
defaultScale: space_dist_index_esm_defaults.space
|
defaultScale: space_dist_index_esm_defaults_space
|
||||||
}
|
}
|
||||||
}, configs.padding.p = configs.padding.padding, configs.padding.pt = configs.padding.paddingTop, configs.padding.pr = configs.padding.paddingRight, configs.padding.pb = configs.padding.paddingBottom, configs.padding.pl = configs.padding.paddingLeft, configs.padding.px = configs.padding.paddingX, configs.padding.py = configs.padding.paddingY;
|
}, configs.padding.p = configs.padding.padding, configs.padding.pt = configs.padding.paddingTop, configs.padding.pr = configs.padding.paddingRight, configs.padding.pb = configs.padding.paddingBottom, configs.padding.pl = configs.padding.paddingLeft, configs.padding.px = configs.padding.paddingX, configs.padding.py = configs.padding.paddingY;
|
||||||
var margin = system(configs.margin), padding = system(configs.padding), space = compose(margin, padding), shadow = system({
|
var margin = system(configs.margin), padding = system(configs.padding), space = compose(margin, padding), shadow = system({
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
import { m } from "../index.f66dda46.js";
|
import { m } from "../index.f66dda46.js";
|
||||||
const process = {
|
const process_env = {
|
||||||
env: {
|
FOO: "bar",
|
||||||
FOO: "bar",
|
OVERRIDE: "11",
|
||||||
OVERRIDE: "11",
|
EMPTY: "",
|
||||||
EMPTY: "",
|
FOO_LOCAL: "bar",
|
||||||
FOO_LOCAL: "bar",
|
NODE_ENV: "production"
|
||||||
NODE_ENV: "production"
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
function Environment() {
|
function Environment() {
|
||||||
return m`<table><thead><tr><th>Name ${42}</th><th>Value</th></tr></thead><tbody>${Object.keys(process.env).sort().map((key)=>m`<tr key=${key}><td>${key}</td><td>${String(process.env[key])}</td></tr>`)}</tbody></table>`;
|
return m`<table><thead><tr><th>Name ${42}</th><th>Value</th></tr></thead><tbody>${Object.keys(process_env).sort().map((key)=>m`<tr key=${key}><td>${key}</td><td>${String(process_env[key])}</td></tr>`)}</tbody></table>`;
|
||||||
}
|
}
|
||||||
export { Environment };
|
export { Environment };
|
||||||
|
File diff suppressed because one or more lines are too long
@ -116,6 +116,7 @@ class_properties/static_property_side_effects/input.js
|
|||||||
classes/class_duplication/input.js
|
classes/class_duplication/input.js
|
||||||
classes/class_duplication_2/input.js
|
classes/class_duplication_2/input.js
|
||||||
classes/class_recursive_refs/input.js
|
classes/class_recursive_refs/input.js
|
||||||
|
classes/pure_prop_assignment_for_classes/input.js
|
||||||
collapse_vars/anonymous_function/input.js
|
collapse_vars/anonymous_function/input.js
|
||||||
collapse_vars/assignment/input.js
|
collapse_vars/assignment/input.js
|
||||||
collapse_vars/boolean_binary_1/input.js
|
collapse_vars/boolean_binary_1/input.js
|
||||||
@ -736,12 +737,12 @@ hoist/dont_hoist_var_destructurings/input.js
|
|||||||
hoist/hoist_funs/input.js
|
hoist/hoist_funs/input.js
|
||||||
hoist/hoist_no_destructurings/input.js
|
hoist/hoist_no_destructurings/input.js
|
||||||
hoist/hoist_vars/input.js
|
hoist/hoist_vars/input.js
|
||||||
hoist_props/contains_this_3/input.js
|
hoist_props/contains_this_1/input.js
|
||||||
|
hoist_props/contains_this_2/input.js
|
||||||
hoist_props/direct_access_1/input.js
|
hoist_props/direct_access_1/input.js
|
||||||
hoist_props/direct_access_2/input.js
|
hoist_props/direct_access_2/input.js
|
||||||
hoist_props/direct_access_3/input.js
|
hoist_props/direct_access_3/input.js
|
||||||
hoist_props/does_not_hoist_objects_with_computed_props/input.js
|
hoist_props/does_not_hoist_objects_with_computed_props/input.js
|
||||||
hoist_props/hoist_function_with_call/input.js
|
|
||||||
hoist_props/issue_2377_1/input.js
|
hoist_props/issue_2377_1/input.js
|
||||||
hoist_props/issue_2377_2/input.js
|
hoist_props/issue_2377_2/input.js
|
||||||
hoist_props/issue_2377_3/input.js
|
hoist_props/issue_2377_3/input.js
|
||||||
@ -749,13 +750,24 @@ hoist_props/issue_2462/input.js
|
|||||||
hoist_props/issue_2473_1/input.js
|
hoist_props/issue_2473_1/input.js
|
||||||
hoist_props/issue_2473_2/input.js
|
hoist_props/issue_2473_2/input.js
|
||||||
hoist_props/issue_2473_3/input.js
|
hoist_props/issue_2473_3/input.js
|
||||||
|
hoist_props/issue_2473_4/input.js
|
||||||
|
hoist_props/issue_2508_1/input.js
|
||||||
|
hoist_props/issue_2508_2/input.js
|
||||||
hoist_props/issue_2508_3/input.js
|
hoist_props/issue_2508_3/input.js
|
||||||
hoist_props/issue_2508_4/input.js
|
hoist_props/issue_2508_4/input.js
|
||||||
|
hoist_props/issue_2508_5/input.js
|
||||||
|
hoist_props/issue_2508_6/input.js
|
||||||
|
hoist_props/issue_2519/input.js
|
||||||
hoist_props/issue_3021/input.js
|
hoist_props/issue_3021/input.js
|
||||||
hoist_props/issue_3071_1/input.js
|
hoist_props/issue_3071_1/input.js
|
||||||
hoist_props/issue_3071_2/input.js
|
hoist_props/issue_3071_2/input.js
|
||||||
hoist_props/issue_3071_2_toplevel/input.js
|
hoist_props/issue_3071_2_toplevel/input.js
|
||||||
hoist_props/issue_3071_3/input.js
|
hoist_props/issue_3071_3/input.js
|
||||||
|
hoist_props/issue_851_hoist_to_conflicting_name/input.js
|
||||||
|
hoist_props/name_collision_1/input.js
|
||||||
|
hoist_props/name_collision_2/input.js
|
||||||
|
hoist_props/name_collision_3/input.js
|
||||||
|
hoist_props/new_this/input.js
|
||||||
hoist_props/single_use/input.js
|
hoist_props/single_use/input.js
|
||||||
hoist_props/toplevel_const/input.js
|
hoist_props/toplevel_const/input.js
|
||||||
hoist_props/toplevel_let/input.js
|
hoist_props/toplevel_let/input.js
|
||||||
|
@ -24,22 +24,9 @@ functions/unsafe_call_2/input.js
|
|||||||
functions/unsafe_call_3/input.js
|
functions/unsafe_call_3/input.js
|
||||||
functions/unsafe_call_expansion_1/input.js
|
functions/unsafe_call_expansion_1/input.js
|
||||||
functions/unsafe_call_expansion_2/input.js
|
functions/unsafe_call_expansion_2/input.js
|
||||||
hoist_props/contains_this_1/input.js
|
|
||||||
hoist_props/contains_this_2/input.js
|
|
||||||
hoist_props/hoist_class/input.js
|
hoist_props/hoist_class/input.js
|
||||||
hoist_props/hoist_class_with_new/input.js
|
hoist_props/hoist_class_with_new/input.js
|
||||||
hoist_props/issue_2473_4/input.js
|
|
||||||
hoist_props/issue_2508_1/input.js
|
|
||||||
hoist_props/issue_2508_2/input.js
|
|
||||||
hoist_props/issue_2508_5/input.js
|
|
||||||
hoist_props/issue_2508_6/input.js
|
|
||||||
hoist_props/issue_2519/input.js
|
|
||||||
hoist_props/issue_3046/input.js
|
hoist_props/issue_3046/input.js
|
||||||
hoist_props/issue_851_hoist_to_conflicting_name/input.js
|
|
||||||
hoist_props/name_collision_1/input.js
|
|
||||||
hoist_props/name_collision_2/input.js
|
|
||||||
hoist_props/name_collision_3/input.js
|
|
||||||
hoist_props/new_this/input.js
|
|
||||||
hoist_props/undefined_key/input.js
|
hoist_props/undefined_key/input.js
|
||||||
ie8/do_screw_try_catch_undefined/input.js
|
ie8/do_screw_try_catch_undefined/input.js
|
||||||
ie8/dont_screw_try_catch/input.js
|
ie8/dont_screw_try_catch/input.js
|
||||||
|
@ -770,10 +770,7 @@
|
|||||||
var textContent = element.textContent;
|
var textContent = element.textContent;
|
||||||
textContent === element._wrapperState.initialValue && "" !== textContent && null !== textContent && (element.value = textContent);
|
textContent === element._wrapperState.initialValue && "" !== textContent && null !== textContent && (element.value = textContent);
|
||||||
}
|
}
|
||||||
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml", SVG_NAMESPACE = "http://www.w3.org/2000/svg", Namespaces = {
|
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml", SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
||||||
html: HTML_NAMESPACE,
|
|
||||||
svg: SVG_NAMESPACE
|
|
||||||
};
|
|
||||||
function getIntrinsicNamespace(type) {
|
function getIntrinsicNamespace(type) {
|
||||||
switch(type){
|
switch(type){
|
||||||
case "svg":
|
case "svg":
|
||||||
@ -788,7 +785,7 @@
|
|||||||
return null == parentNamespace || parentNamespace === HTML_NAMESPACE ? getIntrinsicNamespace(type) : parentNamespace === SVG_NAMESPACE && "foreignObject" === type ? HTML_NAMESPACE : parentNamespace;
|
return null == parentNamespace || parentNamespace === HTML_NAMESPACE ? getIntrinsicNamespace(type) : parentNamespace === SVG_NAMESPACE && "foreignObject" === type ? HTML_NAMESPACE : parentNamespace;
|
||||||
}
|
}
|
||||||
var setInnerHTML = (func = function(node, html) {
|
var setInnerHTML = (func = function(node, html) {
|
||||||
if (node.namespaceURI === Namespaces.svg && !("innerHTML" in node)) {
|
if (node.namespaceURI === SVG_NAMESPACE && !("innerHTML" in node)) {
|
||||||
(reusableSVGContainer = reusableSVGContainer || document.createElement("div")).innerHTML = "<svg>" + html.valueOf().toString() + "</svg>";
|
(reusableSVGContainer = reusableSVGContainer || document.createElement("div")).innerHTML = "<svg>" + html.valueOf().toString() + "</svg>";
|
||||||
for(var svgNode = reusableSVGContainer.firstChild; node.firstChild;)node.removeChild(node.firstChild);
|
for(var svgNode = reusableSVGContainer.firstChild; node.firstChild;)node.removeChild(node.firstChild);
|
||||||
for(; svgNode.firstChild;)node.appendChild(svgNode.firstChild);
|
for(; svgNode.firstChild;)node.appendChild(svgNode.firstChild);
|
||||||
@ -3490,7 +3487,7 @@
|
|||||||
function getListenerSetKey(domEventName, capture) {
|
function getListenerSetKey(domEventName, capture) {
|
||||||
return domEventName + "__" + (capture ? "capture" : "bubble");
|
return domEventName + "__" + (capture ? "capture" : "bubble");
|
||||||
}
|
}
|
||||||
var didWarnInvalidHydration = !1, DANGEROUSLY_SET_INNER_HTML = "dangerouslySetInnerHTML", SUPPRESS_CONTENT_EDITABLE_WARNING = "suppressContentEditableWarning", SUPPRESS_HYDRATION_WARNING = "suppressHydrationWarning", AUTOFOCUS = "autoFocus", CHILDREN = "children", STYLE = "style", HTML$1 = "__html", HTML_NAMESPACE$1 = Namespaces.html;
|
var didWarnInvalidHydration = !1, DANGEROUSLY_SET_INNER_HTML = "dangerouslySetInnerHTML", SUPPRESS_CONTENT_EDITABLE_WARNING = "suppressContentEditableWarning", SUPPRESS_HYDRATION_WARNING = "suppressHydrationWarning", AUTOFOCUS = "autoFocus", CHILDREN = "children", STYLE = "style", HTML$1 = "__html";
|
||||||
warnedUnknownTags = {
|
warnedUnknownTags = {
|
||||||
dialog: !0,
|
dialog: !0,
|
||||||
webview: !0
|
webview: !0
|
||||||
@ -3567,7 +3564,7 @@
|
|||||||
}, warnForInvalidEventListener = function(registrationName, listener) {
|
}, warnForInvalidEventListener = function(registrationName, listener) {
|
||||||
!1 === listener ? error("Expected `%s` listener to be a function, instead got `false`.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.", registrationName, registrationName, registrationName) : error("Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener);
|
!1 === listener ? error("Expected `%s` listener to be a function, instead got `false`.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.", registrationName, registrationName, registrationName) : error("Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener);
|
||||||
}, normalizeHTML = function(parent, html) {
|
}, normalizeHTML = function(parent, html) {
|
||||||
var testElement = parent.namespaceURI === HTML_NAMESPACE$1 ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
|
var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
|
||||||
return testElement.innerHTML = html, testElement.innerHTML;
|
return testElement.innerHTML = html, testElement.innerHTML;
|
||||||
};
|
};
|
||||||
var validateDOMNesting = function() {}, updatedAncestorInfo = function() {}, specialTags = [
|
var validateDOMNesting = function() {}, updatedAncestorInfo = function() {}, specialTags = [
|
||||||
@ -6869,7 +6866,7 @@
|
|||||||
}(domElement, propKey, nextProp, propertyInfo);
|
}(domElement, propKey, nextProp, propertyInfo);
|
||||||
else {
|
else {
|
||||||
var ownNamespace = parentNamespace;
|
var ownNamespace = parentNamespace;
|
||||||
if (ownNamespace === HTML_NAMESPACE$1 && (ownNamespace = getIntrinsicNamespace(tag)), ownNamespace === HTML_NAMESPACE$1) extraAttributeNames.delete(propKey.toLowerCase());
|
if (ownNamespace === HTML_NAMESPACE && (ownNamespace = getIntrinsicNamespace(tag)), ownNamespace === HTML_NAMESPACE) extraAttributeNames.delete(propKey.toLowerCase());
|
||||||
else {
|
else {
|
||||||
var standardName = function(propName) {
|
var standardName = function(propName) {
|
||||||
var lowerCasedName = propName.toLowerCase();
|
var lowerCasedName = propName.toLowerCase();
|
||||||
@ -6906,7 +6903,7 @@
|
|||||||
}
|
}
|
||||||
var domElement = function(type, props, rootContainerElement, parentNamespace) {
|
var domElement = function(type, props, rootContainerElement, parentNamespace) {
|
||||||
var isCustomComponentTag, domElement, ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement), namespaceURI = parentNamespace;
|
var isCustomComponentTag, domElement, ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement), namespaceURI = parentNamespace;
|
||||||
if (namespaceURI === HTML_NAMESPACE$1 && (namespaceURI = getIntrinsicNamespace(type)), namespaceURI === HTML_NAMESPACE$1) {
|
if (namespaceURI === HTML_NAMESPACE && (namespaceURI = getIntrinsicNamespace(type)), namespaceURI === HTML_NAMESPACE) {
|
||||||
if ((isCustomComponentTag = isCustomComponent(type, props)) || type === type.toLowerCase() || error("<%s /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.", type), "script" === type) {
|
if ((isCustomComponentTag = isCustomComponent(type, props)) || type === type.toLowerCase() || error("<%s /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.", type), "script" === type) {
|
||||||
var div = ownerDocument.createElement("div");
|
var div = ownerDocument.createElement("div");
|
||||||
div.innerHTML = "<script></script>";
|
div.innerHTML = "<script></script>";
|
||||||
@ -6920,7 +6917,7 @@
|
|||||||
props.multiple ? node.multiple = !0 : props.size && (node.size = props.size);
|
props.multiple ? node.multiple = !0 : props.size && (node.size = props.size);
|
||||||
}
|
}
|
||||||
} else domElement = ownerDocument.createElementNS(namespaceURI, type);
|
} else domElement = ownerDocument.createElementNS(namespaceURI, type);
|
||||||
return namespaceURI !== HTML_NAMESPACE$1 || isCustomComponentTag || "[object HTMLUnknownElement]" !== Object.prototype.toString.call(domElement) || Object.prototype.hasOwnProperty.call(warnedUnknownTags, type) || (warnedUnknownTags[type] = !0, error("The tag <%s> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.", type)), domElement;
|
return namespaceURI !== HTML_NAMESPACE || isCustomComponentTag || "[object HTMLUnknownElement]" !== Object.prototype.toString.call(domElement) || Object.prototype.hasOwnProperty.call(warnedUnknownTags, type) || (warnedUnknownTags[type] = !0, error("The tag <%s> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.", type)), domElement;
|
||||||
}(type, props, rootContainerInstance, hostContext.namespace);
|
}(type, props, rootContainerInstance, hostContext.namespace);
|
||||||
return hostInst = internalInstanceHandle, domElement[internalInstanceKey] = hostInst, node = domElement, props1 = props, node[internalPropsKey] = props1, domElement;
|
return hostInst = internalInstanceHandle, domElement[internalInstanceKey] = hostInst, node = domElement, props1 = props, node[internalPropsKey] = props1, domElement;
|
||||||
}(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
|
}(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
var o = {
|
|
||||||
a: 1
|
|
||||||
};
|
|
||||||
console.log(function(k) {
|
console.log(function(k) {
|
||||||
if (o["a"]) return "PASS";
|
return "PASS";
|
||||||
}(0));
|
}(0));
|
||||||
|
@ -1,11 +1 @@
|
|||||||
var obj = {
|
console.log(1, 27);
|
||||||
foo: 1,
|
|
||||||
bar: 2,
|
|
||||||
square: function(x) {
|
|
||||||
return x * x;
|
|
||||||
},
|
|
||||||
cube: function(x) {
|
|
||||||
return x * x * x;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
console.log(obj.foo, obj.cube(3));
|
|
||||||
|
@ -1,11 +1,2 @@
|
|||||||
var obj = {
|
var x;
|
||||||
foo: 1,
|
console.log(1, 3 * (x = 3) * x);
|
||||||
bar: 2,
|
|
||||||
square: function(x) {
|
|
||||||
return x * x;
|
|
||||||
},
|
|
||||||
cube: function(x) {
|
|
||||||
return x * x * x;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
console.log(obj.foo, obj.cube(3));
|
|
||||||
|
@ -1,11 +1 @@
|
|||||||
var obj = {
|
console.log(1, 27);
|
||||||
foo: 1,
|
|
||||||
bar: 2,
|
|
||||||
square: function(x) {
|
|
||||||
return x * x;
|
|
||||||
},
|
|
||||||
cube: function(x) {
|
|
||||||
return x * x * x;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
console.log(obj.foo, obj.cube(3));
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
(function () {
|
(function() {
|
||||||
var o_a = 1,
|
console.log(1, 2);
|
||||||
o_b = 2;
|
|
||||||
console.log(o_a, o_b);
|
|
||||||
})();
|
})();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function testFunc() {
|
function testFunc() {
|
||||||
return 1 * ((6 + 5) / 2);
|
return 5.5;
|
||||||
}
|
}
|
||||||
console.log(testFunc());
|
console.log(testFunc());
|
||||||
|
@ -1,5 +1 @@
|
|||||||
const BBB_CCC$0 = "PASS";
|
if (id(true)) console.log("PASS");
|
||||||
if (id(true)) {
|
|
||||||
const BBB_CCC = BBB_CCC$0;
|
|
||||||
console.log(BBB_CCC);
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
var obj_foo = 1;
|
|
||||||
var obj_bar = 2;
|
var obj_bar = 2;
|
||||||
function f() {
|
(function() {
|
||||||
var obj_foo$0 = 3,
|
console.log(1, 3, 4, 5, 6, 7);
|
||||||
obj_bar$0 = 4,
|
})();
|
||||||
obj_b_r = 5,
|
|
||||||
obj_b_r$0 = 6,
|
|
||||||
obj_b_r$1 = 7;
|
|
||||||
console.log(obj_foo, obj_foo$0, obj_bar$0, obj_b_r, obj_b_r$0, obj_b_r$1);
|
|
||||||
}
|
|
||||||
f();
|
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
var o_p = 1,
|
var o_p = 1;
|
||||||
o__ = function (x) {
|
console.log(true, function(x) {
|
||||||
return x;
|
return 4;
|
||||||
},
|
}(0), function(x) {
|
||||||
o__$2 = function (x) {
|
return 6;
|
||||||
return x + 1;
|
}(0), 2, 3);
|
||||||
},
|
|
||||||
o__$0 = 2,
|
|
||||||
o__$1 = 3;
|
|
||||||
console.log(o_p === o_p, o__(4), o__$2(5), o__$0, o__$1);
|
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
var o_p = 1,
|
var o_p = 1, o__$0 = 2, o__$1 = 3;
|
||||||
o__ = function (x) {
|
console.log(true, function(x) {
|
||||||
return x;
|
return 4;
|
||||||
},
|
}(0), function(x) {
|
||||||
o__$2 = function (x) {
|
return 6;
|
||||||
return x + 1;
|
}(0));
|
||||||
},
|
|
||||||
o__$0 = 2,
|
|
||||||
o__$1 = 3;
|
|
||||||
console.log(o_p === o_p, o__(4), o__$2(5));
|
|
||||||
|
@ -331,7 +331,7 @@ where
|
|||||||
let var = self.data.var_or_default(obj.to_id());
|
let var = self.data.var_or_default(obj.to_id());
|
||||||
|
|
||||||
match &*e.left {
|
match &*e.left {
|
||||||
Expr::Lit(Lit::Str(prop)) => {
|
Expr::Lit(Lit::Str(prop)) if prop.value.parse::<f64>().is_err() => {
|
||||||
var.add_accessed_property(prop.value.clone());
|
var.add_accessed_property(prop.value.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,11 +457,11 @@ where
|
|||||||
Expr::Ident(Ident { sym, .. }) if *sym == *"eval" => {
|
Expr::Ident(Ident { sym, .. }) if *sym == *"eval" => {
|
||||||
self.scope.mark_eval_called();
|
self.scope.mark_eval_called();
|
||||||
}
|
}
|
||||||
Expr::Member(m) => for_each_id_ref_in_expr(&m.obj, &mut |id| {
|
Expr::Member(m) if !m.obj.is_ident() => {
|
||||||
self.data
|
for_each_id_ref_in_expr(&m.obj, &mut |id| {
|
||||||
.var_or_default(id.to_id())
|
self.data.var_or_default(id.to_id()).mark_used_as_ref()
|
||||||
.mark_indexed_with_dynamic_key()
|
})
|
||||||
}),
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -917,8 +917,15 @@ where
|
|||||||
let v = self.data.var_or_default(obj.to_id());
|
let v = self.data.var_or_default(obj.to_id());
|
||||||
v.mark_has_property_access();
|
v.mark_has_property_access();
|
||||||
|
|
||||||
if let MemberProp::Computed(..) = e.prop {
|
if let MemberProp::Computed(prop) = &e.prop {
|
||||||
v.mark_indexed_with_dynamic_key();
|
match &*prop.expr {
|
||||||
|
Expr::Lit(Lit::Str(s)) if s.value.parse::<f64>().is_err() => {
|
||||||
|
v.add_accessed_property(s.value.clone());
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
v.mark_indexed_with_dynamic_key();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let MemberProp::Ident(prop) = &e.prop {
|
if let MemberProp::Ident(prop) = &e.prop {
|
||||||
|
Loading…
Reference in New Issue
Block a user