gant-core 0.2.36 → 2.0.1

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 (67) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +11 -0
  3. package/CHANGELOG.md +14 -0
  4. package/eslint.config.mjs +26 -0
  5. package/lib/cli/acorn.js +2 -1
  6. package/lib/cli/angular.js +2 -1
  7. package/lib/cli/babel.js +2 -1
  8. package/lib/cli/config/defineConfig.js +103 -1
  9. package/lib/cli/config/index.js +2 -1
  10. package/lib/cli/copyfiles/index.js +2 -1
  11. package/lib/cli/create/config/index.js +3 -2
  12. package/lib/cli/create/index.js +1 -0
  13. package/lib/cli/create/module/index.js +2 -9
  14. package/lib/cli/estree.js +2 -1
  15. package/lib/cli/flow.js +2 -1
  16. package/lib/cli/glimmer.js +2 -1
  17. package/lib/cli/graphql.js +2 -1
  18. package/lib/cli/html.js +2 -1
  19. package/lib/cli/i18n/index.js +3 -2
  20. package/lib/cli/i18n/utils.js +2 -1
  21. package/lib/cli/index.d.ts +1836 -0
  22. package/lib/cli/index.js +2 -1
  23. package/lib/cli/markdown.js +2 -1
  24. package/lib/cli/meriyah.js +2 -1
  25. package/lib/cli/postcss.js +2 -1
  26. package/lib/cli/routes/index.js +2 -1
  27. package/lib/cli/template/template.vue.config.txt +1 -1
  28. package/lib/cli/template/types.d.txt +134 -132
  29. package/lib/cli/tsconfig/index.js +2 -1
  30. package/lib/cli/typescript.js +2 -1
  31. package/lib/cli/utils/detectPort.js +3 -0
  32. package/lib/cli/utils/getJavascriptfile.js +2 -1
  33. package/lib/cli/utils/index.js +2 -1
  34. package/lib/cli/webpack/Webpack.js +2 -1
  35. package/lib/cli/webpack/config/analyzer.config.js +2 -1
  36. package/lib/cli/webpack/config/browsers.js +1 -0
  37. package/lib/cli/webpack/config/cssRules.js +2 -1
  38. package/lib/cli/webpack/config/default.config.js +2 -1
  39. package/lib/cli/webpack/config/development.config.js +2 -1
  40. package/lib/cli/webpack/config/framework/index.js +3 -0
  41. package/lib/cli/webpack/config/framework/react.js +3 -0
  42. package/lib/cli/webpack/config/framework/vue.js +3 -0
  43. package/lib/cli/webpack/config/index.js +1 -0
  44. package/lib/cli/webpack/config/production.config.js +2 -1
  45. package/lib/cli/webpack/plugins/copy.js +2 -1
  46. package/lib/cli/webpack/plugins/index.js +2 -1
  47. package/lib/cli/yaml.js +2 -1
  48. package/lib/core/i18n/index.js +1 -1
  49. package/lib/core/index.js +1 -1
  50. package/lib/core/microservices/index.js +10 -1
  51. package/lib/core/request/index.js +1 -1
  52. package/lib/core/store/index.js +1 -1
  53. package/lib/core/theme/index.js +1 -1
  54. package/lib/core/utils/index.js +83 -1
  55. package/lib/types/index.d.ts +115 -104
  56. package/package.json +62 -44
  57. package/rollup.config.js +27 -10
  58. package/tsconfig.json +1 -0
  59. package/lib/core/cache/index.js.map +0 -1
  60. package/lib/core/event/index.js.map +0 -1
  61. package/lib/core/i18n/index.js.map +0 -1
  62. package/lib/core/index.js.map +0 -1
  63. package/lib/core/microservices/index.js.map +0 -1
  64. package/lib/core/request/index.js.map +0 -1
  65. package/lib/core/store/index.js.map +0 -1
  66. package/lib/core/theme/index.js.map +0 -1
  67. package/lib/core/utils/index.js.map +0 -1
@@ -1,2 +1,84 @@
1
- import{s as t,g as e}from"../store/index.js";import{find as r,get as a,isEmpty as n,groupBy as o,has as s,join as i}from"lodash-es";const l="LOCALE-v1",c=t=>"en"===t?"en-US":t,d=()=>{let n=t.get(l);if(n)return n;const o=r(e?.platformLanguages,{isDefault:!0});return a(o,"locale","zh_CN")},f=e=>(t.set(l,e),location.reload(),e),p=t=>{if(n(t))return[];const e=o(t,"parentId"),{root:r,...a}=e,l=(t,e="/")=>t.map((t=>{const{id:r,path:n,...o}=t,c=0==n.indexOf("/**")?n:((...t)=>{let e=i(t,"/");return e=e.replace(/\/+/g,"/"),e.startsWith("/")||(e="/"+e),e})(e,n);return s(a,r)?{...o,id:r,children:l(a[r],c),path:c}:{...o,path:c,id:r}}));return l(r)};function h(t=32,e=10){const r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[];let n;const o=e||r.length;if(t)for(n=0;n<t;n++)a[n]=r[0|Math.random()*o];else{let t;for(a[8]=a[13]=a[18]=a[23]="-",a[14]="4",n=0;n<36;n++)a[n]||(t=0|16*Math.random(),a[n]=r[19==n?3&t|8:t])}return a.join("")}export{h as a,c as b,p as c,d as g,f as s};
1
+ import { s as storage, g as globalStore } from '../store/index.js';
2
+ import { find, get, isEmpty, groupBy, has, join } from 'lodash-es';
3
+
4
+ const LOCALE_VERSION = 'LOCALE-v1';
5
+ const getAntdLocaleKey = (localeKey) => {
6
+ if (localeKey === 'en')
7
+ return 'en-US';
8
+ return localeKey;
9
+ };
10
+ const getLocaleKey = () => {
11
+ let key = storage.get(LOCALE_VERSION);
12
+ if (!!key)
13
+ return key;
14
+ const defaultLoacle = find(globalStore?.platformLanguages, {
15
+ isDefault: true,
16
+ });
17
+ return get(defaultLoacle, 'locale', 'zh_CN');
18
+ };
19
+ const setLocaleKey = (locale) => {
20
+ storage.set(LOCALE_VERSION, locale);
21
+ location.reload();
22
+ return locale;
23
+ };
24
+
25
+ const resolvePath = (...paths) => {
26
+ let resolved = join(paths, '/');
27
+ resolved = resolved.replace(/\/+/g, '/');
28
+ if (!resolved.startsWith('/')) {
29
+ resolved = '/' + resolved;
30
+ }
31
+ return resolved;
32
+ };
33
+ const getRoutes = (routesMaps) => {
34
+ if (isEmpty(routesMaps))
35
+ return [];
36
+ const groupRotes = groupBy(routesMaps, 'parentId');
37
+ const { root, ...otherRoutes } = groupRotes;
38
+ const mapRoutes = (routes, parentPath = '/') => {
39
+ return routes.map((itemRoute) => {
40
+ const { id, path, ...restRoute } = itemRoute;
41
+ const itemPath = path.indexOf('/**') == 0 ? path : resolvePath(parentPath, path);
42
+ if (has(otherRoutes, id))
43
+ return {
44
+ ...restRoute,
45
+ id,
46
+ children: mapRoutes(otherRoutes[id], itemPath),
47
+ path: itemPath,
48
+ };
49
+ return { ...restRoute, path: itemPath, id };
50
+ });
51
+ };
52
+ return mapRoutes(root);
53
+ };
54
+
55
+ function generateUuid(len = 32, _radix = 10) {
56
+ const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
57
+ const uuid = [];
58
+ let i;
59
+ const radix = _radix || chars.length;
60
+ if (len) {
61
+ // Compact form
62
+ for (i = 0; i < len; i++)
63
+ uuid[i] = chars[0 | (Math.random() * radix)];
64
+ }
65
+ else {
66
+ // rfc4122, version 4 form
67
+ let r;
68
+ // rfc4122 requires these characters
69
+ uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
70
+ uuid[14] = '4';
71
+ // Fill in random data. At i==19 set the high bits of clock sequence as
72
+ // per rfc4122, sec. 4.1.5
73
+ for (i = 0; i < 36; i++) {
74
+ if (!uuid[i]) {
75
+ r = 0 | (Math.random() * 16);
76
+ uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r];
77
+ }
78
+ }
79
+ }
80
+ return uuid.join('');
81
+ }
82
+
83
+ export { getAntdLocaleKey as a, getLocaleKey as b, getRoutes as c, generateUuid as g, setLocaleKey as s };
2
84
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,10 @@
1
1
  import * as connect_history_api_fallback from 'connect-history-api-fallback';
2
- import { Configuration } from 'webpack';
3
- import { Configuration as Configuration$1 } from 'webpack-dev-server';
2
+ import { Configuration } from '@rspack/core';
3
+ import { Configuration as Configuration$1 } from '@rspack/dev-server';
4
4
  import * as axios from 'axios';
5
5
  import { AxiosRequestConfig, AxiosRequestHeaders, AxiosInterceptorManager, AxiosResponse } from 'axios';
6
6
  export * from 'axios';
7
7
  import { Emitter } from 'mitt';
8
- import * as i18next from 'i18next';
9
8
  import { InitOptions, Callback } from 'i18next';
10
9
  export * from '@ctrl/tinycolor';
11
10
 
@@ -1663,73 +1662,14 @@ declare const getBackgroundColor: (baseColor: string, bgBaseColor: string) => st
1663
1662
 
1664
1663
  declare const token: AliasToken;
1665
1664
 
1666
- declare global {
1667
- const __gant_start_time: string;
1668
- }
1669
-
1670
- interface Route {
1671
- path: string;
1672
- title: string;
1673
- mpaKey?: string;
1674
- children?: Route[];
1675
- [name: string]: any;
1676
- }
1677
- interface ConfigMFA {
1678
- entry?: string;
1679
- subEntry?: string;
1680
- htmlTemplatePath?: string | {
1681
- [name: string]: string;
1682
- };
1683
- port?: number;
1684
- publicPath?: string[] | string;
1685
- name?: string;
1686
- alias?: {
1687
- [name: string]: string;
1688
- };
1689
- base?: string;
1690
- pages?: {
1691
- name: string;
1692
- entry?: string;
1693
- path: string | string[];
1694
- htmlTemplatePath?: string;
1695
- publicPath?: string[] | string;
1696
- port: number;
1697
- base?: string;
1698
- url?: string;
1699
- }[];
1700
- }
1701
- interface GantCustomConfig {
1702
- name?: string;
1703
- base?: string;
1704
- mfa?: ConfigMFA;
1705
- library?: boolean;
1706
- locales?: string[];
1707
- packages?: {
1708
- [name: string]: string;
1709
- };
1710
- htmlTemplatePath?: string;
1711
- routes?: Route | Route[];
1712
- outputPathDir?: string;
1713
- publicPathDir?: string;
1714
- microServiceMap?: any;
1715
- customHistoryApiFallback?: boolean | connect_history_api_fallback.Options | undefined;
1716
- define?: any;
1717
- provide?: Record<string, string | string[]>;
1718
- setting?: CONFIG_TYPE;
1719
- vue?: boolean;
1720
- compression?: boolean;
1721
- terserOptions?: any;
1722
- }
1723
- interface GantUserConfig extends Configuration, GantCustomConfig {
1724
- devServer?: Configuration$1;
1725
- }
1726
- type CONFIG_TYPE = {
1665
+ type SETTING_CONFIG_TYPE = {
1727
1666
  IP2_BASE_CONFIG?: BASE_CONFIG_TYPE;
1728
1667
  BASE_CONFIG?: BASE_CONFIG_TYPE;
1729
1668
  MAIN_CONFIG?: MAIN_CONFIG_TYPE;
1730
1669
  SYSMGMT_CONFIG?: SYSMGMT_CONFIG_TYPE;
1731
1670
  WATER_MARK_CONFIG?: WATER_MARK_CONFIG_TYPE;
1732
1671
  THEME?: THEME_TYPE;
1672
+ CUSTOM_CONFIG?: any;
1733
1673
  };
1734
1674
  type BASE_CONFIG_TYPE = {
1735
1675
  title?: {
@@ -1740,6 +1680,16 @@ type BASE_CONFIG_TYPE = {
1740
1680
  };
1741
1681
  copyright?: string;
1742
1682
  };
1683
+ interface KeepAliveConfig {
1684
+ /** 是否启用 KeepAlive 功能 */
1685
+ enabled: boolean;
1686
+ /** 最大缓存页面数量(可选,用于未来扩展) */
1687
+ maxCacheSize?: number;
1688
+ /** 排除缓存的路径列表(可选,用于未来扩展) */
1689
+ exclude?: string[];
1690
+ /** 包含缓存的路径列表(可选,用于未来扩展) */
1691
+ include?: string[];
1692
+ }
1743
1693
  type LOGIN_CONFIG = {
1744
1694
  loginPathname?: string;
1745
1695
  noCheckPermissionsPath?: string[];
@@ -1755,16 +1705,17 @@ type LOGIN_CONFIG = {
1755
1705
  type MAIN_CONFIG_TYPE = {
1756
1706
  requestTimeout?: number;
1757
1707
  siderMenuCollapsed?: boolean;
1758
- headerMenu?: boolean;
1708
+ menuType?: 'side' | 'multi-level' | 'none';
1759
1709
  navType?: 'breadcrumb' | 'tabs' | 'none';
1760
1710
  menuHistory?: boolean;
1761
1711
  initialDashboardLayout?: any[];
1762
1712
  homePath?: string;
1763
1713
  loginConfig?: LOGIN_CONFIG;
1714
+ dashboard?: boolean;
1715
+ keepAlive?: KeepAliveConfig;
1764
1716
  functionsConfig?: {
1765
1717
  notification?: boolean;
1766
1718
  websocket?: boolean;
1767
- globalSearch?: boolean;
1768
1719
  locale?: boolean;
1769
1720
  tools?: boolean;
1770
1721
  transformTool?: boolean;
@@ -1775,31 +1726,24 @@ type MAIN_CONFIG_TYPE = {
1775
1726
  recordModeTool?: boolean;
1776
1727
  debuggerTool?: boolean;
1777
1728
  compactMode?: boolean;
1778
- drakMode?: boolean;
1729
+ globalSearch?: boolean;
1779
1730
  meettingMode?: boolean;
1780
1731
  motionMode?: boolean;
1781
1732
  menuCollection?: boolean;
1782
1733
  version?: boolean;
1783
1734
  autoDetectVersion?: boolean;
1784
- indexDbCrypt?: boolean;
1785
1735
  agentSuggest?: boolean;
1786
1736
  delegate?: boolean;
1737
+ uiEnabled?: boolean;
1738
+ tourEnabled?: boolean;
1787
1739
  userCardTypes?: {
1788
1740
  message?: boolean;
1789
1741
  phone?: boolean;
1790
1742
  email?: boolean;
1791
1743
  };
1792
1744
  };
1793
- dateConfig?: {
1794
- year: string;
1795
- month: string;
1796
- day: string;
1797
- hour: string;
1798
- date: string;
1799
- dateTime: string;
1800
- time: string;
1801
- customTimeZone?: boolean;
1802
- };
1745
+ numberFormat?: string;
1746
+ timezone?: string;
1803
1747
  fileConfig?: {
1804
1748
  uploadFileSize?: number;
1805
1749
  tusClient?: boolean;
@@ -1850,8 +1794,93 @@ type WATER_MARK_CONFIG_TYPE = {
1850
1794
  type THEME_TYPE = {
1851
1795
  themeType?: ThemeType;
1852
1796
  token?: AliasToken;
1797
+ components?: any;
1798
+ themeColor?: string;
1799
+ themeMode?: 'light' | 'dark' | 'auto';
1800
+ glassEffect?: boolean;
1801
+ glassBgImage?: string;
1802
+ gridConfig?: {
1803
+ bordered?: boolean;
1804
+ striped?: boolean;
1805
+ editTrigger?: 'click' | 'dblclick';
1806
+ viewMode?: 'single' | 'multiple';
1807
+ filterApplyMode?: 'manual' | 'auto';
1808
+ groupStickyRow?: boolean;
1809
+ enableClickSelection?: boolean;
1810
+ };
1853
1811
  };
1854
1812
 
1813
+ interface Route {
1814
+ path: string;
1815
+ title: string;
1816
+ mpaKey?: string;
1817
+ parentPath?: string | string[];
1818
+ children?: Route[];
1819
+ [name: string]: any;
1820
+ }
1821
+ interface ConfigMFA {
1822
+ entry?: string;
1823
+ subEntry?: string;
1824
+ htmlTemplatePath?: string | {
1825
+ [name: string]: string;
1826
+ };
1827
+ port?: number;
1828
+ publicPath?: string[] | string;
1829
+ name?: string;
1830
+ alias?: {
1831
+ [name: string]: string;
1832
+ };
1833
+ base?: string;
1834
+ pages?: {
1835
+ name: string;
1836
+ entry?: string;
1837
+ path: string | string[];
1838
+ htmlTemplatePath?: string;
1839
+ publicPath?: string[] | string;
1840
+ port: number;
1841
+ base?: string;
1842
+ url?: string;
1843
+ }[];
1844
+ }
1845
+ type FrameworkType = 'react' | 'vue';
1846
+ interface GantCustomConfig {
1847
+ name?: string;
1848
+ base?: string;
1849
+ mfa?: ConfigMFA;
1850
+ library?: boolean;
1851
+ locales?: string[];
1852
+ packages?: {
1853
+ [name: string]: string;
1854
+ };
1855
+ htmlTemplatePath?: string;
1856
+ routes?: Route | Route[];
1857
+ outputPathDir?: string;
1858
+ publicPathDir?: string;
1859
+ microServiceMap?: any;
1860
+ customHistoryApiFallback?: boolean | connect_history_api_fallback.Options | undefined;
1861
+ define?: any;
1862
+ provide?: Record<string, string | string[]>;
1863
+ setting?: SETTING_CONFIG_TYPE;
1864
+ /** Specify target framework: 'react' or 'vue' */
1865
+ framework?: FrameworkType;
1866
+ compression?: boolean;
1867
+ /** 复制文件规则,构建后将 from 目录的内容复制到 to 目录 */
1868
+ copy?: {
1869
+ from: string;
1870
+ to: string;
1871
+ }[];
1872
+ terserOptions?: any;
1873
+ }
1874
+ interface GantUserConfig extends Configuration, GantCustomConfig {
1875
+ devServer?: Configuration$1;
1876
+ }
1877
+ declare enum Env {
1878
+ development = "development",
1879
+ production = "production",
1880
+ test = "test"
1881
+ }
1882
+ type GantTypes = 'build' | 'development' | 'analyzer';
1883
+
1855
1884
  interface GantAxiosRequestConfig extends AxiosRequestConfig {
1856
1885
  serviceId?: string;
1857
1886
  }
@@ -1922,9 +1951,10 @@ declare const request: Request;
1922
1951
  declare const requestInstance: {
1923
1952
  interceptors: {
1924
1953
  request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
1925
- response: InterceptorManager<AxiosResponse<any, any>>;
1954
+ response: InterceptorManager<AxiosResponse<any, any, {}>>;
1926
1955
  };
1927
- defaults: Omit<axios.AxiosDefaults<any>, "headers"> & {
1956
+ create(config?: axios.CreateAxiosDefaults): axios.AxiosInstance;
1957
+ defaults: Omit<axios.AxiosDefaults, "headers"> & {
1928
1958
  headers: axios.HeadersDefaults & {
1929
1959
  [key: string]: axios.AxiosHeaderValue;
1930
1960
  };
@@ -2224,7 +2254,7 @@ declare class CompanyData {
2224
2254
  updateCompanyData: (dataType: string, data: any) => Promise<any>;
2225
2255
  removeCompanyData: (dataType: string) => Promise<void>;
2226
2256
  }
2227
- declare const _default$1: CompanyData;
2257
+ declare const _default: CompanyData;
2228
2258
 
2229
2259
  declare const storage: {
2230
2260
  storage: Storage;
@@ -2295,30 +2325,11 @@ declare const userStore: UserStore;
2295
2325
  declare const loginStore: LoginStore;
2296
2326
  declare const menuStore: MenuStore;
2297
2327
 
2298
- declare const initDynamicLang: (language: string, options?: {
2328
+ declare const initI18n: (language: string, options?: {
2299
2329
  i18n?: boolean;
2300
2330
  i18nInitOptions?: InitOptions;
2301
2331
  i18nCallback?: Callback;
2302
- }) => Promise<i18next.i18n>;
2303
- declare const tr: (key: string, agrs?: string[], type?: 'fe' | 'workflow') => any;
2304
-
2305
- declare const getTraceId: (response: any) => any;
2306
-
2307
- declare const getAntdLocaleKey: (localeKey: string) => string;
2308
- declare const getLocaleKey: () => any;
2309
- declare const setLocaleKey: (locale: string) => string;
2310
-
2311
- declare const getRoutes: (routesMaps: any) => any[];
2312
-
2313
- declare function generateUuid(len?: number, _radix?: number): string;
2314
-
2315
- declare const useRequestMicroSevices: (microServiceMap?: any) => (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig;
2316
- declare const useRequestHeader: (userLanguage: string) => (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig;
2317
- interface MainOptions extends GlobalOptions {
2318
- microServiceMap?: any;
2319
- locale?: string;
2320
- dynamicLangCallback?: () => void;
2321
- }
2322
- declare const _default: ({ microServiceMap, dynamicLangCallback, ...globalOptions }: MainOptions) => Promise<boolean>;
2332
+ }) => Promise<(key: string, agrs?: string[], type?: "fe" | "workflow") => string>;
2323
2333
 
2324
- export { type AliasToken, type BASE_CONFIG_TYPE, type CONFIG_TYPE, type ColorMapToken, type ColorNeutralMapToken, type ColorPalettes, type CommonMapToken, type DerivativeFunc, type FontMapToken, type GantAxiosRequestConfig, type GantServerOptions, type GlobalOptions, type GlobalToken, type HeightMapToken, type InternalAxiosRequestConfig, type LOGIN_CONFIG, type Language, type LegacyColorPalettes, type LoginResultData, type MAIN_CONFIG_TYPE, MENU_BREADCRUMBS_UPDATE, MENU_HISTORY_UPDATE, type MainOptions, type MapToken, type MappingAlgorithm, type Perferences, type PresetColorKey, type PresetColorType, PresetColors, type ProductInfo, type SSOConfigType, type SYSMGMT_CONFIG_TYPE, type SeedToken, type ServerMenu, type ServerMenuData, type ServerMenuMap, type SizeMapToken, type StyleMapToken, type THEME_TYPE, type ThemeType, type TokenType, type User, type UserAggregateInfo, type GantUserConfig as UserConfig, type UserIdentityType, codeListStore, derivative$1 as compactAlgorithm, _default$1 as companydataStore, derivative$2 as darkAlgorithm, derivative$3 as defaultAlgorithm, expireCache, formatToken as formatAliasToken, generateUuid, getAliasToken, getAlphaColor, getAntdLocaleKey, getBackgroundColor, getDarkenSolidColor, getLightenSolidColor, getLocaleKey, getRoutes, getTokenCssVar, getTraceId, globalStore, _default as init, initDynamicLang, lighten, loginStore, derivative as meetingDerivative, menuStore, parameterStore, request, requestInstance, seedToken as seed, setLocaleKey, storage as storageStore, token, tr, useRequestHeader, useRequestMicroSevices, userStore };
2334
+ export { Env, MENU_BREADCRUMBS_UPDATE, MENU_HISTORY_UPDATE, PresetColors, codeListStore, derivative$1 as compactAlgorithm, _default as companydataStore, derivative$2 as darkAlgorithm, derivative$3 as defaultAlgorithm, expireCache, formatToken as formatAliasToken, getAliasToken, getAlphaColor, getBackgroundColor, getDarkenSolidColor, getLightenSolidColor, getTokenCssVar, globalStore, initI18n, lighten, loginStore, derivative as meetingDerivative, menuStore, parameterStore, request, requestInstance, seedToken as seed, storage as storageStore, token, userStore };
2335
+ export type { AliasToken, BASE_CONFIG_TYPE, ColorMapToken, ColorNeutralMapToken, ColorPalettes, CommonMapToken, ConfigMFA, DerivativeFunc, FontMapToken, FrameworkType, GantAxiosRequestConfig, GantCustomConfig, GantServerOptions, GantTypes, GantUserConfig, GlobalOptions, GlobalToken, HeightMapToken, InternalAxiosRequestConfig, KeepAliveConfig, LOGIN_CONFIG, Language, LegacyColorPalettes, LoginResultData, MAIN_CONFIG_TYPE, MapToken, MappingAlgorithm, Perferences, PresetColorKey, PresetColorType, ProductInfo, Route, SETTING_CONFIG_TYPE, SSOConfigType, SYSMGMT_CONFIG_TYPE, SeedToken, ServerMenu, ServerMenuData, ServerMenuMap, SizeMapToken, StyleMapToken, THEME_TYPE, ThemeType, TokenType, User, UserAggregateInfo, GantUserConfig as UserConfig, UserIdentityType, WATER_MARK_CONFIG_TYPE };
package/package.json CHANGED
@@ -1,44 +1,74 @@
1
1
  {
2
2
  "name": "gant-core",
3
- "version": "0.2.36",
3
+ "version": "2.0.1",
4
4
  "description": "",
5
5
  "main": "lib/core/index.js",
6
6
  "types": "lib/types/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./lib/types/index.d.ts",
10
+ "import": "./lib/core/index.js"
11
+ },
12
+ "./cli": {
13
+ "types": "./lib/cli/index.d.ts",
14
+ "require": "./lib/cli/index.js"
15
+ },
16
+ "./*": "./*"
17
+ },
7
18
  "bin": {
8
19
  "gant-cli": "bin/index.js"
9
20
  },
10
- "scripts": {
11
- "build": "cross-env NODE_ENV=production rollup --config rollup.config.js",
12
- "dev": "cross-env NODE_ENV=development rollup --config rollup.config.js --watch",
13
- "tag-publish": "npm publish"
14
- },
15
21
  "author": "vvey",
16
22
  "license": "ISC",
17
- "devDependencies": {
23
+ "dependencies": {
18
24
  "@ant-design/colors": "^7.0.2",
25
+ "@ctrl/tinycolor": "^4.2.0",
26
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
27
+ "@rsdoctor/rspack-plugin": "^1.5.10",
19
28
  "@root/walk": "^1.1.0",
29
+ "@rspack/core": "^2.0.1",
30
+ "@rspack/dev-server": "^2.0.1",
31
+ "@rspack/plugin-react-refresh": "^2.0.0",
32
+ "axios": "^1.6.8",
33
+ "chokidar": "^3.6.0",
20
34
  "cli-progress": "^3.12.0",
21
35
  "commander": "^11.1.0",
36
+ "compression-webpack-plugin": "^11.1.0",
37
+ "css-loader": "^6.10.0",
38
+ "css-minimizer-webpack-plugin": "^6.0.0",
22
39
  "ejs": "^3.1.9",
23
- "fs": "^0.0.1-security",
40
+ "ejs-loader": "^0.5.0",
41
+ "file-loader": "^6.2.0",
42
+ "html-loader": "^5.0.0",
43
+ "html-webpack-plugin": "^5.0.0",
24
44
  "i18next": "^23.10.1",
25
45
  "inquirer": "^9.2.14",
46
+ "jiti": "^2.6.1",
47
+ "less": "^4.2.0",
48
+ "less-loader": "^12.2.0",
49
+ "loader-utils": "^3.2.1",
26
50
  "lodash-es": "^4.17.21",
27
51
  "md5-node": "^1.0.1",
52
+ "mini-css-extract-plugin": "^2.8.1",
28
53
  "mitt": "^3.0.1",
29
- "path": "^0.12.7",
30
54
  "picocolors": "^1.0.0",
55
+ "postcss": "^8.4.35",
56
+ "postcss-loader": "^8.1.1",
57
+ "postcss-preset-env": "^9.5.1",
58
+ "postcss-short": "^5.0.0",
31
59
  "prettier": "^3.2.5",
32
- "process": "^0.11.10",
60
+ "style-loader": "^3.3.4",
61
+ "swc-loader": "^0.2.6",
62
+ "terser-webpack-plugin": "^5.3.10",
33
63
  "typescript": "^5.3.3",
34
- "url": "^0.11.3"
64
+ "url-loader": "^4.1.1",
65
+ "vue-loader": "^17.4.2",
66
+ "webpack": "^5.90.3",
67
+ "webpack-dev-server": "^4.7.4"
35
68
  },
36
- "dependencies": {
37
- "@babel/core": "^7.26.0",
38
- "@babel/plugin-transform-modules-commonjs": "^7.26.3",
39
- "@babel/preset-env": "^7.26.0",
40
- "@babel/register": "^7.25.9",
41
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
69
+ "devDependencies": {
70
+ "@changesets/cli": "^2.31.0",
71
+ "@eslint/js": "^10.0.1",
42
72
  "@rollup/plugin-alias": "^5.1.0",
43
73
  "@rollup/plugin-commonjs": "^25.0.7",
44
74
  "@rollup/plugin-json": "^6.1.0",
@@ -49,36 +79,24 @@
49
79
  "@types/inquirer": "^9.0.7",
50
80
  "@types/lodash-es": "^4.17.12",
51
81
  "@types/node": "^20.11.16",
52
- "chokidar": "^3.6.0",
53
- "compression-webpack-plugin": "^11.1.0",
54
82
  "cross-env": "^7.0.3",
55
- "css-loader": "^6.10.0",
56
- "css-minimizer-webpack-plugin": "^6.0.0",
57
- "ejs-loader": "^0.5.0",
58
- "file-loader": "^6.2.0",
59
- "html-loader": "^5.0.0",
60
- "html-webpack-plugin": "^5.0.0",
61
- "less": "^4.2.0",
62
- "less-loader": "^12.2.0",
63
- "loader-utils": "^3.2.1",
64
- "mini-css-extract-plugin": "^2.8.1",
65
- "postcss": "^8.4.35",
66
- "postcss-loader": "^8.1.1",
67
- "postcss-preset-env": "^9.5.1",
68
- "postcss-short": "^5.0.0",
83
+ "eslint": "^10.2.1",
84
+ "fs": "^0.0.1-security",
85
+ "path": "^0.12.7",
86
+ "process": "^0.11.10",
69
87
  "rollup": "^4.9.6",
70
88
  "rollup-plugin-copy": "^3.5.0",
71
89
  "rollup-plugin-dts": "^6.1.0",
72
- "rollup-plugin-typescript2": "^0.36.0",
73
- "style-loader": "^3.3.4",
74
- "swc-loader": "^0.2.6",
75
- "terser-webpack-plugin": "^5.3.10",
76
- "ts-node": "^10.9.2",
77
- "url-loader": "^4.1.1",
78
- "vue-loader": "^17.4.2",
79
- "webpack": "^5.90.3",
80
- "webpack-bundle-analyzer": "^4.10.1",
81
- "webpack-dev-server": "^4.7.4",
82
- "axios": "^1.6.8"
90
+ "typescript-eslint": "^8.59.1",
91
+ "url": "^0.11.3"
92
+ },
93
+ "scripts": {
94
+ "build": "cross-env NODE_ENV=production rollup --config rollup.config.js",
95
+ "dev": "cross-env NODE_ENV=development rollup --config rollup.config.js --watch",
96
+ "link": "pnpm build && npm link",
97
+ "lint": "eslint src/",
98
+ "changeset": "changeset",
99
+ "version": "changeset version",
100
+ "release": "pnpm build && changeset publish"
83
101
  }
84
102
  }
package/rollup.config.js CHANGED
@@ -1,4 +1,4 @@
1
- const typescript = require('rollup-plugin-typescript2');
1
+ const typescript = require('@rollup/plugin-typescript');
2
2
  const commonjs = require('@rollup/plugin-commonjs');
3
3
  const { nodeResolve } = require('@rollup/plugin-node-resolve');
4
4
  const alias = require('@rollup/plugin-alias');
@@ -28,6 +28,7 @@ module.exports = [
28
28
  output: {
29
29
  dir: 'lib/cli', // 输出文件
30
30
  format: 'cjs', // 输出格式设置为
31
+ sourcemap: true, // 生成 sourcemap 以支持 npm link 调试
31
32
  banner: '#!/usr/bin/env node', // 添加shebang,使得生成的文件可以直接作为可执行文件使
32
33
  entryFileNames: 'index.js', // 控制入口文件的名称为 index.js
33
34
  chunkFileNames: '[name].js', // 控制 chunk 的名称
@@ -42,16 +43,14 @@ module.exports = [
42
43
  },
43
44
  },
44
45
  external: [
45
- 'webpack',
46
- 'webpack-dev-server',
47
- 'html-webpack-plugin',
48
- 'css-minimizer-webpack-plugin',
46
+ '@rspack/core',
47
+ '@rspack/dev-server',
49
48
  'mini-css-extract-plugin',
50
- 'webpack-bundle-analyzer',
51
- 'terser-webpack-plugin',
52
- '@pmmmwh/react-refresh-webpack-plugin',
49
+ '@rsdoctor/rspack-plugin',
50
+ '@rspack/plugin-react-refresh',
53
51
  'compression-webpack-plugin',
54
52
  'chokidar',
53
+ 'jiti',
55
54
  ],
56
55
  plugins: [
57
56
  ...plugins,
@@ -80,14 +79,14 @@ module.exports = [
80
79
  chunkFileNames: '[name].js', // 控制 chunk 的名称
81
80
  manualChunks(id) {
82
81
  if (['.json', '.d.ts'].some(suffix => id.includes(suffix))) return;
83
- const filenames = ['auth', 'cache', 'event', 'i18n', 'microservices', 'request', 'store', 'theme', 'utils'];
82
+ const filenames = ['auth', 'cache', 'event', 'i18n', 'microservices', 'request', 'store', 'theme'];
84
83
  const filename = filenames.find(name => id.includes(`core/${name}`));
85
84
  if (filename) {
86
85
  return `${filename}/index`;
87
86
  }
88
87
  },
89
88
  },
90
- external: ['lodash-es', 'axios', 'mitt', 'webpack', 'webpack-dev-server'],
89
+ external: ['lodash-es', 'axios', 'mitt', '@rspack/core', '@rspack/dev-server'],
91
90
  plugins: [
92
91
  ...plugins,
93
92
  alias({
@@ -98,6 +97,10 @@ module.exports = [
98
97
  {
99
98
  input: 'src/index.ts',
100
99
  output: [{ file: 'lib/types/index.d.ts', format: 'es' }],
100
+ onwarn(warning, warn) {
101
+ if (warning.message && warning.message.includes('Ambiguous external namespace')) return;
102
+ warn(warning);
103
+ },
101
104
  plugins: [
102
105
  dts({
103
106
  compilerOptions: {
@@ -107,6 +110,20 @@ module.exports = [
107
110
  },
108
111
  }),
109
112
  ],
113
+ external: [/\.(css|node)$/, '@ctrl/tinycolor'],
114
+ },
115
+ {
116
+ input: 'src/cli/index.ts',
117
+ output: [{ file: 'lib/cli/index.d.ts', format: 'es' }],
118
+ plugins: [
119
+ dts({
120
+ compilerOptions: {
121
+ paths: {
122
+ '@cli/*': ['src/cli/*'],
123
+ },
124
+ },
125
+ }),
126
+ ],
110
127
  external: [/\.(css|node)$/],
111
128
  },
112
129
  ];
package/tsconfig.json CHANGED
@@ -15,6 +15,7 @@
15
15
  "skipLibCheck": true,
16
16
  "experimentalDecorators": true,
17
17
  "strict": false,
18
+ "types": ["node"],
18
19
  "paths": {
19
20
  "@cli/*": ["src/cli/*"],
20
21
  "@core/*": ["src/core/*"]
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/core/cache/index.ts"],"sourcesContent":["// 缓存类\nclass CacheItem {\n constructor(namespace: string) {\n this.cache[namespace] = {};\n }\n private cache: { [key: string]: any } = {};\n get(key: string) {\n return this.cache[key];\n }\n set(key: string, value: any) {\n this.cache[key] = value;\n return this.cache[key];\n }\n clearAll() {\n this.cache = {};\n }\n clear(key: string) {\n delete this.cache[key];\n return this.cache;\n }\n}\n\nclass proxyCacheConstructor {\n private static instance: proxyCacheConstructor | null = null;\n private store: { [key: string]: CacheItem } = {};\n public static getInstance() {\n if (!this.instance) {\n this.instance = new proxyCacheConstructor();\n }\n return this.instance;\n }\n public namespace(namespace: string) {\n this.store[namespace] = new CacheItem(namespace);\n return this.store[namespace];\n }\n}\n\nconst expireCache = proxyCacheConstructor.getInstance();\n\nexport interface CacheD<T> {\n (key: string, value?: T): void | T;\n get: (key: string) => T;\n set: (key: string, value: T) => void;\n}\n\nexport default expireCache;\n"],"names":["CacheItem","constructor","namespace","this","cache","get","key","set","value","clearAll","clear","proxyCacheConstructor","static","store","getInstance","instance","expireCache"],"mappings":"AACA,MAAMA,EACJ,WAAAC,CAAYC,GACVC,KAAKC,MAAMF,GAAa,EACzB,CACOE,MAAgC,CAAA,EACxC,GAAAC,CAAIC,GACF,OAAOH,KAAKC,MAAME,EACnB,CACD,GAAAC,CAAID,EAAaE,GAEf,OADAL,KAAKC,MAAME,GAAOE,EACXL,KAAKC,MAAME,EACnB,CACD,QAAAG,GACEN,KAAKC,MAAQ,EACd,CACD,KAAAM,CAAMJ,GAEJ,cADOH,KAAKC,MAAME,GACXH,KAAKC,KACb,EAGH,MAAMO,EACIC,gBAAgD,KAChDC,MAAsC,CAAA,EACvC,kBAAOC,GAIZ,OAHKX,KAAKY,WACRZ,KAAKY,SAAW,IAAIJ,GAEfR,KAAKY,QACb,CACM,SAAAb,CAAUA,GAEf,OADAC,KAAKU,MAAMX,GAAa,IAAIF,EAAUE,GAC/BC,KAAKU,MAAMX,EACnB,EAGH,MAAMc,EAAcL,EAAsBG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}