refactor(es/module): Implement new module transformer (#4758)

This commit is contained in:
magic-akari 2022-06-27 20:32:06 +08:00 committed by GitHub
parent f41c82ac67
commit fa68cbd74a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1034 changed files with 16755 additions and 15257 deletions

3
Cargo.lock generated
View File

@ -3561,6 +3561,7 @@ name = "swc_ecma_transforms_base"
version = "0.89.6"
dependencies = [
"better_scoped_tls",
"bitflags",
"criterion",
"num_cpus",
"once_cell",
@ -3642,6 +3643,7 @@ dependencies = [
"Inflector",
"ahash",
"anyhow",
"bitflags",
"indexmap",
"path-clean",
"pathdiff",
@ -3800,6 +3802,7 @@ dependencies = [
"swc_ecma_parser",
"swc_ecma_visit",
"tracing",
"unicode-id",
]
[[package]]

View File

@ -1,6 +1,6 @@
use std::{cell::RefCell, path::PathBuf, rc::Rc, sync::Arc};
use std::{path::PathBuf, sync::Arc};
use compat::{es2015::regenerator, es2020::export_namespace_from};
use compat::es2015::regenerator;
use either::Either;
use rustc_hash::FxHashMap;
use swc_atoms::JsWord;
@ -16,9 +16,15 @@ use swc_ecma_ast::{EsVersion, Module};
use swc_ecma_minifier::option::{terser::TerserTopLevelOptions, MinifyOptions};
use swc_ecma_parser::Syntax;
use swc_ecma_transforms::{
compat, compat::es2022::private_in_object, fixer, helpers, hygiene,
hygiene::hygiene_with_config, modules, modules::util::Scope, optimization::const_modules,
pass::Optional, Assumptions,
compat,
compat::es2022::private_in_object,
feature::{enable_available_feature_from_es_version, FeatureFlag},
fixer, helpers, hygiene,
hygiene::hygiene_with_config,
modules,
optimization::const_modules,
pass::Optional,
Assumptions,
};
use swc_ecma_visit::{as_folder, noop_visit_mut_type, VisitMut};
@ -176,13 +182,18 @@ impl<'a, 'b, P: swc_ecma_visit::Fold> PassBuilder<'a, 'b, P> {
where
P: 'cmt,
{
let need_interop_analysis = match module {
Some(ModuleConfig::CommonJs(ref c)) => !c.no_interop,
Some(ModuleConfig::Amd(ref c)) => !c.config.no_interop,
Some(ModuleConfig::Umd(ref c)) => !c.config.no_interop,
Some(ModuleConfig::SystemJs(_)) | Some(ModuleConfig::Es6) | None => false,
let (need_analyzer, no_interop, ignore_dynamic) = match module {
Some(ModuleConfig::CommonJs(ref c)) => (true, c.no_interop, c.ignore_dynamic),
Some(ModuleConfig::Amd(ref c)) => (true, c.config.no_interop, c.config.ignore_dynamic),
Some(ModuleConfig::Umd(ref c)) => (true, c.config.no_interop, c.config.ignore_dynamic),
Some(ModuleConfig::SystemJs(_))
| Some(ModuleConfig::Es6)
| Some(ModuleConfig::NodeNext)
| None => (false, true, true),
};
let mut feature_flag = FeatureFlag::empty();
// compat
let compat_pass = if let Some(env) = self.env {
Either::Left(swc_ecma_preset_env::preset_env(
@ -190,9 +201,13 @@ impl<'a, 'b, P: swc_ecma_visit::Fold> PassBuilder<'a, 'b, P> {
comments,
env,
self.assumptions,
&mut feature_flag,
))
} else {
let assumptions = self.assumptions;
feature_flag = enable_available_feature_from_es_version(self.target);
Either::Right(chain!(
Optional::new(
compat::es2022::es2022(
@ -299,18 +314,16 @@ impl<'a, 'b, P: swc_ecma_visit::Fold> PassBuilder<'a, 'b, P> {
.map(|v| v.mangle.is_obj() || v.mangle.is_true())
.unwrap_or(false);
let module_scope = Rc::new(RefCell::new(Scope::default()));
chain!(
self.pass,
Optional::new(private_in_object(), syntax.private_in_object()),
compat_pass,
// module / helper
Optional::new(
modules::import_analysis::import_analyzer(Rc::clone(&module_scope)),
need_interop_analysis
modules::import_analysis::import_analyzer(no_interop, ignore_dynamic),
need_analyzer
),
compat::reserved_words::reserved_words(),
Optional::new(export_namespace_from(), need_interop_analysis),
Optional::new(helpers::inject_helpers(), self.inject_helpers),
ModuleConfig::build(
self.cm.clone(),
@ -319,7 +332,7 @@ impl<'a, 'b, P: swc_ecma_visit::Fold> PassBuilder<'a, 'b, P> {
base,
self.unresolved_mark,
module,
Rc::clone(&module_scope)
feature_flag
),
as_folder(MinifierPass {
options: self.minify,

View File

@ -1,10 +1,8 @@
#![cfg_attr(any(not(feature = "plugin"), target_arch = "wasm32"), allow(unused))]
use std::{
cell::RefCell,
collections::{HashMap, HashSet},
env, fmt,
path::{Path, PathBuf},
rc::Rc as RustRc,
sync::Arc,
usize,
};
@ -50,16 +48,15 @@ use swc_ecma_minifier::option::{
pub use swc_ecma_parser::JscTarget;
use swc_ecma_parser::{parse_file_as_expr, Syntax, TsConfig};
use swc_ecma_transforms::{
feature::FeatureFlag,
hygiene, modules,
modules::{
hoist::module_hoister, path::NodeImportResolver, rewriter::import_rewriter, util::Scope,
},
modules::{path::NodeImportResolver, rewriter::import_rewriter},
optimization::{const_modules, json_parse, simplifier},
pass::{noop, Optional},
proposals::{decorators, export_default_from, import_assertions},
react::{self, default_pragma, default_pragma_frag},
resolver,
typescript::{self, TSEnumConfig},
typescript::{self, TsEnumConfig, TsImportExportAssignConfig},
Assumptions,
};
use swc_ecma_transforms_compat::es2015::regenerator;
@ -471,7 +468,14 @@ impl Options {
json_parse_pass
);
let preserve_import_export_assign = matches!(&cfg.module, Some(ModuleConfig::Amd(..)));
let import_export_assign_config = match cfg.module {
Some(ModuleConfig::CommonJs(..))
| Some(ModuleConfig::Amd(..))
| Some(ModuleConfig::Umd(..)) => TsImportExportAssignConfig::Preserve,
Some(ModuleConfig::NodeNext) => TsImportExportAssignConfig::NodeNext,
// TODO: should Preserve for SystemJS
_ => TsImportExportAssignConfig::Classic,
};
let pass = PassBuilder::new(
cm,
@ -605,14 +609,14 @@ impl Options {
.clone()
.unwrap_or_else(default_pragma_frag)
),
ts_enum_config: TSEnumConfig {
ts_enum_config: TsEnumConfig {
treat_const_enum_as_enum: transform
.treat_const_enum_as_enum
.into_bool(),
ts_enum_is_readonly: assumptions.ts_enum_is_readonly,
},
use_define_for_class_fields: !assumptions.set_public_class_fields,
preserve_import_export_assign,
import_export_assign_config,
..Default::default()
},
comments,
@ -1260,6 +1264,8 @@ pub enum ModuleConfig {
SystemJs(modules::system_js::Config),
#[serde(rename = "es6")]
Es6,
#[serde(rename = "nodenext")]
NodeNext,
}
impl ModuleConfig {
@ -1270,7 +1276,7 @@ impl ModuleConfig {
base: &FileName,
unresolved_mark: Mark,
config: Option<ModuleConfig>,
scope: RustRc<RefCell<Scope>>,
available_features: FeatureFlag,
) -> Box<dyn swc_ecma_visit::Fold> {
let base = match base {
FileName::Real(v) if !paths.is_empty() => {
@ -1280,7 +1286,7 @@ impl ModuleConfig {
};
match config {
None | Some(ModuleConfig::Es6) => {
None | Some(ModuleConfig::Es6) | Some(ModuleConfig::NodeNext) => {
if paths.is_empty() {
Box::new(noop())
} else {
@ -1290,60 +1296,60 @@ impl ModuleConfig {
}
}
Some(ModuleConfig::CommonJs(config)) => {
let base_pass = module_hoister();
if paths.is_empty() {
Box::new(chain!(
base_pass,
modules::common_js::common_js(unresolved_mark, config, Some(scope),)
Box::new(modules::common_js::common_js(
unresolved_mark,
config,
available_features,
))
} else {
let resolver = build_resolver(base_url, paths);
Box::new(chain!(
base_pass,
modules::common_js::common_js_with_resolver(
resolver,
base,
unresolved_mark,
config,
Some(scope),
)
Box::new(modules::common_js::common_js_with_resolver(
resolver,
base,
unresolved_mark,
config,
available_features,
))
}
}
Some(ModuleConfig::Umd(config)) => {
let base_pass = module_hoister();
if paths.is_empty() {
Box::new(chain!(
base_pass,
modules::umd::umd(cm, unresolved_mark, config)
Box::new(modules::umd::umd(
cm,
unresolved_mark,
config,
available_features,
))
} else {
let resolver = build_resolver(base_url, paths);
Box::new(chain!(
base_pass,
modules::umd::umd_with_resolver(
resolver,
base,
cm,
unresolved_mark,
config,
)
Box::new(modules::umd::umd_with_resolver(
cm,
resolver,
base,
unresolved_mark,
config,
available_features,
))
}
}
Some(ModuleConfig::Amd(config)) => {
let base_pass = module_hoister();
if paths.is_empty() {
Box::new(chain!(base_pass, modules::amd::amd(config)))
Box::new(modules::amd::amd(
unresolved_mark,
config,
available_features,
))
} else {
let resolver = build_resolver(base_url, paths);
Box::new(chain!(
base_pass,
modules::amd::amd_with_resolver(resolver, base, config)
Box::new(modules::amd::amd_with_resolver(
resolver,
base,
unresolved_mark,
config,
available_features,
))
}
}

View File

@ -174,7 +174,11 @@ fn create_matrix(entry: &Path) -> Vec<Options> {
},
..Default::default()
},
module: Some(ModuleConfig::CommonJs(Default::default())),
module: if entry.extension().unwrap() == "mjs" {
Some(ModuleConfig::Es6)
} else {
Some(ModuleConfig::CommonJs(Default::default()))
},
minify: minify.into(),
..Default::default()
},

View File

@ -2,6 +2,10 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
Object.defineProperty(exports, "default", {
get: function() {
return _default;
},
enumerable: true
});
var _default = "\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n";
exports.default = _default;

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
require("./src/dep");
require("./src2/dep-2");

View File

@ -2,7 +2,10 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.displayA = displayA;
Object.defineProperty(exports, "displayA", {
get: ()=>displayA,
enumerable: true
});
function displayA() {
return "Display A";
}

View File

@ -1,3 +1,6 @@
"use strict";
var _a = require("../packages/a/src/index");
console.log(`${(0, _a).displayA()}`);
Object.defineProperty(exports, "__esModule", {
value: true
});
const _a = require("../packages/a/src/index");
console.log(`${(0, _a.displayA)()}`);

View File

@ -2,7 +2,10 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.displayA = displayA;
Object.defineProperty(exports, "displayA", {
get: ()=>displayA,
enumerable: true
});
function displayA() {
return "Display A";
}

View File

@ -1,8 +1,9 @@
"use strict";
var _interop_require_wildcard = require("../../../../../../../../../packages/swc-helpers/src/_interop_require_wildcard.mjs").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interopRequireWildcard = require("../../../../../../../../../packages/swc-helpers/src/_interop_require_wildcard.mjs").default;
(async function() {
const { displayA } = await Promise.resolve().then(function() {
return _interop_require_wildcard(require("../packages/a/src/index"));
});
const { displayA } = await Promise.resolve("../packages/a/src/index").then((p)=>_interopRequireWildcard(require(p)));
console.log(displayA());
})();

View File

@ -1,2 +1,5 @@
"use strict";
var _config = require("../config");
Object.defineProperty(exports, "__esModule", {
value: true
});
const _config = require("../config");

View File

@ -2,5 +2,8 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.test = test;
Object.defineProperty(exports, "test", {
get: ()=>test,
enumerable: true
});
function test() {}

View File

@ -1,4 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
require("./core/module/moduleFile");
require("./core/utils");
require("./core/utilFile");

View File

@ -2,7 +2,10 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.utilFn = utilFn;
var _utilFile = require("../core/utils/utilFile");
(0, _utilFile).test();
Object.defineProperty(exports, "utilFn", {
get: ()=>utilFn,
enumerable: true
});
const _utilFile = require("../core/utils/utilFile");
(0, _utilFile.test)();
function utilFn() {}

View File

@ -0,0 +1,16 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"decorators": true
},
"target": "es2020",
"transform": {
"legacyDecorator": true
}
},
"module": {
"type": "commonjs",
"lazy": true
}
}

View File

@ -0,0 +1,6 @@
import { Class } from "module";
class MyClass extends Class {
@Class.Decorator()
async method() {}
}

View File

@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _tsDecorate() {
const data = require("@swc/helpers/lib/_ts_decorate.js").default;
_tsDecorate = function() {
return data;
};
return data;
}
function _module() {
const data = require("module");
_module = function() {
return data;
};
return data;
}
class MyClass extends _module().Class {
async method() {}
}
_tsDecorate()([
_module().Class.Decorator()
], MyClass.prototype, "method", null);

View File

@ -1,6 +1,9 @@
"use strict";
var _ts_decorate = require("@swc/helpers/lib/_ts_decorate.js").default;
var _ts_metadata = require("@swc/helpers/lib/_ts_metadata.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _tsDecorate = require("@swc/helpers/lib/_ts_decorate.js").default;
const _tsMetadata = require("@swc/helpers/lib/_ts_metadata.js").default;
var MyEnum;
(function(MyEnum) {
MyEnum["x"] = "xxx";
@ -8,9 +11,9 @@ var MyEnum;
})(MyEnum || (MyEnum = {}));
class Xpto {
}
_ts_decorate([
_tsDecorate([
Decorator(),
_ts_metadata("design:type", String)
_tsMetadata("design:type", String)
], Xpto.prototype, "value", void 0);
function Decorator() {
return function(...args) {};

View File

@ -2,17 +2,19 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _foo = _interop_require_default(require("foo"));
class NotOK {
constructor(){
console.log(_foo.default);
}
}
exports.default = NotOK;
Object.defineProperty(exports, "default", {
get: ()=>NotOK,
enumerable: true
});
const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
const _foo = _interopRequireDefault(require("foo"));
class OK {
constructor(){
console.log(_foo.default);
}
}
class NotOK {
constructor(){
console.log(_foo.default);
}
}

View File

@ -1,5 +1,8 @@
"use strict";
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var action = _interop_require_wildcard(require("./actions"));
console.log(action);
console.log(action.foo);
Object.defineProperty(exports, "__esModule", {
value: true
});
var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _actions = _interopRequireWildcard(require("./actions"));
console.log(_actions);
console.log(_actions.foo);

View File

@ -1,6 +1,9 @@
var _tagged_template_literal = require("@swc/helpers/lib/_tagged_template_literal.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _taggedTemplateLiteral = require("@swc/helpers/lib/_tagged_template_literal.js").default;
function _templateObject() {
var data = _tagged_template_literal([
var data = _taggedTemplateLiteral([
"'#ERROR'"
]);
_templateObject = function _templateObject() {

View File

@ -1,6 +1,9 @@
"use strict";
var _ts_decorate = require("@swc/helpers/lib/_ts_decorate.js").default;
var _ts_metadata = require("@swc/helpers/lib/_ts_metadata.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _tsDecorate = require("@swc/helpers/lib/_ts_decorate.js").default;
const _tsMetadata = require("@swc/helpers/lib/_ts_metadata.js").default;
function MyDecorator(klass) {
return ()=>{
// do something
@ -9,8 +12,8 @@ function MyDecorator(klass) {
}
class MyClass {
}
_ts_decorate([
_tsDecorate([
MyDecorator(MyClass),
_ts_metadata("design:type", String)
_tsMetadata("design:type", String)
], MyClass.prototype, "prop", void 0);
console.log(new MyClass());

View File

@ -2,7 +2,9 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.foo = void 0;
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _foo = _interop_require_wildcard(require("./foo"));
exports.foo = _foo;
Object.defineProperty(exports, "foo", {
get: ()=>_foo,
enumerable: true
});
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
const _foo = _interopRequireWildcard(require("./foo"));

View File

@ -1,5 +1,5 @@
{
"mappings": "AAAA;;;;;AAAO,MAAMA,GAAG,GAAG,CAAC,AAAC;QAARA,GAAG,GAAHA,GAAG",
"mappings": "AAAA;;;;+BAAaA,KAAG;aAAHA,GAAG;;;AAAT,MAAMA,GAAG,GAAG,CAAC,AAAC",
"names": [
"foo"
],

View File

@ -2,6 +2,8 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.foo = void 0;
Object.defineProperty(exports, "foo", {
get: ()=>foo,
enumerable: true
});
const foo = 1;
exports.foo = foo;

View File

@ -1,17 +1,20 @@
"use strict";
var _class_private_field_get = require("@swc/helpers/lib/_class_private_field_get.js").default;
var _class_private_field_init = require("@swc/helpers/lib/_class_private_field_init.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _classPrivateFieldGet = require("@swc/helpers/lib/_class_private_field_get.js").default;
const _classPrivateFieldInit = require("@swc/helpers/lib/_class_private_field_init.js").default;
var _ws = /*#__PURE__*/ new WeakMap(), _ws2 = /*#__PURE__*/ new WeakMap();
class Foo {
get connected() {
return _class_private_field_get(this, _ws2) && _class_private_field_get(this, _ws).readyState === _ws1.default.OPEN;
return _classPrivateFieldGet(this, _ws2) && _classPrivateFieldGet(this, _ws).readyState === _ws1.default.OPEN;
}
constructor(){
_class_private_field_init(this, _ws, {
_classPrivateFieldInit(this, _ws, {
writable: true,
value: void 0
});
_class_private_field_init(this, _ws2, {
_classPrivateFieldInit(this, _ws2, {
writable: true,
value: void 0
});

View File

@ -2,15 +2,19 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
var _class_private_field_get = require("@swc/helpers/lib/_class_private_field_get.js").default;
var _class_private_field_init = require("@swc/helpers/lib/_class_private_field_init.js").default;
var _class_private_field_set = require("@swc/helpers/lib/_class_private_field_set.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _ws = _interop_require_default(require("ws"));
var _utils = require("../../utils");
var _connection = require("./connection");
var _serialization = require("./serialization");
var _compression = require("./compression");
Object.defineProperty(exports, "Shard", {
get: ()=>Shard,
enumerable: true
});
const _classPrivateFieldGet = require("@swc/helpers/lib/_class_private_field_get.js").default;
const _classPrivateFieldInit = require("@swc/helpers/lib/_class_private_field_init.js").default;
const _classPrivateFieldSet = require("@swc/helpers/lib/_class_private_field_set.js").default;
const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
const _ws = _interopRequireDefault(require("ws"));
const _utils = require("../../utils");
const _connection = require("./connection");
const _serialization = require("./serialization");
const _compression = require("./compression");
const connectionStates = Object.keys(_ws.default);
var /**
* The serialization handler.
@ -42,13 +46,13 @@ class Shard extends _utils.Emitter {
* The current sequence
* @type {number}
*/ get seq() {
return _class_private_field_get(this, _seq);
return _classPrivateFieldGet(this, _seq);
}
/**
* The closing sequence.
* @type {number}
*/ get closingSeq() {
return _class_private_field_get(this, _closingSeq);
return _classPrivateFieldGet(this, _closingSeq);
}
/**
* The client instance.
@ -60,7 +64,7 @@ class Shard extends _utils.Emitter {
* Whether this shard is connected to the gateway or not.
* @type {boolean}
*/ get connected() {
return _class_private_field_get(this, _ws1) && _class_private_field_get(this, _ws1).readyState === _ws.default.OPEN;
return _classPrivateFieldGet(this, _ws1) && _classPrivateFieldGet(this, _ws1).readyState === _ws.default.OPEN;
}
/**
* Send a new packet to the discord gateway.
@ -73,16 +77,16 @@ class Shard extends _utils.Emitter {
if (++_i < _w) {
return;
}
const encoded = _class_private_field_get(this, _serialization1).encode(data);
_class_private_field_get(this, _ws1).send(encoded);
const encoded = _classPrivateFieldGet(this, _serialization1).encode(data);
_classPrivateFieldGet(this, _ws1).send(encoded);
};
if (data.op === _utils.GatewayOp.PRESENCE_UPDATE) {
++_w;
_class_private_field_get(this, _presenceBucket).queue(func, prioritized);
_classPrivateFieldGet(this, _presenceBucket).queue(func, prioritized);
}
return _class_private_field_get(this, _bucket).queue(func, prioritized);
return _classPrivateFieldGet(this, _bucket).queue(func, prioritized);
}
_class_private_field_get(this, _queue)[prioritized ? "unshift" : "push"](data);
_classPrivateFieldGet(this, _queue)[prioritized ? "unshift" : "push"](data);
}
/**
* Destroys this shard.
@ -95,14 +99,14 @@ class Shard extends _utils.Emitter {
this.heartbeat.reset();
this.session.clearHelloTimeout();
// (Step 1) Close the websocket connection.
if (_class_private_field_get(this, _ws1)) {
if (_class_private_field_get(this, _ws1).readyState === _ws.default.OPEN) {
_class_private_field_get(this, _ws1).close(code);
if (_classPrivateFieldGet(this, _ws1)) {
if (_classPrivateFieldGet(this, _ws1).readyState === _ws.default.OPEN) {
_classPrivateFieldGet(this, _ws1).close(code);
} else {
this._debug(`Ws State: ${connectionStates[_class_private_field_get(this, _ws1).readyState]}`);
this._debug(`Ws State: ${connectionStates[_classPrivateFieldGet(this, _ws1).readyState]}`);
this._cleanupConnection();
try {
_class_private_field_get(this, _ws1).close(code);
_classPrivateFieldGet(this, _ws1).close(code);
} catch {
// no-op
}
@ -116,19 +120,19 @@ class Shard extends _utils.Emitter {
} else if (emit) {
this.emit(_utils.ShardEvent.DESTROYED);
}
_class_private_field_set(this, _ws1, undefined);
_classPrivateFieldSet(this, _ws1, undefined);
// (Step 4) Set the shard status to disconnected.
this.status = _utils.Status.DISCONNECTED;
// (Step 5) Cache ze current sequence!
if (_class_private_field_get(this, _seq) !== -1) {
_class_private_field_set(this, _closingSeq, _class_private_field_get(this, _seq));
if (_classPrivateFieldGet(this, _seq) !== -1) {
_classPrivateFieldSet(this, _closingSeq, _classPrivateFieldGet(this, _seq));
}
// (Step 6) Reset the shit.
if (reset) {
_class_private_field_set(this, _seq, -1);
_classPrivateFieldSet(this, _seq, -1);
this.session.reset();
}
_class_private_field_set(this, _bucket, new _utils.Bucket(120, 6e4));
_classPrivateFieldSet(this, _bucket, new _utils.Bucket(120, 6e4));
}
connect() {
/* Step 0 - Check if a connection already exists. If so identify the session. */ if (this.connected) {
@ -136,7 +140,7 @@ class Shard extends _utils.Emitter {
this.session.identify();
return;
}
/* Step 1 - If a socket is already present, destroy it. */ if (_class_private_field_get(this, _ws1)) {
/* Step 1 - If a socket is already present, destroy it. */ if (_classPrivateFieldGet(this, _ws1)) {
this._debug("A connection is already present, cleaning up...");
this.destroy({
emit: false
@ -147,10 +151,10 @@ class Shard extends _utils.Emitter {
// Step 2.1 - Serialization
const encoding = this.manager.options.useEtf ? "etf" : "json";
qs.append("encoding", encoding);
_class_private_field_set(this, _serialization1, _serialization.Serialization.create(encoding));
_classPrivateFieldSet(this, _serialization1, _serialization.Serialization.create(encoding));
// Step 2.2 - Compression
if (this.manager.compression) {
_class_private_field_set(this, _compression1, _compression.Compression.create(this.manager.compression).on("data", (buffer)=>this._packet(buffer)).on("error", (error)=>this.emit(_utils.ShardEvent.ERROR, error)).on("debug", (message)=>this._debug(message)));
_classPrivateFieldSet(this, _compression1, _compression.Compression.create(this.manager.compression).on("data", (buffer)=>this._packet(buffer)).on("error", (error)=>this.emit(_utils.ShardEvent.ERROR, error)).on("debug", (message)=>this._debug(message)));
qs.append("compress", "zlib-stream");
}
/* Step 5 - Set the status and wait for the hello op code. */ this.status = this.status === _utils.Status.DISCONNECTED ? _utils.Status.RECONNECTING : _utils.Status.CONNECTING;
@ -160,16 +164,16 @@ class Shard extends _utils.Emitter {
* @type {number}
*/ this.connectedAt = Date.now();
/* Step 6 - Connect to the gateway. */ const uri = this.manager.gatewayUrl.replace(/\/*$/m, "");
_class_private_field_set(this, _ws1, new _ws.default(`${uri}/?${qs}`));
/* Step 7 - Attach the listeners. */ _class_private_field_get(this, _ws1).onopen = this._open.bind(this);
_class_private_field_get(this, _ws1).onclose = this._close.bind(this);
_class_private_field_get(this, _ws1).onerror = this._error.bind(this);
_class_private_field_get(this, _ws1).onmessage = this._message.bind(this);
_classPrivateFieldSet(this, _ws1, new _ws.default(`${uri}/?${qs}`));
/* Step 7 - Attach the listeners. */ _classPrivateFieldGet(this, _ws1).onopen = this._open.bind(this);
_classPrivateFieldGet(this, _ws1).onclose = this._close.bind(this);
_classPrivateFieldGet(this, _ws1).onerror = this._error.bind(this);
_classPrivateFieldGet(this, _ws1).onmessage = this._message.bind(this);
}
_packet(raw) {
/** @type {DiscordPacket} */ let pak;
try {
pak = _class_private_field_get(this, _serialization1).decode(raw);
pak = _classPrivateFieldGet(this, _serialization1).decode(raw);
this.manager.emit(_utils.ClientEvent.RAW_PACKET, pak, this);
} catch (e) {
this.manager.client.emit(_utils.ClientEvent.SHARD_ERROR, e, this);
@ -198,10 +202,10 @@ class Shard extends _utils.Emitter {
break;
}
if (pak.s !== null) {
if (_class_private_field_get(this, _seq) !== -1 && pak.s > _class_private_field_get(this, _seq) + 1) {
this._debug(`Non-consecutive sequence [${_class_private_field_get(this, _seq)} => ${pak.s}]`);
if (_classPrivateFieldGet(this, _seq) !== -1 && pak.s > _classPrivateFieldGet(this, _seq) + 1) {
this._debug(`Non-consecutive sequence [${_classPrivateFieldGet(this, _seq)} => ${pak.s}]`);
}
_class_private_field_set(this, _seq, pak.s);
_classPrivateFieldSet(this, _seq, pak.s);
}
switch(pak.op){
case _utils.GatewayOp.HELLO:
@ -220,7 +224,7 @@ class Shard extends _utils.Emitter {
this.session.resume();
break;
}
_class_private_field_set(this, _seq, -1);
_classPrivateFieldSet(this, _seq, -1);
this.session.reset();
this.status = _utils.Status.RECONNECTING;
this.emit(_utils.ShardEvent.INVALID_SESSION);
@ -265,11 +269,11 @@ class Shard extends _utils.Emitter {
*/ _open() {
var ref;
this.status = _utils.Status.HANDSHAKING;
this._debug(`Connected. ${(ref = _class_private_field_get(this, _ws1)) === null || ref === void 0 ? void 0 : ref.url} in ${Date.now() - this.connectedAt}`);
if (_class_private_field_get(this, _queue).length) {
this._debug(`${_class_private_field_get(this, _queue).length} packets waiting... sending all now.`);
while(_class_private_field_get(this, _queue).length){
const pk = _class_private_field_get(this, _queue).shift();
this._debug(`Connected. ${(ref = _classPrivateFieldGet(this, _ws1)) === null || ref === void 0 ? void 0 : ref.url} in ${Date.now() - this.connectedAt}`);
if (_classPrivateFieldGet(this, _queue).length) {
this._debug(`${_classPrivateFieldGet(this, _queue).length} packets waiting... sending all now.`);
while(_classPrivateFieldGet(this, _queue).length){
const pk = _classPrivateFieldGet(this, _queue).shift();
if (!pk) {
break;
}
@ -295,13 +299,13 @@ class Shard extends _utils.Emitter {
var ref;
const reason = (ref = evt.reason || _utils.GatewayCloseCode[evt.code]) !== null && ref !== void 0 ? ref : "unknown";
this._debug(`Closed; Code = ${evt.code}, Clean? = ${evt.wasClean}, Reason = ${reason}`);
if (_class_private_field_get(this, _seq) !== -1) {
_class_private_field_set(this, _closingSeq, _class_private_field_get(this, _seq));
if (_classPrivateFieldGet(this, _seq) !== -1) {
_classPrivateFieldSet(this, _closingSeq, _classPrivateFieldGet(this, _seq));
}
_class_private_field_set(this, _seq, -1);
_classPrivateFieldSet(this, _seq, -1);
this.heartbeat.reset();
this.session.clearHelloTimeout();
if (_class_private_field_get(this, _ws1)) {
if (_classPrivateFieldGet(this, _ws1)) {
this._cleanupConnection();
}
this.status = _utils.Status.DISCONNECTED;
@ -316,13 +320,13 @@ class Shard extends _utils.Emitter {
* @param {WebSocket.MessageEvent} evt
* @private
*/ _message(evt) {
return _class_private_field_get(this, _compression1) ? _class_private_field_get(this, _compression1).add(evt.data) : this._packet(evt.data);
return _classPrivateFieldGet(this, _compression1) ? _classPrivateFieldGet(this, _compression1).add(evt.data) : this._packet(evt.data);
}
/**
* Cleans up the WebSocket connection listeners.
* @private
*/ _cleanupConnection() {
_class_private_field_get(this, _ws1).onopen = _class_private_field_get(this, _ws1).onclose = _class_private_field_get(this, _ws1).onerror = _class_private_field_get(this, _ws1).onmessage = null;
_classPrivateFieldGet(this, _ws1).onopen = _classPrivateFieldGet(this, _ws1).onclose = _classPrivateFieldGet(this, _ws1).onerror = _classPrivateFieldGet(this, _ws1).onmessage = null;
}
/**
* Used for debugging shard stuff.
@ -336,35 +340,35 @@ class Shard extends _utils.Emitter {
* @param {number} id The ID of this shard.
*/ constructor(manager, id){
super();
_class_private_field_init(this, _serialization1, {
_classPrivateFieldInit(this, _serialization1, {
writable: true,
value: void 0
});
_class_private_field_init(this, _compression1, {
_classPrivateFieldInit(this, _compression1, {
writable: true,
value: void 0
});
_class_private_field_init(this, _seq, {
_classPrivateFieldInit(this, _seq, {
writable: true,
value: void 0
});
_class_private_field_init(this, _closingSeq, {
_classPrivateFieldInit(this, _closingSeq, {
writable: true,
value: void 0
});
_class_private_field_init(this, _bucket, {
_classPrivateFieldInit(this, _bucket, {
writable: true,
value: void 0
});
_class_private_field_init(this, _presenceBucket, {
_classPrivateFieldInit(this, _presenceBucket, {
writable: true,
value: void 0
});
_class_private_field_init(this, _ws1, {
_classPrivateFieldInit(this, _ws1, {
writable: true,
value: void 0
});
_class_private_field_init(this, _queue, {
_classPrivateFieldInit(this, _queue, {
writable: true,
value: void 0
});
@ -396,13 +400,13 @@ class Shard extends _utils.Emitter {
* Guilds that are expected to be received.
* @type {Set<string>}
*/ this.expectedGuilds = new Set();
_class_private_field_set(this, _seq, -1);
_class_private_field_set(this, _closingSeq, 0);
_class_private_field_set(this, _queue, []);
_class_private_field_set(this, _bucket, new _utils.Bucket(120, 6e4, {
_classPrivateFieldSet(this, _seq, -1);
_classPrivateFieldSet(this, _closingSeq, 0);
_classPrivateFieldSet(this, _queue, []);
_classPrivateFieldSet(this, _bucket, new _utils.Bucket(120, 6e4, {
reservedTokens: 5
}));
_class_private_field_set(this, _presenceBucket, new _utils.Bucket(5, 6e4));
_classPrivateFieldSet(this, _presenceBucket, new _utils.Bucket(5, 6e4));
}
} /**
* @typedef {Object} DiscordPacket
@ -417,4 +421,3 @@ class Shard extends _utils.Emitter {
* @property {boolean} [log=false] Whether to emit a debug log.
* @property {number} [code=1000] The code to use.
*/
exports.Shard = Shard;

View File

@ -2,13 +2,17 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
var _class_private_field_get = require("@swc/helpers/lib/_class_private_field_get.js").default;
var _class_private_field_init = require("@swc/helpers/lib/_class_private_field_init.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _nodeFetch = _interop_require_default(require("node-fetch"));
var _abortSignal = require("./misc/AbortSignal");
var _errors = require("../../errors");
var _utils = require("../../utils");
Object.defineProperty(exports, "RequestHandler", {
get: ()=>RequestHandler,
enumerable: true
});
const _classPrivateFieldGet = require("@swc/helpers/lib/_class_private_field_get.js").default;
const _classPrivateFieldInit = require("@swc/helpers/lib/_class_private_field_init.js").default;
const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
const _nodeFetch = _interopRequireDefault(require("node-fetch"));
const _abortSignal = require("./misc/AbortSignal");
const _errors = require("../../errors");
const _utils = require("../../utils");
const headers = [
"x-ratelimit-limit",
"x-ratelimit-remaining",
@ -25,7 +29,7 @@ class RequestHandler {
* Whether this handler is inactive or not.
* @return {boolean}
*/ get inactive() {
return !_class_private_field_get(this, _queue).remaining && !this._limited;
return !_classPrivateFieldGet(this, _queue).remaining && !this._limited;
}
/**
* Whether the rate-limit bucket is currently limited.
@ -82,7 +86,7 @@ class RequestHandler {
*
* @return {Promise<*>}
*/ async push(url, request) {
await _class_private_field_get(this, _queue).wait();
await _classPrivateFieldGet(this, _queue).wait();
try {
await this.rest.globalTimeout;
if (this._limited) {
@ -100,11 +104,11 @@ class RequestHandler {
method: request.method,
url
});
await (0, _utils).sleep(this._untilReset);
await (0, _utils.sleep)(this._untilReset);
}
return this._make(url, request);
} finally{
_class_private_field_get(this, _queue).next();
_classPrivateFieldGet(this, _queue).next();
}
}
/**
@ -120,7 +124,7 @@ class RequestHandler {
const timeout = _utils.Timers.setTimeout(()=>signal.abort(), this.rest.options.timeout);
let res;
try {
res = await (0, _nodeFetch).default(url, {
res = await (0, _nodeFetch.default)(url, {
...request,
signal
});
@ -142,7 +146,7 @@ class RequestHandler {
_retry = ~~reset * (cf ? 1000 : 1 + this.rest.options.offset);
}
if (res.headers.get("X-RateLimit-Global")) {
this.rest.globalTimeout = (0, _utils).sleep(_retry).then(()=>{
this.rest.globalTimeout = (0, _utils.sleep)(_retry).then(()=>{
this.api.globalTimeout = null;
});
}
@ -152,7 +156,7 @@ class RequestHandler {
}
if (res.status === 429) {
this.rest.client.emit(_utils.ClientEvent.LIMITED, `Hit a 429 on route: ${this.id}, Retrying After: ${_retry}ms`);
await (0, _utils).sleep(_retry);
await (0, _utils.sleep)(_retry);
return this._make(url, request, tries++);
}
if (res.status >= 500 && res.status < 600) {
@ -171,7 +175,7 @@ class RequestHandler {
* @param {Rest} rest The REST Manager.
* @param {string} id The ID of this request handler.
*/ constructor(rest, id){
_class_private_field_init(this, _queue, {
_classPrivateFieldInit(this, _queue, {
writable: true,
value: new _utils.AsyncQueue()
});
@ -197,7 +201,6 @@ class RequestHandler {
*/ this.limit = Infinity;
}
}
exports.RequestHandler = RequestHandler;
/**
* Bulk fetch headers from a node-fetch response.
* @param {Response} res The request response.

View File

@ -1,12 +1,15 @@
"use strict";
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
class A {
foo() {
var _this = this;
return _async_to_generator(function*() {
return _asyncToGenerator(function*() {
try {
return yield (function() {
var _ref = _async_to_generator(function*(x) {
var _ref = _asyncToGenerator(function*(x) {
return x + _this.val;
});
return function(x) {

View File

@ -2,13 +2,16 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AppController = void 0;
var _ts_decorate = require("@swc/helpers/lib/_ts_decorate.js").default;
var _ts_metadata = require("@swc/helpers/lib/_ts_metadata.js").default;
var _ts_param = require("@swc/helpers/lib/_ts_param.js").default;
var _common = require("@nestjs/common");
var _appService = require("./app.service");
var _createUserDto = require("./dtos/CreateUserDto");
Object.defineProperty(exports, "AppController", {
get: ()=>AppController,
enumerable: true
});
const _tsDecorate = require("@swc/helpers/lib/_ts_decorate.js").default;
const _tsMetadata = require("@swc/helpers/lib/_ts_metadata.js").default;
const _tsParam = require("@swc/helpers/lib/_ts_param.js").default;
const _common = require("@nestjs/common");
const _appService = require("./app.service");
const _createUserDto = require("./dtos/CreateUserDto");
let AppController = class AppController {
async getHello() {
const result = await this.appService.getHello();
@ -22,24 +25,23 @@ let AppController = class AppController {
this.appService = appService;
}
};
exports.AppController = AppController;
_ts_decorate([
(0, _common).Get(),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [])
_tsDecorate([
(0, _common.Get)(),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [])
], AppController.prototype, "getHello", null);
_ts_decorate([
(0, _common).Post(),
_ts_param(0, (0, _common).Body()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
_tsDecorate([
(0, _common.Post)(),
_tsParam(0, (0, _common.Body)()),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof _createUserDto.CreateUserDto === "undefined" ? Object : _createUserDto.CreateUserDto
])
], AppController.prototype, "create", null);
exports.AppController = AppController = _ts_decorate([
(0, _common).Controller(),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
AppController = _tsDecorate([
(0, _common.Controller)(),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof _appService.AppService === "undefined" ? Object : _appService.AppService
])
], AppController);

View File

@ -1,3 +1,3 @@
"use strict";
var request = require("supertest");
console.log(request());
const _supertest = require("supertest");
console.log(_supertest());

View File

@ -1,7 +1,10 @@
"use strict";
var _class_call_check = require("@swc/helpers/lib/_class_call_check.js").default;
var _ts_decorate = require("@swc/helpers/lib/_ts_decorate.js").default;
var _ts_metadata = require("@swc/helpers/lib/_ts_metadata.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default;
var _tsDecorate = require("@swc/helpers/lib/_ts_decorate.js").default;
var _tsMetadata = require("@swc/helpers/lib/_ts_metadata.js").default;
require("reflect-metadata");
var COL_KEY = Symbol("col");
var column = function() {
@ -11,9 +14,9 @@ var column = function() {
};
var User = function User() {
"use strict";
_class_call_check(this, User);
_classCallCheck(this, User);
};
_ts_decorate([
_tsDecorate([
column(),
_ts_metadata("design:type", String)
_tsMetadata("design:type", String)
], User.prototype, "currency", void 0);

View File

@ -1,4 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _necessary = require("necessary");
var second = _necessary.arrayUtilities.second;
var elements = [

View File

@ -8,5 +8,8 @@
"tsx": true
},
"loose": true
},
"module": {
"type": "nodenext"
}
}
}

View File

@ -1,3 +1,4 @@
var F = require("yaml");
import { createRequire as _createRequire } from "module";
var __require = _createRequire(import.meta.url);
var F = __require("yaml");
console.log(F);
export { };

View File

@ -1,3 +1,9 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AbstractProviderDeliveryService", {
get: ()=>AbstractProviderDeliveryService,
enumerable: true
});
class AbstractProviderDeliveryService {
}
exports.AbstractProviderDeliveryService = AbstractProviderDeliveryService;

View File

@ -1,3 +1,9 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "AbstractProviderDeliveryService", {
get: ()=>AbstractProviderDeliveryService,
enumerable: true
});
class AbstractProviderDeliveryService {
}
exports.AbstractProviderDeliveryService = AbstractProviderDeliveryService;

View File

@ -1,8 +1,11 @@
"use strict";
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
const SampleData = typedModel("SampleVideo", VideosSchema, undefined, undefined, {
byPlatform: function() {
var _ref = _async_to_generator(function*(platform) {
var _ref = _asyncToGenerator(function*(platform) {
const result = yield this.find({
platform: {
$eq: platform

View File

@ -1,17 +1,20 @@
"use strict";
var _ts_decorate = require("@swc/helpers/lib/_ts_decorate.js").default;
var _ts_metadata = require("@swc/helpers/lib/_ts_metadata.js").default;
var _ts_param = require("@swc/helpers/lib/_ts_param.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _tsDecorate = require("@swc/helpers/lib/_ts_decorate.js").default;
const _tsMetadata = require("@swc/helpers/lib/_ts_metadata.js").default;
const _tsParam = require("@swc/helpers/lib/_ts_param.js").default;
// not work
class MyClass1 {
constructor(param1){
this.param1 = param1;
}
}
MyClass1 = _ts_decorate([
_ts_param(0, Inject()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
MyClass1 = _tsDecorate([
_tsParam(0, Inject()),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof Injected === "undefined" ? Object : Injected
])
], MyClass1);
@ -20,10 +23,10 @@ class MyClass2 {
this.param1 = param1;
}
}
MyClass2 = _ts_decorate([
_ts_param(0, Inject()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
MyClass2 = _tsDecorate([
_tsParam(0, Inject()),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof Injected === "undefined" ? Object : Injected
])
], MyClass2);
@ -32,10 +35,10 @@ class MyClass3 {
this.param1 = param1;
}
}
MyClass3 = _ts_decorate([
_ts_param(0, Inject()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
MyClass3 = _tsDecorate([
_tsParam(0, Inject()),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof Injected === "undefined" ? Object : Injected
])
], MyClass3);
@ -44,10 +47,10 @@ class MyClass4 {
this.param1 = param1;
}
}
MyClass4 = _ts_decorate([
_ts_param(0, Inject()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
MyClass4 = _tsDecorate([
_tsParam(0, Inject()),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof Injected === "undefined" ? Object : Injected
])
], MyClass4);
@ -56,10 +59,10 @@ class MyClass5 {
this.param1 = param1;
}
}
MyClass5 = _ts_decorate([
_ts_param(0, Inject()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
MyClass5 = _tsDecorate([
_tsParam(0, Inject()),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof Injected === "undefined" ? Object : Injected
])
], MyClass5);
@ -69,11 +72,11 @@ class MyClass6 {
this.param2 = param2;
}
}
MyClass6 = _ts_decorate([
_ts_param(0, Inject()),
_ts_param(1, Inject()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
MyClass6 = _tsDecorate([
_tsParam(0, Inject()),
_tsParam(1, Inject()),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof Injected === "undefined" ? Object : Injected,
typeof Injected === "undefined" ? Object : Injected
])

View File

@ -1,15 +1,18 @@
"use strict";
var _ts_decorate = require("@swc/helpers/lib/_ts_decorate.js").default;
var _ts_metadata = require("@swc/helpers/lib/_ts_metadata.js").default;
var _ts_param = require("@swc/helpers/lib/_ts_param.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _tsDecorate = require("@swc/helpers/lib/_ts_decorate.js").default;
const _tsMetadata = require("@swc/helpers/lib/_ts_metadata.js").default;
const _tsParam = require("@swc/helpers/lib/_ts_param.js").default;
// work
class MyClass1 {
constructor(param1){}
}
MyClass1 = _ts_decorate([
_ts_param(0, Inject()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
MyClass1 = _tsDecorate([
_tsParam(0, Inject()),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof Injected === "undefined" ? Object : Injected
])
], MyClass1);
@ -18,11 +21,11 @@ class MyClass2 {
this.param1 = param1;
}
}
MyClass2 = _ts_decorate([
_ts_param(0, Inject()),
_ts_param(1, Inject()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
MyClass2 = _tsDecorate([
_tsParam(0, Inject()),
_tsParam(1, Inject()),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof Injected === "undefined" ? Object : Injected,
typeof Injected === "undefined" ? Object : Injected
])
@ -32,11 +35,11 @@ class MyClass3 {
this.param2 = param2;
}
}
MyClass3 = _ts_decorate([
_ts_param(0, Inject()),
_ts_param(1, Inject()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
MyClass3 = _tsDecorate([
_tsParam(0, Inject()),
_tsParam(1, Inject()),
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
typeof Injected === "undefined" ? Object : Injected,
typeof Injected === "undefined" ? Object : Injected
])

View File

@ -1,23 +1,26 @@
"use strict";
var _class_call_check = require("@swc/helpers/lib/_class_call_check.js").default;
var _create_class = require("@swc/helpers/lib/_create_class.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default;
var _createClass = require("@swc/helpers/lib/_create_class.js").default;
var _get = require("@swc/helpers/lib/_get.js").default;
var _get_prototype_of = require("@swc/helpers/lib/_get_prototype_of.js").default;
var _getPrototypeOf = require("@swc/helpers/lib/_get_prototype_of.js").default;
var _inherits = require("@swc/helpers/lib/_inherits.js").default;
var _create_super = require("@swc/helpers/lib/_create_super.js").default;
var _createSuper = require("@swc/helpers/lib/_create_super.js").default;
var ColouredCanvasElement = /*#__PURE__*/ function(CanvasElement1) {
"use strict";
_inherits(ColouredCanvasElement, CanvasElement1);
var _super = _create_super(ColouredCanvasElement);
var _super = _createSuper(ColouredCanvasElement);
function ColouredCanvasElement() {
_class_call_check(this, ColouredCanvasElement);
_classCallCheck(this, ColouredCanvasElement);
return _super.apply(this, arguments);
}
_create_class(ColouredCanvasElement, [
_createClass(ColouredCanvasElement, [
{
key: "createFacets",
value: function createFacets(hidden) {
hidden = _get(_get_prototype_of(ColouredCanvasElement.prototype), "createFacets", this).call(this, hidden);
hidden = _get(_getPrototypeOf(ColouredCanvasElement.prototype), "createFacets", this).call(this, hidden);
}
}
]);

View File

@ -1,16 +1,19 @@
"use strict";
var _class_call_check = require("@swc/helpers/lib/_class_call_check.js").default;
var _create_class = require("@swc/helpers/lib/_create_class.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default;
var _createClass = require("@swc/helpers/lib/_create_class.js").default;
var _get = require("@swc/helpers/lib/_get.js").default;
var _get_prototype_of = require("@swc/helpers/lib/_get_prototype_of.js").default;
var _getPrototypeOf = require("@swc/helpers/lib/_get_prototype_of.js").default;
var _inherits = require("@swc/helpers/lib/_inherits.js").default;
var _wrap_native_super = require("@swc/helpers/lib/_wrap_native_super.js").default;
var _create_super = require("@swc/helpers/lib/_create_super.js").default;
var _wrapNativeSuper = require("@swc/helpers/lib/_wrap_native_super.js").default;
var _createSuper = require("@swc/helpers/lib/_create_super.js").default;
var Element = /*#__PURE__*/ function() {
function Element() {
_class_call_check(this, Element);
_classCallCheck(this, Element);
}
_create_class(Element, [
_createClass(Element, [
{
key: "getChildElements",
value: function getChildElements() {
@ -22,12 +25,12 @@ var Element = /*#__PURE__*/ function() {
}();
var CanvasElement = /*#__PURE__*/ function(Element) {
_inherits(CanvasElement, Element);
var _super = _create_super(CanvasElement);
var _super = _createSuper(CanvasElement);
function CanvasElement() {
_class_call_check(this, CanvasElement);
_classCallCheck(this, CanvasElement);
return _super.apply(this, arguments);
}
_create_class(CanvasElement, [
_createClass(CanvasElement, [
{
key: "createFacets",
value: function createFacets(hidden) {
@ -37,19 +40,19 @@ var CanvasElement = /*#__PURE__*/ function(Element) {
}
]);
return CanvasElement;
}(_wrap_native_super(Element));
}(_wrapNativeSuper(Element));
var ColouredCanvasElement = /*#__PURE__*/ function(CanvasElement) {
_inherits(ColouredCanvasElement, CanvasElement);
var _super = _create_super(ColouredCanvasElement);
var _super = _createSuper(ColouredCanvasElement);
function ColouredCanvasElement() {
_class_call_check(this, ColouredCanvasElement);
_classCallCheck(this, ColouredCanvasElement);
return _super.apply(this, arguments);
}
_create_class(ColouredCanvasElement, [
_createClass(ColouredCanvasElement, [
{
key: "createFacets",
value: function createFacets(hidden) {
hidden = _get(_get_prototype_of(ColouredCanvasElement.prototype), "createFacets", this).call(this, hidden); ///
hidden = _get(_getPrototypeOf(ColouredCanvasElement.prototype), "createFacets", this).call(this, hidden); ///
///
}
}
@ -58,9 +61,9 @@ var ColouredCanvasElement = /*#__PURE__*/ function(CanvasElement) {
}(CanvasElement);
var ColouredSquare = /*#__PURE__*/ function(ColouredCanvasElement) {
_inherits(ColouredSquare, ColouredCanvasElement);
var _super = _create_super(ColouredSquare);
var _super = _createSuper(ColouredSquare);
function ColouredSquare() {
_class_call_check(this, ColouredSquare);
_classCallCheck(this, ColouredSquare);
return _super.apply(this, arguments);
}
return ColouredSquare;

View File

@ -2,6 +2,10 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ServiceError", {
get: ()=>ServiceError,
enumerable: true
});
class ServiceError extends Error {
constructor(...args){
super(...args);
@ -9,7 +13,6 @@ class ServiceError extends Error {
this.name = "ServiceError.BadResponse";
}
}
exports.ServiceError = ServiceError;
(function(ServiceError1) {
let Code;
(function(Code) {

View File

@ -1,6 +1,9 @@
"use strict";
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _react = _interop_require_wildcard(require("react"));
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
const _react = _interopRequireWildcard(require("react"));
class X extends _react.Component {
}
_react.default.render(document.getElementById("#root"), /*#__PURE__*/ _react.default.createElement(X, null));

View File

@ -2,17 +2,19 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "X", {
enumerable: true,
get: function() {
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
X: function() {
return _z.default;
}
});
Object.defineProperty(exports, "Y", {
enumerable: true,
get: function() {
},
Y: function() {
return _z.Y;
}
});
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _z = _interop_require_wildcard(require("./Z"));
var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _z = _interopRequireWildcard(require("./Z"));

View File

@ -2,23 +2,22 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "X", {
enumerable: true,
get: function() {
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
X: function() {
return _module.default;
}
});
Object.defineProperty(exports, "Y", {
enumerable: true,
get: function() {
},
Y: function() {
return _module.Y;
}
});
Object.defineProperty(exports, "Z", {
enumerable: true,
get: function() {
},
Z: function() {
return _module.Z;
}
});
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _module = _interop_require_wildcard(require("./module"));
var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _module = _interopRequireWildcard(require("./module"));

View File

@ -2,7 +2,12 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = get;
Object.defineProperty(exports, "default", {
get: function() {
return get;
},
enumerable: true
});
function get(key) {
console.log(key);
}

View File

@ -1,8 +1,9 @@
"use strict";
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
(async ()=>{
const example = await Promise.resolve().then(function() {
return _interop_require_wildcard(require("./example"));
});
const example = await Promise.resolve("./example").then((p)=>_interopRequireWildcard(require(p)));
console.log(example.foo);
})();

View File

@ -2,13 +2,14 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPackage = getPackage;
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _path = require("path");
Object.defineProperty(exports, "getPackage", {
get: ()=>getPackage,
enumerable: true
});
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
const _path = require("path");
async function getPackage() {
const pkg = await Promise.resolve(`${(0, _path).join(process.cwd(), "package.json")}`).then(function(s) {
return _interop_require_wildcard(require(s));
});
const pkg = await Promise.resolve((0, _path.join)(process.cwd(), "package.json")).then((p)=>_interopRequireWildcard(require(p)));
return pkg.default || pkg;
}
(async function() {

View File

@ -2,13 +2,14 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPackage = getPackage;
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _path = require("path");
Object.defineProperty(exports, "getPackage", {
get: ()=>getPackage,
enumerable: true
});
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
const _path = require("path");
async function getPackage() {
const pkg = await Promise.resolve(`${(0, _path).join(process.cwd(), "package.json")}`).then(function(s) {
return _interop_require_wildcard(require(s));
});
const pkg = await Promise.resolve((0, _path.join)(process.cwd(), "package.json")).then((p)=>_interopRequireWildcard(require(p)));
return pkg.default || pkg;
}
(async function() {

View File

@ -3,26 +3,11 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "render", {
enumerable: true,
get: function() {
return _customRender.customRender;
}
},
enumerable: true
});
var _exportNames = {
render: true
};
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _exportStar = require("@swc/helpers/lib/_export_star.js").default;
var _customRender = require("./customRender");
var _react = _interop_require_wildcard(require("@testing-library/react"));
// re-export everything
Object.keys(_react).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _react[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _react[key];
}
});
});
_exportStar(require("@testing-library/react"), exports);

View File

@ -1,4 +1,7 @@
"use strict";
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _a = _interop_require_wildcard(require("./A"));
Object.defineProperty(exports, "__esModule", {
value: true
});
var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _a = _interopRequireWildcard(require("./A"));
console.log(_a.default, _a.foo);

View File

@ -1,4 +1,7 @@
"use strict";
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _a = _interop_require_wildcard(require("./A"));
Object.defineProperty(exports, "__esModule", {
value: true
});
var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _a = _interopRequireWildcard(require("./A"));
console.log(_a.default, _a.foo); // <-- baz foo

View File

@ -1,4 +1,7 @@
"use strict";
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _a = _interop_require_wildcard(require("./A"));
Object.defineProperty(exports, "__esModule", {
value: true
});
var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _a = _interopRequireWildcard(require("./A"));
console.log(_a.default, _a.foo);

View File

@ -1,3 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _testlibrary = require("testlibrary");
console.log("aFunc: ", (0, _testlibrary).aFunc(1, 2));
console.log("aFunc: ", (0, _testlibrary.aFunc)(1, 2));

View File

@ -2,14 +2,19 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Foo;
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interop_require_default(require("regenerator-runtime"));
var _react = _interop_require_default(require("react"));
Object.defineProperty(exports, "default", {
get: function() {
return Foo;
},
enumerable: true
});
var _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"));
var _react = _interopRequireDefault(require("react"));
function Foo() {
return /*#__PURE__*/ _react.default.createElement("div", {
onClick: _async_to_generator(_regeneratorRuntime.default.mark(function _callee(e) {
onClick: _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee(e) {
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
while(1)switch(_ctx.prev = _ctx.next){
case 0:

View File

@ -2,14 +2,17 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Foo;
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _react = _interop_require_default(require("react"));
Object.defineProperty(exports, "default", {
get: ()=>Foo,
enumerable: true
});
const _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
const _react = _interopRequireDefault(require("react"));
function Foo() {
return /*#__PURE__*/ _react.default.createElement("div", {
onClick: function() {
var _ref = _async_to_generator(function*(e) {
var _ref = _asyncToGenerator(function*(e) {
yield doSomething();
});
return function(e) {

View File

@ -2,13 +2,16 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Foo;
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _react = _interop_require_default(require("react"));
Object.defineProperty(exports, "default", {
get: ()=>Foo,
enumerable: true
});
const _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
const _react = _interopRequireDefault(require("react"));
function Foo() {
return /*#__PURE__*/ _react.default.createElement("div", {
onClick: _async_to_generator(function*(e) {
onClick: _asyncToGenerator(function*(e) {
yield doSomething();
})
});

View File

@ -2,13 +2,16 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Foo;
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _react = _interop_require_default(require("react"));
Object.defineProperty(exports, "default", {
get: ()=>Foo,
enumerable: true
});
const _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
const _react = _interopRequireDefault(require("react"));
function Foo() {
return /*#__PURE__*/ _react.default.createElement("div", {
onClick: _async_to_generator(function*(e) {
onClick: _asyncToGenerator(function*(e) {
yield doSomething();
})
});

View File

@ -2,9 +2,12 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Foo;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _react = _interop_require_default(require("react"));
Object.defineProperty(exports, "default", {
get: ()=>Foo,
enumerable: true
});
const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
const _react = _interopRequireDefault(require("react"));
function Foo() {
return /*#__PURE__*/ _react.default.createElement("div", {
onClick: async (e)=>{

View File

@ -2,9 +2,12 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Foo;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _react = _interop_require_default(require("react"));
Object.defineProperty(exports, "default", {
get: ()=>Foo,
enumerable: true
});
const _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
const _react = _interopRequireDefault(require("react"));
function Foo() {
return call(async (e)=>{
await doSomething();

View File

@ -2,13 +2,18 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Foo;
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interop_require_default(require("regenerator-runtime"));
var _react = _interop_require_default(require("react"));
Object.defineProperty(exports, "default", {
get: function() {
return Foo;
},
enumerable: true
});
var _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"));
var _react = _interopRequireDefault(require("react"));
function Foo() {
return call(_async_to_generator(_regeneratorRuntime.default.mark(function _callee(e) {
return call(_asyncToGenerator(_regeneratorRuntime.default.mark(function _callee(e) {
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
while(1)switch(_ctx.prev = _ctx.next){
case 0:

View File

@ -2,9 +2,14 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Foo;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _react = _interop_require_default(require("react"));
Object.defineProperty(exports, "default", {
get: function() {
return Foo;
},
enumerable: true
});
var _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
var _react = _interopRequireDefault(require("react"));
function Foo() {
return call(function(e) {
doSomething();

View File

@ -2,29 +2,6 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {};
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _appConfig = _interop_require_wildcard(require("./app.config"));
Object.keys(_appConfig).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _appConfig[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _appConfig[key];
}
});
});
var _databaseConfig = _interop_require_wildcard(require("./database.config"));
Object.keys(_databaseConfig).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _databaseConfig[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _databaseConfig[key];
}
});
});
var _exportStar = require("@swc/helpers/lib/_export_star.js").default;
_exportStar(require("./app.config"), exports);
_exportStar(require("./database.config"), exports);

View File

@ -2,29 +2,6 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {};
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _appConfig = _interop_require_wildcard(require("./app.config"));
Object.keys(_appConfig).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _appConfig[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _appConfig[key];
}
});
});
var _databaseConfig = _interop_require_wildcard(require("./database.config"));
Object.keys(_databaseConfig).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _databaseConfig[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _databaseConfig[key];
}
});
});
var _exportStar = require("@swc/helpers/lib/_export_star.js").default;
_exportStar(require("./app.config"), exports);
_exportStar(require("./database.config"), exports);

View File

@ -2,6 +2,10 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.bar = void 0;
Object.defineProperty(exports, "bar", {
get: function() {
return bar;
},
enumerable: true
});
var bar = function() {};
exports.bar = bar;

View File

@ -2,6 +2,10 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.foo = void 0;
Object.defineProperty(exports, "foo", {
get: function() {
return foo;
},
enumerable: true
});
var foo = function() {};
exports.foo = foo;

View File

@ -1,4 +1,7 @@
"use strict";
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var lib = _interop_require_wildcard(require("./lib"));
console.log(lib);
Object.defineProperty(exports, "__esModule", {
value: true
});
var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _lib = _interopRequireWildcard(require("./lib"));
console.log(_lib);

View File

@ -2,29 +2,6 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {};
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _foo = _interop_require_wildcard(require("./foo"));
Object.keys(_foo).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _foo[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _foo[key];
}
});
});
var _bar = _interop_require_wildcard(require("./bar"));
Object.keys(_bar).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _bar[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _bar[key];
}
});
});
var _exportStar = require("@swc/helpers/lib/_export_star.js").default;
_exportStar(require("./foo"), exports);
_exportStar(require("./bar"), exports);

View File

@ -1,7 +1,10 @@
"use strict";
var _define_property = require("@swc/helpers/lib/_define_property.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interop_require_default(require("regenerator-runtime"));
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty = require("@swc/helpers/lib/_define_property.js").default;
var _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"));
function _asyncIterator(iterable) {
var method;
if (typeof Symbol === "function") {
@ -55,7 +58,7 @@ _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
promise = new Promise(function(r) {
return resolve = r;
});
iterable = _define_property({}, Symbol.asyncIterator, function() {
iterable = _defineProperty({}, Symbol.asyncIterator, function() {
return {
next: function next() {
return promise;

View File

@ -1,10 +1,13 @@
"use strict";
var _async_iterator = require("@swc/helpers/lib/_async_iterator.js").default;
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _define_property = require("@swc/helpers/lib/_define_property.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interop_require_default(require("regenerator-runtime"));
_async_to_generator(_regeneratorRuntime.default.mark(function _callee() {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _asyncIterator = require("@swc/helpers/lib/_async_iterator.js").default;
var _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _defineProperty = require("@swc/helpers/lib/_define_property.js").default;
var _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"));
_asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
var counter, resolve, promise, iterable, res, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, v, oldresolve;
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
while(1)switch(_ctx.prev = _ctx.next){
@ -14,21 +17,21 @@ _async_to_generator(_regeneratorRuntime.default.mark(function _callee() {
promise = new Promise(function(r) {
return resolve = r;
});
iterable = _define_property({}, Symbol.asyncIterator, function() {
iterable = _defineProperty({}, Symbol.asyncIterator, function() {
return {
next: function next() {
return promise;
}
};
});
res = _async_to_generator(_regeneratorRuntime.default.mark(function _callee() {
res = _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, value;
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
while(1)switch(_ctx.prev = _ctx.next){
case 0:
_iteratorAbruptCompletion = false, _didIteratorError = false;
_ctx.prev = 1;
_iterator = _async_iterator(iterable);
_iterator = _asyncIterator(iterable);
case 3:
_ctx.next = 5;
return _iterator.next();

View File

@ -1,6 +1,9 @@
"use strict";
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interop_require_default(require("regenerator-runtime"));
Object.defineProperty(exports, "__esModule", {
value: true
});
var _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"));
var _marked = _regeneratorRuntime.default.mark(foo);
function foo() {
return _regeneratorRuntime.default.wrap(function foo$(_ctx) {

View File

@ -1,5 +1,8 @@
"use strict";
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var action = _interop_require_wildcard(require("./actions"));
console.log(action);
console.log(action.default);
Object.defineProperty(exports, "__esModule", {
value: true
});
var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _actions = _interopRequireWildcard(require("./actions"));
console.log(_actions);
console.log(_actions.default);

View File

@ -1,8 +1,11 @@
"use strict";
var _define_property = require("@swc/helpers/lib/_define_property.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _defineProperty = require("@swc/helpers/lib/_define_property.js").default;
class Item extends Component {
constructor(props){
super(props);
_define_property(this, "input", this.props.item);
_defineProperty(this, "input", this.props.item);
}
}

View File

@ -1,8 +1,11 @@
"use strict";
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interop_require_default(require("regenerator-runtime"));
_async_to_generator(_regeneratorRuntime.default.mark(function _callee() {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"));
_asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
var sleep, result;
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
while(1)switch(_ctx.prev = _ctx.next){

View File

@ -1,4 +1,7 @@
"use strict";
var _interop_require_default = require("../../../../../../../packages/swc-helpers/src/_interop_require_default.mjs").default;
var _a = _interop_require_default(require("./subfolder/A"));
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interopRequireDefault = require("../../../../../../../packages/swc-helpers/src/_interop_require_default.mjs").default;
const _a = _interopRequireDefault(require("./subfolder/A"));
console.log(_a.default);

View File

@ -2,8 +2,10 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.A = void 0;
var _b = require("./B");
Object.defineProperty(exports, "A", {
get: ()=>A,
enumerable: true
});
const _b = require("./B");
console.log(_b.B);
const A = 400;
exports.A = A;

View File

@ -2,6 +2,8 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.B = void 0;
Object.defineProperty(exports, "B", {
get: ()=>B,
enumerable: true
});
const B = 500;
exports.B = B;

View File

@ -1,4 +1,4 @@
var _func = require("./src/func");
const _func = require("./src/func");
console.log(_func.func1);
function something({ func =0 }) {
const haha = false;

View File

@ -1,5 +1,8 @@
"use strict";
var _ = require("./");
Object.defineProperty(exports, "__esModule", {
value: true
});
const _ = require("./");
describe("example test that should fail due to compilation", ()=>{
test.each([
[
@ -15,7 +18,7 @@ describe("example test that should fail due to compilation", ()=>{
4
],
])("for entry %s", (_1, a, b, expected)=>{
const result = (0, _).sum(a, b);
const result = (0, _.sum)(a, b);
expect(result).toEqual(expected);
});
});

View File

@ -1,31 +1,34 @@
"use strict";
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _ts_decorate = require("@swc/helpers/lib/_ts_decorate.js").default;
var _ts_metadata = require("@swc/helpers/lib/_ts_metadata.js").default;
var _ts_param = require("@swc/helpers/lib/_ts_param.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
const _tsDecorate = require("@swc/helpers/lib/_ts_decorate.js").default;
const _tsMetadata = require("@swc/helpers/lib/_ts_metadata.js").default;
const _tsParam = require("@swc/helpers/lib/_ts_param.js").default;
class Foo {
fnName1(argName) {
return _async_to_generator(function*() {})();
return _asyncToGenerator(function*() {})();
}
fnName2(argName = false) {
return _async_to_generator(function*() {})();
return _asyncToGenerator(function*() {})();
}
}
_ts_decorate([
_ts_param(0, Arg("GraphQLArgName", {
_tsDecorate([
_tsParam(0, Arg("GraphQLArgName", {
nullable: true
})),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
Boolean
])
], Foo.prototype, "fnName1", null);
_ts_decorate([
_ts_param(0, Arg("GraphQLArgName", {
_tsDecorate([
_tsParam(0, Arg("GraphQLArgName", {
nullable: true
})),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
_tsMetadata("design:type", Function),
_tsMetadata("design:paramtypes", [
Boolean
])
], Foo.prototype, "fnName2", null);

View File

@ -2,11 +2,13 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
Object.defineProperty(exports, "default", {
get: ()=>_default,
enumerable: true
});
var _default = {
foo: {
func1 (index) {},
func2 (index, index1) {}
}
};
exports.default = _default;

View File

@ -2,24 +2,31 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.warn = warn;
exports.test2 = exports.test = void 0;
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
test: ()=>test,
test2: ()=>test2,
warn: ()=>warn
});
function warn() {
throw new Error("this should not be called");
}
const test = {};
exports.test = test;
const test2 = {};
exports.test2 = test2;
Object.defineProperty(test, "warn", {
get: ()=>warn,
set: (v)=>{
exports.warn = warn = v;
warn = v;
}
});
Object.defineProperty(test2, "work", {
get: ()=>warn,
set: (v)=>{
exports.warn = warn = v;
warn = v;
}
});

View File

@ -1,7 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
module.exports = function(foo, bar) {
return true;
};

View File

@ -1,5 +1,8 @@
"use strict";
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _boo = _interop_require_wildcard(require("boo"));
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
const _boo = _interopRequireWildcard(require("boo"));
_boo.default.some();
(0, _boo).sdx();
(0, _boo.sdx)();

View File

@ -2,7 +2,20 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.b2 = exports.a2 = void 0;
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
a2: function() {
return a2;
},
b2: function() {
return b2;
}
});
var ref = {
a: 1,
b: 2
@ -12,5 +25,3 @@ var ref1 = {
b: 2
};
var a2 = ref1.a, b2 = ref1.b;
exports.a2 = a2;
exports.b2 = b2;

View File

@ -2,13 +2,22 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.downloadDocument = exports.badIstanbul = exports.noop = void 0;
var _object_without_properties = require("@swc/helpers/lib/_object_without_properties.js").default;
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
badIstanbul: ()=>badIstanbul,
downloadDocument: ()=>downloadDocument,
noop: ()=>noop
});
const _objectWithoutProperties = require("@swc/helpers/lib/_object_without_properties.js").default;
//top comment
const noop = ()=>{};
exports.noop = noop;
var /* istanbul ignore next */ badIstanbul = (test)=>{
const { value } = test, pixelParams = _object_without_properties(test, [
const { value } = test, pixelParams = _objectWithoutProperties(test, [
"value"
]);
console.log("fail");
@ -16,5 +25,3 @@ var /* istanbul ignore next */ badIstanbul = (test)=>{
/* istanbul ignore next: UI-5137 */ const downloadDocument = ()=>{
console.log("fail");
};
exports.downloadDocument = downloadDocument;
exports.badIstanbul = badIstanbul;

View File

@ -1,8 +1,11 @@
"use strict";
var _object_without_properties = require("@swc/helpers/lib/_object_without_properties.js").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _objectWithoutProperties = require("@swc/helpers/lib/_object_without_properties.js").default;
// single line comment
const x = (_param)=>/*todo: refactor any type*/ {
var { y } = _param, rest = _object_without_properties(_param, [
var { y } = _param, rest = _objectWithoutProperties(_param, [
"y"
]);
return {

View File

@ -2,7 +2,10 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AnElement = void 0;
Object.defineProperty(exports, "AnElement", {
get: ()=>AnElement,
enumerable: true
});
const AnElement = ({ prop1 , prop2 , prop3 , num , data })=>{
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(SomeElement, {
prop1: prop1,
@ -11,4 +14,3 @@ const AnElement = ({ prop1 , prop2 , prop3 , num , data })=>{
}), // istanbul ignore next
!(num > 0) && data.name && /*#__PURE__*/ React.createElement(React.Fragment, null, '"Hello"'));
};
exports.AnElement = AnElement;

View File

@ -1,4 +1,7 @@
"use strict";
var _interop_require_default = require("../../../../../../../../packages/swc-helpers/src/_interop_require_default.mjs").default;
var _handlebars = _interop_require_default(require("handlebars"));
Object.defineProperty(exports, "__esModule", {
value: true
});
var _interopRequireDefault = require("../../../../../../../../packages/swc-helpers/src/_interop_require_default.mjs").default;
var _handlebars = _interopRequireDefault(require("handlebars"));
console.log(_handlebars.default);

View File

@ -1,14 +1,17 @@
"use strict";
var _class_call_check = require("@swc/helpers/lib/_class_call_check.js").default;
var _interop_require_wildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _ts_decorate = require("@swc/helpers/lib/_ts_decorate.js").default;
var _ts_metadata = require("@swc/helpers/lib/_ts_metadata.js").default;
var joiful = _interop_require_wildcard(require("joiful"));
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default;
var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
var _tsDecorate = require("@swc/helpers/lib/_ts_decorate.js").default;
var _tsMetadata = require("@swc/helpers/lib/_ts_metadata.js").default;
var _joiful = _interopRequireWildcard(require("joiful"));
var Schema = function Schema() {
"use strict";
_class_call_check(this, Schema);
_classCallCheck(this, Schema);
};
_ts_decorate([
joiful.string().guid().required(),
_ts_metadata("design:type", String)
_tsDecorate([
_joiful.string().guid().required(),
_tsMetadata("design:type", String)
], Schema.prototype, "id", void 0);

View File

@ -2,8 +2,11 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ServiceError = void 0;
var _ts_decorate = require("@swc/helpers/lib/_ts_decorate.js").default;
Object.defineProperty(exports, "ServiceError", {
get: ()=>ServiceError,
enumerable: true
});
const _tsDecorate = require("@swc/helpers/lib/_ts_decorate.js").default;
const CD = ()=>{};
const PD = ()=>{};
let ServiceError = class ServiceError extends Error {
@ -13,11 +16,10 @@ let ServiceError = class ServiceError extends Error {
}
name = "ServiceError.BadResponse";
};
exports.ServiceError = ServiceError;
_ts_decorate([
_tsDecorate([
PD
], ServiceError.prototype, "code", void 0);
exports.ServiceError = ServiceError = _ts_decorate([
ServiceError = _tsDecorate([
CD
], ServiceError);
(function(ServiceError1) {
@ -42,4 +44,4 @@ exports.ServiceError = ServiceError = _ts_decorate([
};
}
ServiceError1.toMessageBody = toMessageBody;
})(ServiceError || (exports.ServiceError = ServiceError = {}));
})(ServiceError || (ServiceError = {}));

View File

@ -1,8 +1,8 @@
{
"mappings": "AACA;;mBAAqB,OAAO;AAArB,QAAKA,GAAG,OAAA,CAAA;AAIR,MAAMC,IAAI,GAAG,CAACC,EAAU,GAAsB;IACjD,sBAAsB;IACtB,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,GACvBC,UAAU,CAAC,IAAM;YACbD,OAAO,CAAC,QAAQ,CAAC,CAAC;SACrB,EAAE,IAAI,CAAC,CACX,CAAC;CACL,AAAC;QAPWH,IAAI,GAAJA,IAAI",
"mappings": "AACA;;;;;;;;IAIaA,IAAI,MAAJA,IAAI;IAJLC,GAAG;;qBAAM,OAAO;AAIrB,MAAMD,IAAI,GAAG,CAACE,EAAU,GAAsB;IACjD,sBAAsB;IACtB,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,GACvBC,UAAU,CAAC,IAAM;YACbD,OAAO,CAAC,QAAQ,CAAC,CAAC;SACrB,EAAE,IAAI,CAAC,CACX,CAAC;CACL,AAAC",
"names": [
"get",
"byID",
"get",
"id",
"Promise",
"resolve",

View File

@ -1,11 +1,18 @@
"use strict";
exports.byID = exports.get = void 0;
var _get = require("./get");
exports.get = _get;
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
get: all[name],
enumerable: true
});
}
_export(exports, {
byID: ()=>byID,
get: ()=>_get
});
const _get = require("./get");
const byID = (id)=>{
// Do some async stuff
return new Promise((resolve)=>setTimeout(()=>{
resolve("result");
}, 2000));
};
exports.byID = byID;

View File

@ -0,0 +1,12 @@
{
"module": {
"type": "amd"
},
"jsc": {
"parser": {
"syntax": "typescript",
"decorators": true
},
"target": "es2016"
}
}

View File

@ -0,0 +1,10 @@
function state() {}
class Controller {}
export default class extends Controller {
@state
isTest = false;
onChange() {}
}

View File

@ -0,0 +1,28 @@
define([
"require",
"exports",
"@swc/helpers/src/_ts_decorate.mjs"
], function(require, exports, _tsDecorate) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
get: ()=>_class,
enumerable: true
});
_tsDecorate = _tsDecorate.default;
function state() {}
class Controller {
}
class _class extends Controller {
onChange() {}
constructor(...args){
super(...args);
this.isTest = false;
}
}
_tsDecorate([
state
], _class.prototype, "isTest", void 0);
});

View File

@ -2,14 +2,16 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ts_decorate = require("@swc/helpers/lib/_ts_decorate.js").default;
Object.defineProperty(exports, "default", {
get: ()=>_class,
enumerable: true
});
const _tsDecorate = require("@swc/helpers/lib/_ts_decorate.js").default;
function test(constructor) {
console.log(constructor);
}
let _class = class _class {
};
exports.default = _class = _ts_decorate([
_class = _tsDecorate([
test
], _class);
exports.default = _class;

View File

@ -1,10 +1,13 @@
"use strict";
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interop_require_default(require("regenerator-runtime"));
Object.defineProperty(exports, "__esModule", {
value: true
});
var _asyncToGenerator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"));
require("reflect-metadata");
var v0 = function() {
var _ref = _async_to_generator(_regeneratorRuntime.default.mark(function _callee(v1) {
var _ref = _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee(v1) {
return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
while(1)switch(_ctx.prev = _ctx.next){
case 0:

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