vite-plugin-lazy-import
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -113,6 +113,9 @@ (function (global, factory) { | ||
exports.forEach(function (item) { | ||
var importName = item.ln || item.n; | ||
var importName = item.n; | ||
var variableCode = item.n; | ||
if (item.ln !== item.n) { | ||
variableCode = "".concat(importName, " as ").concat(item.n); | ||
var asName = ''; | ||
if (item.ln && item.ln !== item.n) { | ||
importName = item.ln; | ||
asName = item.n; | ||
variableCode = "".concat(importName, " as ").concat(asName); | ||
} | ||
@@ -164,2 +167,9 @@ var jsPath = ''; | ||
} | ||
function toVariableExport(impCode) { | ||
var rest = impCode.replace(/\n/, ' ').match(/\{[a-zA-Z,_'"\s]+?\}/); | ||
if (rest) { | ||
return "export ".concat(rest[0]); | ||
} | ||
return ''; | ||
} | ||
return { | ||
@@ -183,3 +193,4 @@ name: 'vite:lazy-import', | ||
} | ||
var exports = (0, _esModuleLexer.parse)(restCode.slice(syntaxItem.ss, syntaxItem.se).replace('import', 'export'))[1]; | ||
var exportCode = toVariableExport(restCode.slice(syntaxItem.ss, syntaxItem.se)); | ||
var exports = (0, _esModuleLexer.parse)(exportCode)[1]; | ||
if (!exports.length) { | ||
@@ -186,0 +197,0 @@ return; |
{ | ||
"name": "vite-plugin-lazy-import", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Used for vite Lazy import js and style", | ||
@@ -17,5 +17,5 @@ "scripts": { | ||
"dependencies": { | ||
"rollup": "^4.18.0", | ||
"@rollup/pluginutils": "^5.1.0", | ||
"es-module-lexer": "^1.5.3" | ||
"rollup": "4.18.0", | ||
"@rollup/pluginutils": "5.1.0", | ||
"es-module-lexer": "1.5.3" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
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
27521
620
+ Added@rollup/pluginutils@5.1.0(transitive)
+ Added@rollup/rollup-android-arm-eabi@4.18.0(transitive)
+ Added@rollup/rollup-android-arm64@4.18.0(transitive)
+ Added@rollup/rollup-darwin-arm64@4.18.0(transitive)
+ Added@rollup/rollup-darwin-x64@4.18.0(transitive)
+ Added@rollup/rollup-linux-arm-gnueabihf@4.18.0(transitive)
+ Added@rollup/rollup-linux-arm-musleabihf@4.18.0(transitive)
+ Added@rollup/rollup-linux-arm64-gnu@4.18.0(transitive)
+ Added@rollup/rollup-linux-arm64-musl@4.18.0(transitive)
+ Added@rollup/rollup-linux-powerpc64le-gnu@4.18.0(transitive)
+ Added@rollup/rollup-linux-riscv64-gnu@4.18.0(transitive)
+ Added@rollup/rollup-linux-s390x-gnu@4.18.0(transitive)
+ Added@rollup/rollup-linux-x64-gnu@4.18.0(transitive)
+ Added@rollup/rollup-linux-x64-musl@4.18.0(transitive)
+ Added@rollup/rollup-win32-arm64-msvc@4.18.0(transitive)
+ Added@rollup/rollup-win32-ia32-msvc@4.18.0(transitive)
+ Added@rollup/rollup-win32-x64-msvc@4.18.0(transitive)
+ Added@types/estree@1.0.5(transitive)
+ Addedes-module-lexer@1.5.3(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedrollup@4.18.0(transitive)
- Removed@rollup/pluginutils@5.1.3(transitive)
- Removed@rollup/rollup-android-arm-eabi@4.27.4(transitive)
- Removed@rollup/rollup-android-arm64@4.27.4(transitive)
- Removed@rollup/rollup-darwin-arm64@4.27.4(transitive)
- Removed@rollup/rollup-darwin-x64@4.27.4(transitive)
- Removed@rollup/rollup-freebsd-arm64@4.27.4(transitive)
- Removed@rollup/rollup-freebsd-x64@4.27.4(transitive)
- Removed@rollup/rollup-linux-arm-gnueabihf@4.27.4(transitive)
- Removed@rollup/rollup-linux-arm-musleabihf@4.27.4(transitive)
- Removed@rollup/rollup-linux-arm64-gnu@4.27.4(transitive)
- Removed@rollup/rollup-linux-arm64-musl@4.27.4(transitive)
- Removed@rollup/rollup-linux-powerpc64le-gnu@4.27.4(transitive)
- Removed@rollup/rollup-linux-riscv64-gnu@4.27.4(transitive)
- Removed@rollup/rollup-linux-s390x-gnu@4.27.4(transitive)
- Removed@rollup/rollup-linux-x64-gnu@4.27.4(transitive)
- Removed@rollup/rollup-linux-x64-musl@4.27.4(transitive)
- Removed@rollup/rollup-win32-arm64-msvc@4.27.4(transitive)
- Removed@rollup/rollup-win32-ia32-msvc@4.27.4(transitive)
- Removed@rollup/rollup-win32-x64-msvc@4.27.4(transitive)
- Removedes-module-lexer@1.5.4(transitive)
- Removedpicomatch@4.0.2(transitive)
- Removedrollup@4.27.4(transitive)
Updated@rollup/pluginutils@5.1.0
Updatedes-module-lexer@1.5.3
Updatedrollup@4.18.0