@10yun/open-sdk 0.3.141

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,41 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./helper-C42BllYY.cjs");let I=require("vite"),y=require("path");y=v.__toESM(y);let g=require("node:fs");g=v.__toESM(g);function h(t,i){for(var r=0,c=i.length,e=t.length;r<c;r++,e++)t[e]=i[r];return t}var E=function(t){return`
2
+ const createDeffer = (hookName) => {
3
+ const d = new Promise((resolve, reject) => {
4
+ window.proxy && (window.proxy[\`vite\${hookName}\`] = resolve)
5
+ })
6
+ return props => d.then(fn => fn(props));
7
+ }
8
+ const bootstrap = createDeffer('bootstrap');
9
+ const mount = createDeffer('mount');
10
+ const unmount = createDeffer('unmount');
11
+ const update = createDeffer('update');
12
+
13
+ ;(global => {
14
+ global.qiankunName = '`+t+`';
15
+ global['`+t+`'] = {
16
+ bootstrap,
17
+ mount,
18
+ unmount,
19
+ update
20
+ };
21
+ })(window);
22
+ `},R=function(t){return`
23
+ const qiankunLifeCycle = window.moudleQiankunAppLifeCycles && window.moudleQiankunAppLifeCycles['`+t+`'];
24
+ if (qiankunLifeCycle) {
25
+ window.proxy.vitemount((props) => qiankunLifeCycle.mount(props));
26
+ window.proxy.viteunmount((props) => qiankunLifeCycle.unmount(props));
27
+ window.proxy.vitebootstrap(() => qiankunLifeCycle.bootstrap());
28
+ window.proxy.viteupdate((props) => qiankunLifeCycle.update(props));
29
+ }
30
+ `};function C(t,i){var r=t.match(/src=["']([^"']+)["']/);if(!r)return t;var c=r[1];return"<script>"+("import("+i+"'"+c+"')")+"<\/script>"}var N=function(t,i){i===void 0&&(i={});var r,c="";return{name:"qiankun-html-transform",configResolved:function(e){r=e.command==="build"||e.isProduction,c=e.base},configureServer:function(e){return function(){e.middlewares.use(function(o,a,f){if(r||!i.useDevMode){f();return}var l=a.end.bind(a);a.end=function(){for(var p=[],u=0;u<arguments.length;u++)p[u]=arguments[u];var n=p[0],m=p.slice(1);if(typeof n=="string"){var d="(window.proxy ? (window.proxy.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ + '..') : '') + ",w=new RegExp(`<script[^>]*src=["']`+c+`@vite/client["'][^>]*><\/script>`);n=n.replace(w,function(s){return C(s,d)})}l.apply(void 0,h([n],m))},f()})}},transformIndexHtml:function(e){for(var o=i.useDevMode&&!r?"(window.proxy ? (window.proxy.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ + '..') : '') + ":"",a=[],f=/<(script)([^>]*?)>([\s\S]*?)<\/script>/gi,l;l=f.exec(e);){var p=l[0],u=l[2];(/type=["']module["']/.test(u)||/crossorigin=["']["']/.test(u))&&/src=["']/.test(u)&&a.push({original:p,transformed:C(p,o)})}return a.length&&(a.forEach(function(n,m){var d=n.transformed;m===a.length-1&&(d=d.replace("<\/script>",`.finally(() => {
31
+ `+R(t)+`
32
+ })<\/script>`)),e=e.replace(n.original,d)}),e=e.replace("</body>","<script>"+E(t)+"<\/script></body>")),e}}},S={};function D(t,i){let r=[];for(let c in i){let e=i[c];if(e=v.parseRouteItem(e),S[e.name]&&(e.name=e.name+"_"+c),e.isMenu==!1&&e.isRbac==!1)continue;let o={title:e.title||e?.meta?.title,path:e.path||"",id:t+"@"+e.name||"",name:e.name||"",apiPermissions:e.apiPermissions||[],isPage:!!e.path,isMenu:e.isMenu||!1,isRbac:e.isRbac||!1,isWindw:e.isWindw||!1,isAlone:e.isAlone||!1,children:[]};if(e.isMenu&&(o.checked=!1,o.menuName=o.title,o.parentId=e.parentId||"",o.children=[]),e.children){let a=e.children,f=0,l=[];for(let u in a){let n=a[u];n.isMenu&&(n.parentId=e.name,l.push(n))}let p=[];for(let u in a){let n=a[u];n=v.parseRouteItem(n),S[n.name]&&(n.name=n.name+"_"+u),n.isRbac&&(n.id=t+"@"+(n.name||e.name+"_"+ ++f),n.optionsName=n.title||n.meta.title,n.checked=!1,p.push(n))}p.length>0&&(o.menuOptionsList=p),l.length>0&&(o=Object.assign({},o,{children:D(t,[...l])}))}r.push(o)}return r}function A(t,i,r){const{RBAC_BASE_SIGN:c}=r;let e=D(c||"",t),o=i+"/public/rbac.json",a=JSON.stringify(e,null,2);g.default.writeFileSync(o,a,"utf8")}function L(t,i,r,c){const{CICD_BUILD_DOMAIN_SCHEME:e,CICD_BUILD_DOMAIN_ALONE:o,CICD_BUILD_VERS_FULL:a,CICD_BUILD_VERS_CODE:f}=i,{VITE_SY_PRODUCT_PORT:l,VITE_SY_PRODUCT_SIGN:p}=t,u=process.cwd(),n=y.default.basename(u),m=p||n;let d="";o=="on"?d=e:d=`${e}/${m}/${a}/`;let w="/";return r==="production"&&(w=v.parseDomainUrl(`${d}/`),A(c.menu_arr,u,{RBAC_BASE_SIGN:m})),{name:"vite-plugin-shiyun-release-common",config:(s,{mode:b,command:_})=>({base:w,server:{port:l},esbuild:{drop:["console","debugger"]},optimizeDeps:{exclude:["@10yun/open-sdk/uncompiled"]},build:{minify:"esbuild",target:"esnext",sourcemap:!1,cssCodeSplit:!1,chunkSizeWarningLimit:2e3,rolldownOptions:{output:{codeSplitting:{groups:[{name:"element-plus",test:/[\\/]node_modules[\\/]element-plus[\\/]/},{name:"@10yun-ui",test:/[\\/]node_modules[\\/]@10yun[\\/]cv-pc-ui[\\/]/}]}}}},output:{library:`${m}-[name]`,libraryTarget:"umd",jsonpFunction:`webpackJsonp_${m}`}}),configResolved(s){},configureServer(s){},transformIndexHtml(s){r==="development"&&(s=s.replace(/<script\b[^>]*?mode="pro"[^>]*>[\s\S]*?<\/script>/gi,""),s=s.replace(/<(link|script)\b[^>]*?mode="pro"[^>]*>/gi,"")),r==="production"&&o!=="on"&&(s=s.replace(/<script\b[^>]*?mode="dev"[^>]*>[\s\S]*?<\/script>/gi,""),s=s.replace(/<(link|script)\b[^>]*?mode="dev"[^>]*>/gi,""));const b="saas软件,软件开发,软件制定,公众号,小程序,app,十云,十云科技,福州十云,ctocode,10yun.com";let _=` <meta name="description" content="${b}" />
33
+ `;return _+=` <meta name="keywords" content="${b}" />
34
+ `,_+=` <meta name="author" content="十云_ctocode_技术支持_https://www.10yun.com" />
35
+ `,_+=` <meta name="copyright" content="福州十云科技有限公司" />
36
+ `,_+=` <meta name="website" content="https://www.10yun.com/" />
37
+ `,a&&(_+=` <meta name="version" content="${a}_${f}" />
38
+ `),s=s.replace("</head>",`
39
+ ${_}
40
+ </head>`),s=s.replace(/\n\s*\n/g,`
41
+ `),s}}}function k(t={menu_arr:[]}){const i=process.cwd(),r=y.default.basename(i),c=process.env.NODE_ENV,e=(0,I.loadEnv)(c,i,"VITE_"),o=(0,I.loadEnv)(c,i,"CICD_");return[N(e.VITE_SY_PRODUCT_SIGN||r,{useDevMode:!0}),L(e,o,c,t)]}exports.qiankunWindow=v.qiankunWindow;exports.shiyunRelease=k;
@@ -0,0 +1,196 @@
1
+ import { a as D, r as y, t as P } from "./helper-_fZwiZH9.js";
2
+ import { loadEnv as b } from "vite";
3
+ import C from "path";
4
+ import h from "node:fs";
5
+ function E(t, o) {
6
+ for (var r = 0, c = o.length, e = t.length; r < c; r++, e++) t[e] = o[r];
7
+ return t;
8
+ }
9
+ var N = function(t) {
10
+ return `
11
+ const createDeffer = (hookName) => {
12
+ const d = new Promise((resolve, reject) => {
13
+ window.proxy && (window.proxy[\`vite\${hookName}\`] = resolve)
14
+ })
15
+ return props => d.then(fn => fn(props));
16
+ }
17
+ const bootstrap = createDeffer('bootstrap');
18
+ const mount = createDeffer('mount');
19
+ const unmount = createDeffer('unmount');
20
+ const update = createDeffer('update');
21
+
22
+ ;(global => {
23
+ global.qiankunName = '` + t + `';
24
+ global['` + t + `'] = {
25
+ bootstrap,
26
+ mount,
27
+ unmount,
28
+ update
29
+ };
30
+ })(window);
31
+ `;
32
+ }, A = function(t) {
33
+ return `
34
+ const qiankunLifeCycle = window.moudleQiankunAppLifeCycles && window.moudleQiankunAppLifeCycles['` + t + `'];
35
+ if (qiankunLifeCycle) {
36
+ window.proxy.vitemount((props) => qiankunLifeCycle.mount(props));
37
+ window.proxy.viteunmount((props) => qiankunLifeCycle.unmount(props));
38
+ window.proxy.vitebootstrap(() => qiankunLifeCycle.bootstrap());
39
+ window.proxy.viteupdate((props) => qiankunLifeCycle.update(props));
40
+ }
41
+ `;
42
+ };
43
+ function g(t, o) {
44
+ var r = t.match(/src=["']([^"']+)["']/);
45
+ if (!r) return t;
46
+ var c = r[1];
47
+ return "<script>" + ("import(" + o + "'" + c + "')") + "<\/script>";
48
+ }
49
+ var R = function(t, o) {
50
+ o === void 0 && (o = {});
51
+ var r, c = "";
52
+ return {
53
+ name: "qiankun-html-transform",
54
+ configResolved: function(e) {
55
+ r = e.command === "build" || e.isProduction, c = e.base;
56
+ },
57
+ configureServer: function(e) {
58
+ return function() {
59
+ e.middlewares.use(function(i, a, f) {
60
+ if (r || !o.useDevMode) {
61
+ f();
62
+ return;
63
+ }
64
+ var l = a.end.bind(a);
65
+ a.end = function() {
66
+ for (var p = [], u = 0; u < arguments.length; u++) p[u] = arguments[u];
67
+ var n = p[0], m = p.slice(1);
68
+ if (typeof n == "string") {
69
+ var d = "(window.proxy ? (window.proxy.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ + '..') : '') + ", v = new RegExp(`<script[^>]*src=["']` + c + `@vite/client["'][^>]*><\/script>`);
70
+ n = n.replace(v, function(s) {
71
+ return g(s, d);
72
+ });
73
+ }
74
+ l.apply(void 0, E([n], m));
75
+ }, f();
76
+ });
77
+ };
78
+ },
79
+ transformIndexHtml: function(e) {
80
+ for (var i = o.useDevMode && !r ? "(window.proxy ? (window.proxy.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ + '..') : '') + " : "", a = [], f = /<(script)([^>]*?)>([\s\S]*?)<\/script>/gi, l; l = f.exec(e); ) {
81
+ var p = l[0], u = l[2];
82
+ (/type=["']module["']/.test(u) || /crossorigin=["']["']/.test(u)) && /src=["']/.test(u) && a.push({
83
+ original: p,
84
+ transformed: g(p, i)
85
+ });
86
+ }
87
+ return a.length && (a.forEach(function(n, m) {
88
+ var d = n.transformed;
89
+ m === a.length - 1 && (d = d.replace("<\/script>", `.finally(() => {
90
+ ` + A(t) + `
91
+ })<\/script>`)), e = e.replace(n.original, d);
92
+ }), e = e.replace("</body>", "<script>" + N(t) + "<\/script></body>")), e;
93
+ }
94
+ };
95
+ }, I = {};
96
+ function S(t, o) {
97
+ let r = [];
98
+ for (let c in o) {
99
+ let e = o[c];
100
+ if (e = y(e), I[e.name] && (e.name = e.name + "_" + c), e.isMenu == !1 && e.isRbac == !1) continue;
101
+ let i = {
102
+ title: e.title || e?.meta?.title,
103
+ path: e.path || "",
104
+ id: t + "@" + e.name || "",
105
+ name: e.name || "",
106
+ apiPermissions: e.apiPermissions || [],
107
+ isPage: !!e.path,
108
+ isMenu: e.isMenu || !1,
109
+ isRbac: e.isRbac || !1,
110
+ isWindw: e.isWindw || !1,
111
+ isAlone: e.isAlone || !1,
112
+ children: []
113
+ };
114
+ if (e.isMenu && (i.checked = !1, i.menuName = i.title, i.parentId = e.parentId || "", i.children = []), e.children) {
115
+ let a = e.children, f = 0, l = [];
116
+ for (let u in a) {
117
+ let n = a[u];
118
+ n.isMenu && (n.parentId = e.name, l.push(n));
119
+ }
120
+ let p = [];
121
+ for (let u in a) {
122
+ let n = a[u];
123
+ n = y(n), I[n.name] && (n.name = n.name + "_" + u), n.isRbac && (n.id = t + "@" + (n.name || e.name + "_" + ++f), n.optionsName = n.title || n.meta.title, n.checked = !1, p.push(n));
124
+ }
125
+ p.length > 0 && (i.menuOptionsList = p), l.length > 0 && (i = Object.assign({}, i, { children: S(t, [...l]) }));
126
+ }
127
+ r.push(i);
128
+ }
129
+ return r;
130
+ }
131
+ function L(t, o, r) {
132
+ const { RBAC_BASE_SIGN: c } = r;
133
+ let e = S(c || "", t), i = o + "/public/rbac.json", a = JSON.stringify(e, null, 2);
134
+ h.writeFileSync(i, a, "utf8");
135
+ }
136
+ function k(t, o, r, c) {
137
+ const { CICD_BUILD_DOMAIN_SCHEME: e, CICD_BUILD_DOMAIN_ALONE: i, CICD_BUILD_VERS_FULL: a, CICD_BUILD_VERS_CODE: f } = o, { VITE_SY_PRODUCT_PORT: l, VITE_SY_PRODUCT_SIGN: p } = t, u = process.cwd(), n = C.basename(u), m = p || n;
138
+ let d = "";
139
+ i == "on" ? d = e : d = `${e}/${m}/${a}/`;
140
+ let v = "/";
141
+ return r === "production" && (v = D(`${d}/`), L(c.menu_arr, u, { RBAC_BASE_SIGN: m })), {
142
+ name: "vite-plugin-shiyun-release-common",
143
+ config: (s, { mode: w, command: _ }) => ({
144
+ base: v,
145
+ server: { port: l },
146
+ esbuild: { drop: ["console", "debugger"] },
147
+ optimizeDeps: { exclude: ["@10yun/open-sdk/uncompiled"] },
148
+ build: {
149
+ minify: "esbuild",
150
+ target: "esnext",
151
+ sourcemap: !1,
152
+ cssCodeSplit: !1,
153
+ chunkSizeWarningLimit: 2e3,
154
+ rolldownOptions: { output: { codeSplitting: { groups: [{
155
+ name: "element-plus",
156
+ test: /[\\/]node_modules[\\/]element-plus[\\/]/
157
+ }, {
158
+ name: "@10yun-ui",
159
+ test: /[\\/]node_modules[\\/]@10yun[\\/]cv-pc-ui[\\/]/
160
+ }] } } }
161
+ },
162
+ output: {
163
+ library: `${m}-[name]`,
164
+ libraryTarget: "umd",
165
+ jsonpFunction: `webpackJsonp_${m}`
166
+ }
167
+ }),
168
+ configResolved(s) {
169
+ },
170
+ configureServer(s) {
171
+ },
172
+ transformIndexHtml(s) {
173
+ r === "development" && (s = s.replace(/<script\b[^>]*?mode="pro"[^>]*>[\s\S]*?<\/script>/gi, ""), s = s.replace(/<(link|script)\b[^>]*?mode="pro"[^>]*>/gi, "")), r === "production" && i !== "on" && (s = s.replace(/<script\b[^>]*?mode="dev"[^>]*>[\s\S]*?<\/script>/gi, ""), s = s.replace(/<(link|script)\b[^>]*?mode="dev"[^>]*>/gi, ""));
174
+ const w = "saas软件,软件开发,软件制定,公众号,小程序,app,十云,十云科技,福州十云,ctocode,10yun.com";
175
+ let _ = ` <meta name="description" content="${w}" />
176
+ `;
177
+ return _ += ` <meta name="keywords" content="${w}" />
178
+ `, _ += ` <meta name="author" content="十云_ctocode_技术支持_https://www.10yun.com" />
179
+ `, _ += ` <meta name="copyright" content="福州十云科技有限公司" />
180
+ `, _ += ` <meta name="website" content="https://www.10yun.com/" />
181
+ `, a && (_ += ` <meta name="version" content="${a}_${f}" />
182
+ `), s = s.replace("</head>", `
183
+ ${_}
184
+ </head>`), s = s.replace(/\n\s*\n/g, `
185
+ `), s;
186
+ }
187
+ };
188
+ }
189
+ function U(t = { menu_arr: [] }) {
190
+ const o = process.cwd(), r = C.basename(o), c = process.env.NODE_ENV, e = b(c, o, "VITE_"), i = b(c, o, "CICD_");
191
+ return [R(e.VITE_SY_PRODUCT_SIGN || r, { useDevMode: !0 }), k(e, i, c, t)];
192
+ }
193
+ export {
194
+ P as qiankunWindow,
195
+ U as shiyunRelease
196
+ };
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@10yun/open-sdk",
3
+ "version": "0.3.141",
4
+ "private": false,
5
+ "description": "开放平台接入sdk",
6
+ "keywords": [
7
+ "10yun",
8
+ "10yun-open-sdk",
9
+ "ctocode",
10
+ "http://ctocode.com",
11
+ "https://cvjs.cn",
12
+ "https://www.10yun.com",
13
+ "javascript",
14
+ "vite打包",
15
+ "十云"
16
+ ],
17
+ "homepage": "https://gitee.com/open10/open-sdk",
18
+ "bugs": {
19
+ "url": "https://gitee.com/open10/open-sdk/issues"
20
+ },
21
+ "license": "MIT",
22
+ "author": "10yun.com",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://gitee.com/open10/open-sdk"
26
+ },
27
+ "files": [
28
+ "common",
29
+ "dist",
30
+ "uncompiled"
31
+ ],
32
+ "type": "module",
33
+ "main": "./dist/index.cjs.js",
34
+ "module": "./dist/index.es.js",
35
+ "types": "./dist/index.d.ts",
36
+ "exports": {
37
+ ".": {
38
+ "import": "./dist/index.es.js",
39
+ "require": "./dist/index.cjs.js"
40
+ },
41
+ "./plugin": {
42
+ "import": "./dist/vite-plugin.es.js",
43
+ "require": "./dist/vite-plugin.cjs.js"
44
+ },
45
+ "./uncompiled": {
46
+ "import": "./uncompiled/index.js",
47
+ "require": "./uncompiled/index.js"
48
+ },
49
+ "./uncompiled/*": {
50
+ "import": "./uncompiled/*",
51
+ "require": "./uncompiled/*"
52
+ }
53
+ },
54
+ "publishConfig": {
55
+ "access": "public",
56
+ "registry": "https://registry.npmjs.org/"
57
+ },
58
+ "scripts": {
59
+ "build": "vite build"
60
+ },
61
+ "dependencies": {
62
+ "localforage": "^1.10.0"
63
+ },
64
+ "devDependencies": {
65
+ "@vitejs/plugin-vue": "^6.0.5",
66
+ "rollup-plugin-visualizer": "^7.0.1",
67
+ "vite": "^8.0.0"
68
+ }
69
+ }
@@ -0,0 +1,23 @@
1
+ export const DICT_SHOW_TYPE = [
2
+ { label: '显示', value: 'on' },
3
+ { label: '隐藏', value: 'off' }
4
+ ];
5
+ export const DICT_ENABLE_TYPES = [
6
+ { label: '启用', value: 'on' },
7
+ { label: '停用', value: 'off' }
8
+ ];
9
+ export const DICT_AUDIT_TYPES = [
10
+ { label: '通过', value: '通过' },
11
+ { label: '驳回', value: '驳回' },
12
+ { label: '拒绝', value: '拒绝' }
13
+ ];
14
+ export const DICT_CHOICE_TYPES = [
15
+ { label: '单选', value: 'dan' },
16
+ { label: '多选', value: 'duo' }
17
+ ];
18
+ export const DICT_TF_TYPES = [
19
+ { label: '是', value: 'on' },
20
+ { label: '否', value: 'off' }
21
+ ];
22
+
23
+ // import { DICT_AUDIT_TYPES } from '@10yun/open-sdk/uncompiled/dict.js';
@@ -0,0 +1,102 @@
1
+ import { routeParseQiankun } from '../common/router.js';
2
+ /**
3
+ * 初始化API
4
+ */
5
+ import ApiFlagSet from '@/api/index.js';
6
+ import ApiAuthSet from '@/api/index-auth.js';
7
+ /**
8
+ * 初始化配置
9
+ */
10
+ const envArr = import.meta.env;
11
+ export function loadInitConfig() {
12
+ // const envArr = process.env || {};
13
+
14
+ // 合并主应用_SY_API_BASE_URL_
15
+ const last_api_base_url = window._SY_API_BASE_URL_ || envArr.VITE_SY_API_URL;
16
+ // 合并主应用_项目接入id
17
+ const lastAppProjectSign = window['SY-APP-PROJECT-SIGN'] || envArr.VITE_SY_CONNECT_PSIGN;
18
+ // 合并主应用_应用接入id
19
+ const lastAppConnectId = window['SY-APP-CONNECT-ID'] || envArr.VITE_SY_CONNECT_APPID;
20
+ // 合并主应用_应用接入role
21
+ const lastAppConnectRole = window['SY-APP-CONNECT-ROLE'] || envArr.VITE_SY_CONNECT_ROLE;
22
+ // 合并主应用_api_flag
23
+ const last_open_api_flag = window._SY_OPEN_API_FLAG_ || {};
24
+ // 合并主应用_api_auth
25
+ const last_open_api_auth = window._SY_OPEN_API_AUTH_ || {};
26
+
27
+ /**
28
+ * 产品信息
29
+ */
30
+ const last_product_title = envArr.VITE_SY_PRODUCT_TITLE || 'ShiyunProduct';
31
+ const last_product_sign = envArr.VITE_SY_PRODUCT_SIGN || 'ShiyunProduct';
32
+ const last_vers_alone = envArr.CICD_BUILD_DOMAIN_ALONE || 'off';
33
+ return {
34
+ syProductAlone: last_vers_alone,
35
+ syProductTitle: last_product_title,
36
+ syProductSign: last_product_sign,
37
+ /**
38
+ *
39
+ */
40
+ syOpenApiFlag: last_open_api_flag,
41
+ syOpenApiAuth: last_open_api_auth,
42
+ // syAppUrlBase: lastAppUrlBase,
43
+ // syAppUrlPay: lastAppUrlPay,
44
+ // syAppUrlFile: lastAppUrlFile,
45
+ syApiBaseUrl: last_api_base_url,
46
+ syAppProjectSign: lastAppProjectSign,
47
+ syAppConnectRole: lastAppConnectRole,
48
+ syAppConnectId: lastAppConnectId
49
+ /**
50
+ *
51
+ */
52
+ };
53
+ }
54
+ /**
55
+ * 语言
56
+ */
57
+ // 获取所有语言文件的路径
58
+ const language_glob = import.meta.glob('@/language/modules/**/*.json');
59
+ // 语言文件的存储
60
+ const language_messages = {};
61
+ // 动态加载语言文件
62
+ export async function loadLocaleMessages(locale) {
63
+ if (!language_messages[locale]) {
64
+ language_messages[locale] = {};
65
+ for (const path in language_glob) {
66
+ if (path.includes(`/${locale}.json`)) {
67
+ const module = await language_glob[path]();
68
+ if (module.default) {
69
+ Object.assign(language_messages[locale], module.default, {});
70
+ // console.log(module.default, path, language_messages[locale]);
71
+ }
72
+ }
73
+ }
74
+ }
75
+ return language_messages[locale];
76
+ }
77
+
78
+ /**
79
+ * 路由
80
+ */
81
+ const views_glob = import.meta.glob('@/views/**/*.vue');
82
+ const views_path = '/src/views/';
83
+ export function loadInitRouter(routes, yyMenuArr) {
84
+ let last_routes = routeParseQiankun(routes, [...yyMenuArr]);
85
+ // https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations
86
+ // return () => import(/* @vite-ignore */ itemPath);
87
+ last_routes.forEach((item, index) => {
88
+ if (item.component_str) {
89
+ let globPath = views_path + item.component_str + '.vue';
90
+ if (views_glob[globPath]) {
91
+ item.component = views_glob[globPath];
92
+ }
93
+ }
94
+ });
95
+ return last_routes;
96
+ }
97
+ export function loadInitApi() {
98
+ return {
99
+ INIT_API_FLAG: ApiFlagSet,
100
+ INIT_API_AUTH: ApiAuthSet
101
+ };
102
+ }
File without changes