Vendor things

This commit is contained in:
John Doty 2024-03-08 11:03:01 -08:00
parent 5deceec006
commit 977e3c17e5
19434 changed files with 10682014 additions and 0 deletions

View file

@ -0,0 +1,131 @@
use serde::{Deserialize, Serialize};
/// Alternative for https://babeljs.io/docs/en/assumptions
///
/// All fields default to `false`.
#[derive(
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize,
)]
#[non_exhaustive]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct Assumptions {
/// https://babeljs.io/docs/en/assumptions#arraylikeisiterable
#[serde(default)]
pub array_like_is_iterable: bool,
/// https://babeljs.io/docs/en/assumptions#constantreexports
#[serde(default)]
pub constant_reexports: bool,
/// https://babeljs.io/docs/en/assumptions#constantsuper
#[serde(default)]
pub constant_super: bool,
/// https://babeljs.io/docs/en/assumptions#enumerablemodulemeta
#[serde(default)]
pub enumerable_module_meta: bool,
/// https://babeljs.io/docs/en/assumptions#ignorefunctionlength
#[serde(default)]
pub ignore_function_length: bool,
#[serde(default)]
pub ignore_function_name: bool,
/// https://babeljs.io/docs/en/assumptions#ignoretoprimitivehint
#[serde(default)]
pub ignore_to_primitive_hint: bool,
/// https://babeljs.io/docs/en/assumptions#iterableisarray
#[serde(default)]
pub iterable_is_array: bool,
/// https://babeljs.io/docs/en/assumptions#mutabletemplateobject
#[serde(default)]
pub mutable_template_object: bool,
/// https://babeljs.io/docs/en/assumptions#noclasscalls
#[serde(default)]
pub no_class_calls: bool,
/// https://babeljs.io/docs/en/assumptions#nodocumentall
#[serde(default)]
pub no_document_all: bool,
/// https://babeljs.io/docs/en/assumptions#noincompletensimportdetection
#[serde(default)]
pub no_incomplete_ns_import_detection: bool,
/// https://babeljs.io/docs/en/assumptions#nonewarrows
#[serde(default)]
pub no_new_arrows: bool,
/// https://babeljs.io/docs/en/assumptions#objectrestnosymbols
#[serde(default)]
pub object_rest_no_symbols: bool,
/// https://babeljs.io/docs/en/assumptions#privatefieldsasproperties
#[serde(default)]
pub private_fields_as_properties: bool,
/// https://babeljs.io/docs/en/assumptions#puregetters
#[serde(default)]
pub pure_getters: bool,
/// https://babeljs.io/docs/en/assumptions#setclassmethods
#[serde(default)]
pub set_class_methods: bool,
/// https://babeljs.io/docs/en/assumptions#setcomputedproperties
#[serde(default)]
pub set_computed_properties: bool,
/// https://babeljs.io/docs/en/assumptions#setpublicclassfields
#[serde(default)]
pub set_public_class_fields: bool,
/// https://babeljs.io/docs/en/assumptions#setspreadproperties
#[serde(default)]
pub set_spread_properties: bool,
/// https://babeljs.io/docs/en/assumptions#skipforofiteratorclosing
#[serde(default)]
pub skip_for_of_iterator_closing: bool,
/// https://babeljs.io/docs/en/assumptions#superiscallableconstructor
#[serde(default)]
pub super_is_callable_constructor: bool,
#[serde(default)]
pub ts_enum_is_readonly: bool,
}
impl Assumptions {
pub fn all() -> Self {
Self {
array_like_is_iterable: true,
constant_reexports: true,
constant_super: true,
enumerable_module_meta: true,
ignore_function_length: true,
ignore_function_name: true,
ignore_to_primitive_hint: true,
iterable_is_array: true,
mutable_template_object: true,
no_class_calls: true,
no_document_all: true,
no_incomplete_ns_import_detection: true,
no_new_arrows: true,
object_rest_no_symbols: true,
private_fields_as_properties: true,
pure_getters: true,
set_class_methods: true,
set_computed_properties: true,
set_public_class_fields: true,
set_spread_properties: true,
skip_for_of_iterator_closing: true,
super_is_callable_constructor: true,
ts_enum_is_readonly: true,
}
}
}

View file

@ -0,0 +1,163 @@
//! Do not use: This is not a public api and it can be changed without a version
//! bump.
use std::ops::DerefMut;
use swc_ecma_ast::*;
use swc_ecma_utils::ExprExt;
/// Do not use: This is not a public api and it can be changed without a version
/// bump.
pub trait PatOrExprExt: AsOptExpr {
fn as_ref(&self) -> &PatOrExpr;
fn as_mut(&mut self) -> &mut PatOrExpr;
fn as_ident(&self) -> Option<&Ident> {
if let Some(Expr::Ident(i)) = self.as_expr() {
return Some(i);
}
match self.as_ref() {
PatOrExpr::Expr(e) => match &**e {
Expr::Ident(i) => Some(i),
_ => None,
},
PatOrExpr::Pat(p) => match &**p {
Pat::Ident(i) => Some(&i.id),
_ => None,
},
}
}
fn as_ident_mut(&mut self) -> Option<&mut Ident> {
match self.as_mut() {
PatOrExpr::Pat(p) => match **p {
Pat::Ident(ref mut i) => Some(&mut i.id),
Pat::Expr(ref mut e) => match e.deref_mut() {
Expr::Ident(i) => Some(i),
_ => None,
},
_ => None,
},
PatOrExpr::Expr(ref mut e) => match e.deref_mut() {
Expr::Ident(i) => Some(i),
_ => None,
},
}
}
fn normalize_expr(self) -> Self;
fn normalize_ident(self) -> Self;
}
impl PatOrExprExt for PatOrExpr {
fn as_ref(&self) -> &PatOrExpr {
self
}
fn as_mut(&mut self) -> &mut PatOrExpr {
self
}
fn normalize_expr(self) -> Self {
match self {
PatOrExpr::Pat(pat) => match *pat {
Pat::Expr(expr) => PatOrExpr::Expr(expr),
_ => PatOrExpr::Pat(pat),
},
_ => self,
}
}
fn normalize_ident(self) -> Self {
match self {
PatOrExpr::Expr(expr) => match *expr {
Expr::Ident(i) => PatOrExpr::Pat(i.into()),
_ => PatOrExpr::Expr(expr),
},
PatOrExpr::Pat(pat) => match *pat {
Pat::Expr(expr) => match *expr {
Expr::Ident(i) => PatOrExpr::Pat(i.into()),
_ => PatOrExpr::Expr(expr),
},
_ => PatOrExpr::Pat(pat),
},
}
}
}
pub trait ExprRefExt: ExprExt {
fn as_ident(&self) -> Option<&Ident> {
match self.as_expr() {
Expr::Ident(ref i) => Some(i),
_ => None,
}
}
}
impl<T> ExprRefExt for T where T: ExprExt {}
/// Do not use: This is not a public api and it can be changed without a version
/// bump.
pub trait AsOptExpr {
fn as_expr(&self) -> Option<&Expr>;
fn as_expr_mut(&mut self) -> Option<&mut Expr>;
}
impl AsOptExpr for PatOrExpr {
fn as_expr(&self) -> Option<&Expr> {
match self.as_ref() {
PatOrExpr::Expr(e) => Some(e),
PatOrExpr::Pat(p) => match &**p {
Pat::Expr(e) => Some(e),
_ => None,
},
}
}
fn as_expr_mut(&mut self) -> Option<&mut Expr> {
match self.as_mut() {
PatOrExpr::Expr(e) => Some(e.deref_mut()),
PatOrExpr::Pat(p) => match &mut **p {
Pat::Expr(e) => Some(e.deref_mut()),
_ => None,
},
}
}
}
impl AsOptExpr for Callee {
fn as_expr(&self) -> Option<&Expr> {
match self {
Callee::Super(_) | Callee::Import(_) => None,
Callee::Expr(e) => Some(e),
}
}
fn as_expr_mut(&mut self) -> Option<&mut Expr> {
match self {
Callee::Super(_) | Callee::Import(_) => None,
Callee::Expr(e) => Some(e),
}
}
}
impl<N> AsOptExpr for Option<N>
where
N: AsOptExpr,
{
fn as_expr(&self) -> Option<&Expr> {
match self {
Some(n) => n.as_expr(),
None => None,
}
}
fn as_expr_mut(&mut self) -> Option<&mut Expr> {
match self {
None => None,
Some(n) => n.as_expr_mut(),
}
}
}

View file

@ -0,0 +1,246 @@
#![allow(non_upper_case_globals)]
use bitflags::bitflags;
use swc_ecma_ast::EsVersion::{self, *};
bitflags! {
#[derive(Default, Clone, Copy)]
pub struct FeatureFlag: u64 {
/// `transform-template-literals`
const TemplateLiterals = 1 << 0;
/// `transform-literals`
const Literals = 1 << 1;
/// `transform-function-name`
const FunctionName = 1 << 2;
/// `transform-arrow-functions`
const ArrowFunctions = 1 << 3;
/// `transform-block-scoped-functions`
const BlockScopedFunctions = 1 << 4;
/// `transform-classes`
const Classes = 1 << 5;
/// `transform-object-super`
const ObjectSuper = 1 << 6;
/// `transform-shorthand-properties`
const ShorthandProperties = 1 << 7;
/// `transform-duplicate-keys`
const DuplicateKeys = 1 << 8;
/// `transform-computed-properties`
const ComputedProperties = 1 << 9;
/// `transform-for-of`
const ForOf = 1 << 10;
/// `transform-sticky-regex`
const StickyRegex = 1 << 11;
/// `transform-dotall-regex`
const DotAllRegex = 1 << 12;
/// `transform-unicode-regex`
const UnicodeRegex = 1 << 13;
/// `transform-spread`
const Spread = 1 << 14;
/// `transform-parameters`
const Parameters = 1 << 15;
/// `transform-destructuring`
const Destructuring = 1 << 16;
/// `transform-block-scoping`
const BlockScoping = 1 << 17;
/// `transform-typeof-symbol`
const TypeOfSymbol = 1 << 18;
/// `transform-new-target`
const NewTarget = 1 << 19;
/// `transform-regenerator`
const Regenerator = 1 << 20;
/// `transform-exponentiation-operator`
const ExponentiationOperator = 1 << 21;
/// `transform-async-to-generator`
const AsyncToGenerator = 1 << 22;
/// `proposal-async-generator-functions`
const AsyncGeneratorFunctions = 1 << 23;
/// `proposal-object-rest-spread`
const ObjectRestSpread = 1 << 24;
/// `proposal-unicode-property-regex`
const UnicodePropertyRegex = 1 << 25;
/// `proposal-json-strings`
const JsonStrings = 1 << 26;
/// `proposal-optional-catch-binding`
const OptionalCatchBinding = 1 << 27;
/// `transform-named-capturing-groups-regex`
const NamedCapturingGroupsRegex = 1 << 28;
/// `transform-member-expression-literals`
const MemberExpressionLiterals = 1 << 29;
/// `transform-property-literals`
const PropertyLiterals = 1 << 30;
/// `transform-reserved-words`
const ReservedWords = 1 << 31;
/// `proposal-export-namespace-from`
const ExportNamespaceFrom = 1 << 32;
/// `proposal-nullish-coalescing-operator`
const NullishCoalescing = 1 << 33;
/// `proposal-logical-assignment-operators`
const LogicalAssignmentOperators = 1 << 34;
/// `proposal-optional-chaining`
const OptionalChaining = 1 << 35;
/// `proposal-class-properties`
const ClassProperties = 1 << 36;
/// `proposal-numeric-separator`
const NumericSeparator = 1 << 37;
/// `proposal-private-methods`
const PrivateMethods = 1 << 38;
/// `proposal-class-static-block`
const ClassStaticBlock = 1 << 39;
/// `proposal-private-property-in-object`
const PrivatePropertyInObject = 1 << 40;
/// `transform-unicode-escapes`
const UnicodeEscapes = 1 << 41;
/// `bugfix/transform-async-arrows-in-class`
const BugfixAsyncArrowsInClass = 1 << 42;
/// `bugfix/transform-edge-default-parameters`
const BugfixEdgeDefaultParam = 1 << 43;
/// `bugfix/transform-tagged-template-caching`
const BugfixTaggedTemplateCaching = 1 << 44;
/// `bugfix/transform-safari-id-destructuring-collision-in-function-expression`
const BugfixSafariIdDestructuringCollisionInFunctionExpression = 1 << 45;
/// `bugfix/transform-edge-function-name`
const BugfixTransformEdgeFunctionName = 1 << 46; // TODO
/// `bugfix/transform-safari-block-shadowing`
const BugfixTransformSafariBlockShadowing = 1 << 47; // TODO
/// `bugfix/transform-safari-for-shadowing`
const BugfixTransformSafariForShadowing = 1 << 48; // TODO
/// `bugfix/transform-v8-spread-parameters-in-optional-chaining`
const BugfixTransformV8SpreadParametersInOptionalChaining = 1 << 49; // TODO
}
}
pub fn enable_available_feature_from_es_version(version: EsVersion) -> FeatureFlag {
let mut feature = FeatureFlag::empty();
if version < Es5 {
return feature;
}
feature |= FeatureFlag::PropertyLiterals
| FeatureFlag::MemberExpressionLiterals
| FeatureFlag::ReservedWords;
if version < Es2015 {
return feature;
}
feature |= FeatureFlag::ArrowFunctions
| FeatureFlag::BlockScopedFunctions
| FeatureFlag::BlockScoping
| FeatureFlag::Classes
| FeatureFlag::ComputedProperties
| FeatureFlag::Destructuring
| FeatureFlag::DuplicateKeys
| FeatureFlag::ForOf
| FeatureFlag::FunctionName
| FeatureFlag::NewTarget
| FeatureFlag::ObjectSuper
| FeatureFlag::Parameters
| FeatureFlag::Regenerator
| FeatureFlag::ShorthandProperties
| FeatureFlag::Spread
| FeatureFlag::StickyRegex
| FeatureFlag::TemplateLiterals
| FeatureFlag::TypeOfSymbol
| FeatureFlag::UnicodeRegex;
if version < Es2016 {
return feature;
}
feature |= FeatureFlag::ExponentiationOperator;
if version < Es2017 {
return feature;
}
// support `async`
feature |= FeatureFlag::AsyncToGenerator;
if version < Es2018 {
return feature;
}
feature |= FeatureFlag::ObjectRestSpread
| FeatureFlag::DotAllRegex
| FeatureFlag::NamedCapturingGroupsRegex
| FeatureFlag::UnicodePropertyRegex;
if version < Es2019 {
return feature;
}
feature |= FeatureFlag::OptionalCatchBinding;
if version < Es2020 {
return feature;
}
feature |= FeatureFlag::ExportNamespaceFrom
| FeatureFlag::NullishCoalescing
| FeatureFlag::OptionalChaining;
if version < Es2021 {
return feature;
}
feature |= FeatureFlag::LogicalAssignmentOperators;
if version < Es2022 {
return feature;
}
feature |= FeatureFlag::ClassProperties
| FeatureFlag::ClassStaticBlock
| FeatureFlag::PrivatePropertyInObject;
feature
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,29 @@
function _apply_decorated_descriptor(target, property, decorators, descriptor, context) {
var desc = {};
Object["ke" + "ys"](descriptor).forEach(function(key) {
desc[key] = descriptor[key];
});
desc.enumerable = !!desc.enumerable;
desc.configurable = !!desc.configurable;
if ("value" in desc || desc.initializer) {
desc.writable = true;
}
desc = decorators.slice().reverse().reduce(function(desc, decorator) {
return decorator ? decorator(target, property, desc) || desc : desc;
}, desc);
var hasAccessor = Object.prototype.hasOwnProperty.call(desc, "get") || Object.prototype.hasOwnProperty.call(desc, "set");
if (context && desc.initializer !== void 0 && !hasAccessor) {
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
desc.initializer = undefined;
}
if (hasAccessor) {
delete desc.writable;
delete desc.initializer;
delete desc.value;
}
if (desc.initializer === void 0) {
Object["define" + "Property"](target, property, desc);
desc = null;
}
return desc;
}

View file

@ -0,0 +1,642 @@
/* @minVersion 7.20.0 */
/**
Enums are used in this file, but not assigned to vars to avoid non-hoistable values
CONSTRUCTOR = 0;
PUBLIC = 1;
PRIVATE = 2;
FIELD = 0;
ACCESSOR = 1;
METHOD = 2;
GETTER = 3;
SETTER = 4;
STATIC = 5;
CLASS = 10; // only used in assertValidReturnValue
*/
function applyDecs2203RFactory() {
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
return function addInitializer(initializer) {
assertNotFinished(decoratorFinishedRef, "addInitializer");
assertCallable(initializer, "An initializer");
initializers.push(initializer);
};
}
function memberDec(
dec,
name,
desc,
initializers,
kind,
isStatic,
isPrivate,
value
) {
var kindStr;
switch (kind) {
case 1 /* ACCESSOR */:
kindStr = "accessor";
break;
case 2 /* METHOD */:
kindStr = "method";
break;
case 3 /* GETTER */:
kindStr = "getter";
break;
case 4 /* SETTER */:
kindStr = "setter";
break;
default:
kindStr = "field";
}
var ctx = {
kind: kindStr,
name: isPrivate ? "#" + name : name,
static: isStatic,
private: isPrivate,
};
var decoratorFinishedRef = { v: false };
if (kind !== 0 /* FIELD */) {
ctx.addInitializer = createAddInitializerMethod(
initializers,
decoratorFinishedRef
);
}
var get, set;
if (kind === 0 /* FIELD */) {
if (isPrivate) {
get = desc.get;
set = desc.set;
} else {
get = function () {
return this[name];
};
set = function (v) {
this[name] = v;
};
}
} else if (kind === 2 /* METHOD */) {
get = function () {
return desc.value;
};
} else {
// replace with values that will go through the final getter and setter
if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) {
get = function () {
return desc.get.call(this);
};
}
if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) {
set = function (v) {
desc.set.call(this, v);
};
}
}
ctx.access =
get && set ? { get: get, set: set } : get ? { get: get } : { set: set };
try {
return dec(value, ctx);
} finally {
decoratorFinishedRef.v = true;
}
}
function assertNotFinished(decoratorFinishedRef, fnName) {
if (decoratorFinishedRef.v) {
throw new Error(
"attempted to call " + fnName + " after decoration was finished"
);
}
}
function assertCallable(fn, hint) {
if (typeof fn !== "function") {
throw new TypeError(hint + " must be a function");
}
}
function assertValidReturnValue(kind, value) {
var type = typeof value;
if (kind === 1 /* ACCESSOR */) {
if (type !== "object" || value === null) {
throw new TypeError(
"accessor decorators must return an object with get, set, or init properties or void 0"
);
}
if (value.get !== undefined) {
assertCallable(value.get, "accessor.get");
}
if (value.set !== undefined) {
assertCallable(value.set, "accessor.set");
}
if (value.init !== undefined) {
assertCallable(value.init, "accessor.init");
}
} else if (type !== "function") {
var hint;
if (kind === 0 /* FIELD */) {
hint = "field";
} else if (kind === 10 /* CLASS */) {
hint = "class";
} else {
hint = "method";
}
throw new TypeError(
hint + " decorators must return a function or void 0"
);
}
}
function applyMemberDec(
ret,
base,
decInfo,
name,
kind,
isStatic,
isPrivate,
initializers
) {
var decs = decInfo[0];
var desc, init, value;
if (isPrivate) {
if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
desc = {
get: decInfo[3],
set: decInfo[4],
};
} else if (kind === 3 /* GETTER */) {
desc = {
get: decInfo[3],
};
} else if (kind === 4 /* SETTER */) {
desc = {
set: decInfo[3],
};
} else {
desc = {
value: decInfo[3],
};
}
} else if (kind !== 0 /* FIELD */) {
desc = Object.getOwnPropertyDescriptor(base, name);
}
if (kind === 1 /* ACCESSOR */) {
value = {
get: desc.get,
set: desc.set,
};
} else if (kind === 2 /* METHOD */) {
value = desc.value;
} else if (kind === 3 /* GETTER */) {
value = desc.get;
} else if (kind === 4 /* SETTER */) {
value = desc.set;
}
var newValue, get, set;
if (typeof decs === "function") {
newValue = memberDec(
decs,
name,
desc,
initializers,
kind,
isStatic,
isPrivate,
value
);
if (newValue !== void 0) {
assertValidReturnValue(kind, newValue);
if (kind === 0 /* FIELD */) {
init = newValue;
} else if (kind === 1 /* ACCESSOR */) {
init = newValue.init;
get = newValue.get || value.get;
set = newValue.set || value.set;
value = { get: get, set: set };
} else {
value = newValue;
}
}
} else {
for (var i = decs.length - 1; i >= 0; i--) {
var dec = decs[i];
newValue = memberDec(
dec,
name,
desc,
initializers,
kind,
isStatic,
isPrivate,
value
);
if (newValue !== void 0) {
assertValidReturnValue(kind, newValue);
var newInit;
if (kind === 0 /* FIELD */) {
newInit = newValue;
} else if (kind === 1 /* ACCESSOR */) {
newInit = newValue.init;
get = newValue.get || value.get;
set = newValue.set || value.set;
value = { get: get, set: set };
} else {
value = newValue;
}
if (newInit !== void 0) {
if (init === void 0) {
init = newInit;
} else if (typeof init === "function") {
init = [init, newInit];
} else {
init.push(newInit);
}
}
}
}
}
if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
if (init === void 0) {
// If the initializer was void 0, sub in a dummy initializer
init = function (instance, init) {
return init;
};
} else if (typeof init !== "function") {
var ownInitializers = init;
init = function (instance, init) {
var value = init;
for (var i = 0; i < ownInitializers.length; i++) {
value = ownInitializers[i].call(instance, value);
}
return value;
};
} else {
var originalInitializer = init;
init = function (instance, init) {
return originalInitializer.call(instance, init);
};
}
ret.push(init);
}
if (kind !== 0 /* FIELD */) {
if (kind === 1 /* ACCESSOR */) {
desc.get = value.get;
desc.set = value.set;
} else if (kind === 2 /* METHOD */) {
desc.value = value;
} else if (kind === 3 /* GETTER */) {
desc.get = value;
} else if (kind === 4 /* SETTER */) {
desc.set = value;
}
if (isPrivate) {
if (kind === 1 /* ACCESSOR */) {
ret.push(function (instance, args) {
return value.get.call(instance, args);
});
ret.push(function (instance, args) {
return value.set.call(instance, args);
});
} else if (kind === 2 /* METHOD */) {
ret.push(value);
} else {
ret.push(function (instance, args) {
return value.call(instance, args);
});
}
} else {
Object.defineProperty(base, name, desc);
}
}
}
function applyMemberDecs(Class, decInfos) {
var ret = [];
var protoInitializers;
var staticInitializers;
var existingProtoNonFields = new Map();
var existingStaticNonFields = new Map();
for (var i = 0; i < decInfos.length; i++) {
var decInfo = decInfos[i];
// skip computed property names
if (!Array.isArray(decInfo)) continue;
var kind = decInfo[1];
var name = decInfo[2];
var isPrivate = decInfo.length > 3;
var isStatic = kind >= 5; /* STATIC */
var base;
var initializers;
if (isStatic) {
base = Class;
kind = kind - 5 /* STATIC */;
// initialize staticInitializers when we see a non-field static member
if (kind !== 0 /* FIELD */) {
staticInitializers = staticInitializers || [];
initializers = staticInitializers;
}
} else {
base = Class.prototype;
// initialize protoInitializers when we see a non-field member
if (kind !== 0 /* FIELD */) {
protoInitializers = protoInitializers || [];
initializers = protoInitializers;
}
}
if (kind !== 0 /* FIELD */ && !isPrivate) {
var existingNonFields = isStatic
? existingStaticNonFields
: existingProtoNonFields;
var existingKind = existingNonFields.get(name) || 0;
if (
existingKind === true ||
(existingKind === 3 /* GETTER */ && kind !== 4) /* SETTER */ ||
(existingKind === 4 /* SETTER */ && kind !== 3) /* GETTER */
) {
throw new Error(
"Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " +
name
);
} else if (!existingKind && kind > 2 /* METHOD */) {
existingNonFields.set(name, kind);
} else {
existingNonFields.set(name, true);
}
}
applyMemberDec(
ret,
base,
decInfo,
name,
kind,
isStatic,
isPrivate,
initializers
);
}
pushInitializers(ret, protoInitializers);
pushInitializers(ret, staticInitializers);
return ret;
}
function pushInitializers(ret, initializers) {
if (initializers) {
ret.push(function (instance) {
for (var i = 0; i < initializers.length; i++) {
initializers[i].call(instance);
}
return instance;
});
}
}
function applyClassDecs(targetClass, classDecs) {
if (classDecs.length > 0) {
var initializers = [];
var newClass = targetClass;
var name = targetClass.name;
for (var i = classDecs.length - 1; i >= 0; i--) {
var decoratorFinishedRef = { v: false };
try {
var nextNewClass = classDecs[i](newClass, {
kind: "class",
name: name,
addInitializer: createAddInitializerMethod(
initializers,
decoratorFinishedRef
),
});
} finally {
decoratorFinishedRef.v = true;
}
if (nextNewClass !== undefined) {
assertValidReturnValue(10 /* CLASS */, nextNewClass);
newClass = nextNewClass;
}
}
return [
newClass,
function () {
for (var i = 0; i < initializers.length; i++) {
initializers[i].call(newClass);
}
},
];
}
// The transformer will not emit assignment when there are no class decorators,
// so we don't have to return an empty array here.
}
/**
Basic usage:
applyDecs(
Class,
[
// member decorators
[
dec, // dec or array of decs
0, // kind of value being decorated
'prop', // name of public prop on class containing the value being decorated,
'#p', // the name of the private property (if is private, void 0 otherwise),
]
],
[
// class decorators
dec1, dec2
]
)
```
Fully transpiled example:
```js
@dec
class Class {
@dec
a = 123;
@dec
#a = 123;
@dec
@dec2
accessor b = 123;
@dec
accessor #b = 123;
@dec
c() { console.log('c'); }
@dec
#c() { console.log('privC'); }
@dec
get d() { console.log('d'); }
@dec
get #d() { console.log('privD'); }
@dec
set e(v) { console.log('e'); }
@dec
set #e(v) { console.log('privE'); }
}
// becomes
let initializeInstance;
let initializeClass;
let initA;
let initPrivA;
let initB;
let initPrivB, getPrivB, setPrivB;
let privC;
let privD;
let privE;
let Class;
class _Class {
static {
let ret = applyDecs(
this,
[
[dec, 0, 'a'],
[dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v],
[[dec, dec2], 1, 'b'],
[dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v],
[dec, 2, 'c'],
[dec, 2, 'c', () => console.log('privC')],
[dec, 3, 'd'],
[dec, 3, 'd', () => console.log('privD')],
[dec, 4, 'e'],
[dec, 4, 'e', () => console.log('privE')],
],
[
dec
]
)
initA = ret[0];
initPrivA = ret[1];
initB = ret[2];
initPrivB = ret[3];
getPrivB = ret[4];
setPrivB = ret[5];
privC = ret[6];
privD = ret[7];
privE = ret[8];
initializeInstance = ret[9];
Class = ret[10]
initializeClass = ret[11];
}
a = (initializeInstance(this), initA(this, 123));
#a = initPrivA(this, 123);
#bData = initB(this, 123);
get b() { return this.#bData }
set b(v) { this.#bData = v }
#privBData = initPrivB(this, 123);
get #b() { return getPrivB(this); }
set #b(v) { setPrivB(this, v); }
c() { console.log('c'); }
#c(...args) { return privC(this, ...args) }
get d() { console.log('d'); }
get #d() { return privD(this); }
set e(v) { console.log('e'); }
set #e(v) { privE(this, v); }
}
initializeClass(Class);
*/
return function applyDecs2203R(targetClass, memberDecs, classDecs) {
return {
e: applyMemberDecs(targetClass, memberDecs),
// Lazily apply class decorations so that member init locals can be properly bound.
get c() {
return applyClassDecs(targetClass, classDecs);
},
};
};
}
function _apply_decs_2203_r(targetClass, memberDecs, classDecs) {
return (_apply_decs_2203_r = applyDecs2203RFactory())(
targetClass,
memberDecs,
classDecs
);
}

View file

@ -0,0 +1,5 @@
function _array_like_to_array(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}

View file

@ -0,0 +1,3 @@
function _array_with_holes(arr) {
if (Array.isArray(arr)) return arr;
}

View file

@ -0,0 +1,3 @@
function _array_without_holes(arr) {
if (Array.isArray(arr)) return _array_like_to_array(arr);
}

View file

@ -0,0 +1,6 @@
function _assert_this_initialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}

View file

@ -0,0 +1,69 @@
function _async_generator(gen) {
var front, back;
function send(key, arg) {
return new Promise(function(resolve, reject) {
var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null };
if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
}
function resume(key, arg) {
try {
var result = gen[key](arg);
var value = result.value;
var wrappedAwait = value instanceof _await_value;
Promise.resolve(wrappedAwait ? value.wrapped : value).then(function(arg) {
if (wrappedAwait) {
resume("next", arg);
return;
}
settle(result.done ? "return" : "normal", arg);
}, function(err) {
resume("throw", err);
});
} catch (err) {
settle("throw", err);
}
}
function settle(type, value) {
switch (type) {
case "return":
front.resolve({ value: value, done: true });
break;
case "throw":
front.reject(value);
break;
default:
front.resolve({ value: value, done: false });
break;
}
front = front.next;
if (front) {
resume(front.key, front.arg);
} else {
back = null;
}
}
this._invoke = send;
if (typeof gen.return !== "function") {
this.return = undefined;
}
}
if (typeof Symbol === "function" && Symbol.asyncIterator) {
_async_generator.prototype[Symbol.asyncIterator] = function() {
return this;
};
}
_async_generator.prototype.next = function(arg) {
return this._invoke("next", arg);
};
_async_generator.prototype.throw = function(arg) {
return this._invoke("throw", arg);
};
_async_generator.prototype.return = function(arg) {
return this._invoke("return", arg);
};

View file

@ -0,0 +1,37 @@
function _async_generator_delegate(inner, awaitWrap) {
var iter = {}, waiting = false;
function pump(key, value) {
waiting = true;
value = new Promise(function(resolve) {
resolve(inner[key](value));
});
return { done: false, value: awaitWrap(value) };
}
if (typeof Symbol === "function" && Symbol.iterator) {
iter[Symbol.iterator] = function() {
return this;
};
}
iter.next = function(value) {
if (waiting) {
waiting = false;
return value;
}
return pump("next", value);
};
if (typeof inner.throw === "function") {
iter.throw = function(value) {
if (waiting) {
waiting = false;
throw value;
}
return pump("throw", value);
};
}
if (typeof inner.return === "function") {
iter.return = function(value) {
return pump("return", value);
};
}
return iter;
}

View file

@ -0,0 +1,39 @@
function _async_iterator(iterable) {
var method, async, sync, retry = 2;
for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) {
if (async && null != (method = iterable[async])) return method.call(iterable);
if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable));
async = "@@asyncIterator", sync = "@@iterator";
}
throw new TypeError("Object is not async iterable");
}
function AsyncFromSyncIterator(s) {
function AsyncFromSyncIteratorContinuation(r) {
if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
var done = r.done;
return Promise.resolve(r.value).then(function(value) {
return { value: value, done: done };
});
}
return AsyncFromSyncIterator = function(s) {
this.s = s, this.n = s.next;
},
AsyncFromSyncIterator.prototype = {
s: null,
n: null,
next: function() {
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
},
return: function(value) {
var ret = this.s.return;
return void 0 === ret
? Promise.resolve({ value: value, done: !0 })
: AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
},
throw: function(value) {
var thr = this.s.return;
return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
}
},
new AsyncFromSyncIterator(s);
}

View file

@ -0,0 +1,29 @@
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _async_to_generator(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}

View file

@ -0,0 +1,3 @@
function _await_async_generator(value) {
return new _await_value(value);
}

View file

@ -0,0 +1,3 @@
function _await_value(value) {
this.wrapped = value;
}

View file

@ -0,0 +1,5 @@
function _check_private_redeclaration(obj, privateCollection) {
if (privateCollection.has(obj)) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}

View file

@ -0,0 +1,20 @@
function _class_apply_descriptor_destructure(receiver, descriptor) {
if (descriptor.set) {
if (!("__destrObj" in descriptor)) {
descriptor.__destrObj = {
set value(v) {
descriptor.set.call(receiver, v);
}
};
}
return descriptor.__destrObj;
} else {
if (!descriptor.writable) {
// This should only throw in strict mode, but class bodies are
// always strict and private fields can only be used inside
// class bodies.
throw new TypeError("attempted to set read only private field");
}
return descriptor;
}
}

View file

@ -0,0 +1,6 @@
function _class_apply_descriptor_get(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}

View file

@ -0,0 +1,13 @@
function _class_apply_descriptor_set(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
// This should only throw in strict mode, but class bodies are
// always strict and private fields can only be used inside
// class bodies.
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}

View file

@ -0,0 +1,26 @@
function _class_apply_descriptor_update(receiver, descriptor) {
if (descriptor.set) {
if (!descriptor.get) {
throw new TypeError("attempted to read set only private field");
}
if (!("__destrWrapper" in descriptor)) {
descriptor.__destrWrapper = {
set value(v) {
descriptor.set.call(receiver, v);
},
get value() {
return descriptor.get.call(receiver);
}
};
}
return descriptor.__destrWrapper;
} else {
if (!descriptor.writable) {
// This should only throw in strict mode, but class bodies are
// always strict and private fields can only be used inside
// class bodies.
throw new TypeError("attempted to set read only private field");
}
return descriptor;
}
}

View file

@ -0,0 +1,5 @@
function _class_call_check(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}

View file

@ -0,0 +1,5 @@
function _class_check_private_static_access(receiver, classConstructor) {
if (receiver !== classConstructor) {
throw new TypeError("Private static access of wrong provenance");
}
}

View file

@ -0,0 +1,5 @@
function _class_check_private_static_field_descriptor(descriptor, action) {
if (descriptor === undefined) {
throw new TypeError("attempted to " + action + " private static field before its declaration");
}
}

View file

@ -0,0 +1,6 @@
function _class_extract_field_descriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}

View file

@ -0,0 +1,3 @@
function _class_name_tdz_error(name) {
throw new Error("Class \"" + name + "\" cannot be referenced in computed property keys.");
}

View file

@ -0,0 +1,4 @@
function _class_private_field_destructure(receiver, privateMap) {
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
return _class_apply_descriptor_destructure(receiver, descriptor);
}

View file

@ -0,0 +1,4 @@
function _class_private_field_get(receiver, privateMap) {
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
return _class_apply_descriptor_get(receiver, descriptor);
}

View file

@ -0,0 +1,4 @@
function _class_private_field_init(obj, privateMap, value) {
_check_private_redeclaration(obj, privateMap);
privateMap.set(obj, value);
}

View file

@ -0,0 +1,6 @@
function _class_private_field_loose_base(receiver, privateKey) {
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
throw new TypeError("attempted to use private field on non-instance");
}
return receiver;
}

View file

@ -0,0 +1,4 @@
var id = 0;
function _class_private_field_loose_key(name) {
return "__private_" + id++ + "_" + name;
}

View file

@ -0,0 +1,5 @@
function _class_private_field_set(receiver, privateMap, value) {
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
_class_apply_descriptor_set(receiver, descriptor, value);
return value;
}

View file

@ -0,0 +1,4 @@
function _class_private_field_update(receiver, privateMap) {
var descriptor = _class_extract_field_descriptor(receiver, privateMap, "update");
return _class_apply_descriptor_update(receiver, descriptor);
}

View file

@ -0,0 +1,6 @@
function _class_private_method_get(receiver, privateSet, fn) {
if (!privateSet.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return fn;
}

View file

@ -0,0 +1,4 @@
function _class_private_method_init(obj, privateSet) {
_check_private_redeclaration(obj, privateSet);
privateSet.add(obj);
}

View file

@ -0,0 +1,3 @@
function _class_private_method_set() {
throw new TypeError("attempted to reassign private method");
}

View file

@ -0,0 +1,5 @@
function _class_static_private_field_destructure(receiver, classConstructor, descriptor) {
_class_check_private_static_access(receiver, classConstructor);
_class_check_private_static_field_descriptor(descriptor, "set");
return _class_apply_descriptor_destructure(receiver, descriptor);
}

View file

@ -0,0 +1,5 @@
function _class_static_private_field_spec_get(receiver, classConstructor, descriptor) {
_class_check_private_static_access(receiver, classConstructor);
_class_check_private_static_field_descriptor(descriptor, "get");
return _class_apply_descriptor_get(receiver, descriptor);
}

View file

@ -0,0 +1,6 @@
function _class_static_private_field_spec_set(receiver, classConstructor, descriptor, value) {
_class_check_private_static_access(receiver, classConstructor);
_class_check_private_static_field_descriptor(descriptor, "set");
_class_apply_descriptor_set(receiver, descriptor, value);
return value;
}

View file

@ -0,0 +1,5 @@
function _class_static_private_field_update(receiver, classConstructor, descriptor) {
_class_check_private_static_access(receiver, classConstructor);
_class_check_private_static_field_descriptor(descriptor, "update");
return _class_apply_descriptor_update(receiver, descriptor);
}

View file

@ -0,0 +1,4 @@
function _class_static_private_method_get(receiver, classConstructor, method) {
_class_check_private_static_access(receiver, classConstructor);
return method;
}

View file

@ -0,0 +1,15 @@
function _construct(Parent, args, Class) {
if (_is_native_reflect_construct()) {
_construct = Reflect.construct;
} else {
_construct = function construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _set_prototype_of(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}

View file

@ -0,0 +1,14 @@
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _create_class(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}

View file

@ -0,0 +1,18 @@
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
// Fallback for engines without symbol support
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function() {
if (i >= o.length) {
return { done: true };
}
return { done: false, value: o[i++] };
};
}
throw new TypeError(
"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
);
}

View file

@ -0,0 +1,13 @@
function _create_super(Derived) {
var hasNativeReflectConstruct = _is_native_reflect_construct();
return function _createSuperInternal() {
var Super = _get_prototype_of(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _get_prototype_of(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possible_constructor_return(this, result);
};
}

View file

@ -0,0 +1,281 @@
function _decorate(decorators, factory, superClass) {
var r = factory(function initialize(O) {
_initializeInstanceElements(O, decorated.elements);
}, superClass);
var decorated = _decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators);
_initializeClassElements(r.F, decorated.elements);
return _runClassFinishers(r.F, decorated.finishers);
}
function _createElementDescriptor(def) {
var key = _to_property_key(def.key);
var descriptor;
if (def.kind === "method") {
descriptor = { value: def.value, writable: true, configurable: true, enumerable: false };
Object.defineProperty(def.value, "name", { value: _type_of(key) === "symbol" ? "" : key, configurable: true });
} else if (def.kind === "get") {
descriptor = { get: def.value, configurable: true, enumerable: false };
} else if (def.kind === "set") {
descriptor = { set: def.value, configurable: true, enumerable: false };
} else if (def.kind === "field") {
descriptor = { configurable: true, writable: true, enumerable: true };
}
var element = {
kind: def.kind === "field" ? "field" : "method",
key: key,
placement: def.static ? "static" : def.kind === "field" ? "own" : "prototype",
descriptor: descriptor
};
if (def.decorators) element.decorators = def.decorators;
if (def.kind === "field") element.initializer = def.value;
return element;
}
function _coalesceGetterSetter(element, other) {
if (element.descriptor.get !== undefined) {
other.descriptor.get = element.descriptor.get;
} else {
other.descriptor.set = element.descriptor.set;
}
}
function _coalesceClassElements(elements) {
var newElements = [];
var isSameElement = function isSameElement(other) {
return other.kind === "method" && other.key === element.key && other.placement === element.placement;
};
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
var other;
if (element.kind === "method" && (other = newElements.find(isSameElement))) {
if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) {
if (_hasDecorators(element) || _hasDecorators(other)) {
throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated.");
}
other.descriptor = element.descriptor;
} else {
if (_hasDecorators(element)) {
if (_hasDecorators(other)) {
throw new ReferenceError(
"Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."
);
}
other.decorators = element.decorators;
}
_coalesceGetterSetter(element, other);
}
} else {
newElements.push(element);
}
}
return newElements;
}
function _hasDecorators(element) {
return element.decorators && element.decorators.length;
}
function _isDataDescriptor(desc) {
return desc !== undefined && !(desc.value === undefined && desc.writable === undefined);
}
function _initializeClassElements(F, elements) {
var proto = F.prototype;
["method", "field"].forEach(function(kind) {
elements.forEach(function(element) {
var placement = element.placement;
if (element.kind === kind && (placement === "static" || placement === "prototype")) {
var receiver = placement === "static" ? F : proto;
_defineClassElement(receiver, element);
}
});
});
}
function _initializeInstanceElements(O, elements) {
["method", "field"].forEach(function(kind) {
elements.forEach(function(element) {
if (element.kind === kind && element.placement === "own") {
_defineClassElement(O, element);
}
});
});
}
function _defineClassElement(receiver, element) {
var descriptor = element.descriptor;
if (element.kind === "field") {
var initializer = element.initializer;
descriptor = {
enumerable: descriptor.enumerable,
writable: descriptor.writable,
configurable: descriptor.configurable,
value: initializer === void 0 ? void 0 : initializer.call(receiver)
};
}
Object.defineProperty(receiver, element.key, descriptor);
}
function _decorateClass(elements, decorators) {
var newElements = [];
var finishers = [];
var placements = { static: [], prototype: [], own: [] };
elements.forEach(function(element) {
_addElementPlacement(element, placements);
});
elements.forEach(function(element) {
if (!_hasDecorators(element)) return newElements.push(element);
var elementFinishersExtras = _decorateElement(element, placements);
newElements.push(elementFinishersExtras.element);
newElements.push.apply(newElements, elementFinishersExtras.extras);
finishers.push.apply(finishers, elementFinishersExtras.finishers);
});
if (!decorators) {
return { elements: newElements, finishers: finishers };
}
var result = _decorateConstructor(newElements, decorators);
finishers.push.apply(finishers, result.finishers);
result.finishers = finishers;
return result;
}
function _addElementPlacement(element, placements, silent) {
var keys = placements[element.placement];
if (!silent && keys.indexOf(element.key) !== -1) {
throw new TypeError("Duplicated element (" + element.key + ")");
}
keys.push(element.key);
}
function _decorateElement(element, placements) {
var extras = [];
var finishers = [];
for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) {
var keys = placements[element.placement];
keys.splice(keys.indexOf(element.key), 1);
var elementObject = _fromElementDescriptor(element);
var elementFinisherExtras = _toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject);
element = elementFinisherExtras.element;
_addElementPlacement(element, placements);
if (elementFinisherExtras.finisher) {
finishers.push(elementFinisherExtras.finisher);
}
var newExtras = elementFinisherExtras.extras;
if (newExtras) {
for (var j = 0; j < newExtras.length; j++) {
_addElementPlacement(newExtras[j], placements);
}
extras.push.apply(extras, newExtras);
}
}
return { element: element, finishers: finishers, extras: extras };
}
function _decorateConstructor(elements, decorators) {
var finishers = [];
for (var i = decorators.length - 1; i >= 0; i--) {
var obj = _fromClassDescriptor(elements);
var elementsAndFinisher = _toClassDescriptor((0, decorators[i])(obj) || obj);
if (elementsAndFinisher.finisher !== undefined) {
finishers.push(elementsAndFinisher.finisher);
}
if (elementsAndFinisher.elements !== undefined) {
elements = elementsAndFinisher.elements;
for (var j = 0; j < elements.length - 1; j++) {
for (var k = j + 1; k < elements.length; k++) {
if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) {
throw new TypeError("Duplicated element (" + elements[j].key + ")");
}
}
}
}
}
return { elements: elements, finishers: finishers };
}
function _fromElementDescriptor(element) {
var obj = { kind: element.kind, key: element.key, placement: element.placement, descriptor: element.descriptor };
var desc = { value: "Descriptor", configurable: true };
Object.defineProperty(obj, Symbol.toStringTag, desc);
if (element.kind === "field") obj.initializer = element.initializer;
return obj;
}
function _toElementDescriptors(elementObjects) {
if (elementObjects === undefined) return;
return _to_array(elementObjects).map(function(elementObject) {
var element = _toElementDescriptor(elementObject);
_disallowProperty(elementObject, "finisher", "An element descriptor");
_disallowProperty(elementObject, "extras", "An element descriptor");
return element;
});
}
function _toElementDescriptor(elementObject) {
var kind = String(elementObject.kind);
if (kind !== "method" && kind !== "field") {
throw new TypeError(
"An element descriptor's .kind property must be either \"method\" or"
+ " \"field\", but a decorator created an element descriptor with" + " .kind \"" + kind + "\""
);
}
var key = _to_property_key(elementObject.key);
var placement = String(elementObject.placement);
if (placement !== "static" && placement !== "prototype" && placement !== "own") {
throw new TypeError(
"An element descriptor's .placement property must be one of \"static\","
+ " \"prototype\" or \"own\", but a decorator created an element descriptor" + " with .placement \"" + placement + "\""
);
}
var descriptor = elementObject.descriptor;
_disallowProperty(elementObject, "elements", "An element descriptor");
var element = { kind: kind, key: key, placement: placement, descriptor: Object.assign({}, descriptor) };
if (kind !== "field") {
_disallowProperty(elementObject, "initializer", "A method descriptor");
} else {
_disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
_disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
_disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
element.initializer = elementObject.initializer;
}
return element;
}
function _toElementFinisherExtras(elementObject) {
var element = _toElementDescriptor(elementObject);
var finisher = _optionalCallableProperty(elementObject, "finisher");
var extras = _toElementDescriptors(elementObject.extras);
return { element: element, finisher: finisher, extras: extras };
}
function _fromClassDescriptor(elements) {
var obj = { kind: "class", elements: elements.map(_fromElementDescriptor) };
var desc = { value: "Descriptor", configurable: true };
Object.defineProperty(obj, Symbol.toStringTag, desc);
return obj;
}
function _toClassDescriptor(obj) {
var kind = String(obj.kind);
if (kind !== "class") {
throw new TypeError(
"A class descriptor's .kind property must be \"class\", but a decorator" + " created a class descriptor with .kind \"" + kind
+ "\""
);
}
_disallowProperty(obj, "key", "A class descriptor");
_disallowProperty(obj, "placement", "A class descriptor");
_disallowProperty(obj, "descriptor", "A class descriptor");
_disallowProperty(obj, "initializer", "A class descriptor");
_disallowProperty(obj, "extras", "A class descriptor");
var finisher = _optionalCallableProperty(obj, "finisher");
var elements = _toElementDescriptors(obj.elements);
return { elements: elements, finisher: finisher };
}
function _disallowProperty(obj, name, objectType) {
if (obj[name] !== undefined) {
throw new TypeError(objectType + " can't have a ." + name + " property.");
}
}
function _optionalCallableProperty(obj, name) {
var value = obj[name];
if (value !== undefined && typeof value !== "function") {
throw new TypeError("Expected '" + name + "' to be a function");
}
return value;
}
function _runClassFinishers(constructor, finishers) {
for (var i = 0; i < finishers.length; i++) {
var newConstructor = (0, finishers[i])(constructor);
if (newConstructor !== undefined) {
if (typeof newConstructor !== "function") {
throw new TypeError("Finishers must return a constructor.");
}
constructor = newConstructor;
}
}
return constructor;
}

View file

@ -0,0 +1,11 @@
function _defaults(obj, defaults) {
var keys = Object.getOwnPropertyNames(defaults);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var value = Object.getOwnPropertyDescriptor(defaults, key);
if (value && value.configurable && obj[key] === undefined) {
Object.defineProperty(obj, key, value);
}
}
return obj;
}

View file

@ -0,0 +1,19 @@
function _define_enumerable_properties(obj, descs) {
for (var key in descs) {
var desc = descs[key];
desc.configurable = desc.enumerable = true;
if ("value" in desc) desc.writable = true;
Object.defineProperty(obj, key, desc);
}
if (Object.getOwnPropertySymbols) {
var objectSymbols = Object.getOwnPropertySymbols(descs);
for (var i = 0; i < objectSymbols.length; i++) {
var sym = objectSymbols[i];
var desc = descs[sym];
desc.configurable = desc.enumerable = true;
if ("value" in desc) desc.writable = true;
Object.defineProperty(obj, sym, desc);
}
}
return obj;
}

View file

@ -0,0 +1,8 @@
function _define_property(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}

View file

@ -0,0 +1,45 @@
/* @minVersion 7.22.0 */
function dispose_SuppressedError(suppressed, error) {
if (typeof SuppressedError !== "undefined") {
// eslint-disable-next-line no-undef
dispose_SuppressedError = SuppressedError;
} else {
dispose_SuppressedError = function SuppressedError(suppressed, error) {
this.suppressed = suppressed;
this.error = error;
this.stack = new Error().stack;
};
dispose_SuppressedError.prototype = Object.create(Error.prototype, {
constructor: {
value: dispose_SuppressedError,
writable: true,
configurable: true,
},
});
}
return new dispose_SuppressedError(suppressed, error);
}
function _dispose(stack, error, hasError) {
function next() {
while (stack.length > 0) {
try {
var r = stack.pop();
var p = r.d.call(r.v);
if (r.a) return Promise.resolve(p).then(next, err);
} catch (e) {
return err(e);
}
}
if (hasError) throw error;
}
function err(e) {
error = hasError ? new dispose_SuppressedError(e, error) : e;
hasError = true;
return next();
}
return next();
}

View file

@ -0,0 +1,13 @@
function _export_star(from, to) {
Object.keys(from).forEach(function(k) {
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
Object.defineProperty(to, k, {
enumerable: true,
get: function() {
return from[k];
}
});
}
});
return from;
}

View file

@ -0,0 +1,14 @@
function _extends() {
_extends = Object.assign || function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}

View file

@ -0,0 +1,16 @@
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get;
} else {
_get = function get(target, property, receiver) {
var base = _super_prop_base(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(receiver || target);
}
return desc.value;
};
}
return _get(target, property, receiver || target);
}

View file

@ -0,0 +1,6 @@
function _get_prototype_of(o) {
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _get_prototype_of(o);
}

View file

@ -0,0 +1 @@
function _identity(x) { return x; }

View file

@ -0,0 +1,9 @@
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: { value: subClass, writable: true, configurable: true }
});
if (superClass) _set_prototype_of(subClass, superClass);
}

View file

@ -0,0 +1,5 @@
function _inherits_loose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}

View file

@ -0,0 +1,9 @@
function _initializer_define_property(target, property, descriptor, context) {
if (!descriptor) return;
Object.defineProperty(target, property, {
enumerable: descriptor.enumerable,
configurable: descriptor.configurable,
writable: descriptor.writable,
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
});
}

View file

@ -0,0 +1,7 @@
function _initializer_warning_helper(descriptor, context) {
throw new Error(
"Decorating class property failed. Please ensure that " + "proposal-class-properties is enabled and set to use loose mode. "
+ "To use proposal-class-properties in spec mode with decorators, wait for "
+ "the next major version of decorators in stage 2."
);
}

View file

@ -0,0 +1,7 @@
function _instanceof(left, right) {
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
return !!right[Symbol.hasInstance](left);
} else {
return left instanceof right;
}
}

View file

@ -0,0 +1,3 @@
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}

View file

@ -0,0 +1,37 @@
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return { default: obj };
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}

View file

@ -0,0 +1,3 @@
function _is_native_function(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}

View file

@ -0,0 +1,11 @@
function _is_native_reflect_construct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
return true;
} catch (e) {
return false;
}
}

View file

@ -0,0 +1,3 @@
function _iterable_to_array(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}

View file

@ -0,0 +1,24 @@
function _iterable_to_array_limit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}

View file

@ -0,0 +1,10 @@
function _iterable_to_array_limit_loose(arr, i) {
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
if (_i == null) return;
var _arr = [];
for (_i = _i.call(arr), _step; !(_step = _i.next()).done;) {
_arr.push(_step.value);
if (i && _arr.length === i) break;
}
return _arr;
}

View file

@ -0,0 +1,30 @@
var REACT_ELEMENT_TYPE;
function _jsx(type, props, key, children) {
if (!REACT_ELEMENT_TYPE) {
REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
}
var defaultProps = type && type.defaultProps;
var childrenLength = arguments.length - 3;
if (!props && childrenLength !== 0) {
props = { children: void 0 };
}
if (props && defaultProps) {
for (var propName in defaultProps) {
if (props[propName] === void 0) {
props[propName] = defaultProps[propName];
}
}
} else if (!props) {
props = defaultProps || {};
}
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = new Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 3];
}
props.children = childArray;
}
return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : "" + key, ref: null, props: props, _owner: null };
}

View file

@ -0,0 +1,5 @@
function _new_arrow_check(innerThis, boundThis) {
if (innerThis !== boundThis) {
throw new TypeError("Cannot instantiate an arrow function");
}
}

View file

@ -0,0 +1,5 @@
function _non_iterable_rest() {
throw new TypeError(
"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
);
}

View file

@ -0,0 +1,5 @@
function _non_iterable_spread() {
throw new TypeError(
"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
);
}

View file

@ -0,0 +1,4 @@
function _object_destructuring_empty(o) {
if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
return o;
}

View file

@ -0,0 +1,17 @@
function _object_spread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_define_property(target, key, source[key]);
});
}
return target;
}

View file

@ -0,0 +1,24 @@
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _object_spread_props(target, source) {
source = source != null ? source : {};
if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}

View file

@ -0,0 +1,15 @@
function _object_without_properties(source, excluded) {
if (source == null) return {};
var target = _object_without_properties_loose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}

View file

@ -0,0 +1,12 @@
function _object_without_properties_loose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}

View file

@ -0,0 +1,6 @@
function _possible_constructor_return(self, call) {
if (call && (_type_of(call) === "object" || typeof call === "function")) {
return call;
}
return _assert_this_initialized(self);
}

View file

@ -0,0 +1,3 @@
function _read_only_error(name) {
throw new TypeError("\"" + name + "\" is read-only");
}

View file

@ -0,0 +1,38 @@
function set(target, property, value, receiver) {
if (typeof Reflect !== "undefined" && Reflect.set) {
set = Reflect.set;
} else {
set = function set(target, property, value, receiver) {
var base = _super_prop_base(target, property);
var desc;
if (base) {
desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.set) {
desc.set.call(receiver, value);
return true;
} else if (!desc.writable) {
return false;
}
}
desc = Object.getOwnPropertyDescriptor(receiver, property);
if (desc) {
if (!desc.writable) {
return false;
}
desc.value = value;
Object.defineProperty(receiver, property, desc);
} else {
_define_property(receiver, property, value);
}
return true;
};
}
return set(target, property, value, receiver);
}
function _set(target, property, value, receiver, isStrict) {
var s = set(target, property, value, receiver || target);
if (!s && isStrict) {
throw new Error("failed to set property");
}
return value;
}

View file

@ -0,0 +1,7 @@
function _set_prototype_of(o, p) {
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _set_prototype_of(o, p);
}

View file

@ -0,0 +1,7 @@
function _skip_first_generator_next(fn) {
return function() {
var it = fn.apply(this, arguments);
it.next();
return it;
};
}

View file

@ -0,0 +1,3 @@
function _sliced_to_array(arr, i) {
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
}

View file

@ -0,0 +1,4 @@
function _sliced_to_array_loose(arr, i) {
return _array_with_holes(arr) || _iterable_to_array_limit_loose(arr, i) || _unsupported_iterable_to_array(arr, i)
|| _non_iterable_rest();
}

View file

@ -0,0 +1,7 @@
function _super_prop_base(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _get_prototype_of(object);
if (object === null) break;
}
return object;
}

View file

@ -0,0 +1,6 @@
function _tagged_template_literal(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } }));
}

View file

@ -0,0 +1,7 @@
function _tagged_template_literal_loose(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
strings.raw = raw;
return strings;
}

View file

@ -0,0 +1,3 @@
function _throw(e) {
throw e;
}

View file

@ -0,0 +1,3 @@
function _to_array(arr) {
return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
}

View file

@ -0,0 +1,3 @@
function _to_consumable_array(arr) {
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
}

View file

@ -0,0 +1,10 @@
function _to_primitive(input, hint) {
if (_type_of(input) !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (_type_of(res) !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}

View file

@ -0,0 +1,4 @@
function _to_property_key(arg) {
var key = _to_primitive(arg, "string");
return _type_of(key) === "symbol" ? key : String(key);
}

View file

@ -0,0 +1,6 @@
function _ts_decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}

View file

@ -0,0 +1,27 @@
function _ts_generator(thisArg, body) {
var f, y, t, g, _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] };
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}

View file

@ -0,0 +1,3 @@
function _ts_metadata(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
}

View file

@ -0,0 +1,3 @@
function _ts_param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}

View file

@ -0,0 +1,11 @@
function _ts_values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}

View file

@ -0,0 +1,4 @@
function _type_of(obj) {
"@swc/helpers - typeof";
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
}

View file

@ -0,0 +1,8 @@
function _unsupported_iterable_to_array(o, minLen) {
if (!o) return;
if (typeof o === "string") return _array_like_to_array(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(n);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}

View file

@ -0,0 +1,10 @@
function _update(target, property, receiver, isStrict) {
return {
get _() {
return _get(target, property, receiver);
},
set _(value) {
_set(target, property, value, receiver, isStrict);
}
};
}

View file

@ -0,0 +1,21 @@
function _using(stack, value, isAwait) {
if (value === null || value === void 0) return value;
if (typeof value !== "object") {
throw new TypeError(
"using declarations can only be used with objects, null, or undefined."
);
}
// core-js-pure uses Symbol.for for polyfilling well-known symbols
if (isAwait) {
var dispose =
value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")];
}
if (dispose === null || dispose === void 0) {
dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")];
}
if (typeof dispose !== "function") {
throw new TypeError(`Property [Symbol.dispose] is not a function.`);
}
stack.push({ v: value, d: dispose, a: isAwait });
return value;
}

Some files were not shown because too many files have changed in this diff Show more