@moneko/core 1.0.0

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 (164) hide show
  1. package/LICENSE +21 -0
  2. package/build/common.d.ts +5 -0
  3. package/build/common.js +1 -0
  4. package/build/coverage.d.ts +2 -0
  5. package/build/coverage.js +1 -0
  6. package/build/envFlags.d.ts +18 -0
  7. package/build/envFlags.js +1 -0
  8. package/build/has-antd.d.ts +3 -0
  9. package/build/has-antd.js +1 -0
  10. package/build/has-pkg.d.ts +1 -0
  11. package/build/has-pkg.js +1 -0
  12. package/build/html-add-entry-attr.d.ts +17 -0
  13. package/build/html-add-entry-attr.js +1 -0
  14. package/build/html-plugin-option.d.ts +3 -0
  15. package/build/html-plugin-option.js +1 -0
  16. package/build/minify.d.ts +26 -0
  17. package/build/minify.js +1 -0
  18. package/build/modifyVars.d.ts +2 -0
  19. package/build/modifyVars.js +1 -0
  20. package/build/module-federation.d.ts +4 -0
  21. package/build/module-federation.js +1 -0
  22. package/build/module.config.d.ts +3 -0
  23. package/build/module.config.js +1 -0
  24. package/build/process-env.d.ts +27 -0
  25. package/build/process-env.js +1 -0
  26. package/build/resolver-sync.d.ts +9 -0
  27. package/build/resolver-sync.js +1 -0
  28. package/build/swcrc.d.ts +4 -0
  29. package/build/swcrc.js +1 -0
  30. package/build/tsloader.config.d.ts +8 -0
  31. package/build/tsloader.config.js +1 -0
  32. package/build/utils.d.ts +18 -0
  33. package/build/utils.js +1 -0
  34. package/build/webpack.common.d.ts +3 -0
  35. package/build/webpack.common.js +1 -0
  36. package/build/webpack.dev.d.ts +2 -0
  37. package/build/webpack.dev.js +1 -0
  38. package/build/webpack.prod.d.ts +3 -0
  39. package/build/webpack.prod.js +1 -0
  40. package/build/yarn-argv.d.ts +4 -0
  41. package/build/yarn-argv.js +1 -0
  42. package/lib/components/app-router/index.d.ts +9 -0
  43. package/lib/components/app-router/index.js +2 -0
  44. package/lib/components/app-router/index.js.map +1 -0
  45. package/lib/components/fallback/index.d.ts +3 -0
  46. package/lib/components/fallback/index.js +2 -0
  47. package/lib/components/fallback/index.js.map +1 -0
  48. package/lib/components/fallback-comp/index.d.ts +10 -0
  49. package/lib/components/fallback-comp/index.js +2 -0
  50. package/lib/components/fallback-comp/index.js.map +1 -0
  51. package/lib/components/layout-menu/index.d.ts +8 -0
  52. package/lib/components/layout-menu/index.global.less +40 -0
  53. package/lib/components/layout-menu/index.js +2 -0
  54. package/lib/components/layout-menu/index.js.map +1 -0
  55. package/lib/components/readme/index.d.ts +3 -0
  56. package/lib/components/readme/index.js +2 -0
  57. package/lib/components/readme/index.js.map +1 -0
  58. package/lib/hooks/navgate.d.ts +3 -0
  59. package/lib/hooks/navgate.js +2 -0
  60. package/lib/hooks/navgate.js.map +1 -0
  61. package/lib/index.d.ts +43 -0
  62. package/lib/index.js +2 -0
  63. package/lib/index.js.map +1 -0
  64. package/lib/packages/back-stage/antd.global.less +56 -0
  65. package/lib/packages/back-stage/app.d.ts +7 -0
  66. package/lib/packages/back-stage/app.js +2 -0
  67. package/lib/packages/back-stage/app.js.map +1 -0
  68. package/lib/packages/back-stage/bootstrap.d.ts +1 -0
  69. package/lib/packages/back-stage/bootstrap.js +2 -0
  70. package/lib/packages/back-stage/bootstrap.js.map +1 -0
  71. package/lib/packages/back-stage/index.d.ts +5 -0
  72. package/lib/packages/back-stage/index.js +2 -0
  73. package/lib/packages/back-stage/index.js.map +1 -0
  74. package/lib/packages/back-stage/layout/index.d.ts +3 -0
  75. package/lib/packages/back-stage/layout/index.js +2 -0
  76. package/lib/packages/back-stage/layout/index.js.map +1 -0
  77. package/lib/packages/back-stage/layout/index.less +91 -0
  78. package/lib/packages/back-stage/models/app-program.d.ts +24 -0
  79. package/lib/packages/back-stage/models/app-program.js +2 -0
  80. package/lib/packages/back-stage/models/app-program.js.map +1 -0
  81. package/lib/packages/library/app.d.ts +3 -0
  82. package/lib/packages/library/app.js +2 -0
  83. package/lib/packages/library/app.js.map +1 -0
  84. package/lib/packages/library/bootstrap.d.ts +1 -0
  85. package/lib/packages/library/bootstrap.js +2 -0
  86. package/lib/packages/library/bootstrap.js.map +1 -0
  87. package/lib/packages/library/index.d.ts +5 -0
  88. package/lib/packages/library/index.js +2 -0
  89. package/lib/packages/library/index.js.map +1 -0
  90. package/lib/packages/mobile/app.d.ts +3 -0
  91. package/lib/packages/mobile/app.js +2 -0
  92. package/lib/packages/mobile/app.js.map +1 -0
  93. package/lib/packages/mobile/index.d.ts +4 -0
  94. package/lib/packages/mobile/index.js +2 -0
  95. package/lib/packages/mobile/index.js.map +1 -0
  96. package/lib/packages/single-spa/app.d.ts +7 -0
  97. package/lib/packages/single-spa/app.js +2 -0
  98. package/lib/packages/single-spa/app.js.map +1 -0
  99. package/lib/packages/single-spa/bootstrap.d.ts +4 -0
  100. package/lib/packages/single-spa/bootstrap.js +2 -0
  101. package/lib/packages/single-spa/bootstrap.js.map +1 -0
  102. package/lib/packages/single-spa/index.d.ts +6 -0
  103. package/lib/packages/single-spa/index.js +2 -0
  104. package/lib/packages/single-spa/index.js.map +1 -0
  105. package/lib/packages/single-spa/public-path.d.ts +0 -0
  106. package/lib/packages/single-spa/public-path.js +2 -0
  107. package/lib/packages/single-spa/public-path.js.map +1 -0
  108. package/lib/packages/site/app.d.ts +3 -0
  109. package/lib/packages/site/app.js +2 -0
  110. package/lib/packages/site/app.js.map +1 -0
  111. package/lib/packages/site/bootstrap.d.ts +1 -0
  112. package/lib/packages/site/bootstrap.js +2 -0
  113. package/lib/packages/site/bootstrap.js.map +1 -0
  114. package/lib/packages/site/index.d.ts +5 -0
  115. package/lib/packages/site/index.js +2 -0
  116. package/lib/packages/site/index.js.map +1 -0
  117. package/lib/prefix/i18n-hooks.d.ts +1 -0
  118. package/lib/prefix/i18n-hooks.js +2 -0
  119. package/lib/prefix/i18n-hooks.js.map +1 -0
  120. package/lib/prefix/mini-idc.d.ts +1 -0
  121. package/lib/prefix/mini-idc.js +2 -0
  122. package/lib/prefix/mini-idc.js.map +1 -0
  123. package/lib/prefix/prefix-remote-react-refresh.d.ts +1 -0
  124. package/lib/prefix/prefix-remote-react-refresh.js +2 -0
  125. package/lib/prefix/prefix-remote-react-refresh.js.map +1 -0
  126. package/lib/prefix/react-router-dom.d.ts +1 -0
  127. package/lib/prefix/react-router-dom.js +2 -0
  128. package/lib/prefix/react-router-dom.js.map +1 -0
  129. package/lib/router/index.d.ts +23 -0
  130. package/lib/router/index.js +2 -0
  131. package/lib/router/index.js.map +1 -0
  132. package/lib/styles/animation.less +58 -0
  133. package/lib/styles/ant.variables.global.less +221 -0
  134. package/lib/styles/eval/bezierEasing.less +106 -0
  135. package/lib/styles/eval/colorPalette.less +73 -0
  136. package/lib/styles/eval/tinyColor.less +1181 -0
  137. package/lib/styles/index.global.less +136 -0
  138. package/lib/styles/normalize.css +192 -0
  139. package/lib/styles/vars.less +94 -0
  140. package/lib/utils/color-palette.d.ts +2 -0
  141. package/lib/utils/color-palette.js +2 -0
  142. package/lib/utils/color-palette.js.map +1 -0
  143. package/lib/utils/env.d.ts +0 -0
  144. package/lib/utils/env.js +2 -0
  145. package/lib/utils/env.js.map +1 -0
  146. package/lib/utils/fontloader.d.ts +1 -0
  147. package/lib/utils/fontloader.js +2 -0
  148. package/lib/utils/fontloader.js.map +1 -0
  149. package/lib/utils/index.d.ts +13 -0
  150. package/lib/utils/index.js +2 -0
  151. package/lib/utils/index.js.map +1 -0
  152. package/lib/utils/lazy-import.d.ts +34 -0
  153. package/lib/utils/lazy-import.js +2 -0
  154. package/lib/utils/lazy-import.js.map +1 -0
  155. package/lib/utils/refresh-rem.d.ts +0 -0
  156. package/lib/utils/refresh-rem.js +2 -0
  157. package/lib/utils/refresh-rem.js.map +1 -0
  158. package/lib/utils/theme.d.ts +13 -0
  159. package/lib/utils/theme.js +2 -0
  160. package/lib/utils/theme.js.map +1 -0
  161. package/package.json +91 -0
  162. package/template/favicon.ico +0 -0
  163. package/template/index.html +25 -0
  164. package/typings/global.d.ts +493 -0
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@moneko/core",
3
+ "version": "1.0.0",
4
+ "description": "core",
5
+ "main": "lib/index.js",
6
+ "scripts": {
7
+ "build": "npm run build-conf && npm run build-src && npm run build:types",
8
+ "build-conf": "swc config -d build -C module.type=commonjs -C minify=true --copy-files",
9
+ "build-src": "swc src -d lib -C module.type=es6 -C minify=true -s --copy-files",
10
+ "build:types": "tsc && tsc --project cli.json",
11
+ "postbuild": "node ./copy.js ./prefix ./lib",
12
+ "prebuild": "rm -rf ./build && rm -rf ./lib"
13
+ },
14
+ "keywords": [],
15
+ "author": "moneko",
16
+ "license": "MIT",
17
+ "dependencies": {
18
+ "@mapbox/rehype-prism": "0.8.0",
19
+ "@mdx-js/loader": "2.1.3",
20
+ "@moneko/mock": "1.0.2",
21
+ "@parcel/css": "1.14.0",
22
+ "@pmmmwh/react-refresh-webpack-plugin": "0.5.7",
23
+ "@soda/friendly-errors-webpack-plugin": "1.8.1",
24
+ "@swc/cli": "0.1.57",
25
+ "@swc/core": "1.3.1",
26
+ "@swc/helpers": "0.4.11",
27
+ "add-asset-html-webpack-plugin": "5.0.2",
28
+ "antd-dayjs-webpack-plugin": "1.0.6",
29
+ "core-js": "3.22.4",
30
+ "cross-env": "7.0.3",
31
+ "css-loader": "6.7.1",
32
+ "css-minimizer-webpack-plugin": "4.0.0",
33
+ "css-unicode-loader": "1.0.3",
34
+ "external-remotes-plugin": "1.0.0",
35
+ "fastclick": "1.0.6",
36
+ "html-webpack-plugin": "5.5.0",
37
+ "i18n-hooks": "1.0.16",
38
+ "less": "4.1.3",
39
+ "less-loader": "11.0.0",
40
+ "mini-css-extract-plugin": "2.6.1",
41
+ "mini-idc": "1.0.17",
42
+ "mini-svg-data-uri": "1.4.4",
43
+ "path-to-regexp": "6.2.1",
44
+ "portfinder": "1.0.28",
45
+ "react-activation": "0.11.2",
46
+ "react-refresh": "0.14.0",
47
+ "react-refresh-typescript": "2.0.7",
48
+ "react-router": "6.3.0",
49
+ "react-router-dom": "6.3.0",
50
+ "rehype-accessible-emojis": "0.3.2",
51
+ "rehype-figure": "1.0.1",
52
+ "style-loader": "3.3.1",
53
+ "style-resources-loader": "1.5.0",
54
+ "swc-loader": "0.2.3",
55
+ "swc-plugin-import-on-demand": "1.0.2",
56
+ "tinycolor2": "1.4.2",
57
+ "ts-import-plugin": "2.0.0",
58
+ "ts-loader": "9.3.1",
59
+ "typescript": "4.7.4",
60
+ "webfontloader": "1.6.28",
61
+ "webpack": "5.74.0",
62
+ "webpack-cli": "4.10.0",
63
+ "webpack-dev-server": "4.11.0",
64
+ "webpack-merge": "5.8.0",
65
+ "webpackbar": "5.0.2",
66
+ "xml2js": "0.4.23"
67
+ },
68
+ "devDependencies": {
69
+ "@types/lodash": "^4.14.182",
70
+ "@types/mini-css-extract-plugin": "^2.5.1",
71
+ "@types/react": "^18.0.17",
72
+ "@types/react-dom": "^18.0.6",
73
+ "@types/react-router-dom": "^5.3.3",
74
+ "@types/shelljs": "^0.8.11",
75
+ "@types/tinycolor2": "^1.4.3",
76
+ "@types/webfontloader": "^1.6.34",
77
+ "@types/webpack-env": "^1.16.4",
78
+ "@types/xml2js": "^0.4.11",
79
+ "antd": "^4.20.2",
80
+ "eslint-config-moneko": "^1.0.0",
81
+ "react": "^18.2.0",
82
+ "shelljs": "^0.8.5",
83
+ "stylelint-config-moneko": "^1.0.0"
84
+ },
85
+ "files": [
86
+ "lib",
87
+ "build",
88
+ "template",
89
+ "typings/global.d.ts"
90
+ ]
91
+ }
Binary file
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= htmlWebpackPlugin.options.title %></title>
5
+ <%
6
+ var customTag="";
7
+ if (htmlWebpackPlugin.options.tags) {
8
+ htmlWebpackPlugin.options.tags.forEach(function(item){
9
+ var { tag = "script", textContent = "", ...attrs } = item;
10
+ var _attrs = "";
11
+ for (const key in attrs) {
12
+ if (attrs.hasOwnProperty(key)) {
13
+ _attrs += `${key}="${attrs[key]}" `;
14
+ }
15
+ }
16
+ customTag += `<${tag} ${_attrs}>${textContent}</${tag}>`;
17
+ });
18
+ }
19
+ %>
20
+ <%= customTag %>
21
+ </head>
22
+ <body>
23
+ <div id="root"></div>
24
+ </body>
25
+ </html>
@@ -0,0 +1,493 @@
1
+ /* eslint-disable no-unused-vars */
2
+ import type { Options } from 'ts-import-plugin';
3
+ import type { RuleSetRule, WebpackPluginInstance, Configuration, CleanPlugin } from 'webpack';
4
+ import type { ProxyArray, ProxyConfigArray, ProxyConfigMap } from 'webpack-dev-server';
5
+ import type { JsMinifyOptions } from '@swc/core';
6
+ import type { MinifyOptions } from 'terser';
7
+ import { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
8
+ import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
9
+
10
+ export type MinifierType = 'swc' | 'terser';
11
+ export declare type AppType = 'mobile' | 'site' | 'back-stage' | 'single-spa' | 'library';
12
+ export type TerserOptions = MinifyOptions;
13
+ export type SwcOptions = JsMinifyOptions;
14
+ export declare type ConfigType<T = 'tsc'> = {
15
+ clean: boolean | CleanPlugin['options'];
16
+ /** 渲染模式 */
17
+ mode: 'ssr' | 'csr';
18
+ /** 编译器 */
19
+ compiler: 'tsc' | 'swc';
20
+ /** swc 配置项,仅当编译器为 swc 时有效 */
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ swcrc?: Record<string, any> | ((isDev: boolean) => Record<string, any>);
23
+ /**
24
+ * 自定义entry
25
+ * 当你需要添加一些polyfill函数时可在这里添加
26
+ * 比如兼容es10的object.fromentries:
27
+ * @example
28
+ * ```
29
+ * const config = {
30
+ * entry: {
31
+ * polyfillObjectFromentries: 'polyfill-object.fromentries'
32
+ * }
33
+ * }
34
+ * ```
35
+ **/
36
+ entry?: Record<string, string>;
37
+ /** 压缩配置 */
38
+ minifier: {
39
+ type?: MinifierType;
40
+ options?: SwcOptions | TerserOptions;
41
+ css?: 'cssnano' | 'parcelCss';
42
+ };
43
+ /** 环境变量, 可通过 process.env 获取 */
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ env?: Record<string, any>;
46
+ /** mini-idc 数据持久化配置, 为 false 时关闭持久化 */
47
+ miniIdc?:
48
+ | {
49
+ /** 持久化数据使用的key, 当key为 'none' 时, 关闭持久化 */
50
+ programName?: string;
51
+ /** 持久化数据是否加密 */
52
+ encrypt?: boolean;
53
+ /** 自定义RSA加密密钥 */
54
+ encryptKey?: string;
55
+ }
56
+ | false;
57
+ devtool?: Configuration['devtool'];
58
+ sourceMap?: SourceMapDevToolPluginOptions | false;
59
+ /** 路径别名映射 */
60
+ alias?: {
61
+ [key: string]: string;
62
+ };
63
+ /** 根路由 */
64
+ routeBaseName: string;
65
+ /** 输出目录前置路径,默认: / */
66
+ publicPath: string;
67
+ /** 设计图尺寸 默认: 1680 */
68
+ designSize: number;
69
+ /** 自定义降级组件 */
70
+ fallbackCompPath?: string | null;
71
+ /** less 全局变量 */
72
+ modifyVars: Record<string, string>;
73
+ /** antd 主题配置 */
74
+ antdThemeVariables: {
75
+ compact?: boolean;
76
+ dark?: boolean;
77
+ };
78
+ /** 类名前缀 */
79
+ prefixCls?: string;
80
+ /** 左侧菜单栏, 不需要时设置为 false, 仅 type: back-stage 时有效 */
81
+ layoutSider:
82
+ | false
83
+ | {
84
+ theme?: 'light' | 'dark';
85
+ breakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
86
+ };
87
+ /** 自定义 webpack module rules */
88
+ moduleRules: RuleSetRule[];
89
+ /** node_modules中, 需要开启 cssModules 的模块 */
90
+ cssModules: string[];
91
+ /** 按需引入 */
92
+ importOnDemand: T extends 'tsc'
93
+ ? Partial<Options>[]
94
+ : Record<string, SwcImportOnDemandTransform | SwcImportOnDemandConfig>;
95
+ /** 开发服务器代理 */
96
+ proxy: ProxyArray | ProxyConfigArray | ProxyConfigMap;
97
+ /** 自定义缓存目录,为 false 时,不使用缓存 */
98
+ cacheDirectory: string | false;
99
+ /** 开发服务器设置 */
100
+ devServer: {
101
+ allowedHosts?: string[];
102
+ host?: string;
103
+ port?: number;
104
+ https?: boolean;
105
+ compress?: boolean;
106
+ };
107
+ /** HtmlWebpackPlugin Option */
108
+ htmlPluginOption: HtmlWebpackPluginOptions & {
109
+ tags?: {
110
+ textContent?: string;
111
+ tag?: string;
112
+ [key: string]: string | null | boolean | number;
113
+ }[];
114
+ };
115
+ /** 自定义插入 html 的 js 和 css */
116
+ assetHtml: AssetHtmlOptions[];
117
+ /** 路由模式 默认 browser */
118
+ routerMode: 'hash' | 'browser' | 'memory';
119
+ /** webpack 插件 */
120
+ plugins: WebpackPluginInstance[];
121
+ /** 对生产chunk进行拆分 */
122
+ splitChunk?: false | OptimizationSplitChunksOptions;
123
+ runtimeChunk?:
124
+ | boolean
125
+ | 'single'
126
+ | 'multiple'
127
+ | {
128
+ // eslint-disable-next-line @typescript-eslint/ban-types
129
+ name?: string | Function;
130
+ };
131
+ /** 通过Web字体加载加载的字体 */
132
+ webFontLoader: string[];
133
+ /** 编译输出路径 */
134
+ output: string;
135
+ /** 模块联邦 */
136
+ moduleFederation: ModuleFederationOption[];
137
+ /** 跳过编译的模块 */
138
+ externals?: Configuration['externals'];
139
+ rulesInclude?: {
140
+ less?: string[];
141
+ css?: string[];
142
+ js?: string[];
143
+ media?: string[];
144
+ fonts?: string[];
145
+ };
146
+ };
147
+ export declare interface ModuleFederationOption {
148
+ /** 模块名称,唯一性,不能重名 */
149
+ name: string;
150
+ /** 打包的模块文件名 默认: remote_entry.js */
151
+ filename?: string;
152
+ library?: {
153
+ type: 'var' | string;
154
+ name: string;
155
+ };
156
+ runtime?: string;
157
+ /** 表示作为 Host 时, 去消费哪些 Remote */
158
+ remotes?: {
159
+ /** 远程模块名称 */
160
+ name: string;
161
+ /** 远程模块文件名 默认: remote_entry.js */
162
+ filename?: string;
163
+ /** 远程模块访问地址 */
164
+ host: string;
165
+ /** 远程模块别名
166
+ * @example
167
+ * ```javascript
168
+ * const remote = {
169
+ * name: 'a-b-c',
170
+ * // 设置别名为ABC
171
+ * alias: 'ABC',
172
+ * library: ['react'],
173
+ * }
174
+ * // 通过别名导入
175
+ * import React from 'ABC/react';
176
+ * ```
177
+ */
178
+ alias?: string;
179
+ /** 从此模块加载的library
180
+ * @example
181
+ * ```javascript
182
+ * const library = ['react', 'lodash'];
183
+ * // 所有通过react、lodash的导入将被转换成
184
+ * import ... from '远程模块名/react';
185
+ * import ... from '远程模块名/lodash';
186
+ * ```
187
+ */
188
+ library?: string[];
189
+ }[];
190
+ /** 当前模块具体导出去的内容
191
+ * @example
192
+ * ```javascript
193
+ * const exposes = [
194
+ * // 导出 node_modules下 的 react
195
+ * "react",
196
+ * // 导出 node_modules下 的 lodash
197
+ * "lodash",
198
+ * // 导出自定义组件
199
+ * {
200
+ * // 给这个组件取名为Button
201
+ * name: 'Button',
202
+ * // 组件的源码位置
203
+ * path: './src/btn/index.tsx',
204
+ * }
205
+ * ]
206
+ * // 其它项目接入后使用Button组件
207
+ * import Button from '模块名/Button';
208
+ * import React from '模块名/react';
209
+ * ```
210
+ */
211
+ exposes?: (
212
+ | string
213
+ | {
214
+ /** 组件名称 */
215
+ name: string;
216
+ /** 组件源码路径 */
217
+ path: string;
218
+ }
219
+ )[];
220
+ /** 优先用 Host 的依赖, 如果 Host 没有, 再用自己的 */
221
+ shared?: Record<string, SharedConfig | string> | string[];
222
+ }
223
+
224
+ export declare interface SharedConfig {
225
+ /**
226
+ *直接在异步请求后面包含提供的和后备模块。这也允许在初始加载中使用此共享模块。所有可能的共享模块也都需要急切。
227
+ */
228
+ eager?: boolean;
229
+ /**
230
+ *应提供共享范围的提供的模块。如果在共享作用域中找不到共享模块或版本无效,则还充当回退模块。默认为属性名称。
231
+ */
232
+ import?: number;
233
+ /**
234
+ *软件包名称,用于从描述文件中确定所需的版本。仅当无法根据请求自动确定包名称时才需要。
235
+ */
236
+ packageName?: string;
237
+ /**
238
+ *共享范围中来自模块的版本要求。
239
+ */
240
+ requiredVersion?: number;
241
+ /**
242
+ *在共享范围内的此键下查找模块。
243
+ */
244
+ shareKey?: string;
245
+ /**
246
+ *共享范围名称。
247
+ */
248
+ shareScope?: string;
249
+ /**
250
+ *在共享范围内仅允许共享模块的单个版本(默认情况下处于禁用状态)。
251
+ */
252
+ singleton?: boolean;
253
+ /**
254
+ *如果版本无效,则不接受共享模块(默认为是,如果本地后备模块可用并且共享模块不是单例,否则为no,如果未指定所需的版本,则无效)。
255
+ */
256
+ strictVersion?: boolean;
257
+ /**
258
+ *所提供模块的版本。将替换较低的匹配版本,但不会替换较高的版本。
259
+ */
260
+ version?: number;
261
+ }
262
+
263
+ export declare type CommomType<T> = {
264
+ CONFIG: ConfigType<T>;
265
+ log: (msg: string) => void;
266
+ };
267
+ export declare interface SourceMapDevToolPluginOptions {
268
+ append?: null | string | false;
269
+ columns?: boolean;
270
+ exclude?: string | RegExp | Rule[];
271
+ fallbackModuleFilenameTemplate?: string | typeof Function;
272
+ fileContext?: string;
273
+ filename?: null | string | false;
274
+ include?: string | RegExp | Rule[];
275
+ module?: boolean;
276
+ moduleFilenameTemplate?: string | typeof Function;
277
+ namespace?: string;
278
+ noSources?: boolean;
279
+ publicPath?: string;
280
+ sourceRoot?: string;
281
+ test?: string | RegExp | Rule[];
282
+ }
283
+ export type ProgramInfoType = {
284
+ /** 应用名称 */
285
+ name: string;
286
+ /** 应用描述 */
287
+ description: string;
288
+ /** 应用版本 */
289
+ version: string;
290
+ /** 应用类型 */
291
+ type: 'mobile' | 'site' | 'back-stage' | 'single-spa' | 'library';
292
+ /** 开发者 */
293
+ author:
294
+ | {
295
+ name: string;
296
+ email?: string;
297
+ }
298
+ | string;
299
+ /** 存储库 */
300
+ repository: string;
301
+ /** 路由模式 */
302
+ routerMode: 'hash' | 'browser' | 'memory';
303
+ /** 根路由 */
304
+ routeBaseName: string;
305
+ /** 设计尺寸 */
306
+ designSize: number;
307
+ /** 渲染模式 */
308
+ renderMode: 'ssr' | 'csr';
309
+ };
310
+
311
+ export type CoverageType = {
312
+ /** 语句(statement coverage) */
313
+ statements: string;
314
+ /** 语句覆盖: 是不是每个语句都执行了 */
315
+ coveredstatements: string;
316
+ /** 条件(branch coverage) */
317
+ conditionals: string;
318
+ /** 条件覆盖: 是不是每个条件代码块都执行了 */
319
+ coveredconditionals: string;
320
+ /** 函数(function coverage) */
321
+ methods: string;
322
+ /** 函数覆盖: 是不是每个函数都调用了 */
323
+ coveredmethods: string;
324
+ };
325
+
326
+ export type ProjectCoverageType = {
327
+ /** 元素 */
328
+ elements: string;
329
+ /** 覆盖元素 */
330
+ coveredelements: string;
331
+ complexity: string;
332
+ loc: string;
333
+ ncloc: string;
334
+ /** 经过测试的组件 */
335
+ packages: string;
336
+ /** 经过测试的文件 */
337
+ files: string;
338
+ /** 经过测试的类 */
339
+ classes: string;
340
+ };
341
+
342
+ declare interface OptimizationSplitChunksOptions {
343
+ /**
344
+ * Sets the name delimiter for created chunks.
345
+ */
346
+ automaticNameDelimiter?: string;
347
+
348
+ /**
349
+ * Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks, default categories: 'default', 'defaultVendors').
350
+ */
351
+ cacheGroups?: {
352
+ // eslint-disable-next-line @typescript-eslint/ban-types
353
+ [index: string]: string | false | Function | RegExp | OptimizationSplitChunksCacheGroup;
354
+ };
355
+
356
+ /**
357
+ * Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
358
+ */
359
+ chunks?: 'all' | 'initial' | 'async' | ((chunk: Chunk) => boolean);
360
+
361
+ /**
362
+ * Sets the size types which are used when a number is used for sizes.
363
+ */
364
+ defaultSizeTypes?: string[];
365
+
366
+ /**
367
+ * Size threshold at which splitting is enforced and other restrictions (minRemainingSize, maxAsyncRequests, maxInitialRequests) are ignored.
368
+ */
369
+ enforceSizeThreshold?: number | { [index: string]: number };
370
+
371
+ /**
372
+ * Options for modules not selected by any other cache group.
373
+ */
374
+ fallbackCacheGroup?: {
375
+ /**
376
+ * Sets the name delimiter for created chunks.
377
+ */
378
+ automaticNameDelimiter?: string;
379
+ /**
380
+ * Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
381
+ */
382
+ chunks?: 'all' | 'initial' | 'async' | ((chunk: Chunk) => boolean);
383
+ /**
384
+ * Maximal size hint for the on-demand chunks.
385
+ */
386
+ maxAsyncSize?: number | { [index: string]: number };
387
+ /**
388
+ * Maximal size hint for the initial chunks.
389
+ */
390
+ maxInitialSize?: number | { [index: string]: number };
391
+ /**
392
+ * Maximal size hint for the created chunks.
393
+ */
394
+ maxSize?: number | { [index: string]: number };
395
+ /**
396
+ * Minimal size for the created chunk.
397
+ */
398
+ minSize?: number | { [index: string]: number };
399
+ /**
400
+ * Minimum size reduction due to the created chunk.
401
+ */
402
+ minSizeReduction?: number | { [index: string]: number };
403
+ };
404
+
405
+ /**
406
+ * Sets the template for the filename for created chunks.
407
+ */
408
+ filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
409
+
410
+ /**
411
+ * Prevents exposing path info when creating names for parts splitted by maxSize.
412
+ */
413
+ hidePathInfo?: boolean;
414
+
415
+ /**
416
+ * Maximum number of requests which are accepted for on-demand loading.
417
+ */
418
+ maxAsyncRequests?: number;
419
+
420
+ /**
421
+ * Maximal size hint for the on-demand chunks.
422
+ */
423
+ maxAsyncSize?: number | { [index: string]: number };
424
+
425
+ /**
426
+ * Maximum number of initial chunks which are accepted for an entry point.
427
+ */
428
+ maxInitialRequests?: number;
429
+
430
+ /**
431
+ * Maximal size hint for the initial chunks.
432
+ */
433
+ maxInitialSize?: number | { [index: string]: number };
434
+
435
+ /**
436
+ * Maximal size hint for the created chunks.
437
+ */
438
+ maxSize?: number | { [index: string]: number };
439
+
440
+ /**
441
+ * Minimum number of times a module has to be duplicated until it's considered for splitting.
442
+ */
443
+ minChunks?: number;
444
+
445
+ /**
446
+ * Minimal size for the chunks the stay after moving the modules to a new chunk.
447
+ */
448
+ minRemainingSize?: number | { [index: string]: number };
449
+
450
+ /**
451
+ * Minimal size for the created chunks.
452
+ */
453
+ minSize?: number | { [index: string]: number };
454
+
455
+ /**
456
+ * Minimum size reduction due to the created chunk.
457
+ */
458
+ minSizeReduction?: number | { [index: string]: number };
459
+
460
+ /**
461
+ * Give chunks created a name (chunks with equal name are merged).
462
+ */
463
+ // eslint-disable-next-line @typescript-eslint/ban-types
464
+ name?: string | false | Function;
465
+
466
+ /**
467
+ * Compare used exports when checking common modules. Modules will only be put in the same chunk when exports are equal.
468
+ */
469
+ usedExports?: boolean;
470
+ }
471
+
472
+ export interface SwcImportOnDemandTransformCtx {
473
+ source: string;
474
+ name: string;
475
+ }
476
+
477
+ export type SwcImportOnDemandTransformFn = (
478
+ ctx: SwcImportOnDemandTransformCtx
479
+ ) => string | string[] | undefined | null | false;
480
+
481
+ export type SwcImportOnDemandTransform = string | string[] | SwcImportOnDemandTransformFn;
482
+
483
+ export interface SwcImportOnDemandConfig {
484
+ transform: SwcImportOnDemandTransform;
485
+ style?: boolean | string;
486
+ }
487
+
488
+ declare global {
489
+ // eslint-disable-next-line vars-on-top,no-var
490
+ var NEKOCLICONFIG: CommomType;
491
+ }
492
+
493
+ export {};