神仙 9 месяцев назад
Родитель
Сommit
c5f5170f28

+ 17 - 17
packages/vite-plugin/dist/index.js

@@ -1,8 +1,8 @@
 (function (global, factory) {
-    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs'), require('path'), require('axios'), require('lodash-es'), require('prettier'), require('@vue/compiler-sfc'), require('magic-string'), require('glob'), require('svgo')) :
-    typeof define === 'function' && define.amd ? define(['exports', 'fs', 'path', 'axios', 'lodash-es', 'prettier', '@vue/compiler-sfc', 'magic-string', 'glob', 'svgo'], factory) :
-    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.index = {}, global.fs, global.path, global.axios, global.lodashEs, global.prettier, global.compilerSfc, global.magicString, global.glob, global.svgo));
-})(this, (function (exports, fs, path, axios, lodashEs, prettier, compilerSfc, magicString, glob, svgo) { 'use strict';
+    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs'), require('path'), require('axios'), require('lodash'), require('prettier'), require('@vue/compiler-sfc'), require('magic-string'), require('glob'), require('svgo')) :
+    typeof define === 'function' && define.amd ? define(['exports', 'fs', 'path', 'axios', 'lodash', 'prettier', '@vue/compiler-sfc', 'magic-string', 'glob', 'svgo'], factory) :
+    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.index = {}, global.fs, global.path, global.axios, global.lodash, global.prettier, global.compilerSfc, global.magicString, global.glob, global.svgo));
+})(this, (function (exports, fs, path, axios, lodash, prettier, compilerSfc, magicString, glob, svgo) { 'use strict';
 
     const config = {
         type: "admin",
@@ -141,7 +141,7 @@
     // 获取数据
     async function getData(data) {
         // 自定义数据
-        if (!lodashEs.isEmpty(data)) {
+        if (!lodash.isEmpty(data)) {
             customList = (data || []).map((e) => {
                 return {
                     ...e,
@@ -161,8 +161,8 @@
             .then((res) => {
             const { code, data, message } = res.data;
             if (code === 1000) {
-                if (!lodashEs.isEmpty(data) && data) {
-                    list = lodashEs.values(data).flat();
+                if (!lodash.isEmpty(data) && data) {
+                    list = lodash.values(data).flat();
                 }
             }
             else {
@@ -173,11 +173,11 @@
             error(`[cool-eps] 后端未启动 ➜ ${url}`);
         });
         // 合并自定义数据
-        if (lodashEs.isArray(customList)) {
+        if (lodash.isArray(customList)) {
             customList.forEach((e) => {
                 const d = list.find((a) => e.prefix === a.prefix);
                 if (d) {
-                    lodashEs.merge(d, e);
+                    lodash.merge(d, e);
                 }
                 else {
                     list.push(e);
@@ -298,7 +298,7 @@
                                 const permission = [];
                                 item.api.forEach((a) => {
                                     // 方法名
-                                    const n = toCamel(formatName(a.name || lodashEs.last(a.path.split("/")) || ""));
+                                    const n = toCamel(formatName(a.name || lodash.last(a.path.split("/")) || ""));
                                     if (n) {
                                         // 参数类型
                                         let q = [];
@@ -315,7 +315,7 @@
                                             const b = `${p.schema.type || "string"}`;
                                             q.push(`${a}: ${b},`);
                                         });
-                                        if (lodashEs.isEmpty(q)) {
+                                        if (lodash.isEmpty(q)) {
                                             q = ["any"];
                                         }
                                         else {
@@ -659,7 +659,7 @@
             // 页面配置
             ctx = readFile(ctxPath, true);
             // 原数据,做更新比较用
-            const ctxData = lodashEs.cloneDeep(ctx);
+            const ctxData = lodash.cloneDeep(ctx);
             // 删除临时页面
             ctx.pages = ctx.pages?.filter((e) => !e.isTemp);
             ctx.subPackages = ctx.subPackages?.filter((e) => !e.isTemp);
@@ -679,7 +679,7 @@
                             ? ctx.subPackages?.find((a) => a.root == e.root)
                             : ctx.pages?.find((a) => a.path == e.path);
                         if (d) {
-                            lodashEs.assign(d, e);
+                            lodash.assign(d, e);
                         }
                         else {
                             if (isSub) {
@@ -695,12 +695,12 @@
             // 排序后检测,避免加载顺序问题
             function order(d) {
                 return {
-                    pages: lodashEs.orderBy(d.pages, "path"),
-                    subPackages: lodashEs.orderBy(d.subPackages, "root"),
+                    pages: lodash.orderBy(d.pages, "path"),
+                    subPackages: lodash.orderBy(d.subPackages, "root"),
                 };
             }
             // 是否需要更新 pages.json
-            if (!lodashEs.isEqual(order(ctxData), order(ctx))) {
+            if (!lodash.isEqual(order(ctxData), order(ctx))) {
                 console.log("[cool-ctx] pages updated");
                 writeFile(ctxPath, JSON.stringify(ctx, null, 4));
             }
@@ -892,7 +892,7 @@ if (typeof window !== 'undefined') {
             }
             // 匹配规则
             if (mapping) {
-                lodashEs.merge(config.eps.mapping, mapping);
+                lodash.merge(config.eps.mapping, mapping);
             }
         }
         return [base(), virtual(), demo(options.demo)];

+ 1 - 2
packages/vite-plugin/package.json

@@ -1,6 +1,6 @@
 {
 	"name": "@cool-vue/vite-plugin",
-	"version": "7.2.3",
+	"version": "7.2.4",
 	"description": "cool-admin、cool-uni builder",
 	"main": "/dist/index.js",
 	"scripts": {
@@ -32,7 +32,6 @@
 		"@vue/compiler-sfc": "^3.4.24",
 		"axios": "^1.6.8",
 		"glob": "^10.3.12",
-		"lodash": "^4.17.21",
 		"lodash-es": "^4.17.21",
 		"magic-string": "^0.30.10",
 		"prettier": "^3.2.5",

+ 0 - 8
packages/vite-plugin/pnpm-lock.yaml

@@ -17,9 +17,6 @@ importers:
       glob:
         specifier: ^10.3.12
         version: 10.3.12
-      lodash:
-        specifier: ^4.17.21
-        version: 4.17.21
       lodash-es:
         specifier: ^4.17.21
         version: 4.17.21
@@ -850,9 +847,6 @@ packages:
   lodash.merge@4.6.2:
     resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
 
-  lodash@4.17.21:
-    resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
-
   lru-cache@10.2.0:
     resolution: {integrity: sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==}
     engines: {node: 14 || >=16.14}
@@ -1874,8 +1868,6 @@ snapshots:
 
   lodash.merge@4.6.2: {}
 
-  lodash@4.17.21: {}
-
   lru-cache@10.2.0: {}
 
   lru-cache@6.0.0:

+ 2 - 0
packages/vite-plugin/rollup.config.js

@@ -5,6 +5,8 @@ import { defineConfig } from "rollup";
 export default defineConfig({
 	input: ["src/index.ts"],
 
+	external: ["lodash-es"],
+
 	output: {
 		name: "index",
 		format: "umd",

+ 1 - 1
packages/vite-plugin/src/eps/index.ts

@@ -195,7 +195,7 @@ async function createDescribe({ list, service }: { list: Eps.Entity[]; service:
 
 			if (!ignore.includes(item.name)) {
 				ignore.push(item.name);
-				t0 += t;
+				t0 += t + "\n\n";
 			}
 		}