babel-plugin-system-import-transformer
Advanced tools
Comparing version 1.1.4 to 1.1.5
29
index.js
@@ -208,27 +208,18 @@ module.exports = function (babel) { | ||
SystemImportExpressionTransformer.prototype.createTransformedExpression = function () { | ||
var amdTest = this.getAmdTest(); | ||
var amdRequire = this.getAmdRequire(this.moduleNameLiteral); | ||
var commonJSTest = this.getCommonJSTest(); | ||
var componentTest = this.getComponentTest(); | ||
var commonJSRequire = this.getCommonJSRequire(this.importedModuleLiteral); | ||
var globalRequire = this.getGlobalRequire(this.moduleNameLiteral); | ||
var commonJSOrComponentTest = t.logicalExpression('||', commonJSTest, componentTest); | ||
var moduleImportExpressions; | ||
if (this.file.opts.modules === 'amd') { | ||
moduleImportExpressions = [amdRequire]; | ||
moduleImportExpressions = [this.getAmdRequire(this.moduleNameLiteral)]; | ||
} else if (this.file.opts.modules === 'common') { | ||
moduleImportExpressions = [commonJSRequire]; | ||
moduleImportExpressions = [this.getCommonJSRequire(this.importedModuleLiteral)]; | ||
} else { | ||
var amdTest = this.getAmdTest(); | ||
var commonJSTest = this.getCommonJSTest(); | ||
var componentTest = this.getComponentTest(); | ||
var commonJSOrComponentTest = t.logicalExpression('||', commonJSTest, componentTest); | ||
var umdRequire = t.ifStatement(amdTest, | ||
t.blockStatement([amdRequire]), | ||
t.blockStatement([this.getAmdRequire(this.moduleNameLiteral)]), | ||
t.ifStatement(commonJSOrComponentTest, | ||
t.blockStatement([commonJSRequire]), | ||
t.blockStatement([globalRequire]) | ||
t.blockStatement([this.getCommonJSRequire(this.importedModuleLiteral)]), | ||
t.blockStatement([this.getGlobalRequire(this.moduleNameLiteral)]) | ||
) | ||
@@ -235,0 +226,0 @@ ); |
{ | ||
"name": "babel-plugin-system-import-transformer", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Babel plugin that replaces System.import with the equivalent UMD pattern", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# babel-plugin-system-import-transformer | ||
Babel plugin that replaces System.import with the equivalent UMD pattern | ||
[![npm](https://img.shields.io/npm/v/babel-plugin-system-import-transformer.svg)](https://www.npmjs.com/package/babel-plugin-system-import-transformer) | ||
[![npm](https://img.shields.io/npm/dm/babel-plugin-system-import-transformer.svg)](https://www.npmjs.com/package/babel-plugin-system-import-transformer) | ||
[Babel](https://babeljs.io/) plugin that replaces System.import with the equivalent UMD pattern | ||
## Transforms | ||
@@ -5,0 +8,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12697
89
230