ts-import-plugin
Advanced tools
Comparing version 1.5.5 to 1.6.0
@@ -9,2 +9,3 @@ import * as ts from 'typescript'; | ||
transformToDefaultImport?: boolean; | ||
resolveContext?: string[]; | ||
} | ||
@@ -11,0 +12,0 @@ export interface ImportedStruct { |
@@ -84,3 +84,5 @@ "use strict"; | ||
try { | ||
require.resolve(importPath); | ||
require.resolve(importPath, { | ||
paths: [process.cwd()].concat(options.resolveContext), | ||
}); | ||
var scriptNode = ts.createImportDeclaration(undefined, undefined, ts.createImportClause(struct.variableName || !options.transformToDefaultImport ? undefined : ts.createIdentifier(struct.importName), struct.variableName | ||
@@ -117,2 +119,3 @@ ? ts.createNamedImports([ | ||
transformToDefaultImport: true, | ||
resolveContext: [], | ||
}; | ||
@@ -119,0 +122,0 @@ function createTransformer(_options) { |
{ | ||
"name": "ts-import-plugin", | ||
"version": "1.5.5", | ||
"version": "1.6.0", | ||
"description": "babel-plugin-import TypeScript version", | ||
@@ -11,3 +11,2 @@ "main": "index.js", | ||
"lint": "tslint -c ./tslint.json -p ./src/tsconfig.json", | ||
"precommit": "lint-staged", | ||
"prepare": "npm run build", | ||
@@ -34,36 +33,37 @@ "start": "rm -rf dist && NODE_ENV=production webpack", | ||
"devDependencies": { | ||
"@types/chai": "^4.1.3", | ||
"@types/lodash": "^4.14.109", | ||
"@types/material-ui": "^0.21.1", | ||
"@types/mocha": "^5.2.1", | ||
"@types/node": "^10.3.1", | ||
"@types/react": "^16.3.16", | ||
"@types/react-dom": "^16.0.6", | ||
"antd": "^3.6.1", | ||
"chai": "^4.1.2", | ||
"coveralls": "^3.0.1", | ||
"css-loader": "^1.0.0", | ||
"husky": "^0.14.3", | ||
"lint-staged": "^7.1.3", | ||
"lodash": "^4.17.10", | ||
"material-ui": "^0.20.1", | ||
"mini-css-extract-plugin": "^0.4.0", | ||
"mocha": "^5.2.0", | ||
"nyc": "^12.0.2", | ||
"prettier": "^1.13.4", | ||
"react": "^16.4.0", | ||
"react-dom": "^16.4.0", | ||
"rxjs": "^6.2.0", | ||
"style-loader": "^0.23.0", | ||
"ts-loader": "^4.3.1", | ||
"ts-node": "^7.0.0", | ||
"tslint": "^5.10.0", | ||
"tslint-eslint-rules": "^5.3.1", | ||
"typescript": "^2.9.1", | ||
"webpack": "^4.10.2", | ||
"webpack-bundle-analyzer": "^2.13.1", | ||
"webpack-cli": "^3.0.2" | ||
"@istanbuljs/nyc-config-typescript": "^0.1.3", | ||
"@types/chai": "^4.1.7", | ||
"@types/lodash": "^4.14.134", | ||
"@types/material-ui": "^0.21.6", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.0.8", | ||
"@types/react": "^16.8.22", | ||
"@types/react-dom": "^16.8.4", | ||
"antd": "^3.19.6", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.4", | ||
"css-loader": "^3.0.0", | ||
"husky": "^2.4.1", | ||
"lint-staged": "^8.2.1", | ||
"lodash": "^4.17.11", | ||
"material-ui": "^0.20.2", | ||
"mini-css-extract-plugin": "^0.7.0", | ||
"mocha": "^6.1.4", | ||
"nyc": "^14.1.1", | ||
"prettier": "^1.18.2", | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6", | ||
"rxjs": "^6.5.2", | ||
"style-loader": "^0.23.1", | ||
"ts-loader": "^6.0.4", | ||
"ts-node": "^8.3.0", | ||
"tslint": "^5.17.0", | ||
"tslint-eslint-rules": "^5.4.0", | ||
"typescript": "^3.5.2", | ||
"webpack": "^4.35.0", | ||
"webpack-bundle-analyzer": "^3.3.2", | ||
"webpack-cli": "^3.3.4" | ||
}, | ||
"dependencies": { | ||
"tslib": "^1.9.2" | ||
"tslib": "^1.10.0" | ||
}, | ||
@@ -90,3 +90,15 @@ "standard": { | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"nyc": { | ||
"extends": "@istanbuljs/nyc-config-typescript", | ||
"exclude": [ | ||
"test/**/*.{js,ts}" | ||
], | ||
"check-coverage": true | ||
} | ||
} |
@@ -91,3 +91,2 @@ [![npm version](https://badge.fury.io/js/ts-import-plugin.svg)](https://www.npmjs.com/package/ts-import-plugin) | ||
{ | ||
{ | ||
test: /\.tsx?$/, | ||
@@ -139,3 +138,3 @@ loader: 'awesome-typescript-loader', | ||
{ | ||
libraryName: 'material-ui', | ||
libraryName: '@material-ui/core', | ||
libraryDirectory: '', | ||
@@ -157,3 +156,3 @@ camel2DashComponentName: false | ||
}, { | ||
libraryName: 'material-ui', | ||
libraryName: '@material-ui/core', | ||
libraryDirectory: '', | ||
@@ -202,7 +201,7 @@ camel2DashComponentName: false | ||
## [material-ui](https://github.com/callemall/material-ui) | ||
## [material-ui](https://github.com/mui-org/material-ui) | ||
```ts | ||
import { FloatingActionButton } from 'material-ui' | ||
import { ContentRemove, NavigationRefresh, ContentAdd } from 'material-ui/svg-icons' | ||
import { Button } from '@material-ui/core' | ||
import { Remove, Refresh, Add } from '@material-ui/icons' | ||
``` | ||
@@ -212,3 +211,3 @@ | ||
transformerFactory({ | ||
libraryName: 'material-ui', | ||
libraryName: '@material-ui/core', | ||
libraryDirectory: '', | ||
@@ -235,3 +234,3 @@ camel2DashComponentName: false | ||
}, | ||
libraryName: 'material-ui/svg-icons', | ||
libraryName: '@material-ui/icons', | ||
style: false, | ||
@@ -242,2 +241,19 @@ camel2DashComponentName: false | ||
## [element-ui](https://github.com/ElemeFE/element) | ||
```ts | ||
import { Button } from 'element-ui' | ||
``` | ||
```ts | ||
transformerFactory({ | ||
libraryName: 'element-ui', | ||
libraryDirectory: 'lib', | ||
camel2DashComponentName: true, | ||
style: (path: string) => | ||
join('element-ui', 'lib', 'theme-chalk', `${ | ||
camel2Dash(basename(path, '.js'))}.css`), | ||
}) | ||
``` | ||
## [RxJS](https://github.com/reactivex/rxjs) | ||
@@ -244,0 +260,0 @@ |
Sorry, the diff of this file is not supported yet
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
21181
172
288
32
Updatedtslib@^1.10.0