Gathering detailed insights and metrics for @yanhe-su/vue-cli-plugin-shared-utils
Gathering detailed insights and metrics for @yanhe-su/vue-cli-plugin-shared-utils
npm install @yanhe-su/vue-cli-plugin-shared-utils
Typescript
Module System
Node Version
NPM Version
32.1
Supply Chain
53.1
Quality
67.6
Maintenance
100
Vulnerability
94.3
License
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
4,166
Last Day
4
Last Week
24
Last Month
129
Last Year
822
Latest Version
0.1.29
Package Id
@yanhe-su/vue-cli-plugin-shared-utils@0.1.29
Unpacked Size
15.25 kB
Size
4.29 kB
File Count
14
NPM Version
8.19.2
Node Version
16.18.0
Published on
Apr 27, 2023
Cumulative downloads
Total Downloads
Last Day
300%
4
Compared to previous day
Last Week
33.3%
24
Compared to previous week
Last Month
148.1%
129
Compared to previous month
Last Year
-75.4%
822
Compared to previous year
2
1
封装了一些用于写文件的操作
用于检测是否存在 plugin,如果不存在,则确定为未初始化的环境,进行 entryFile 的覆盖行为
const mainInit = require("@dao-style/vue-cli-plugin-shared-utils/lib/mainInit");
mainInit(api) // api => generator api
合并 mainInit 的功能
1/** 2 * 在 main.[t|j]s 中进行注入,如果不存,则创建并注入 3 * @param {api} api 4 * @param {string} importFrom: import xxx from '\<importFrom\>'; 5 * @param {string} defaultImport: import \<defaultImport\> from '\<importFrom\>'; 6 * @param {string[]} importList: import \<defaultImport\>, { ...\<importList\> } from '\<importFrom\>'; 7 * @param {string} usedName: app.use 8 */
如 plugin 初始化的时候会自动调用该方法,进行创建注入,在 entryFile 中写入 import 与 app.use 的行为
1const mainImportInit = require("@dao-style/vue-cli-plugin-shared-utils/lib/mainImportInit"); 2mainImportInit(api, './plugins', 'pluginInstall', [], 'pluginInstall') // api => generator api
用于检测是否存在 plugin,如果不存在,则确定为未初始化的环境,进行 plugins 目录的创建与启动 mainImportInit
const pluginInit = require("@dao-style/vue-cli-plugin-shared-utils/lib/pluginInit");
pluginInit(api) // api => generator api
合并 pluginInit 的行为,用于在 plugins/index 中写入 import 与 export 并在 installl function 中对 plugin 进行安装行为,因此作为方法接受的参数列表如下:
1/** 2 * 在 plugins/index 中进行注入,如果不存,则创建并注入 3 * @param {api} api 4 * @param {string} importFrom: import xxx from '\<importFrom\>'; 5 * @param {string} defaultImport: import \<defaultImport\> from '\<importFrom\>'; 6 * @param {string[]} importList: import \<defaultImport\>, { ...\<importList\> } from '\<importFrom\>'; 7 */
1const pluginImportInit = require("@dao-style/vue-cli-plugin-shared-utils/lib/pluginImportInit"); 2pluginImportInit(api, './vue-i18n', 'i18nInstall', ['loadLanguageAsync']) // api => generator api
如上面进行书写会在 plugins/index 进行以下修改
1import i18nInstall, { loadLanguageAsync } from './vue-i18n'; 2 3// 原本就有 4export default function install(app) { 5 ... 6 app.use(i18nInstall); 7// 原本就有 8} 9 10// 原本就有 11export { 12 ..., 13 loadLanguageAsync, 14// 原本就有 15}
生成一条 import 语句 genImport
生成一条具名导出的表达式 genNamedExport
判断某个 目录/文件 是否存在 isTargetExist
检测 src/plugins
目录是否存在
checkPluginExist
No vulnerabilities found.
No security vulnerabilities found.