@plugin-light/webpack-plugin-dispatch-vue
Advanced tools
+9
-103
@@ -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": { |
+5
-0
@@ -83,1 +83,6 @@ ## 组件分发 | ||
| [uni-app分包优化——组件分发](https://juejin.cn/post/7134873157449547812) | ||
| ### 更新日志 | ||
| [点此查看](./CHANGELOG.md) |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
88
6.02%41590
-7.07%4
33.33%813
-10.36%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
Updated
Updated