@moneko/core 2.0.17 → 2.0.18
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.
- package/build/seo.js +1 -1
- package/package.json +1 -1
- package/typings/global.d.ts +41 -10
package/build/seo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"seo",{enumerable:true,get:function(){return seo}});var _fs=require("fs");var _path=require("path");var _common=require("./common");var _processEnv=require("./process-env");var _webpackCommon=require("./webpack.common");function getLibDocsPages(dir,domain,basename){var results=[];var list=(0,_fs.readdirSync)(dir);list.forEach(function(_file){if(_file==="static"){return false}var file=dir+"/"+_file;var stat=(0,_fs.statSync)(file);if(stat&&stat.isDirectory()){results=results.concat(getLibDocsPages(file,domain,basename))}else if(file.endsWith("README.mdx")){results.push("https://"+domain+basename+file.replace(_processEnv.PROGRAMPATH+"/components/","").replace("/README.mdx",""))}});return results}var seo=function(){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"seo",{enumerable:true,get:function(){return seo}});var _fs=require("fs");var _path=require("path");var _common=require("./common");var _processEnv=require("./process-env");var _webpackCommon=require("./webpack.common");function getLibDocsPages(dir,domain,basename){var results=[];var list=(0,_fs.readdirSync)(dir);list.forEach(function(_file){if(_file==="static"){return false}var file=dir+"/"+_file;var stat=(0,_fs.statSync)(file);if(stat&&stat.isDirectory()){results=results.concat(getLibDocsPages(file,domain,basename))}else if(file.endsWith("README.mdx")){results.push("https://"+domain+basename+file.replace(_processEnv.PROGRAMPATH+"/components/","").replace("/README.mdx",""))}});return results}var seo=function(){var _ref=_common.CONFIG.seo||{},domain=_ref.domain,nojekyll=_ref.nojekyll;if(!domain){return}var baseDir=(_webpackCommon.outputConfig===null||_webpackCommon.outputConfig===void 0?void 0:_webpackCommon.outputConfig.path)||process.cwd();var call=function(err){if(err){throw err}};(0,_fs.writeFile)((0,_path.join)(baseDir,"CNAME"),domain,"utf-8",call);(0,_fs.writeFile)((0,_path.join)(baseDir,"robots"),"Sitemap: https://".concat(domain).concat(_common.CONFIG.routeBaseName,"sitemap.txt"),"utf-8",call);var sitemap="";switch(_processEnv.APPTYPE){case"library":sitemap=getLibDocsPages((0,_path.join)(_processEnv.PROGRAMPATH,"./components"),domain,_common.CONFIG.routeBaseName).join("\n");break;case"single-component":case"mobile":case"site":case"back-stage":case"single-spa":default:break}(0,_fs.writeFile)((0,_path.join)(baseDir,"sitemap.txt"),sitemap,"utf-8",call);if(nojekyll){(0,_fs.writeFile)((0,_path.join)(baseDir,".nojekyll"),"","utf-8",call)}};
|
package/package.json
CHANGED
package/typings/global.d.ts
CHANGED
|
@@ -31,9 +31,13 @@ export type HtmlWebpackOption = HtmlWebpackPluginOptions & {
|
|
|
31
31
|
}[];
|
|
32
32
|
};
|
|
33
33
|
export declare type ConfigType<T = 'tsc'> = {
|
|
34
|
-
/** 渲染模式
|
|
34
|
+
/** 渲染模式
|
|
35
|
+
* @default 'csr'
|
|
36
|
+
*/
|
|
35
37
|
mode: 'ssr' | 'csr';
|
|
36
|
-
/** 编译器
|
|
38
|
+
/** 编译器
|
|
39
|
+
* @default 'swc'
|
|
40
|
+
*/
|
|
37
41
|
compiler: 'tsc' | 'swc';
|
|
38
42
|
/** swc 配置项,仅当编译器为 swc 时有效 */
|
|
39
43
|
swcrc?: SwcConfig | ((isDev: boolean) => SwcConfig);
|
|
@@ -53,14 +57,22 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
53
57
|
entry?: Record<string, string>;
|
|
54
58
|
/** 压缩配置 */
|
|
55
59
|
minifier: {
|
|
60
|
+
/**
|
|
61
|
+
* @default 'swc'
|
|
62
|
+
*/
|
|
56
63
|
type?: MinifierType;
|
|
57
64
|
options?: SwcOptions | TerserOptions;
|
|
65
|
+
/**
|
|
66
|
+
* @default 'parcelCss'
|
|
67
|
+
*/
|
|
58
68
|
css?: 'cssnano' | 'parcelCss';
|
|
59
69
|
};
|
|
60
70
|
/** 环境变量, 可通过 process.env 获取 */
|
|
61
71
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
72
|
env?: Record<string, any>;
|
|
63
|
-
/** persistence 持久化数据使用的key, 为 false 时关闭持久化
|
|
73
|
+
/** persistence 持久化数据使用的key, 为 false 时关闭持久化
|
|
74
|
+
* @default false
|
|
75
|
+
**/
|
|
64
76
|
persistence?: string | false;
|
|
65
77
|
devtool?: Configuration['devtool'];
|
|
66
78
|
sourceMap?: SourceMapDevToolPluginOptions | false;
|
|
@@ -70,15 +82,21 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
70
82
|
};
|
|
71
83
|
/** 根路由 */
|
|
72
84
|
routeBaseName: string;
|
|
73
|
-
/**
|
|
85
|
+
/** 输出目录前置路径
|
|
86
|
+
* @default /
|
|
87
|
+
* */
|
|
74
88
|
publicPath: string;
|
|
75
|
-
/** 设计图尺寸
|
|
89
|
+
/** 设计图尺寸
|
|
90
|
+
* @default 1680
|
|
91
|
+
* */
|
|
76
92
|
designSize: number;
|
|
77
93
|
/** 自定义降级组件 */
|
|
78
94
|
fallbackCompPath?: string | null;
|
|
79
95
|
/** less 全局变量 */
|
|
80
96
|
modifyVars: Record<string, string>;
|
|
81
|
-
/** 类名前缀
|
|
97
|
+
/** 类名前缀
|
|
98
|
+
* @default n
|
|
99
|
+
*/
|
|
82
100
|
prefixCls?: string;
|
|
83
101
|
/** 左侧菜单栏, 不需要时设置为 false, 仅 type: back-stage 时有效 */
|
|
84
102
|
layoutSider:
|
|
@@ -126,11 +144,16 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
126
144
|
htmlPluginOption: HtmlWebpackOption;
|
|
127
145
|
/** 自定义插入 html 的 js 和 css */
|
|
128
146
|
assetHtml: AssetHtmlOptions[];
|
|
129
|
-
/** 路由模式
|
|
147
|
+
/** 路由模式
|
|
148
|
+
* @description
|
|
130
149
|
* 当在不支持 browserRouter 的环境(GitHub pages)使用 browserRouter,
|
|
131
|
-
* 则需要添加设置 fixBrowserRouter: true
|
|
150
|
+
* 则需要添加设置 fixBrowserRouter: true
|
|
151
|
+
* @default 'browser'
|
|
152
|
+
* */
|
|
132
153
|
routerMode: 'hash' | 'browser' | 'memory';
|
|
133
|
-
/** 在不支持 browserRouter 的环境(GitHub pages)使用 browserRouter
|
|
154
|
+
/** 在不支持 browserRouter 的环境(GitHub pages)使用 browserRouter
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
134
157
|
fixBrowserRouter: boolean;
|
|
135
158
|
/** webpack 插件 */
|
|
136
159
|
plugins: WebpackPluginInstance[];
|
|
@@ -158,11 +181,19 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
158
181
|
fonts?: string[];
|
|
159
182
|
};
|
|
160
183
|
bundleAnalyzer: BundleAnalyzerPlugin.Options;
|
|
161
|
-
/** seo优化
|
|
184
|
+
/** seo优化
|
|
185
|
+
* @default false
|
|
186
|
+
*/
|
|
162
187
|
seo:
|
|
163
188
|
| {
|
|
164
189
|
/** 域名 */
|
|
165
190
|
domain: string;
|
|
191
|
+
/** 添加 .nojekyll 文件
|
|
192
|
+
* @description 告诉网站部署平台当前网站不是基于 Jekyll 构建的,
|
|
193
|
+
* 不要忽略掉下划线开头的文件和文件夹
|
|
194
|
+
* @default true
|
|
195
|
+
**/
|
|
196
|
+
nojekyll?: boolean;
|
|
166
197
|
}
|
|
167
198
|
| false;
|
|
168
199
|
/** 📦 打包完成 */
|