ts-import-plugin
Advanced tools
Comparing version 1.6.3 to 1.6.4
@@ -0,2 +1,7 @@ | ||
# 1.6.4 | ||
**[Feat]** Add `module` field support | ||
**[Doc]** Add rollup example. | ||
# 1.6.3 | ||
**[Fix]** Throw error if custom style resolver thrown [#251](https://github.com/Brooooooklyn/ts-import-plugin/issues/251) |
@@ -16,3 +16,3 @@ import * as ts from 'typescript'; | ||
} | ||
export declare function createTransformer(_options?: Partial<Options> | Array<Partial<Options>>): ts.TransformerFactory<ts.SourceFile>; | ||
export declare function createTransformer(_options?: Partial<Options> | Array<Partial<Options>>): (context: ts.TransformationContext) => (node: ts.Node) => ts.Node; | ||
export default createTransformer; |
@@ -77,6 +77,4 @@ "use strict"; | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (libraryDirectory == null) { | ||
console.warn("custom libraryDirectory resolve a " + libraryDirectory + " path"); | ||
} | ||
if (process.env.NODE_ENV !== 'production' && libraryDirectory == null) { | ||
console.warn("custom libraryDirectory resolve a " + libraryDirectory + " path"); | ||
} | ||
@@ -112,2 +110,3 @@ var importPath = !libraryOverride ? join(libraryName, libraryDirectory) : libraryDirectory; | ||
else { | ||
// eslint-disable-next-line no-restricted-syntax | ||
stylePath = importPath + "/style/" + (style === true ? 'index' : style) + ".js"; | ||
@@ -138,3 +137,3 @@ } | ||
: [mergeDefault(_options)]; | ||
var transformer = function (context) { | ||
return function (context) { | ||
var visitor = function (node) { | ||
@@ -163,3 +162,2 @@ if (ts.isSourceFile(node)) { | ||
}; | ||
return transformer; | ||
} | ||
@@ -166,0 +164,0 @@ exports.createTransformer = createTransformer; |
{ | ||
"name": "ts-import-plugin", | ||
"version": "1.6.3", | ||
"version": "1.6.4", | ||
"description": "babel-plugin-import TypeScript version", | ||
"main": "index.js", | ||
"typings": "index.d.ts", | ||
"main": "./index.js", | ||
"module": "./esm/index.js", | ||
"jsnext:main": "./next/index.js", | ||
"typings": "./lib/index.d.ts", | ||
"scripts": { | ||
"build": "rm -rf lib && tsc -p src/tsconfig.json", | ||
"build": "yarn build:cjs && yarn build:esm && yarn build:next", | ||
"build:cjs": "shx rm -rf lib && tsc -p src/tsconfig.json", | ||
"build:esm": "tsc -p src/tsconfig.json -m esnext --outDir esm -d false", | ||
"build:next": "tsc -p src/tsconfig.json -m esnext --target ES2018 --outDir next -d false", | ||
"cover": "rm -rf ./coverage ./.nyc_output && nyc --reporter=html --reporter=lcov --exclude=node_modules --exclude=test ava && nyc report", | ||
"lint": "tslint -c ./tslint.json -p ./src/tsconfig.json", | ||
"lint": "eslint . -c ./.eslintrc.yml 'src/**/*.{ts,tsx}' './*.js'", | ||
"start": "rm -rf dist && NODE_ENV=production webpack", | ||
@@ -25,4 +30,5 @@ "test": "ava", | ||
"files": [ | ||
"index.d.ts", | ||
"lib/" | ||
"lib/", | ||
"esm/", | ||
"next/" | ||
], | ||
@@ -32,14 +38,23 @@ "author": "lynweklm@gmail.com", | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "^1.0.0", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
"@types/lodash": "^4.14.149", | ||
"@types/material-ui": "^0.21.7", | ||
"@types/node": "^13.1.0", | ||
"@types/react": "^16.9.14", | ||
"@types/react-dom": "^16.9.4", | ||
"antd": "^3.26.0", | ||
"ava": "^3.0.0", | ||
"codecov": "^3.6.1", | ||
"css-loader": "^3.2.1", | ||
"husky": "^4.0.0", | ||
"lint-staged": "^10.0.1", | ||
"@types/node": "^13.7.7", | ||
"@types/react": "^16.9.23", | ||
"@types/react-dom": "^16.9.5", | ||
"@typescript-eslint/parser": "^2.21.0", | ||
"antd": "^4.0.0", | ||
"ava": "^3.5.0", | ||
"codecov": "^3.6.5", | ||
"css-loader": "^3.4.2", | ||
"cssnano": "^4.1.10", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-plugin-import": "^2.20.1", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"eslint-plugin-react": "^7.18.3", | ||
"eslint-plugin-react-hooks": "^2.5.0", | ||
"eslint-plugin-sonarjs": "^0.5.0", | ||
"husky": "^4.2.3", | ||
"lint-staged": "^10.0.8", | ||
"lodash": "^4.17.15", | ||
@@ -50,19 +65,21 @@ "lodash-es": "^4.17.15", | ||
"nyc": "^15.0.0", | ||
"postcss-loader": "^3.0.0", | ||
"prettier": "^1.19.1", | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"rxjs": "^6.5.3", | ||
"react": "^16.13.0", | ||
"react-dom": "^16.13.0", | ||
"rollup": "^1.32.0", | ||
"rollup-plugin-typescript2": "^0.26.0", | ||
"rxjs": "^6.5.4", | ||
"shx": "^0.3.2", | ||
"source-map-support": "^0.5.16", | ||
"style-loader": "^1.0.1", | ||
"style-loader": "^1.1.3", | ||
"ts-loader": "^6.2.1", | ||
"ts-node": "^8.5.4", | ||
"tslint": "^6.0.0", | ||
"tslint-eslint-rules": "^5.4.0", | ||
"typescript": "^3.7.3", | ||
"webpack": "^4.41.2", | ||
"ts-node": "^8.6.2", | ||
"typescript": "^3.8.3", | ||
"webpack": "^4.41.6", | ||
"webpack-bundle-analyzer": "^3.6.0", | ||
"webpack-cli": "^3.3.10" | ||
"webpack-cli": "^3.3.11" | ||
}, | ||
"dependencies": { | ||
"tslib": "^1.10.0" | ||
"tslib": "^1.11.1" | ||
}, | ||
@@ -89,5 +106,5 @@ "ava": { | ||
"lint-staged": { | ||
"*.ts": [ | ||
"*.@(js|ts)": [ | ||
"prettier --write", | ||
"tslint -c tslint.json -p tsconfig.json --fix -e \"**/test/expect/**\"" | ||
"eslint -c .eslintrc.yml --fix" | ||
] | ||
@@ -94,0 +111,0 @@ }, |
@@ -13,3 +13,3 @@ [![Financial Contributors on Open Collective](https://opencollective.com/ts-import-plugin/all/badge.svg?label=financial+contributors)](https://opencollective.com/ts-import-plugin) [![npm version](https://badge.fury.io/js/ts-import-plugin.svg)](https://www.npmjs.com/package/ts-import-plugin) | ||
![bundle-analyzer](./bundle.png) | ||
![bundle-analyzer](./bundle.jpg) | ||
@@ -104,2 +104,31 @@ # Why use this | ||
``` | ||
## With rollup | ||
```js | ||
import typescript from 'rollup-plugin-typescript2' | ||
import createTransformer from 'ts-import-plugin' | ||
const transformer = createTransformer({ | ||
libraryDirectory: 'es', | ||
libraryName: 'antd', | ||
style: true | ||
}) | ||
export default { | ||
input: `./test/fixtures/index.tsx`, | ||
plugins: [typescript({ | ||
clean: true, | ||
transformers: [() => ({ | ||
before: transformer, | ||
})] | ||
})], | ||
output: [ | ||
{ | ||
file: `./dist/rollup.dist.js`, | ||
format: 'esm', | ||
}, | ||
], | ||
} | ||
``` | ||
## Options | ||
@@ -106,0 +135,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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
50254
10
488
348
42
1
6
1
Updatedtslib@^1.11.1