fix(es/transforms): Fix transforms (#1861)

swc_ecma_transforms_compat:
 - Organize logical assignment pass correctly.

swc_ecma_transforms_optimization:
 - `dead_branch_remover`: Handle nullish coalescing operator correctly. (#1851)
This commit is contained in:
강동윤 2021-06-26 16:02:15 +09:00 committed by GitHub
parent 5345c90989
commit 33f2ab2d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 439 additions and 52 deletions

View File

@ -11,7 +11,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc"
repository = "https://github.com/swc-project/swc.git"
version = "0.25.0"
version = "0.26.0"
[lib]
name = "swc"
@ -30,15 +30,15 @@ serde = {version = "1", features = ["derive"]}
serde_json = "1"
sourcemap = "6"
swc_atoms = {version = "0.2", path = "./atoms"}
swc_bundler = {version = "0.43.0", path = "./bundler"}
swc_bundler = {version = "0.44.0", path = "./bundler"}
swc_common = {version = "0.10.16", path = "./common", features = ["sourcemap", "concurrent"]}
swc_ecma_ast = {version = "0.47.0", path = "./ecmascript/ast"}
swc_ecma_codegen = {version = "0.60.0", path = "./ecmascript/codegen"}
swc_ecma_ext_transforms = {version = "0.19.0", path = "./ecmascript/ext-transforms"}
swc_ecma_loader = {version = "0.9.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]}
swc_ecma_parser = {version = "0.61.0", path = "./ecmascript/parser"}
swc_ecma_preset_env = {version = "0.26.0", path = "./ecmascript/preset-env"}
swc_ecma_transforms = {version = "0.56.0", path = "./ecmascript/transforms", features = [
swc_ecma_preset_env = {version = "0.27.0", path = "./ecmascript/preset-env"}
swc_ecma_transforms = {version = "0.57.0", path = "./ecmascript/transforms", features = [
"compat",
"module",
"optimization",

View File

@ -9,7 +9,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"]
license = "Apache-2.0/MIT"
name = "swc_bundler"
repository = "https://github.com/swc-project/swc.git"
version = "0.43.0"
version = "0.44.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
@ -37,7 +37,7 @@ swc_ecma_ast = {version = "0.47.0", path = "../ecmascript/ast"}
swc_ecma_codegen = {version = "0.60.0", path = "../ecmascript/codegen"}
swc_ecma_loader = {version = "0.9.0", path = "../ecmascript/loader"}
swc_ecma_parser = {version = "0.61.0", path = "../ecmascript/parser"}
swc_ecma_transforms = {version = "0.56.0", path = "../ecmascript/transforms", features = ["optimization"]}
swc_ecma_transforms = {version = "0.57.0", path = "../ecmascript/transforms", features = ["optimization"]}
swc_ecma_utils = {version = "0.38.0", path = "../ecmascript/utils"}
swc_ecma_visit = {version = "0.33.0", path = "../ecmascript/visit"}
@ -46,7 +46,7 @@ hex = "0.4"
ntest = "0.7.2"
reqwest = {version = "0.10.8", features = ["blocking"]}
sha-1 = "0.9"
swc_ecma_transforms = {version = "0.56.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
swc_ecma_transforms = {version = "0.57.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
tempfile = "3.1.0"
testing = {version = "0.10.5", path = "../testing"}
url = "2.1.1"

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecmascript"
repository = "https://github.com/swc-project/swc.git"
version = "0.42.0"
version = "0.43.0"
[package.metadata.docs.rs]
all-features = true
@ -31,9 +31,9 @@ typescript = ["swc_ecma_transforms/typescript"]
swc_ecma_ast = {version = "0.47.0", path = "./ast"}
swc_ecma_codegen = {version = "0.60.0", path = "./codegen", optional = true}
swc_ecma_dep_graph = {version = "0.29.0", path = "./dep-graph", optional = true}
swc_ecma_minifier = {version = "0.8.0", path = "./minifier", optional = true}
swc_ecma_minifier = {version = "0.9.0", path = "./minifier", optional = true}
swc_ecma_parser = {version = "0.61.0", path = "./parser", optional = true}
swc_ecma_transforms = {version = "0.56.0", path = "./transforms", optional = true}
swc_ecma_transforms = {version = "0.57.0", path = "./transforms", optional = true}
swc_ecma_utils = {version = "0.38.0", path = "./utils", optional = true}
swc_ecma_visit = {version = "0.33.0", path = "./visit", optional = true}

View File

@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "src/lists/*.json"]
license = "Apache-2.0/MIT"
name = "swc_ecma_minifier"
repository = "https://github.com/swc-project/swc.git"
version = "0.8.0"
version = "0.9.0"
[features]
debug = []
@ -27,7 +27,7 @@ swc_common = {version = "0.10.8", path = "../../common"}
swc_ecma_ast = {version = "0.47.0", path = "../ast"}
swc_ecma_codegen = {version = "0.60.0", path = "../codegen"}
swc_ecma_parser = {version = "0.61.0", path = "../parser"}
swc_ecma_transforms = {version = "0.56.0", path = "../transforms/", features = ["optimization"]}
swc_ecma_transforms = {version = "0.57.0", path = "../transforms/", features = ["optimization"]}
swc_ecma_transforms_base = {version = "0.20.0", path = "../transforms/base"}
swc_ecma_utils = {version = "0.38.0", path = "../utils"}
swc_ecma_visit = {version = "0.33.0", path = "../visit"}

View File

@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_preset_env/"
edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_preset_env"
version = "0.26.0"
version = "0.27.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -22,7 +22,7 @@ string_enum = {version = "0.3.1", path = "../../macros/string_enum"}
swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.47.0", path = "../ast"}
swc_ecma_transforms = {version = "0.56.0", path = "../transforms", features = ["compat", "proposal"]}
swc_ecma_transforms = {version = "0.57.0", path = "../transforms", features = ["compat", "proposal"]}
swc_ecma_utils = {version = "0.38.0", path = "../utils"}
swc_ecma_visit = {version = "0.33.0", path = "../visit"}
walkdir = "2"

View File

@ -14,7 +14,7 @@ use swc_atoms::{js_word, JsWord};
use swc_common::{chain, comments::Comments, FromVariant, Mark, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_transforms::{
compat::{bugfixes, es2015, es2016, es2017, es2018, es2020, es3},
compat::{bugfixes, es2015, es2016, es2017, es2018, es2020, es2021, es3},
pass::{noop, Optional},
};
use swc_ecma_utils::prepend_stmts;
@ -87,7 +87,11 @@ where
let pass = add!(pass, ExportNamespaceFrom, es2020::export_namespace_from());
let pass = add!(pass, NullishCoalescing, es2020::nullish_coalescing());
let pass = add!(pass, LogicalAssignmentOperators, es2020::operators());
let pass = add!(
pass,
LogicalAssignmentOperators,
es2021::logical_assignments()
);
let pass = add!(pass, OptionalChaining, es2020::optional_chaining());
let pass = add!(pass, ClassProperties, es2020::class_properties());

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms"
repository = "https://github.com/swc-project/swc.git"
version = "0.56.0"
version = "0.57.0"
[package.metadata.docs.rs]
all-features = true
@ -26,12 +26,12 @@ swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.47.0", path = "../ast"}
swc_ecma_parser = {version = "0.61.0", path = "../parser"}
swc_ecma_transforms_base = {version = "0.20.0", path = "./base"}
swc_ecma_transforms_compat = {version = "0.22.0", path = "./compat", optional = true}
swc_ecma_transforms_module = {version = "0.23.0", path = "./module", optional = true}
swc_ecma_transforms_optimization = {version = "0.26.0", path = "./optimization", optional = true}
swc_ecma_transforms_proposal = {version = "0.23.0", path = "./proposal", optional = true}
swc_ecma_transforms_react = {version = "0.24.0", path = "./react", optional = true}
swc_ecma_transforms_typescript = {version = "0.25.0", path = "./typescript", optional = true}
swc_ecma_transforms_compat = {version = "0.23.0", path = "./compat", optional = true}
swc_ecma_transforms_module = {version = "0.24.0", path = "./module", optional = true}
swc_ecma_transforms_optimization = {version = "0.27.0", path = "./optimization", optional = true}
swc_ecma_transforms_proposal = {version = "0.24.0", path = "./proposal", optional = true}
swc_ecma_transforms_react = {version = "0.25.0", path = "./react", optional = true}
swc_ecma_transforms_typescript = {version = "0.26.0", path = "./typescript", optional = true}
swc_ecma_utils = {version = "0.38.0", path = "../utils"}
swc_ecma_visit = {version = "0.33.0", path = "../visit"}
unicode-xid = "0.2"

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_base"
repository = "https://github.com/swc-project/swc.git"
version = "0.20.0"
version = "0.20.1"
[dependencies]
fxhash = "0.2.1"

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_compat"
repository = "https://github.com/swc-project/swc.git"
version = "0.22.0"
version = "0.23.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -3,7 +3,6 @@ pub use self::{
class_properties::{class_properties, typescript_class_properties},
export_namespace_from::export_namespace_from,
nullish_coalescing::nullish_coalescing,
operators::operators,
opt_chaining::optional_chaining,
};
use swc_common::chain;
@ -12,7 +11,6 @@ use swc_ecma_visit::Fold;
mod class_properties;
mod export_namespace_from;
mod nullish_coalescing;
mod operators;
mod opt_chaining;
pub fn es2020() -> impl Fold {
@ -21,6 +19,5 @@ pub fn es2020() -> impl Fold {
optional_chaining(),
class_properties(),
export_namespace_from(),
operators(),
)
}

View File

@ -8,7 +8,7 @@ use swc_ecma_visit::{
as_folder, noop_visit_mut_type, noop_visit_type, Fold, Node, Visit, VisitMut, VisitMutWith,
};
pub fn operators() -> impl Fold + VisitMut {
pub fn logical_assignments() -> impl Fold + VisitMut {
as_folder(Operators::default())
}

View File

@ -0,0 +1,8 @@
pub use self::logical_assignments::logical_assignments;
use swc_ecma_visit::{Fold, VisitMut};
mod logical_assignments;
pub fn es2021() -> impl Fold + VisitMut {
logical_assignments()
}

View File

@ -2,7 +2,7 @@
pub use self::{
bugfixes::bugfixes, es2015::es2015, es2016::es2016, es2017::es2017, es2018::es2018,
es2020::es2020, es3::es3,
es2020::es2020, es2021::es2021, es3::es3,
};
#[macro_use]
@ -13,5 +13,6 @@ pub mod es2016;
pub mod es2017;
pub mod es2018;
pub mod es2020;
pub mod es2021;
pub mod es3;
pub mod reserved_words;

View File

@ -1,10 +1,10 @@
use swc_ecma_parser::{Syntax, TsConfig};
use swc_ecma_transforms_compat::es2020;
use swc_ecma_transforms_compat::es2021;
use swc_ecma_transforms_testing::test;
use swc_ecma_visit::Fold;
fn tr() -> impl Fold {
es2020::operators()
es2021::logical_assignments()
}
fn syntax() -> Syntax {

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_module"
repository = "https://github.com/swc-project/swc.git"
version = "0.23.0"
version = "0.24.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -26,6 +26,6 @@ swc_ecma_utils = {version = "0.38.0", path = "../../utils"}
swc_ecma_visit = {version = "0.33.0", path = "../../visit"}
[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.22.0", path = "../compat"}
swc_ecma_transforms_compat = {version = "0.23.0", path = "../compat"}
swc_ecma_transforms_testing = {version = "0.20.0", path = "../testing/"}
testing = {version = "0.10.5", path = "../../../testing/"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_optimization"
repository = "https://github.com/swc-project/swc.git"
version = "0.26.0"
version = "0.27.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -26,10 +26,10 @@ swc_ecma_utils = {version = "0.38.0", path = "../../utils"}
swc_ecma_visit = {version = "0.33.0", path = "../../visit"}
[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.22.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.23.0", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.23.0", path = "../proposal"}
swc_ecma_transforms_react = {version = "0.24.0", path = "../react"}
swc_ecma_transforms_compat = {version = "0.23.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.24.0", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.24.0", path = "../proposal"}
swc_ecma_transforms_react = {version = "0.25.0", path = "../react"}
swc_ecma_transforms_testing = {version = "0.20.0", path = "../testing"}
swc_ecma_transforms_typescript = {version = "0.25.0", path = "../typescript"}
swc_ecma_transforms_typescript = {version = "0.26.0", path = "../typescript"}
testing = {version = "0.10.5", path = "../../../testing"}

View File

@ -1172,7 +1172,7 @@ fn ignore_result(e: Expr) -> Option<Expr> {
left,
op,
right,
}) if op != op!("&&") && op != op!("||") => {
}) if op != op!("&&") && op != op!("||") && op != op!("??") => {
let left = ignore_result(*left);
let right = ignore_result(*right);
@ -1214,7 +1214,7 @@ fn ignore_result(e: Expr) -> Option<Expr> {
}))
}
} else {
debug_assert_eq!(op, op!("||"));
debug_assert!(op == op!("||") || op == op!("??"));
let l = left.as_pure_bool();

View File

@ -1787,3 +1787,8 @@ fn issue_1825() {
",
);
}
#[test]
fn issue_1851_1() {
test("x ?? (x = 'abc');", "x ?? (x = 'abc');");
}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_proposal"
repository = "https://github.com/swc-project/swc.git"
version = "0.23.0"
version = "0.24.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -30,6 +30,6 @@ swc_ecma_utils = {version = "0.38.0", path = "../../utils"}
swc_ecma_visit = {version = "0.33.0", path = "../../visit"}
[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.22.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.23.0", path = "../module"}
swc_ecma_transforms_compat = {version = "0.23.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.24.0", path = "../module"}
swc_ecma_transforms_testing = {version = "0.20.0", path = "../testing"}

View File

@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_react"
repository = "https://github.com/swc-project/swc.git"
version = "0.24.0"
version = "0.25.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -29,7 +29,7 @@ swc_ecma_visit = {version = "0.33.0", path = "../../visit"}
[dev-dependencies]
swc_ecma_codegen = {version = "0.60.0", path = "../../codegen/"}
swc_ecma_transforms_compat = {version = "0.22.0", path = "../compat/"}
swc_ecma_transforms_module = {version = "0.23.0", path = "../module"}
swc_ecma_transforms_compat = {version = "0.23.0", path = "../compat/"}
swc_ecma_transforms_module = {version = "0.24.0", path = "../module"}
swc_ecma_transforms_testing = {version = "0.20.0", path = "../testing/"}
testing = {version = "0.10.5", path = "../../../testing"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_typescript"
repository = "https://github.com/swc-project/swc.git"
version = "0.25.0"
version = "0.26.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -22,9 +22,9 @@ swc_ecma_visit = {version = "0.33.0", path = "../../visit"}
[dev-dependencies]
swc_ecma_codegen = {version = "0.60.0", path = "../../codegen"}
swc_ecma_transforms_compat = {version = "0.22.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.23.0", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.23.0", path = "../proposal/"}
swc_ecma_transforms_compat = {version = "0.23.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.24.0", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.24.0", path = "../proposal/"}
swc_ecma_transforms_testing = {version = "0.20.0", path = "../testing"}
testing = {version = "0.10.5", path = "../../../testing"}
walkdir = "2.3.1"

View File

@ -155,6 +155,7 @@ impl<'a, 'b, P: swc_ecma_visit::Fold> PassBuilder<'a, 'b, P> {
} else {
Either::Right(chain!(
import_assertions(),
Optional::new(compat::es2021::es2021(), self.target < JscTarget::Es2021),
Optional::new(compat::es2020::es2020(), self.target < JscTarget::Es2020),
Optional::new(typescript::strip(), syntax.typescript()),
Optional::new(compat::es2018(), self.target <= JscTarget::Es2018),

View File

@ -0,0 +1,12 @@
{
"jsc": {
"parser": {
"syntax": "typescript"
},
"transform": null,
"target": "es2015",
"loose": true,
"keepClassNames": false
},
"minify": true
}

View File

@ -0,0 +1,7 @@
const f = (...characters: Array<string>): number =>
characters.length
const g = (str: string): number =>
f(...str)
g("meow")

View File

@ -0,0 +1 @@
var f=function(){for(var _len=arguments.length,characters=new Array(_len),_key=0;_key<_len;_key++){characters[_key]=arguments[_key];}return characters.length;};var g=function(str){return f.apply(void 0,str);};g("meow");

View File

@ -0,0 +1,11 @@
{
"jsc": {
"parser": {
"syntax": "typescript"
},
"transform": null,
"target": "es2015",
"loose": true,
"keepClassNames": false
}
}

View File

@ -0,0 +1,7 @@
const f = (...characters: Array<string>): number =>
characters.length
const g = (str: string): number =>
f(...str)
g("meow")

View File

@ -0,0 +1,10 @@
var f = function() {
for(var _len = arguments.length, characters = new Array(_len), _key = 0; _key < _len; _key++){
characters[_key] = arguments[_key];
}
return characters.length;
};
var g = function(str) {
return f.apply(void 0, str);
};
g("meow");

View File

@ -0,0 +1,5 @@
{
"module": {
"type": "commonjs"
}
}

View File

@ -0,0 +1,2 @@
export * from './app.config';
export * from './database.config';

View File

@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
};
var _appConfig = _interopRequireWildcard(require("./app.config"));
var _databaseConfig = _interopRequireWildcard(require("./database.config"));
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {
};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
Object.keys(_appConfig).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _appConfig[key];
}
});
});
Object.keys(_databaseConfig).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _databaseConfig[key];
}
});
});

View File

@ -0,0 +1,10 @@
{
"jsc": {
"parser": {
"syntax": "typescript"
}
},
"module": {
"type": "commonjs"
}
}

View File

@ -0,0 +1,2 @@
export * from './app.config';
export * from './database.config';

View File

@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
};
var _appConfig = _interopRequireWildcard(require("./app.config"));
var _databaseConfig = _interopRequireWildcard(require("./database.config"));
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {
};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
Object.keys(_appConfig).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _appConfig[key];
}
});
});
Object.keys(_databaseConfig).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _databaseConfig[key];
}
});
});

View File

@ -0,0 +1,10 @@
{
"jsc": {
"parser": {
"syntax": "typescript"
}
},
"module": {
"type": "commonjs"
}
}

View File

@ -0,0 +1 @@
export const bar = () => { }

View File

@ -0,0 +1 @@
export const foo = () => { }

View File

@ -0,0 +1,2 @@
import * as lib from './lib';
console.log(lib)

View File

@ -0,0 +1,2 @@
export * from './foo';
export * from './bar';

View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.bar = void 0;
var bar = function() {
};
exports.bar = bar;

View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.bar = void 0;
var bar = function() {
};
exports.bar = bar;

View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.foo = void 0;
var foo = function() {
};
exports.foo = foo;

View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.foo = void 0;
var foo = function() {
};
exports.foo = foo;

View File

@ -0,0 +1,26 @@
"use strict";
var lib = _interopRequireWildcard(require("./lib"));
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {
};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
console.log(lib);

View File

@ -0,0 +1,26 @@
"use strict";
var lib = _interopRequireWildcard(require("./lib"));
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {
};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
console.log(lib);

View File

@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
};
var _foo = _interopRequireWildcard(require("./foo"));
var _bar = _interopRequireWildcard(require("./bar"));
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {
};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
Object.keys(_foo).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _foo[key];
}
});
});
Object.keys(_bar).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _bar[key];
}
});
});

View File

@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
};
var _foo = _interopRequireWildcard(require("./foo"));
var _bar = _interopRequireWildcard(require("./bar"));
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {
};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
Object.keys(_foo).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _foo[key];
}
});
});
Object.keys(_bar).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _bar[key];
}
});
});