vite-plugin-resolve
Advanced tools
Comparing version 2.1.7 to 2.2.1
{ | ||
"name": "vite-plugin-resolve", | ||
"version": "2.1.7", | ||
"version": "2.2.1", | ||
"description": "Custom resolve module content.", | ||
@@ -24,4 +24,8 @@ "main": "index.js", | ||
"build": "node build.mjs", | ||
"test": "node test/index.mjs", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"dependencies": { | ||
"lib-esm": "~0.1.0" | ||
}, | ||
"devDependencies": { | ||
@@ -28,0 +32,0 @@ "vite": "^3.x.x" |
@@ -0,1 +1,3 @@ | ||
const libEsm = require('lib-esm'); | ||
/** | ||
@@ -18,67 +20,8 @@ * @type {import('.').Lib2esm} | ||
const keywords = [ | ||
'await', | ||
'break', | ||
'case', | ||
'catch', | ||
'class', | ||
'const', | ||
'continue', | ||
'debugger', | ||
'default', | ||
'delete', | ||
'do', | ||
'else', | ||
'enum', | ||
'export', | ||
'extends', | ||
'false', | ||
'finally', | ||
'for', | ||
'function', | ||
'if', | ||
'implements', | ||
'import', | ||
'in', | ||
'instanceof', | ||
'interface', | ||
'let', | ||
'new', | ||
'null', | ||
'package', | ||
'private', | ||
'protected', | ||
'public', | ||
'return', | ||
'super', | ||
'switch', | ||
'static', | ||
'this', | ||
'throw', | ||
'try', | ||
'true', | ||
'typeof', | ||
'var', | ||
'void', | ||
'while', | ||
'with', | ||
'yield', | ||
]; | ||
const { snippet } = libEsm({ | ||
lib: name, | ||
members, | ||
format, | ||
}); | ||
const exportMembers = members | ||
.filter(e => !keywords.includes(e)) | ||
.map(e => `export const ${e} = _M_.${e};`) | ||
.join('\n'); | ||
const importTpl = format === 'cjs' | ||
? `const _M_ = require('${name}');` | ||
: `const _M_ = window['${name}'];` | ||
const snippet = ` | ||
${importTpl} | ||
const _D_ = _M_.default || _M_; | ||
export { _D_ as default } | ||
${exportMembers} | ||
`.trim(); | ||
return snippet; | ||
@@ -85,0 +28,0 @@ }; |
@@ -11,6 +11,6 @@ # vite-plugin-resolve | ||
🤔 You can think of this as the implementation of the official tutorial 👉 [Virtual Modules Convention](https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention) | ||
📦 **Out of the box**, builtin Vue, React, Antd, Element and others | ||
🌱 Support custom code snippets | ||
✅ Browser, Node.js, Electron | ||
- 🤔 You can think of this as the implementation of the official tutorial 👉 [Virtual Modules Convention](https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention) | ||
- 🌱 What you see is what you get | ||
- 📦 Out of the box <sub><sup>(builtin Vue, React, Antd, Element and others)</sup></sub> | ||
- 🚀 Browser, Node.js, Electron | ||
@@ -17,0 +17,0 @@ ## Install |
@@ -11,6 +11,6 @@ # vite-plugin-resolve | ||
🤔 你可以认为它是官方教程的一个实现 👉 [Virtual Modules Convention](https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention) | ||
📦 **开箱即用**, 内置 Vue, React, Antd, Element 等等 | ||
🌱 支持自定义 external 代码段 | ||
✅ Browser, Node.js, Electron | ||
- 🤔 你可以认为它是官方教程的一个实现 👉 [Virtual Modules Convention](https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention) | ||
- 🌱 所见即所得 | ||
- 📦 开箱即用 <sub><sup>(内置 Vue, React, Antd, Element 等等)</sup></sub> | ||
- 🚀 Browser, Node.js, Electron | ||
@@ -17,0 +17,0 @@ ## 安装 |
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
48548
1
1775
+ Addedlib-esm@~0.1.0
+ Addedlib-esm@0.1.0(transitive)