akfun 5.1.19 → 5.1.20
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/package.json +1 -1
- package/src/build2esm.js +1 -1
- package/src/config/.eslintrc.js +2 -1
- package/src/config/.eslintrc.ts.js +2 -1
- package/src/config/.eslintrc.vue.js +2 -1
- package/src/config/babel.config.js +1 -1
- package/src/manage/ConfigManager.js +5 -2
- package/src/webpack/loaderUtils.js +5 -2
- package/src/webpack/vue-loader.conf.js +1 -1
- package/src/webpack/webpack.dev.conf.js +1 -1
- package/src/webpack/webpack.library.conf.js +1 -1
- package/src/webpack/webpack.prod.conf.js +1 -1
package/package.json
CHANGED
package/src/build2esm.js
CHANGED
|
@@ -31,7 +31,7 @@ module.exports = function (fileName, akfunConfig, _consoleTag) {
|
|
|
31
31
|
const consoleTag = _consoleTag || curConsoleTag;
|
|
32
32
|
// 获取项目配置文件
|
|
33
33
|
let config = getProjectConfig(akfunConfig);
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
const spinner = ora(`${consoleTag}开启esm模块构建能力...`).start();
|
|
36
36
|
const curRollupConfig = rollupConfig(fileName, config); // 默认配置
|
|
37
37
|
const build2esm = config.build2esm; // 用户的项目配置
|
package/src/config/.eslintrc.js
CHANGED
|
@@ -82,6 +82,7 @@ module.exports = {
|
|
|
82
82
|
'no-eval': 1, // JavaScript的eval()功能具有潜在的危险,并且经常被滥用
|
|
83
83
|
'object-curly-newline': 0, // 该规则在对象文字括号或销毁分配中强制使用一致的换行符
|
|
84
84
|
'operator-linebreak': [0, 'before'], // 换行时运算符在行尾还是行首
|
|
85
|
-
'max-len': ['warn', { code: 150 }]
|
|
85
|
+
'max-len': ['warn', { code: 150 }],
|
|
86
|
+
'class-methods-use-this': 0 // 允许类方法不使用 this
|
|
86
87
|
}
|
|
87
88
|
};
|
|
@@ -83,6 +83,7 @@ module.exports = {
|
|
|
83
83
|
'no-eval': 1, // JavaScript的eval()功能具有潜在的危险,并且经常被滥用
|
|
84
84
|
'object-curly-newline': 0, // 该规则在对象文字括号或销毁分配中强制使用一致的换行符
|
|
85
85
|
'operator-linebreak': [0, 'before'], // 换行时运算符在行尾还是行首
|
|
86
|
-
'max-len': ['warn', { code: 150 }]
|
|
86
|
+
'max-len': ['warn', { code: 150 }],
|
|
87
|
+
'class-methods-use-this': 0 // 允许类方法不使用 this
|
|
87
88
|
}
|
|
88
89
|
};
|
|
@@ -82,6 +82,7 @@ module.exports = {
|
|
|
82
82
|
'no-eval': 1, // JavaScript的eval()功能具有潜在的危险,并且经常被滥用
|
|
83
83
|
'object-curly-newline': 0, // 该规则在对象文字括号或销毁分配中强制使用一致的换行符
|
|
84
84
|
'operator-linebreak': [0, 'before'], // 换行时运算符在行尾还是行首
|
|
85
|
-
'max-len': ['warn', { code: 150 }]
|
|
85
|
+
'max-len': ['warn', { code: 150 }],
|
|
86
|
+
'class-methods-use-this': 0 // 允许类方法不使用 this
|
|
86
87
|
}
|
|
87
88
|
};
|
|
@@ -4,7 +4,7 @@ module.exports = {
|
|
|
4
4
|
'@babel/preset-env',
|
|
5
5
|
{
|
|
6
6
|
loose: true,
|
|
7
|
-
modules: false
|
|
7
|
+
modules: false // 是否启用将ES6模块语法转换为其他模块类型的功能,当前设置为false,以便webpack进行tree shaking。
|
|
8
8
|
/*
|
|
9
9
|
备注:后续升级babel版本时,再启用此配置
|
|
10
10
|
useBuiltIns: 'usage', // 按需引入 polyfill,替代 @babel/polyfill
|
|
@@ -58,7 +58,9 @@ class ConfigManager {
|
|
|
58
58
|
* 按优先级查找:akfun.config.js -> akfun.config.json
|
|
59
59
|
* @returns {Object|null}
|
|
60
60
|
*/
|
|
61
|
-
autoLoadConfig(
|
|
61
|
+
autoLoadConfig(
|
|
62
|
+
configFiles = ['akfun.config.js', 'akfun.config.json', '.akfunrc.js', '.akfunrc.json']
|
|
63
|
+
) {
|
|
62
64
|
for (const configFile of configFiles) {
|
|
63
65
|
const configPath = path.resolve(process.cwd(), configFile);
|
|
64
66
|
if (fs.existsSync(configPath)) {
|
|
@@ -66,7 +68,8 @@ class ConfigManager {
|
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
// 待优化:eslint 配置中如何使用外部项目的 webpack 配置
|
|
72
|
+
// console.log(chalk.gray(' 未找到项目配置文件,使用默认配置'));
|
|
70
73
|
return null;
|
|
71
74
|
}
|
|
72
75
|
|
|
@@ -20,7 +20,7 @@ function getAssetsPath(url) {
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* 用于生成css-loader配置
|
|
23
|
-
* @param {*} options
|
|
23
|
+
* @param {*} options
|
|
24
24
|
* @param {Object} options.envConfig 当前环境配置
|
|
25
25
|
* @param {Object} options.webpackConfig 当前webpack配置
|
|
26
26
|
* @returns {Object} css-loader配置
|
|
@@ -50,7 +50,10 @@ exports.cssLoaders = function (options) {
|
|
|
50
50
|
// url: false, // enables/disables url()/image-set() functions handling
|
|
51
51
|
url: {
|
|
52
52
|
filter: (url, resourcePath) => {
|
|
53
|
-
if (
|
|
53
|
+
if (
|
|
54
|
+
curWebpackConfig.cssLoaderUrlDir &&
|
|
55
|
+
resourcePath.includes(curWebpackConfig.cssLoaderUrlDir)
|
|
56
|
+
) {
|
|
54
57
|
// 指定处理某类路径下的中相关 css 文件中的 url
|
|
55
58
|
return true;
|
|
56
59
|
}
|
|
@@ -4,7 +4,7 @@ module.exports = (curEnvConfig, curWebpackConfig) => {
|
|
|
4
4
|
return {
|
|
5
5
|
loaders: utils.cssLoaders({
|
|
6
6
|
envConfig: curEnvConfig, // 当前环境变量
|
|
7
|
-
webpackConfig: curWebpackConfig
|
|
7
|
+
webpackConfig: curWebpackConfig // 当前webpack配置
|
|
8
8
|
}),
|
|
9
9
|
transformToRequire: {
|
|
10
10
|
video: 'src',
|
|
@@ -40,7 +40,7 @@ module.exports = (akfunConfig) => {
|
|
|
40
40
|
module: {
|
|
41
41
|
rules: utils.styleLoaders({
|
|
42
42
|
envConfig: curEnvConfig, // 当前环境变量
|
|
43
|
-
webpackConfig: curWebpackConfig
|
|
43
|
+
webpackConfig: curWebpackConfig // 当前webpack配置
|
|
44
44
|
})
|
|
45
45
|
},
|
|
46
46
|
// devtool: '#cheap-module-eval-source-map', // 本地开发环境中的取值
|
|
@@ -43,7 +43,7 @@ module.exports = (akfunConfig) => {
|
|
|
43
43
|
module: {
|
|
44
44
|
rules: utils.styleLoaders({
|
|
45
45
|
envConfig: curEnvConfig, // 当前环境变量
|
|
46
|
-
webpackConfig: curWebpackConfig
|
|
46
|
+
webpackConfig: curWebpackConfig // 当前webpack配置
|
|
47
47
|
})
|
|
48
48
|
},
|
|
49
49
|
devtool: curEnvConfig.productionSourceMap ? curEnvConfig.devtool || 'source-map' : false, // 线上生成环境
|
|
@@ -56,7 +56,7 @@ module.exports = (akfunConfig) => {
|
|
|
56
56
|
module: {
|
|
57
57
|
rules: utils.styleLoaders({
|
|
58
58
|
envConfig: curEnvConfig, // 当前环境变量
|
|
59
|
-
webpackConfig: curWebpackConfig
|
|
59
|
+
webpackConfig: curWebpackConfig // 当前webpack配置
|
|
60
60
|
})
|
|
61
61
|
},
|
|
62
62
|
devtool: curEnvConfig.productionSourceMap ? curEnvConfig.devtool || 'source-map' : false, // 线上生成环境
|