Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-import-plugin

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-import-plugin - npm Package Compare versions

Comparing version 1.4.4 to 1.4.5

16

lib/index.js

@@ -16,10 +16,2 @@ "use strict";

}
function getImportedLibName(node) {
var childCount = node.getChildCount();
var lastChild = node.getChildAt(childCount - 1);
if (lastChild.kind === ts.SyntaxKind.SemicolonToken) {
lastChild = node.getChildAt(childCount - 2);
}
return lastChild.getText().replace(/"/g, '\'');
}
function getImportedStructs(node) {

@@ -96,10 +88,10 @@ var structs = new Set();

var visitor = function (node) {
if (node.kind === ts.SyntaxKind.SourceFile) {
if (ts.isSourceFile(node)) {
return ts.visitEachChild(node, visitor, context);
}
if (node.kind !== ts.SyntaxKind.ImportDeclaration) {
if (!ts.isImportDeclaration(node)) {
return node;
}
var importedLibName = getImportedLibName(node);
var options = optionsArray.find(function (_) { return "'" + _.libraryName + "'" === importedLibName; });
var importedLibName = node.moduleSpecifier.text;
var options = optionsArray.find(function (_) { return _.libraryName === importedLibName; });
if (!options) {

@@ -106,0 +98,0 @@ return node;

{
"name": "ts-import-plugin",
"version": "1.4.4",
"version": "1.4.5",
"description": "babel-plugin-import TypeScript version",

@@ -10,3 +10,4 @@ "main": "index.js",

"cover": "rm -rf ./coverage ./.nyc_output && nyc --reporter=html --reporter=lcov --exclude=node_modules --exclude=test mocha && nyc report",
"lint": "tslint -c ./tslint.json -p ./src/tsconfig.json & standard \"test/*.js\" \"./*.js\"",
"lint": "tslint -c ./tslint.json -p ./src/tsconfig.json && standard \"test/*.js\" \"./*.js\"",
"precommit": "lint-staged",
"prepare": "npm run build",

@@ -35,8 +36,8 @@ "start": "rm -rf dist && NODE_ENV=production webpack",

"@types/lodash": "^4.14.104",
"@types/material-ui": "^0.20.7",
"@types/mocha": "^2.2.48",
"@types/node": "^9.4.6",
"@types/react": "^16.0.38",
"@types/material-ui": "^0.21.1",
"@types/mocha": "^5.0.0",
"@types/node": "^10.0.3",
"@types/react": "^16.0.40",
"@types/react-dom": "^16.0.4",
"antd": "^3.2.1",
"antd": "^3.2.3",
"chai": "^4.1.2",

@@ -46,5 +47,7 @@ "coveralls": "^3.0.0",

"extract-text-webpack-plugin": "^3.0.2",
"husky": "^0.14.3",
"lint-staged": "^7.1.2",
"lodash": "^4.17.5",
"material-ui": "^0.20.0",
"mocha": "^5.0.1",
"mocha": "^5.0.4",
"nyc": "^11.4.1",

@@ -55,10 +58,10 @@ "react": "^16.2.0",

"standard": "^11.0.0",
"style-loader": "^0.20.2",
"ts-loader": "^3.5.0",
"ts-node": "^5.0.0",
"style-loader": "^0.21.0",
"ts-loader": "^4.0.1",
"ts-node": "^6.0.0",
"tslint": "^5.9.1",
"tslint-eslint-rules": "^5.0.0",
"tslint-eslint-rules": "^5.1.0",
"typescript": "^2.7.2",
"webpack": "^3.11.0",
"webpack-bundle-analyzer": "^2.10.0"
"webpack": "^4.1.1",
"webpack-bundle-analyzer": "^2.11.1"
},

@@ -73,3 +76,9 @@ "dependencies": {

]
},
"lint-staged": {
"*.ts": [
"tslint -c tslint.json -p tsconfig.json --fix",
"git add"
]
}
}

@@ -35,2 +35,10 @@ [![npm version](https://badge.fury.io/js/ts-import-plugin.svg)](https://www.npmjs.com/package/ts-import-plugin)

## With ts-loader
```js
//tsconfig.json
{
...
"module": "ESNext",
...
}
```

@@ -65,6 +73,36 @@ ```js

## With awesome-typescript-loader
## With awesome-typescript-loader ( >= 3.5.0 )
```js
//tsconfig.json
{
...
"module": "ESNext",
...
}
```
Due to https://github.com/s-panferov/awesome-typescript-loader/issues/447, `awesome-typescript-loader` is not working with any `TypeScript plugin`, include this one.
```js
// webpack.config.js
const tsImportPluginFactory = require('ts-import-plugin')
module.exports = {
// ...
module: {
rules: [
{
{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader',
options: {
getCustomTransformers: () => ({
before: [ tsImportPluginFactory( /** options */) ]
}),
},
exclude: /node_modules/
}
]
},
// ...
}
```
## Options

@@ -158,2 +196,5 @@

transformerFactory({ libraryName: 'antd-mobile', style: 'css', styleExt: 'css.web' })
// antd-mobile recently changed styleExt. If error occurs with prev, try next.
transformerFactory({ libraryName: 'antd-mobile', style: 'css' })
```

@@ -160,0 +201,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc