gant-core 2.0.1 → 2.0.4

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/bin/index.js +21 -1
  3. package/bin/styletext-loader.mjs +30 -0
  4. package/lib/cli/config/index.js +155 -2
  5. package/lib/cli/config/index.mjs +3 -0
  6. package/lib/cli/copyfiles/index.js +33 -2
  7. package/lib/cli/copyfiles/index.mjs +3 -0
  8. package/lib/cli/create/config/index.js +1226 -4
  9. package/lib/cli/create/config/index.mjs +11 -0
  10. package/lib/cli/create/index.js +4 -2
  11. package/lib/cli/create/index.mjs +3 -0
  12. package/lib/cli/create/module/index.js +33214 -2
  13. package/lib/cli/create/module/index.mjs +3 -0
  14. package/lib/cli/i18n/index.js +22179 -3
  15. package/lib/cli/i18n/index.mjs +10 -0
  16. package/lib/cli/i18n/utils.js +180 -2
  17. package/lib/cli/i18n/utils.mjs +3 -0
  18. package/lib/cli/index.js +3655 -2
  19. package/lib/cli/index.mjs +3 -0
  20. package/lib/cli/routes/index.js +75 -2
  21. package/lib/cli/routes/index.mjs +3 -0
  22. package/lib/cli/tsconfig/index.js +70 -2
  23. package/lib/cli/tsconfig/index.mjs +3 -0
  24. package/lib/cli/utils/detectPort.js +120 -2
  25. package/lib/cli/utils/detectPort.mjs +3 -0
  26. package/lib/cli/utils/getJavascriptfile.js +14 -2
  27. package/lib/cli/utils/getJavascriptfile.mjs +3 -0
  28. package/lib/cli/utils/index.js +4948 -2
  29. package/lib/cli/utils/index.mjs +3 -0
  30. package/lib/cli/webpack/Webpack.js +60 -2
  31. package/lib/cli/webpack/Webpack.mjs +3 -0
  32. package/lib/cli/webpack/config/analyzer.config.js +17 -2
  33. package/lib/cli/webpack/config/analyzer.config.mjs +3 -0
  34. package/lib/cli/webpack/config/browsers.js +13 -2
  35. package/lib/cli/webpack/config/browsers.mjs +3 -0
  36. package/lib/cli/webpack/config/cssRules.js +80 -2
  37. package/lib/cli/webpack/config/cssRules.mjs +3 -0
  38. package/lib/cli/webpack/config/default.config.js +179 -2
  39. package/lib/cli/webpack/config/default.config.mjs +3 -0
  40. package/lib/cli/webpack/config/development.config.js +45 -2
  41. package/lib/cli/webpack/config/development.config.mjs +3 -0
  42. package/lib/cli/webpack/config/framework/index.js +25 -2
  43. package/lib/cli/webpack/config/framework/index.mjs +3 -0
  44. package/lib/cli/webpack/config/framework/react.js +23 -2
  45. package/lib/cli/webpack/config/framework/react.mjs +3 -0
  46. package/lib/cli/webpack/config/framework/vue.js +33 -2
  47. package/lib/cli/webpack/config/framework/vue.mjs +3 -0
  48. package/lib/cli/webpack/config/index.js +23 -2
  49. package/lib/cli/webpack/config/index.mjs +3 -0
  50. package/lib/cli/webpack/config/production.config.js +74 -2
  51. package/lib/cli/webpack/config/production.config.mjs +3 -0
  52. package/lib/cli/webpack/plugins/copy.js +20 -2
  53. package/lib/cli/webpack/plugins/copy.mjs +3 -0
  54. package/lib/cli/webpack/plugins/index.js +4 -2
  55. package/lib/cli/webpack/plugins/index.mjs +3 -0
  56. package/lib/core/store/index.js +1 -1
  57. package/package.json +2 -2
  58. package/rollup.config.js +5 -4
  59. package/.changeset/README.md +0 -8
  60. package/.changeset/config.json +0 -11
  61. package/lib/cli/acorn.js +0 -3
  62. package/lib/cli/angular.js +0 -3
  63. package/lib/cli/babel.js +0 -3
  64. package/lib/cli/estree.js +0 -3
  65. package/lib/cli/flow.js +0 -3
  66. package/lib/cli/glimmer.js +0 -3
  67. package/lib/cli/graphql.js +0 -3
  68. package/lib/cli/html.js +0 -3
  69. package/lib/cli/markdown.js +0 -3
  70. package/lib/cli/meriyah.js +0 -3
  71. package/lib/cli/msmain.js +0 -65
  72. package/lib/cli/postcss.js +0 -3
  73. package/lib/cli/typescript.js +0 -3
  74. package/lib/cli/yaml.js +0 -3
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{createRequire as e}from"module";const o=e(import.meta.url);function r(){const e=o("vue-loader").VueLoaderPlugin;return{swcTransform:{},loaders:[{test:/\.vue$/,loader:o.resolve("vue-loader")}],plugins:[new e],extensions:[".vue"],tsConfigSuffix:"vue",devPlugins:[]}}export{r as g};
3
+ //# sourceMappingURL=vue.mjs.map
@@ -1,3 +1,24 @@
1
- #!/usr/bin/env node
2
- "use strict";var e=require("./production.config.js"),t=require("./default.config.js"),n=require("./development.config.js"),o=require("./analyzer.config.js");exports.getAnalyzerConfig=(e,n)=>{const r=o._getAnalyzerConfig(e,n);return t.getDefaultConfig(n,r)},exports.getDevConfig=(e,o)=>{const r=n._getDevlopmentConfig(e,o);return t.getDefaultConfig(o,r)},exports.getProductionConfig=(n,o)=>{const r=e.getProConfig(n,o);return t.getDefaultConfig(o,r)};
1
+ 'use strict';
2
+
3
+ var webpack_config_production_config = require('./production.config.js');
4
+ var webpack_config_default_config = require('./default.config.js');
5
+ var webpack_config_development_config = require('./development.config.js');
6
+ var webpack_config_analyzer_config = require('./analyzer.config.js');
7
+
8
+ const getProductionConfig = (config, cwd) => {
9
+ const proConfig = webpack_config_production_config.getProConfig(config, cwd);
10
+ return webpack_config_default_config.getDefaultConfig(cwd, proConfig);
11
+ };
12
+ const getDevConfig = (config, cwd) => {
13
+ const proConfig = webpack_config_development_config._getDevlopmentConfig(config, cwd);
14
+ return webpack_config_default_config.getDefaultConfig(cwd, proConfig);
15
+ };
16
+ const getAnalyzerConfig = (config, cwd) => {
17
+ const previewConfig = webpack_config_analyzer_config._getAnalyzerConfig(config, cwd);
18
+ return webpack_config_default_config.getDefaultConfig(cwd, previewConfig);
19
+ };
20
+
21
+ exports.getAnalyzerConfig = getAnalyzerConfig;
22
+ exports.getDevConfig = getDevConfig;
23
+ exports.getProductionConfig = getProductionConfig;
3
24
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{g as o}from"./production.config.mjs";import{g as r}from"./default.config.mjs";import{_ as s}from"./development.config.mjs";import{_ as t}from"./analyzer.config.mjs";const n=(s,t)=>{const n=o(s,t);return r(t,n)},m=(o,t)=>{const n=s(o,t);return r(t,n)},a=(o,s)=>{const n=t(o,s);return r(s,n)};export{a,n as b,m as g};
3
+ //# sourceMappingURL=index.mjs.map
@@ -1,3 +1,75 @@
1
- #!/usr/bin/env node
2
- "use strict";var i=require("../plugins/copy.js"),e=require("path"),s=require("../../utils/index.js"),t=require("@rspack/core"),n=require("compression-webpack-plugin");exports.getProConfig=(r,o)=>{const{outputPathDir:u="dist",publicPathDir:p=e.resolve(o,s.getSrcPath(),".gant/public"),optimization:a,library:l,compression:c=!0,copy:m=[]}=r,g=[];return l?s.mergeConfig({mode:"production",optimization:{minimize:!0,...a},plugins:[new t.CssExtractRspackPlugin]},r):(!0===c&&g.push(new n({algorithm:"gzip",test:/\.js(\?.*)?$/i,threshold:10240,minRatio:.7,deleteOriginalAssets:!1})),s.mergeConfig({mode:"production",devtool:"source-map",optimization:{minimize:!0,runtimeChunk:"single",moduleIds:"deterministic",...a,splitChunks:{chunks:"all",minSize:10240,maxAsyncRequests:30,maxInitialRequests:30,minChunks:1,maxSize:5242880,...a?.splitChunks,cacheGroups:{vendors:{chunks:"initial",name:"vendors",test:/[\\/]node_modules[\\/]/,priority:-10,reuseExistingChunk:!0},...s.get(a?.splitChunks,"cacheGroups",{})}}},plugins:[new t.CssExtractRspackPlugin,new i.CopyFolderPlugin({patterns:[{from:p,to:e.resolve(o,u,"public")},...m]}),...g]},r))};
1
+ 'use strict';
2
+
3
+ var webpack_plugins_copy = require('../plugins/copy.js');
4
+ var path = require('path');
5
+ var utils_index = require('../../utils/index.js');
6
+ var core = require('@rspack/core');
7
+ var CompressionPlugin = require('compression-webpack-plugin');
8
+
9
+ var getProConfig = (config, cwd) => {
10
+ const { outputPathDir = 'dist', publicPathDir = path.resolve(cwd, utils_index.getSrcPath(), '.gant/public'), optimization, library, compression = true, copy: userCopyPatterns = [], } = config;
11
+ const plugins = [];
12
+ if (library)
13
+ return utils_index.mergeConfig({
14
+ mode: 'production',
15
+ optimization: {
16
+ minimize: true,
17
+ ...optimization,
18
+ },
19
+ plugins: [new core.CssExtractRspackPlugin()],
20
+ }, config);
21
+ if (compression === true) {
22
+ plugins.push(new CompressionPlugin({
23
+ algorithm: 'gzip', // 使用gzip压缩
24
+ test: /\.js(\?.*)?$/i, // 匹配需要压缩的文件
25
+ threshold: 10240, // 对大于10kB的文件进行压缩
26
+ minRatio: 0.7, // 压缩比例
27
+ deleteOriginalAssets: false, // 是否删除原文件
28
+ }));
29
+ }
30
+ return utils_index.mergeConfig({
31
+ mode: 'production',
32
+ devtool: 'source-map',
33
+ optimization: {
34
+ minimize: true,
35
+ runtimeChunk: 'single',
36
+ moduleIds: 'deterministic',
37
+ ...optimization,
38
+ splitChunks: {
39
+ chunks: 'all',
40
+ minSize: 10240,
41
+ maxAsyncRequests: 30,
42
+ maxInitialRequests: 30,
43
+ minChunks: 1,
44
+ maxSize: 1024 * 1024 * 5,
45
+ ...optimization?.splitChunks,
46
+ cacheGroups: {
47
+ vendors: {
48
+ chunks: 'initial',
49
+ name: 'vendors',
50
+ test: /[\\/]node_modules[\\/]/,
51
+ priority: -10,
52
+ reuseExistingChunk: true,
53
+ },
54
+ ...utils_index.get(optimization?.splitChunks, 'cacheGroups', {}),
55
+ },
56
+ },
57
+ },
58
+ plugins: [
59
+ new core.CssExtractRspackPlugin(),
60
+ new webpack_plugins_copy.CopyFolderPlugin({
61
+ patterns: [
62
+ {
63
+ from: publicPathDir,
64
+ to: path.resolve(cwd, outputPathDir, 'public'),
65
+ },
66
+ ...userCopyPatterns,
67
+ ],
68
+ }),
69
+ ...plugins,
70
+ ],
71
+ }, config);
72
+ };
73
+
74
+ exports.getProConfig = getProConfig;
3
75
  //# sourceMappingURL=production.config.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{C as i}from"../plugins/copy.mjs";import{resolve as s}from"path";import{g as t,m as o,a as e}from"../../utils/index.mjs";import{CssExtractRspackPlugin as n}from"@rspack/core";import r from"compression-webpack-plugin";var m=(m,p)=>{const{outputPathDir:a="dist",publicPathDir:u=s(p,t(),".gant/public"),optimization:l,library:c,compression:h=!0,copy:d=[]}=m,g=[];return c?o({mode:"production",optimization:{minimize:!0,...l},plugins:[new n]},m):(!0===h&&g.push(new r({algorithm:"gzip",test:/\.js(\?.*)?$/i,threshold:10240,minRatio:.7,deleteOriginalAssets:!1})),o({mode:"production",devtool:"source-map",optimization:{minimize:!0,runtimeChunk:"single",moduleIds:"deterministic",...l,splitChunks:{chunks:"all",minSize:10240,maxAsyncRequests:30,maxInitialRequests:30,minChunks:1,maxSize:5242880,...l?.splitChunks,cacheGroups:{vendors:{chunks:"initial",name:"vendors",test:/[\\/]node_modules[\\/]/,priority:-10,reuseExistingChunk:!0},...e(l?.splitChunks,"cacheGroups",{})}}},plugins:[new n,new i({patterns:[{from:u,to:s(p,a,"public")},...d]}),...g]},m))};export{m as g};
3
+ //# sourceMappingURL=production.config.mjs.map
@@ -1,3 +1,21 @@
1
- #!/usr/bin/env node
2
- "use strict";var o=require("../../utils/index.js");exports.CopyFolderPlugin=class{options;constructor(o){this.options=o}apply(t){t.hooks.afterEmit.tap("CopyFolderPlugin",()=>{this.options?.patterns?.map(t=>{o.copyFolder(t.from,t.to)})})}};
1
+ 'use strict';
2
+
3
+ var utils_index = require('../../utils/index.js');
4
+
5
+ class CopyFolderPlugin {
6
+ options;
7
+ constructor(options) {
8
+ this.options = options;
9
+ }
10
+ apply(compiler) {
11
+ compiler.hooks.afterEmit.tap('CopyFolderPlugin', () => {
12
+ this.options?.patterns?.map((item) => {
13
+ utils_index.copyFolder(item.from, item.to);
14
+ return;
15
+ });
16
+ });
17
+ }
18
+ }
19
+
20
+ exports.CopyFolderPlugin = CopyFolderPlugin;
3
21
  //# sourceMappingURL=copy.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{c as o}from"../../utils/index.mjs";class t{options;constructor(o){this.options=o}apply(t){t.hooks.afterEmit.tap("CopyFolderPlugin",()=>{this.options?.patterns?.map(t=>{o(t.from,t.to)})})}}export{t as C};
3
+ //# sourceMappingURL=copy.mjs.map
@@ -1,3 +1,5 @@
1
- #!/usr/bin/env node
2
- "use strict";require("fs"),require("path"),require("../../utils/getJavascriptfile.js"),require("net");
1
+ 'use strict';
2
+
3
+ require('../../utils/index.js');
4
+
3
5
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import"../../utils/index.mjs";
3
+ //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- import{r as t}from"../request/index.js";import{groupBy as e,get as s,reduce as a,find as i,keyBy as n,pick as r,isEmpty as o,findIndex as c,isPlainObject as h,cloneDeep as u,mapValues as d,uniqBy as g}from"lodash-es";import m from"mitt";const l=new class{codeLists=[];codeMaps={};async findAllCodeList(){const s=await t("/codeList/findAll",{data:{},serviceId:"fwPlatform"})||[],a=e(s,"type");this.codeLists=s,this.codeMaps=a}getCodeLocaleList=t=>s(this.codeMaps,t,[]);getCodeLocaleName=(t,e)=>{const s=this.getCodeLocaleList(t);function n(t){const e=i(s,e=>e.value===String(t));return e?.name||""}if(Array.isArray(e)){const t=a(e,(t="",e="")=>t+","+n(e),"");return t.slice(1,t.length)}if(String(e).indexOf(",")>=0){const t=e.replace("[","").replace("]","").split(","),s=a(t,(t="",e="")=>t+","+n(e),"");return s.slice(1,s.length)}return n(e)}};l.getCodeLocaleList,l.getCodeLocaleName;const p=new class{parameterList=[];parameterMap={};findAllParameters=async()=>{const e=await t("/parameter/findAll",{serviceId:"fwPlatform",data:{}},{showError:!1})||[],s=n(e,"name");this.parameterList=e,this.parameterMap=s};getSystemParameterByName=t=>"string"==typeof t?this.parameterMap[t]:r(this.parameterMap,t)};const y=(({prefixKey:t="",storage:e=localStorage}={})=>new class{storage=e;prefixKey=t;getKey(t){return`${this.prefixKey}${t}`.toUpperCase()}set(t,e,s=604800){const a=JSON.stringify({value:e,expire:null!==s?(new Date).getTime()+1e3*s:null});this.storage.setItem(this.getKey(t),a)}get(t,e=null){const s=this.storage.getItem(this.getKey(t));if(s)try{const e=JSON.parse(s),{value:a,expire:i}=e;if(null===i||i>=Date.now())return a;this.remove(t)}catch(t){return console.error(t),e}return e}remove(t){this.storage.removeItem(this.getKey(t))}clear(){this.storage.clear()}setCookie(t,e,s=604800){document.cookie=`${this.getKey(t)}=${e}; Max-Age=${s}`}getCookie(t){const e=document.cookie.split("; ");for(let s=0,a=e.length;s<a;s++){const a=e[s].split("=");if(a[0]===this.getKey(t))return a[1]}return""}removeCookie(t){this.setCookie(t,1,-1)}clearCookie(){const t=document.cookie.match(/[^ =;]+(?==)/g);if(t)for(let e=t.length;e--;)document.cookie=t[e]+"=0;expire="+new Date(0).toUTCString()}})();class f{userIdentity={};currentUser={};isSuperAdmin=!1;roles=[];functions=[];delegations=[];userSetting={};users=[];getUserIdentity(){if(!o(this.userIdentity))return this.userIdentity;const t=y?.get("userIdentity");return t||{}}setUserIdentity(t){return this.userIdentity={...this.userIdentity,...t},y.set("userIdentity",this.userIdentity),this.userIdentity}clearUserIdentity(){y.remove("userIdentity"),this.userIdentity={}}setUserAggregateInfo=({delegations:t,roles:e,functions:s,isSuperAdmin:a,currentUser:i})=>{this.delegations=t,this.roles=e,this.functions=s,this.isSuperAdmin=a,this.currentUser=i};getUserSettingType=t=>`${this.currentUser.id}-${t}`;getUserSetting=async e=>{const s=this.getUserSettingType(e),a=this.currentUser.id;if(this.userSetting[s])return this.userSetting[s];const i=await async function(e){return t("/accountUserSelf/getUserData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:a+e}),n=i?.bigData?JSON.parse(i.bigData):void 0;return this.userSetting[s]=n,n};updateUserSetting=async(e,s)=>{const a=this.getUserSettingType(e),i=this.currentUser.id;return await async function(e,s){return t("/accountUserSelf/setUserData",{data:e,serviceId:"fwSecurity"},s)}({dataType:e,dataId:i+e,bigData:JSON.stringify(s)}),this.userSetting[a]=s,s};removeUserSetting=async e=>{const s=this.getUserSettingType(e),a=this.currentUser.id;await async function(e,s){return t("/accountUserSelf/delUserData",{data:e,serviceId:"fwSecurity"},s)}({dataType:e,dataId:a}),delete this.userSetting[s]};getUserInfo=async(e,a)=>{const i=c(this.users,t=>a?t.userLoginName===e:t.id===e);if(i>-1)return s(this.users,`[${i}]`);const n=a?await async function(e){return t("/security/getUserByUserLoginName",{method:"POST",data:{userLoginName:e},serviceId:"fwSecurity"})}(e):await async function(e){return t("/security/getUserById",{method:"POST",data:{id:e},serviceId:"fwSecurity"})}(e);return h(n)&&this.users.push(n),n}}const w=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,S=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,L=t=>w.test(t)||S.test(t)||0===t?.indexOf("/")?t:"/"+t,I="MENU_HISTORY_UPDATE",P="MENU_BREADCRUMBS_UPDATE";m();class U{menuDataMaps={};menuData=[];menuPathMaps={};breadcrumbs=[];menuHistorys=[];userId;emitter;constructor(){this.emitter=m()}addListenerMenuHistorys=t=>{this.emitter.on(I,t)};removeListenerMenuHistorys=t=>this.emitter.off(I,t);addListenerBreadcrumbs=t=>this.emitter.on(P,t);removeListenerBreadcrumbs=t=>this.emitter.off(P,t);getTreeMenuData=(t,e,s)=>t.map(t=>{const{id:a,path:i,leaf:n}=t,r=e[a],o={...t,key:a,path:s?s+L(i):L(i)};if(r&&!n){const t=this.getTreeMenuData(r,e,o.path);o.children=t}return this.menuDataMaps[o.path]=o,o}).sort((t,e)=>t.seqNum-e.seqNum);init=(t,s)=>{const a=u(t);if(o(a))return;const i=e(a,"parentResourceId"),{ROOT:n,...r}=i;this.menuData=this.getTreeMenuData(n,r),this.menuData=[...this.menuData];const c=d(this.menuDataMaps,"name");this.updateMenuMaps(c),this.initMenuHistorys(s)};updateMenuMaps=t=>{this.menuPathMaps={...this.menuPathMaps,...t};const e=this.menuHistorys.map(t=>{const e=this.menuPathMaps[t.pathname];return{pathname:t.pathname,name:e||t.name}}),s=this.breadcrumbs.map(t=>{const e=this.menuPathMaps[t.pathname];return{...t,name:e||t.name}});this.updatehistorys(e),this.updateBreadcrumbs(s)};liseterHistorys=t=>{let e=this.menuHistorys;this.menuDataMaps[t]?.leaf&&!e.some(e=>e.pathname===t)&&(e=[{pathname:t,name:this.menuPathMaps[t]},...e],this.updatehistorys(e))};updatehistorys=t=>{if(!this.userId)return;const e=t.map(t=>({...t,name:t.name?t.name:this.menuPathMaps[t.pathname]}));this.menuHistorys=e,this.menuHistorys=g(this.menuHistorys,"pathname"),this.emitter.emit(I,this.menuHistorys),y.set(`${this.userId}-menu-history`,this.menuHistorys)};initMenuHistorys=t=>{this.userId=t;const e=y.get(`${t}-menu-history`,this.menuHistorys);this.updatehistorys(e)};liseterBreadcrumbs=t=>{const e=t.split("/");let s=1;const a=[],i={pathname:t,name:this.menuPathMaps[t]};for(;s<e.length;){const t=e.slice(0,s).join("/");this.menuPathMaps[t]&&a.push({name:this.menuPathMaps[t],pathname:t}),s++}a.push(i),this.updateBreadcrumbs(a)};updateBreadcrumbs=t=>{this.breadcrumbs=t,this.breadcrumbs=g(this.breadcrumbs,"pathname"),this.emitter.emit(P,t)}}class C{loginPathname;BASE="/";get baseLoginPathname(){return`${this.BASE}${this.loginPathname?.replace("/","")}`}tokenValue="";get isLoginPathname(){const t=window.location.pathname;return this.baseLoginPathname==t}getRealPath=t=>`${this.BASE}${t.replace("/","")}`;chekToken=async()=>{const e=await t("/authentication/checkToken",{serviceId:"fwSecurity"},{showError:!1});return e&&this.isLoginPathname&&window.location.replace(this.BASE),e};getLoginMethod=async()=>t("/authentication/getLoginMethod",{serviceId:"fwSecurity"});redirectBaseLogin=async()=>{const t=window.location.pathname,e=window.location.href;if(this.isLoginPathname)return!0;const s=new URLSearchParams(window.location.search),a=new URLSearchParams;"true"===s.get("forceLocal")&&a.append("forceLocal","true"),t!==this.BASE&&"/"!==t&&a.append("redirectUrl",e);const i=decodeURIComponent(a.toString());return window.location.replace(`${this.baseLoginPathname}${i?"?"+decodeURIComponent(a.toString()):""}`),!1};checkPassword=async()=>"noPass"!==await t("/security/checkPasswordUpdateTime",{data:{}},{showError:!1})||(this.tokenValue=await t("/authentication/extractToken",{data:{}}),!1);refactorToken=async()=>{var e;await(e=this.tokenValue,t("/authentication/refactorToken",{data:{value:e}}))};login=async t=>{const e=await this.baseLogin(t);return e.error,e};baseLogin=async e=>{const s={error:void 0,data:void 0};try{const a=await function(e){return t("/authentication/login",{data:e,serviceId:"fwSecurity"})}(e),{userToken:i,traceId:n}=a;if(i){s.data=a;return await this.checkPassword()||(s.error="passwordExpiration"),s}return n?(s.data=a,s.error="SLIDER_VERIFICATION_LOGIN",s):(s.error="passwordError",s)}catch(t){return s.error="validateError",s}};loginSuccess=()=>{let t=new URLSearchParams(window.location.search).get("redirectUrl");t?window.location.href=t:window.location.replace(this.BASE)};baseLoginOut=async e=>{const s=new URLSearchParams,a=window.location.href;window.location.pathname!==this.BASE&&s.append("redirectUrl",a),await t("/authentication/logout",{data:{},serviceId:"fwSecurity"}),e?window.location.replace(`${this.baseLoginPathname}?${s.toString()}`):window.location.replace(this.baseLoginPathname)}}const k={sso:!1,ssoUrlSearchParams:["ticket"],ssoCheckTokenUrl:"",ssoSuccessUrlkey:"successUrl",ssoLoginUrl:window.location.origin+"/fwSecurity/ssoAuth/login.api",ssologinOutUrl:window.location.origin+"/fwSecurity/ssoAuth/logout.api"};class v{init(t){this.ssoConfig={...this.ssoConfig,...t}}ssoConfig=k;isSso=async e=>{if(!this.ssoConfig.sso)return!1;let s=!1;try{s=await t("/ssoAuthConfig/checkOnlyRedirect",{},{showError:!1})}catch(t){console.error("sso",t)}return e&&(s=await e()),!!s};ssoLogin=()=>{const{ssoSuccessUrlkey:t,ssoUrlSearchParams:e,ssoLoginUrl:s}=this.ssoConfig,a=new URLSearchParams(window.location.search.slice(1)),i=new URLSearchParams,n=window.location.href;return i.append(t,encodeURIComponent(n)),e.map(t=>{const e=a.get(t);e&&i.append(t,e)}),window.location.href=`${s}?${i.toString()}`,!1};ssoLoginOut=()=>{window.location.href=this.ssoConfig.ssologinOutUrl}}class D{getValidateCodeImage=e=>function(e={}){return t("/authentication/getValidateCode",{data:e,serviceId:"fwSecurity"})}(e);sliderVerificationCodeImage=()=>t("/authentication/sliderVerificationCode",{method:"POST",serviceId:"fwSecurity"});checkCaptcha=e=>{return s=e,t("/authentication/checkCaptcha",{method:"POST",data:{...s},serviceId:"fwSecurity"});var s}}class A extends C{ssoLogin;validate;noCheckPermissionsPath=[];ssoCallback;constructor(){super(),this.ssoLogin=new v,this.validate=new D}init=(t,e="/",s)=>{this.BASE=e,this.ssoCallback=s,this.noCheckPermissionsPath=t?.noCheckPermissionsPath,this.ssoLogin.init(t),this.loginPathname=t?.loginPathname||"/login"};isNoLoginRequiredPage=()=>{const t=window.location.pathname,e=this.noCheckPermissionsPath?.some(e=>this.getRealPath(e)==t);return e};loginOut=async()=>{await this.ssoLogin.isSso(this.ssoCallback)&&this.ssoLogin.ssoLoginOut(),await this.baseLoginOut()};loginAuthentication=async e=>{var s;await(s=e,t("/authentication/beforeLoginCheckCode",{method:"POST",data:{...s},serviceId:"fwSecurity"})),this.loginSuccess()};redirectLogin=async()=>{if(this.ssoLogin.ssoConfig.sso){if(await this.ssoLogin.isSso())return this.ssoCallback()?(this.ssoLogin.ssoLogin(),!1):!!this.isNoLoginRequiredPage()||this.redirectBaseLogin()}return!!this.isNoLoginRequiredPage()||(!!this.isLoginPathname||await this.redirectBaseLogin())}}const M=new class{userStore;menuStore;loginStore;isSuperAdmin=!1;loginCallback;constructor(){this.userStore=new f,this.menuStore=new U,this.loginStore=new A}platformLanguages=[];productInfo={isProdEnv:!1,productName:""};get isPrd(){return this.productInfo?.isProdEnv}get userInfo(){return this.userStore.currentUser}get menuData(){return this.menuStore.menuData}findPlantform=async()=>{const e=await t("/platformManage/getPlatformAggregateInfo",{method:"POST"},{showError:!1});this.platformLanguages=e.platformLanguages,this.productInfo=e.productInfo};getAggregateInfo=async e=>{const s=await async function(){return t("/security/findUserAggregateInfo",{method:"POST"})}(),{user:a,startMenus:i,isSuperAdmin:n,...r}=s;this.userStore.setUserAggregateInfo({...r,currentUser:a}),this.isSuperAdmin=n;const c="function"==typeof e?await e(s):e;this.menuStore.init(o(c)?i:c,a.id)};init=async t=>{const{base:e="/",menuData:s,loginSuccessCallback:a,ssoCallback:i}=t;this.loginStore.init(t?.loginConfig,e,i);try{const t=await this.loginStore.chekToken();return t?(this.userStore.setUserIdentity(t),await this.getAggregateInfo(s),await l.findAllCodeList(),await p.findAllParameters(),await(a?.()),!0):await this.loginStore.redirectLogin()}catch(t){console.error(t)}return!1}};const b="company-v1";var T=new class{data={};getCompanyDataType=t=>`${b}-${t}`;getCompanyData=async e=>{const s=this.getCompanyDataType(e);if(this.data[s])return this.data[s];const a=await async function(e){return t("/companyData/getCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:b}),i=a?.bigData?JSON.parse(a.bigData):void 0;return this.data[s]=i,i};updateCompanyData=async(e,s)=>{const a=this.getCompanyDataType(e);return await async function(e){return t("/companyData/setCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:b,bigData:JSON.stringify(s)}),this.data[a]=s,s};removeCompanyData=async e=>{const s=this.getCompanyDataType(e);await async function(e){return t("/companyData/delCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:b}),delete this.data[s]}};const O=l,E=p,$=M.userStore,B=M.loginStore,N=M.menuStore;export{P as M,I as a,O as c,M as g,T as i,B as l,N as m,E as p,y as s,$ as u};
1
+ import{r as t}from"../request/index.js";import{groupBy as e,get as s,reduce as a,find as i,keyBy as n,pick as r,isEmpty as o,findIndex as c,isPlainObject as h,cloneDeep as u,mapValues as d,uniqBy as g}from"lodash-es";import m from"mitt";const l=new class{codeLists=[];codeMaps={};async findAllCodeList(){const s=await t("/codeList/findAll",{data:{},serviceId:"fwPlatform"})||[],a=e(s,"type");this.codeLists=s,this.codeMaps=a}getCodeLocaleList=t=>s(this.codeMaps,t,[]);getCodeLocaleName=(t,e)=>{const s=this.getCodeLocaleList(t);function n(t){const e=i(s,e=>e.value===String(t));return e?.name||""}if(Array.isArray(e)){const t=a(e,(t="",e="")=>t+","+n(e),"");return t.slice(1,t.length)}if(String(e).indexOf(",")>=0){const t=e.replace("[","").replace("]","").split(","),s=a(t,(t="",e="")=>t+","+n(e),"");return s.slice(1,s.length)}return n(e)}};l.getCodeLocaleList,l.getCodeLocaleName;const p=new class{parameterList=[];parameterMap={};findAllParameters=async()=>{const e=await t("/parameter/findAll",{serviceId:"fwPlatform",data:{}},{showError:!1})||[],s=n(e,"name");this.parameterList=e,this.parameterMap=s};getSystemParameterByName=t=>"string"==typeof t?this.parameterMap[t]:r(this.parameterMap,t)};const y=(({prefixKey:t="",storage:e=localStorage}={})=>new class{storage=e;prefixKey=t;getKey(t){return`${this.prefixKey}${t}`.toUpperCase()}set(t,e,s=604800){const a=JSON.stringify({value:e,expire:null!==s?(new Date).getTime()+1e3*s:null});this.storage.setItem(this.getKey(t),a)}get(t,e=null){const s=this.storage.getItem(this.getKey(t));if(s)try{const e=JSON.parse(s),{value:a,expire:i}=e;if(null===i||i>=Date.now())return a;this.remove(t)}catch(t){return console.error(t),e}return e}remove(t){this.storage.removeItem(this.getKey(t))}clear(){this.storage.clear()}setCookie(t,e,s=604800){document.cookie=`${this.getKey(t)}=${e}; Max-Age=${s}`}getCookie(t){const e=document.cookie.split("; ");for(let s=0,a=e.length;s<a;s++){const a=e[s].split("=");if(a[0]===this.getKey(t))return a[1]}return""}removeCookie(t){this.setCookie(t,1,-1)}clearCookie(){const t=document.cookie.match(/[^ =;]+(?==)/g);if(t)for(let e=t.length;e--;)document.cookie=t[e]+"=0;expire="+new Date(0).toUTCString()}})();class f{userIdentity={};currentUser={};isSuperAdmin=!1;roles=[];functions=[];delegations=[];userSetting={};users=[];getUserIdentity(){if(!o(this.userIdentity))return this.userIdentity;const t=y?.get("userIdentity");return t||{}}setUserIdentity(t){return this.userIdentity={...this.userIdentity,...t},y.set("userIdentity",this.userIdentity),this.userIdentity}clearUserIdentity(){y.remove("userIdentity"),this.userIdentity={}}setUserAggregateInfo=({delegations:t,roles:e,functions:s,isSuperAdmin:a,currentUser:i})=>{this.delegations=t,this.roles=e,this.functions=s,this.isSuperAdmin=a,this.currentUser=i};getUserSettingType=t=>`${this.currentUser.id}-${t}`;getUserSetting=async e=>{const s=this.getUserSettingType(e),a=this.currentUser.id;if(this.userSetting[s])return this.userSetting[s];const i=await async function(e){return t("/accountUserSelf/getUserData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:a+e}),n=i?.bigData?JSON.parse(i.bigData):void 0;return this.userSetting[s]=n,n};updateUserSetting=async(e,s)=>{const a=this.getUserSettingType(e),i=this.currentUser.id;return await async function(e,s){return t("/accountUserSelf/setUserData",{data:e,serviceId:"fwSecurity"},s)}({dataType:e,dataId:i+e,bigData:JSON.stringify(s)}),this.userSetting[a]=s,s};removeUserSetting=async e=>{const s=this.getUserSettingType(e),a=this.currentUser.id;await async function(e,s){return t("/accountUserSelf/delUserData",{data:e,serviceId:"fwSecurity"},s)}({dataType:e,dataId:a}),delete this.userSetting[s]};getUserInfo=async(e,a)=>{const i=c(this.users,t=>a?t.userLoginName===e:t.id===e);if(i>-1)return s(this.users,`[${i}]`);const n=a?await async function(e){return t("/security/getUserByUserLoginName",{method:"POST",data:{userLoginName:e},serviceId:"fwSecurity"})}(e):await async function(e){return t("/security/getUserById",{method:"POST",data:{id:e},serviceId:"fwSecurity"})}(e);return h(n)&&this.users.push(n),n}}const w=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,S=/^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,L=t=>w.test(t)||S.test(t)||0===t?.indexOf("/")?t:"/"+t,I="MENU_HISTORY_UPDATE",P="MENU_BREADCRUMBS_UPDATE";m();class U{menuDataMaps={};menuData=[];menuPathMaps={};breadcrumbs=[];menuHistorys=[];userId;emitter;constructor(){this.emitter=m()}addListenerMenuHistorys=t=>{this.emitter.on(I,t)};removeListenerMenuHistorys=t=>this.emitter.off(I,t);addListenerBreadcrumbs=t=>this.emitter.on(P,t);removeListenerBreadcrumbs=t=>this.emitter.off(P,t);getTreeMenuData=(t,e,s)=>t.map(t=>{const{id:a,path:i,leaf:n}=t,r=e[a],o={...t,key:a,path:s?s+L(i):L(i)};if(r&&!n){const t=this.getTreeMenuData(r,e,o.path);o.children=t}return this.menuDataMaps[o.path]=o,o}).sort((t,e)=>t.seqNum-e.seqNum);init=(t,s)=>{const a=u(t);if(o(a))return;const i=e(a,"parentResourceId"),{ROOT:n,...r}=i;this.menuData=this.getTreeMenuData(n,r),this.menuData=[...this.menuData];const c=d(this.menuDataMaps,"name");this.updateMenuMaps(c),this.initMenuHistorys(s)};updateMenuMaps=t=>{this.menuPathMaps={...this.menuPathMaps,...t};const e=this.menuHistorys.map(t=>{const e=this.menuPathMaps[t.pathname];return{pathname:t.pathname,name:e||t.name}}),s=this.breadcrumbs.map(t=>{const e=this.menuPathMaps[t.pathname];return{...t,name:e||t.name}});this.updatehistorys(e),this.updateBreadcrumbs(s)};liseterHistorys=t=>{let e=this.menuHistorys;this.menuDataMaps[t]?.leaf&&!e.some(e=>e.pathname===t)&&(e=[{pathname:t,name:this.menuPathMaps[t]},...e],this.updatehistorys(e))};updatehistorys=t=>{if(!this.userId)return;const e=t.map(t=>({...t,name:t.name?t.name:this.menuPathMaps[t.pathname]}));this.menuHistorys=e,this.menuHistorys=g(this.menuHistorys,"pathname"),this.emitter.emit(I,this.menuHistorys),y.set(`${this.userId}-menu-history`,this.menuHistorys)};initMenuHistorys=t=>{this.userId=t;const e=y.get(`${t}-menu-history`,this.menuHistorys);this.updatehistorys(e)};liseterBreadcrumbs=t=>{const e=t.split("/");let s=1;const a=[],i={pathname:t,name:this.menuPathMaps[t]};for(;s<e.length;){const t=e.slice(0,s).join("/");this.menuPathMaps[t]&&a.push({name:this.menuPathMaps[t],pathname:t}),s++}a.push(i),this.updateBreadcrumbs(a)};updateBreadcrumbs=t=>{this.breadcrumbs=t,this.breadcrumbs=g(this.breadcrumbs,"pathname"),this.emitter.emit(P,t)}}class C{loginPathname;BASE="/";get baseLoginPathname(){return`${this.BASE}${this.loginPathname?.replace("/","")}`}tokenValue="";get isLoginPathname(){const t=window.location.pathname;return this.baseLoginPathname==t}getRealPath=t=>`${this.BASE}${t.replace("/","")}`;chekToken=async()=>{const e=await t("/authentication/checkToken",{serviceId:"fwSecurity"},{showError:!1});return e&&this.isLoginPathname&&window.location.replace(this.BASE),e};getLoginMethod=async()=>t("/authentication/getLoginMethod",{serviceId:"fwSecurity"});redirectBaseLogin=async()=>{const t=window.location.pathname,e=window.location.href;if(this.isLoginPathname)return!0;const s=new URLSearchParams(window.location.search),a=new URLSearchParams;"true"===s.get("forceLocal")&&a.append("forceLocal","true"),t!==this.BASE&&"/"!==t&&a.append("redirectUrl",e);const i=decodeURIComponent(a.toString());return window.location.replace(`${this.baseLoginPathname}${i?"?"+decodeURIComponent(a.toString()):""}`),!1};checkPassword=async()=>"noPass"!==await t("/security/checkPasswordUpdateTime",{data:{}},{showError:!1})||(this.tokenValue=await t("/authentication/extractToken",{data:{}}),!1);refactorToken=async()=>{var e;await(e=this.tokenValue,t("/authentication/refactorToken",{data:{value:e}}))};login=async t=>{const e=await this.baseLogin(t);return e.error,e};baseLogin=async e=>{const s={error:void 0,data:void 0};try{const a=await function(e){return t("/authentication/login",{data:e,serviceId:"fwSecurity"})}(e),{userToken:i,traceId:n}=a;if(i){s.data=a;return await this.checkPassword()||(s.error="passwordExpiration"),s}return n?(s.data=a,s.error="SLIDER_VERIFICATION_LOGIN",s):(s.error="passwordError",s)}catch(t){return s.error="validateError",s}};loginSuccess=()=>{let t=new URLSearchParams(window.location.search).get("redirectUrl");t?window.location.href=t:window.location.replace(this.BASE)};baseLoginOut=async e=>{const s=new URLSearchParams,a=window.location.href;window.location.pathname!==this.BASE&&s.append("redirectUrl",a),await t("/authentication/logout",{data:{},serviceId:"fwSecurity"}),e?window.location.replace(`${this.baseLoginPathname}?${s.toString()}`):window.location.replace(this.baseLoginPathname)}}const k={sso:!1,ssoUrlSearchParams:["ticket"],ssoSuccessUrlkey:"successUrl",ssoLoginUrl:window.location.origin+"/fwSecurity/ssoAuth/login.api",ssologinOutUrl:window.location.origin+"/fwSecurity/ssoAuth/logout.api",ssoCheckTokenUrl:window.location.origin+"/fwSecurity/ssoAuth/checkToken.api"};class v{init(t){this.ssoConfig={...this.ssoConfig,...t}}ssoConfig=k;isSso=async e=>{if(!this.ssoConfig.sso)return!1;let s=!1;try{s=await(a=this.ssoConfig.ssoCheckTokenUrl,t(a,{},{showError:!1}))}catch(t){console.error("sso",t)}var a;return e&&(s=await e()),!!s};ssoLogin=()=>{const{ssoSuccessUrlkey:t,ssoUrlSearchParams:e,ssoLoginUrl:s}=this.ssoConfig,a=new URLSearchParams(window.location.search.slice(1)),i=new URLSearchParams,n=window.location.href;return i.append(t,encodeURIComponent(n)),e.map(t=>{const e=a.get(t);e&&i.append(t,e)}),window.location.href=`${s}?${i.toString()}`,!1};ssoLoginOut=()=>{window.location.href=this.ssoConfig.ssologinOutUrl}}class D{getValidateCodeImage=e=>function(e={}){return t("/authentication/getValidateCode",{data:e,serviceId:"fwSecurity"})}(e);sliderVerificationCodeImage=()=>t("/authentication/sliderVerificationCode",{method:"POST",serviceId:"fwSecurity"});checkCaptcha=e=>{return s=e,t("/authentication/checkCaptcha",{method:"POST",data:{...s},serviceId:"fwSecurity"});var s}}class T extends C{ssoLogin;validate;noCheckPermissionsPath=[];ssoCallback;constructor(){super(),this.ssoLogin=new v,this.validate=new D}init=(t,e="/",s)=>{this.BASE=e,this.ssoCallback=s,this.noCheckPermissionsPath=t?.noCheckPermissionsPath,this.ssoLogin.init(t),this.loginPathname=t?.loginPathname||"/login"};isNoLoginRequiredPage=()=>{const t=window.location.pathname,e=this.noCheckPermissionsPath?.some(e=>this.getRealPath(e)==t);return e};loginOut=async()=>{await this.ssoLogin.isSso(this.ssoCallback)&&this.ssoLogin.ssoLoginOut(),await this.baseLoginOut()};loginAuthentication=async e=>{var s;await(s=e,t("/authentication/beforeLoginCheckCode",{method:"POST",data:{...s},serviceId:"fwSecurity"})),this.loginSuccess()};redirectLogin=async()=>{if(this.ssoLogin.ssoConfig.sso){if(await this.ssoLogin.isSso())return this.ssoCallback()?(this.ssoLogin.ssoLogin(),!1):!!this.isNoLoginRequiredPage()||this.redirectBaseLogin()}return!!this.isNoLoginRequiredPage()||(!!this.isLoginPathname||await this.redirectBaseLogin())}}const A=new class{userStore;menuStore;loginStore;isSuperAdmin=!1;loginCallback;constructor(){this.userStore=new f,this.menuStore=new U,this.loginStore=new T}platformLanguages=[];productInfo={isProdEnv:!1,productName:""};get isPrd(){return this.productInfo?.isProdEnv}get userInfo(){return this.userStore.currentUser}get menuData(){return this.menuStore.menuData}findPlantform=async()=>{const e=await t("/platformManage/getPlatformAggregateInfo",{method:"POST"},{showError:!1});this.platformLanguages=e.platformLanguages,this.productInfo=e.productInfo};getAggregateInfo=async e=>{const s=await async function(){return t("/security/findUserAggregateInfo",{method:"POST"})}(),{user:a,startMenus:i,isSuperAdmin:n,...r}=s;this.userStore.setUserAggregateInfo({...r,currentUser:a}),this.isSuperAdmin=n;const c="function"==typeof e?await e(s):e;this.menuStore.init(o(c)?i:c,a.id)};init=async t=>{const{base:e="/",menuData:s,loginSuccessCallback:a,ssoCallback:i}=t;this.loginStore.init(t?.loginConfig,e,i);try{const t=await this.loginStore.chekToken();return t?(this.userStore.setUserIdentity(t),await this.getAggregateInfo(s),await l.findAllCodeList(),await p.findAllParameters(),await(a?.()),!0):await this.loginStore.redirectLogin()}catch(t){console.error(t)}return!1}};const M="company-v1";var b=new class{data={};getCompanyDataType=t=>`${M}-${t}`;getCompanyData=async e=>{const s=this.getCompanyDataType(e);if(this.data[s])return this.data[s];const a=await async function(e){return t("/companyData/getCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:M}),i=a?.bigData?JSON.parse(a.bigData):void 0;return this.data[s]=i,i};updateCompanyData=async(e,s)=>{const a=this.getCompanyDataType(e);return await async function(e){return t("/companyData/setCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:M,bigData:JSON.stringify(s)}),this.data[a]=s,s};removeCompanyData=async e=>{const s=this.getCompanyDataType(e);await async function(e){return t("/companyData/delCompanyData",{data:e,serviceId:"fwSecurity"})}({dataType:e,dataId:M}),delete this.data[s]}};const O=l,E=p,$=A.userStore,B=A.loginStore,N=A.menuStore;export{P as M,I as a,O as c,A as g,b as i,B as l,N as m,E as p,y as s,$ as u};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gant-core",
3
- "version": "2.0.1",
3
+ "version": "2.0.4",
4
4
  "description": "",
5
5
  "main": "lib/core/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "./cli": {
13
13
  "types": "./lib/cli/index.d.ts",
14
- "require": "./lib/cli/index.js"
14
+ "import": "./lib/cli/index.mjs"
15
15
  },
16
16
  "./*": "./*"
17
17
  },
package/rollup.config.js CHANGED
@@ -27,11 +27,11 @@ module.exports = [
27
27
  input: 'src/cli/index.ts', // 入口文件
28
28
  output: {
29
29
  dir: 'lib/cli', // 输出文件
30
- format: 'cjs', // 输出格式设置为
30
+ format: 'es', // ESM 格式,兼容 @rspack/core 等 ESM-only 依赖
31
31
  sourcemap: true, // 生成 sourcemap 以支持 npm link 调试
32
- banner: '#!/usr/bin/env node', // 添加shebang,使得生成的文件可以直接作为可执行文件使
33
- entryFileNames: 'index.js', // 控制入口文件的名称为 index.js
34
- chunkFileNames: '[name].js', // 控制 chunk 的名称
32
+ banner: '#!/usr/bin/env node',
33
+ entryFileNames: '[name].mjs', // 控制入口文件的名称为 index.mjs
34
+ chunkFileNames: '[name].mjs', // 控制 chunk 的名称
35
35
  manualChunks(id) {
36
36
  if (['.json', '.d.ts'].some(suffix => id.includes(suffix))) return;
37
37
  const filenames = ['i18n', 'create', 'copyfiles', 'webpack', 'tsconfig', 'routes', 'utils', 'config'];
@@ -51,6 +51,7 @@ module.exports = [
51
51
  'compression-webpack-plugin',
52
52
  'chokidar',
53
53
  'jiti',
54
+ 'prettier',
54
55
  ],
55
56
  plugins: [
56
57
  ...plugins,
@@ -1,8 +0,0 @@
1
- # Changesets
2
-
3
- Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
- with multi-package repos, or single-package repos to help you version and publish your code. You can
5
- find the full documentation for it [in our repository](https://github.com/changesets/changesets).
6
-
7
- We have a quick list of common questions to get you started engaging with this project in
8
- [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md).
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
3
- "changelog": "@changesets/cli/changelog",
4
- "commit": false,
5
- "fixed": [],
6
- "linked": [],
7
- "access": "public",
8
- "baseBranch": "master",
9
- "updateInternalDependencies": "patch",
10
- "ignore": []
11
- }