New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-lazy-import

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-lazy-import - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

dist/resolvers/index.cjs

9

dist/index.js

@@ -20,6 +20,4 @@ (function (global, factory) {

var _exportNames = {
kebabCase: true,
lazyImport: true
};
exports.kebabCase = void 0;
exports.lazyImport = lazyImport;

@@ -94,3 +92,2 @@ var _esModuleLexer = require("es-module-lexer");

}
var kebabCase = exports.kebabCase = _xeUtils["default"].kebabCase;
function lazyImport(options) {

@@ -135,6 +132,8 @@ var opts = Object.assign({

var extName = resOpts.importStyle === true ? 'css' : resOpts.importStyle || 'css';
jsPath = "import { ".concat(name, " } from \"").concat(resOpts.lib, "/").concat(libDir, "/").concat(kebabCase(importName), "/index.js\"");
stylePath = "import \"".concat(resOpts.lib, "/").concat(libDir, "/").concat(kebabCase(importName), "/style.").concat(extName, "\"");
var dirName = _xeUtils["default"].kebabCase(importName);
jsPath = "import { ".concat(name, " } from \"").concat(resOpts.lib, "/").concat(libDir, "/").concat(dirName, "/index.js\"");
stylePath = "import \"".concat(resOpts.lib, "/").concat(libDir, "/").concat(dirName, "/style.").concat(extName, "\"");
if (resOpts.resolve) {
var rest = resOpts.resolve({
dirName: dirName,
name: importName,

@@ -141,0 +140,0 @@ lib: resOpts.lib

{
"name": "vite-plugin-lazy-import",
"version": "0.6.0",
"version": "0.7.0",
"description": "Used for vite Lazy import js and style",

@@ -5,0 +5,0 @@ "scripts": {

@@ -62,3 +62,3 @@ # vite-plugin-lazy-import

```javascript
import { lazyImport, kebabCase } from 'vite-plugin-lazy-import'
import { lazyImport } from 'vite-plugin-lazy-import'

@@ -69,5 +69,5 @@ lazyImport({

lib: 'vxe-pc-ui',
resolve ({ name }) {
resolve ({ name, dirName }) {
return {
from: `vxe-pc-ui/es/${kebabCase(name)}/index.js`
from: `vxe-pc-ui/es/${dirName}/index.js`
}

@@ -83,3 +83,3 @@ }

```javascript
import { lazyImport, kebabCase } from 'vite-plugin-lazy-import'
import { lazyImport } from 'vite-plugin-lazy-import'

@@ -91,7 +91,7 @@ lazyImport({

importStyle: true,
resolve ({ name }) {
resolve ({ name, dirName }) {
return {
from: {
jsPath: `vxe-pc-ui/es/${kebabCase(name)}/index.js`,
stylePath: `vxe-pc-ui/es/${kebabCase(name)}/style.css`
jsPath: `vxe-pc-ui/es/${dirName}/index.js`,
stylePath: `vxe-pc-ui/es/${dirName}/style.css`
}

@@ -98,0 +98,0 @@ }

@@ -1,29 +0,24 @@

import { Plugin, FilterPattern } from 'vite'
import { kebabCase as kebabCaseMethod } from 'xe-utils'
import { Plugin, FilterPattern } from 'vite';
export interface LazyImportResolverResult {
from: string | {
jsPath: string
stylePath: string
}
from: string | {
jsPath: string;
stylePath: string;
};
}
export interface LazyImportResolver {
lib: string
esm?: boolean
importStyle?: boolean | 'css' | 'scss'
resolve?: (params: {
name: string
lib: string
}) => null | LazyImportResolverResult
lib: string;
esm?: boolean;
importStyle?: boolean | 'css' | 'scss';
resolve?: (params: {
dirName: string;
name: string;
lib: string;
}) => null | LazyImportResolverResult;
}
export interface LazyImportConfig {
include?: FilterPattern
exclude?: FilterPattern
resolvers: LazyImportResolver[]
include?: FilterPattern;
exclude?: FilterPattern;
resolvers: LazyImportResolver[];
}
export const kebabCase = kebabCaseMethod
export function lazyImport (options: LazyImportConfig): Plugin<any>
export declare function lazyImport(options: LazyImportConfig): Plugin<any>;
export * from './resolvers';

Sorry, the diff of this file is not supported yet

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