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.5.1 to 1.5.2

3

lib/index.d.ts
import * as ts from 'typescript';
export interface Options {
libraryName?: string;
style?: boolean | 'css';
style?: boolean | 'css' | string | ((name: string) => string);
libraryDirectory?: ((name: string) => string) | string;
camel2DashComponentName?: boolean;
camel2UnderlineComponentName?: boolean;
styleExt?: string;
transformToDefaultImport?: boolean;

@@ -10,0 +9,0 @@ }

@@ -6,2 +6,15 @@ "use strict";

var path_1 = require("path");
function join() {
var params = [];
for (var _i = 0; _i < arguments.length; _i++) {
params[_i] = arguments[_i];
}
/* istanbul ignore if */
if (path_1.sep === '\\') {
var ret = path_1.join.apply(void 0, params);
return ret.replace(/\\/g, '/');
}
/* istanbul ignore next */
return path_1.join.apply(void 0, params);
}
// camel2Dash camel2Underline

@@ -63,3 +76,3 @@ // borrow from https://github.com/ant-design/babel-plugin-import

options.libraryDirectory(_importName) :
path_1.join((options.libraryDirectory || ''), importName);
join((options.libraryDirectory || ''), importName);
/* istanbul ignore next */

@@ -71,3 +84,3 @@ if (process.env.NODE_ENV !== 'production') {

}
var importPath = path_1.join(libraryName, libraryDirectory);
var importPath = join(libraryName, libraryDirectory);
try {

@@ -82,4 +95,7 @@ require.resolve(path_1.join(process.cwd(), 'node_modules', importPath));

if (options.style) {
var style = options.style, styleExt = options.styleExt;
var styleNode = ts.createImportDeclaration(undefined, undefined, undefined, ts.createLiteral(importPath + "/style/" + (style === 'css' ? (styleExt ? styleExt : 'css') : 'index') + ".js"));
var style = options.style;
var stylePath = (typeof style === 'function')
? style(importPath)
: importPath + "/style/" + (style === true ? 'index' : style) + ".js";
var styleNode = ts.createImportDeclaration(undefined, undefined, undefined, ts.createLiteral(stylePath));
astNodes.push(styleNode);

@@ -86,0 +102,0 @@ }

{
"name": "ts-import-plugin",
"version": "1.5.1",
"version": "1.5.2",
"description": "babel-plugin-import TypeScript version",

@@ -75,3 +75,3 @@ "main": "index.js",

"*.ts": [
"tslint -c tslint.json -p tsconfig.json --fix",
"tslint -c tslint.json -p tsconfig.json --fix -e \"**/test/expect/**\"",
"git add"

@@ -78,0 +78,0 @@ ]

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

default `'antd'`
- style `boolean | 'css'`
- style `boolean | string | ((path: string) => string)`
default `false`
- libraryDirectory `string`
- libraryDirectory `string | ((name: string) => string)`

@@ -119,0 +119,0 @@ default `'lib'`

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