ts-import-plugin
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -83,2 +83,3 @@ "use strict"; | ||
var importPath = !libraryOverride ? join(libraryName, libraryDirectory) : libraryDirectory; | ||
var canResolveImportPath = true; | ||
try { | ||
@@ -88,2 +89,8 @@ require.resolve(importPath, { | ||
}); | ||
} | ||
catch (e) { | ||
canResolveImportPath = false; | ||
astNodes.push(ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamedImports([ts.createImportSpecifier(undefined, ts.createIdentifier(_importName))])), ts.createLiteral(libraryName))); | ||
} | ||
if (canResolveImportPath) { | ||
var scriptNode = ts.createImportDeclaration(undefined, undefined, ts.createImportClause(struct.variableName || !options.transformToDefaultImport ? undefined : ts.createIdentifier(struct.importName), struct.variableName | ||
@@ -101,3 +108,9 @@ ? ts.createNamedImports([ | ||
var style = options.style; | ||
var stylePath = typeof style === 'function' ? style(importPath) : importPath + "/style/" + (style === true ? 'index' : style) + ".js"; | ||
var stylePath = void 0; | ||
if (typeof style === 'function') { | ||
stylePath = style(importPath); | ||
} | ||
else { | ||
stylePath = importPath + "/style/" + (style === true ? 'index' : style) + ".js"; | ||
} | ||
if (stylePath) { | ||
@@ -108,7 +121,3 @@ var styleNode = ts.createImportDeclaration(undefined, undefined, undefined, ts.createLiteral(stylePath)); | ||
} | ||
// tslint:disable-next-line:no-empty | ||
} | ||
catch (e) { | ||
astNodes.push(ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamedImports([ts.createImportSpecifier(undefined, ts.createIdentifier(_importName))])), ts.createLiteral(libraryName))); | ||
} | ||
return astNodes; | ||
@@ -115,0 +124,0 @@ } |
{ | ||
"name": "ts-import-plugin", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "babel-plugin-import TypeScript version", | ||
@@ -31,19 +31,19 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "^0.1.3", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.0", | ||
"@types/lodash": "^4.14.149", | ||
"@types/material-ui": "^0.21.7", | ||
"@types/node": "^12.12.14", | ||
"@types/node": "^13.1.0", | ||
"@types/react": "^16.9.14", | ||
"@types/react-dom": "^16.9.4", | ||
"antd": "^3.26.0", | ||
"ava": "^2.4.0", | ||
"ava": "^3.0.0", | ||
"codecov": "^3.6.1", | ||
"css-loader": "^3.2.1", | ||
"husky": "^3.1.0", | ||
"lint-staged": "^9.5.0", | ||
"husky": "^4.0.0", | ||
"lint-staged": "^10.0.1", | ||
"lodash": "^4.17.15", | ||
"lodash-es": "^4.17.15", | ||
"material-ui": "^0.20.2", | ||
"mini-css-extract-plugin": "^0.8.0", | ||
"nyc": "^14.1.1", | ||
"mini-css-extract-plugin": "^0.9.0", | ||
"nyc": "^15.0.0", | ||
"prettier": "^1.19.1", | ||
@@ -57,3 +57,3 @@ "react": "^16.12.0", | ||
"ts-node": "^8.5.4", | ||
"tslint": "^5.20.1", | ||
"tslint": "^6.0.0", | ||
"tslint-eslint-rules": "^5.4.0", | ||
@@ -69,3 +69,2 @@ "typescript": "^3.7.3", | ||
"ava": { | ||
"compileEnhancements": false, | ||
"extensions": [ | ||
@@ -79,5 +78,2 @@ "ts" | ||
"test/specs.ts" | ||
], | ||
"sources": [ | ||
"src/**/*.ts" | ||
] | ||
@@ -96,4 +92,3 @@ }, | ||
"prettier --write", | ||
"tslint -c tslint.json -p tsconfig.json --fix -e \"**/test/expect/**\"", | ||
"git add" | ||
"tslint -c tslint.json -p tsconfig.json --fix -e \"**/test/expect/**\"" | ||
] | ||
@@ -100,0 +95,0 @@ }, |
Sorry, the diff of this file is not supported yet
24580
8
183