Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@plugin-light/webpack-plugin-dispatch-vue

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plugin-light/webpack-plugin-dispatch-vue - npm Package Compare versions

Comparing version
0.0.4
to
0.0.6
+9
-103
lib/index.js

@@ -8,2 +8,3 @@ 'use strict';

var shared = require('@plugin-light/shared');
var sharedVue2 = require('@plugin-light/shared-vue2');
var webpackPluginFixNpmPackage = require('@plugin-light/webpack-plugin-fix-npm-package');

@@ -53,55 +54,2 @@

/**
* 拉平组件关系
*
* @example
* // 示例如下:
*
* {
* "app": [
* "../../local-component/ui/tip-match/tip-match-tip-popup/index",
* ],
* "views/index/index-home": [
* "../../local-component/ui/pages/user/home/index",
* ],
* "../../components/ua-nes-tim/components/uni-badge": [],
* "../../components/ua-nes-tim/components/sned-target-selector": [
* "../../components/ua-nes-tim/components/uni-data-select",
* "../../components/ua-nes-tim/components/uni-icons/uni-icons"
* ],
* }
*/
function flattenUsingComponentMap(rawMap) {
const res = {};
function cursive(componentsMap = {}, components = [], fathers) {
const keys = Object.keys(componentsMap);
for (const key of keys) {
if (fathers.includes(key)) {
// 防止递归调用,即防止子孙和祖先相同
continue;
}
const subComponentsMap = rawMap[key];
if (subComponentsMap) {
const innerKeys = Object.keys(subComponentsMap);
innerKeys.forEach((innerKey) => {
if (!fathers.includes(innerKey)) {
// 防止递归调用
components.push(innerKey);
}
});
cursive(subComponentsMap, components, [...fathers, key]);
}
}
}
Object.keys(rawMap).map((key) => {
const components = [];
const componentsMap = rawMap[key];
if (componentsMap) {
components.push(...Object.keys(componentsMap));
}
cursive(componentsMap, components, [key]);
res[key] = components;
});
return res;
}
/**
* 获取使用一个组件的所有分包,返回 allUsingComponentMap

@@ -155,44 +103,2 @@ * @example

/**
* 处理 usingComponentsMap 迭代关系
* @example
*
* // usingComponentsMap 示例
* {
* "app": {
* "../../local-component/ui/tip-match/tip-match-header-mp/index": {
* "../../local-component/ui/tip-match/tip-match-global-notice/index": {},
* "../../local-component/ui/tip-match/tip-match-global-msg/index": {},
* "../../local-component/ui/tip-match/tip-match-popver/index": {}
* }
* },
* "views/index/index-home": {
* "../../local-component/ui/pages/user/home/index": {
* "../../local-component/ui/tip-match/tip-match-loading-mode/index": {},
* "../../local-component/ui/tip-match/tip-match-item/index": {},
* "../../local-component/ui/pages/user/guide/index": {},
* "../../local-component/ui/tip-match/tip-match-popver/index": {},
* "../../component/ui/tip-merchant/tip-comp-scroll-view/index": {
* "../../component/ui/tip-merchant/tip-comp-scroll-view/scroll-view-mp": {}
* },
* },
* "../../local-component/ui/tip-match/tip-match-qr-code-popup/index": {
* "../../component/ui/widget/qrcode/index": {
* "../../component/ui/widget/qrcode/qrcode-mp": {}
* }
* }
* },
* "packages/views/webview/webview": {},
* }
*/
function genIterativeComponentMap(usingComponentsMap) {
Object.keys(usingComponentsMap).map((page) => {
const compObj = usingComponentsMap[page];
Object.keys(compObj).map((comp) => {
if (usingComponentsMap[comp]) {
compObj[comp] = usingComponentsMap[comp];
}
});
});
}
/**
* 格式化组件路径

@@ -348,3 +254,3 @@ * genericComponents数组中存储的是一个key,找到其对应的真正的组件路径

}
const getPageSet = () => shared.getUniCliCache('getPageSet')();
const getPageSet = () => sharedVue2.getUniCliCache('getPageSet')();

@@ -393,7 +299,7 @@ replaceAllPolyfill();

/* eslint-disable max-len */
const getJsonFileMap = () => shared.getUniCliCache('getJsonFileMap')();
const getGlobalUsingComponents = () => shared.getUniCliCache('getGlobalUsingComponents')();
const getWXComponents = () => shared.getUniCliCache('getWXComponents')();
const getComponentSet = () => shared.getUniCliCache('getComponentSet')();
const getJsonFile = () => shared.getUniCliCache('getJsonFile')();
const getJsonFileMap = () => sharedVue2.getUniCliCache('getJsonFileMap')();
const getGlobalUsingComponents = () => sharedVue2.getUniCliCache('getGlobalUsingComponents')();
const getWXComponents = () => sharedVue2.getUniCliCache('getWXComponents')();
const getComponentSet = () => sharedVue2.getUniCliCache('getComponentSet')();
const getJsonFile = () => sharedVue2.getUniCliCache('getJsonFile')();
let MOVE_COMPONENT_MIN_DISABLE_LIST = [];

@@ -463,7 +369,7 @@ let MOVE_COMPONENT_MIN_USE_TIMES = 10000000;

getUsingComponentsMap(jsonFileMap, pageSet, usingComponentsMap);
genIterativeComponentMap(usingComponentsMap);
tComm.genIterativeComponentMap(usingComponentsMap);
let usingComponentPages = {};
let flattenUsingComponent = {};
try {
flattenUsingComponent = flattenUsingComponentMap(usingComponentsMap);
flattenUsingComponent = tComm.flattenUsingComponentMap(usingComponentsMap);
usingComponentPages = handleComponentMap(flattenUsingComponent, pageSet);

@@ -470,0 +376,0 @@ shared.saveJsonToLog(usingComponentsMap, 'dispatch-vue.inner-using-component-map.json', options.needLog);

+7
-6
{
"name": "@plugin-light/webpack-plugin-dispatch-vue",
"version": "0.0.4",
"version": "0.0.6",
"main": "./lib/index",

@@ -10,13 +10,14 @@ "files": [

"type": "git",
"url": "https://github.com/novlan1/uni-plugin-light"
"url": "https://github.com/novlan1/plugin-light"
},
"author": "guowangyang",
"homepage": "https://novlan1.github.io/uni-plugin-light/",
"homepage": "https://novlan1.github.io/plugin-light/",
"bugs": {
"url": "https://github.com/novlan1/uni-plugin-light/issues"
"url": "https://github.com/novlan1/plugin-light/issues"
},
"dependencies": {
"t-comm": "^1.3.104",
"t-comm": "^1.3.139",
"@plugin-light/shared": "^0.0.19",
"@plugin-light/webpack-plugin-fix-npm-package": "^0.0.5",
"@plugin-light/shared": "0.0.11"
"@plugin-light/shared-vue2": "^0.0.8"
},

@@ -23,0 +24,0 @@ "scripts": {

@@ -83,1 +83,6 @@ ## 组件分发

[uni-app分包优化——组件分发](https://juejin.cn/post/7134873157449547812)
### 更新日志
[点此查看](./CHANGELOG.md)