@wiajs/core 0.1.19 → 1.0.2
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/.eslintrc.js +104 -73
- package/.prettierignore +5 -7
- package/LICENSE +1 -1
- package/babel.config.js +73 -19
- package/babel.web.js +86 -0
- package/dist/core.cmn.js +2209 -0
- package/dist/core.esm.js +1463 -1509
- package/dist/core.js +406 -893
- package/dist/core.min.js +9 -4
- package/gulpfile.js +57 -8
- package/index.js +2 -2
- package/package.json +17 -19
- package/prettier.config.js +4 -1
- package/test/test.js +73 -0
- package/util/tool.js +29 -26
- package/build.js +0 -102
- package/config.js +0 -69
- package/dist/core.common.js +0 -2257
- package/dist/core.common.min.js +0 -6
- package/dist/core.esm.min.js +0 -6
package/.eslintrc.js
CHANGED
|
@@ -1,90 +1,121 @@
|
|
|
1
|
+
const rules = {
|
|
2
|
+
// Disable for console/alert
|
|
3
|
+
// 0 关闭 1 警告 2 报错 https://eslint.org/docs/rules/ 中文网址:http://eslint.cn/docs/rules/
|
|
4
|
+
// "arrow-parens": [2, "as-needed"],
|
|
5
|
+
'arrow-parens': [2, 'as-needed', {requireForBlockBody: false}],
|
|
6
|
+
'arrow-body-style': [2, 'as-needed'],
|
|
7
|
+
'global-require': 0,
|
|
8
|
+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
9
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
10
|
+
quotes: [1, 'single'],
|
|
11
|
+
'no-alert': 0,
|
|
12
|
+
'no-trailing-spaces': 0,
|
|
13
|
+
'nonblock-statement-body-position': 0, // [2, "beside"], // if else 强制单行
|
|
14
|
+
'block-spacing': 0, // 对象空格
|
|
15
|
+
'function-paren-newline': 0, // 函数参数换行
|
|
16
|
+
'linebreak-style': 0,
|
|
17
|
+
'lines-between-class-members': 0,
|
|
18
|
+
'class-methods-use-this': 0,
|
|
19
|
+
'import/no-extraneous-dependencies': 0,
|
|
20
|
+
indent: [2, 2, {SwitchCase: 1}],
|
|
21
|
+
'object-curly-spacing': 0,
|
|
22
|
+
'no-plusplus': 0,
|
|
23
|
+
'no-multi-spaces': 0,
|
|
24
|
+
'no-param-reassign': ['warn', {props: false}],
|
|
25
|
+
'no-use-before-define': [2, {functions: false, classes: true}],
|
|
26
|
+
'no-unused-expressions': ['error', {allowShortCircuit: true}],
|
|
27
|
+
'no-underscore-dangle': 0,
|
|
28
|
+
'no-unused-vars': [1, {vars: 'local', args: 'after-used'}],
|
|
29
|
+
'no-cond-assign': ['error', 'except-parens'],
|
|
30
|
+
'no-return-assign': [2, 'except-parens'],
|
|
31
|
+
'no-await-in-loop': 0,
|
|
32
|
+
'import/prefer-default-export': 0,
|
|
33
|
+
'operator-linebreak': 0,
|
|
34
|
+
'generator-star-spacing': 0,
|
|
35
|
+
// if while function 后面的{必须与if在同一行,java风格。
|
|
36
|
+
// "brace-style": [2, "1tbs", { "allowSingleLine": true }]
|
|
37
|
+
|
|
38
|
+
// 数组和对象键值对最后一个逗号, never 参数:不能带末尾的逗号, always参数:必须带末尾的逗号,
|
|
39
|
+
// always-multiline:多行模式必须带逗号,单行模式不能带逗号
|
|
40
|
+
'comma-dangle': [2, 'only-multiline'],
|
|
41
|
+
// 控制逗号前后的空格
|
|
42
|
+
'comma-spacing': [2, {before: false, after: true}],
|
|
43
|
+
// 控制逗号在行尾出现还是在行首出现
|
|
44
|
+
// http://eslint.org/docs/rules/comma-style
|
|
45
|
+
'comma-style': [0, 'last'],
|
|
46
|
+
'max-len': [2, 120, 2],
|
|
47
|
+
curly: [0, 'multi'], // 单行无需大括号
|
|
48
|
+
// 强制方法必须返回值,TypeScript强类型,不配置
|
|
49
|
+
'consistent-return': 0,
|
|
50
|
+
'object-curly-newline': 0,
|
|
51
|
+
semi: 0, // 分号检查
|
|
52
|
+
'space-before-function-paren': 0, // ["error", "never"]
|
|
53
|
+
'func-names': ['error', 'never'],
|
|
54
|
+
};
|
|
55
|
+
|
|
1
56
|
module.exports = {
|
|
2
57
|
root: true, // 停止父目录查找配置
|
|
3
|
-
parser:
|
|
58
|
+
parser: '@babel/eslint-parser', // "typescript-eslint-parser", "babel-eslint",
|
|
4
59
|
env: {
|
|
5
60
|
es6: true,
|
|
6
|
-
|
|
61
|
+
es2017: true,
|
|
62
|
+
es2020: true,
|
|
63
|
+
es2021: true,
|
|
64
|
+
browser: true, // 浏览器环境中的全局变量
|
|
65
|
+
worker: true,
|
|
7
66
|
node: true,
|
|
8
67
|
commonjs: true,
|
|
9
68
|
mongo: true,
|
|
10
|
-
jest: true
|
|
69
|
+
jest: true,
|
|
70
|
+
jquery: true,
|
|
71
|
+
},
|
|
72
|
+
globals: {
|
|
73
|
+
XMLHttpRequest: true,
|
|
74
|
+
Blob: true,
|
|
75
|
+
Document: true,
|
|
76
|
+
FormData: true,
|
|
77
|
+
Dom: true,
|
|
78
|
+
$: true,
|
|
79
|
+
document: true,
|
|
80
|
+
window: true,
|
|
11
81
|
},
|
|
12
82
|
parserOptions: {
|
|
13
|
-
ecmaVersion:
|
|
83
|
+
ecmaVersion: 'latest',
|
|
14
84
|
sourceType: 'module',
|
|
15
85
|
ecmaFeatures: {
|
|
16
|
-
jsx: true
|
|
17
|
-
}
|
|
86
|
+
jsx: true,
|
|
87
|
+
},
|
|
18
88
|
},
|
|
89
|
+
plugins: [
|
|
90
|
+
// 插件,需安装好,配置时省略 eslint-plugin-
|
|
91
|
+
// babel,
|
|
92
|
+
// react,
|
|
93
|
+
],
|
|
19
94
|
extends: [
|
|
20
|
-
'airbnb'
|
|
21
|
-
|
|
22
|
-
|
|
95
|
+
// 继承规则 // 'airbnb', 'eslint:recommended'
|
|
96
|
+
'plugin:react/recommended',
|
|
97
|
+
'airbnb',
|
|
98
|
+
'plugin:prettier/recommended',
|
|
99
|
+
'plugin:import/recommended',
|
|
23
100
|
],
|
|
24
101
|
rules: {
|
|
25
|
-
|
|
26
|
-
// 0 关闭 1 警告 2 报错 https://eslint.org/docs/rules/ 中文网址:http://eslint.cn/docs/rules/
|
|
27
|
-
// "arrow-parens": [2, "as-needed"],
|
|
28
|
-
"arrow-parens": [2, "as-needed", {requireForBlockBody: false}],
|
|
29
|
-
"arrow-body-style": [2, "as-needed"],
|
|
30
|
-
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
31
|
-
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
32
|
-
"quotes": [1, "single"],
|
|
33
|
-
"no-alert": 0,
|
|
34
|
-
"no-trailing-spaces": 0,
|
|
35
|
-
"nonblock-statement-body-position": 0, //[2, "beside"], // if else 强制单行
|
|
36
|
-
"block-spacing": 0, // 对象空格
|
|
37
|
-
"function-paren-newline": 0, // 函数参数换行
|
|
38
|
-
"linebreak-style": 0,
|
|
39
|
-
"lines-between-class-members": 0,
|
|
40
|
-
"class-methods-use-this": 0,
|
|
41
|
-
"indent": [2, 2, {"SwitchCase": 1}],
|
|
42
|
-
"object-curly-spacing": 0,
|
|
43
|
-
"no-plusplus": 0,
|
|
44
|
-
"no-multi-spaces": 0,
|
|
45
|
-
"no-trailing-spaces": 0,
|
|
46
|
-
"no-param-reassign": [0, {props: false }],
|
|
47
|
-
"no-param-reassign": ["warn", { "props": false }],
|
|
48
|
-
"no-use-before-define": [2, { "functions": false, "classes": true }],
|
|
49
|
-
"no-unused-expressions": ["error", { "allowShortCircuit": true }],
|
|
50
|
-
"no-underscore-dangle": 0,
|
|
51
|
-
"no-unused-vars": [0, { "vars": "local", "args": "after-used" }],
|
|
52
|
-
"generator-star-spacing": 0,
|
|
53
|
-
// if while function 后面的{必须与if在同一行,java风格。
|
|
54
|
-
// "brace-style": [2, "1tbs", { "allowSingleLine": true }]
|
|
55
|
-
|
|
56
|
-
// 数组和对象键值对最后一个逗号, never 参数:不能带末尾的逗号, always参数:必须带末尾的逗号,
|
|
57
|
-
// always-multiline:多行模式必须带逗号,单行模式不能带逗号
|
|
58
|
-
"comma-dangle": [2, "only-multiline"],
|
|
59
|
-
// 控制逗号前后的空格
|
|
60
|
-
"comma-spacing": [2, { "before": false, "after": true }],
|
|
61
|
-
// 控制逗号在行尾出现还是在行首出现
|
|
62
|
-
// http://eslint.org/docs/rules/comma-style
|
|
63
|
-
"comma-style": [0, "last"],
|
|
64
|
-
"max-len": [2, 120, 2],
|
|
65
|
-
"curly": [0, "multi"], // 单行无需大括号
|
|
66
|
-
// 强制方法必须返回值,TypeScript强类型,不配置
|
|
67
|
-
"consistent-return": 0,
|
|
68
|
-
"object-curly-newline": 0,
|
|
69
|
-
"semi": 0, // 分号检查
|
|
70
|
-
"space-before-function-paren": 0, // ["error", "never"]
|
|
71
|
-
"func-names": ["error", "never"]
|
|
102
|
+
...rules,
|
|
72
103
|
},
|
|
73
|
-
|
|
74
|
-
|
|
104
|
+
overrides: [
|
|
105
|
+
{
|
|
106
|
+
files: ['src/**/*.js'],
|
|
107
|
+
extends: [
|
|
108
|
+
'plugin:react/recommended',
|
|
109
|
+
'airbnb-base',
|
|
110
|
+
'plugin:prettier/recommended',
|
|
111
|
+
'plugin:import/recommended'
|
|
112
|
+
],
|
|
113
|
+
plugins: ['react'],
|
|
114
|
+
rules: {
|
|
115
|
+
...rules,
|
|
116
|
+
'react/no-unknown-property': ['off'],
|
|
117
|
+
'react/jsx-key': ['off'],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
75
120
|
],
|
|
76
|
-
|
|
77
|
-
"import/parser": "babel-eslint",
|
|
78
|
-
"import/resolve": {
|
|
79
|
-
"moduleDirectory": ["node_modules", "src"]
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"globals": {
|
|
83
|
-
"__DEV__": true,
|
|
84
|
-
"__OPTION__": true,
|
|
85
|
-
"window": true,
|
|
86
|
-
"document": true,
|
|
87
|
-
"Dom": true,
|
|
88
|
-
"$": true
|
|
89
|
-
}
|
|
90
|
-
}
|
|
121
|
+
};
|
package/.prettierignore
CHANGED
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2015-present, Yan (Sibyl) Yu
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/babel.config.js
CHANGED
|
@@ -1,21 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 代码转换时,控制语法转换与功能补全
|
|
3
|
+
* 目标 node,超es6语法转换,不补全
|
|
4
|
+
* 用于默认转换和eslint
|
|
5
|
+
*/
|
|
1
6
|
const loose = true;
|
|
2
7
|
|
|
3
8
|
const presets = [
|
|
9
|
+
// '@babel/preset-react', // 支持 jsx 语法,如果前端项目中使用jsx,需安装并设置
|
|
4
10
|
[
|
|
5
|
-
'@babel/preset-env',
|
|
11
|
+
'@babel/preset-env', // 预设,已经包含大部分新语法
|
|
12
|
+
/*
|
|
13
|
+
1、影响语法转换与功能补全,不指定则将代码转为ES5语法,补全由useBuiltIns决定
|
|
14
|
+
2、指定目标targets,则目标环境已支持的语法、功能不转换、不补全,减少代码
|
|
15
|
+
3、库、后端打包,无需考虑语法转换和补全,目标设置为node,转换、补全留给前端项目完成
|
|
16
|
+
前端项目需考虑浏览器功能缺失,建议设置较低浏览器版本,避免功能不全报错
|
|
17
|
+
后端项目或库,需支持特定node版本,可设置node版本,引入补全代码,可支持特定版本。
|
|
18
|
+
*/
|
|
6
19
|
{
|
|
7
|
-
|
|
20
|
+
loose,
|
|
21
|
+
// targets: 'defaults', // '> 0.5%, last 2 versions, Firefox ESR, not dead'
|
|
8
22
|
targets: {
|
|
9
|
-
|
|
10
|
-
browsers: [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
// 浏览器设置规则请参加:https://github.com/browserslist/browserslist
|
|
24
|
+
// browsers: ['>1%', 'last 3 versions', 'Firefox ESR', 'ie >= 11'],
|
|
25
|
+
node: 'current', // 按系统安装的node版本作为目标,后台项目
|
|
26
|
+
// node: '14.0', // 指定兼容到node版本,避免低版本node无法运行,后端项目需要
|
|
27
|
+
},
|
|
28
|
+
/*
|
|
29
|
+
1、用于补全,false不补全,由外部polyfill或runtime corejs补全,否则运行报错
|
|
30
|
+
2、库、后端无需补全,但需开启runtime的 helpers,引用辅助函数代替内置,减少体积
|
|
31
|
+
3、usage 通过自动添加使用方法的的corejs引用实现补全,用于前端项目打包
|
|
32
|
+
如:require("core-js/modules/es.promise.js");
|
|
33
|
+
4、需安装 core-js,属于替换全局的补全方案
|
|
34
|
+
5、UMD页面加载库,需通过runtime的corejs补全,避免污染全局
|
|
35
|
+
*/
|
|
36
|
+
// useBuiltIns: 'usage', // 'usage' | 'entry' | false, 缺省为 false
|
|
37
|
+
// usage 需安装并配置corejs版本,defaults to "2.0"
|
|
38
|
+
// corejs: `${require('core-js/package.json').version}`,
|
|
39
|
+
/*
|
|
40
|
+
1、是否将es6模块语法改成其他模块语法,如cjs
|
|
41
|
+
2、false则保留es6语法,可以被rollup或webpack打包时摇树,减少包大小
|
|
42
|
+
3、后端库不需要摇树,直接设置为cjs,除非前端库输出es6版本,方便用户输出时摇树
|
|
43
|
+
*/
|
|
44
|
+
modules: false, // 'cjs' | 'auto' | false, 缺省 auto
|
|
19
45
|
},
|
|
20
46
|
],
|
|
21
47
|
];
|
|
@@ -26,12 +52,40 @@ const plugins = [
|
|
|
26
52
|
['@babel/plugin-proposal-function-bind'],
|
|
27
53
|
['@babel/plugin-proposal-nullish-coalescing-operator'],
|
|
28
54
|
['@babel/plugin-proposal-optional-chaining'],
|
|
55
|
+
[
|
|
56
|
+
/*
|
|
57
|
+
1、将语法转换用到的辅助函数(包括异步await)从内置改为外部runtime引用,避免重复代码
|
|
58
|
+
2、需安装 @babel/runtime-corejs3 是 @babel/runtime、runtime-corejs2 的升级版
|
|
59
|
+
3、corejs: 3,所有用到的es6功能(不管targets),通过runtime-corejs3引用实现补全。
|
|
60
|
+
umd打包页面加载库时,代替usage实现补全,不污染全局空间。
|
|
61
|
+
4、与usage不同的是转换方法名称,不污染全局空间,usage 引用core-js/modules模块,如
|
|
62
|
+
require("core-js/modules/es.promise.js");
|
|
63
|
+
替换为:
|
|
64
|
+
var _promise = require("@babel/runtime-corejs3/core-js-stable/promise");
|
|
65
|
+
5、usage 与 corjs并存时,自动用runtime替换core-js/modules模块
|
|
66
|
+
6、usage时,不使用 runtime,文件引用大量 core-js/modules,使用后引用模块数大量减少
|
|
67
|
+
*/
|
|
68
|
+
'@babel/plugin-transform-runtime',
|
|
69
|
+
{
|
|
70
|
+
// helpers: true, // 语法辅助函数,缺省 true,将内置改为对引用,减少文件大小
|
|
71
|
+
// corejs: 3, // false, 2, 3, 缺省 false.
|
|
72
|
+
// require("@babel/runtime/helpers/asyncToGenerator")
|
|
73
|
+
// 设置为 true/false 好像无变化
|
|
74
|
+
// regenerator: true, // asynt/await支持函数asyncToGenerator转换,缺省 true
|
|
75
|
+
// absoluteRuntime: false, // runtime 路径,缺省false
|
|
76
|
+
// 指定runtime 版本,如 runtime-corejs3@7.20.1,缺省 @babel/runtime@7.0.0
|
|
77
|
+
version: `^${require('@babel/runtime-corejs3/package.json').version}`,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
29
80
|
];
|
|
30
81
|
|
|
31
|
-
module.exports = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
//
|
|
82
|
+
module.exports = {
|
|
83
|
+
presets,
|
|
84
|
+
plugins,
|
|
85
|
+
only: ['./src'],
|
|
86
|
+
ignore: ['./dist', './lib'],
|
|
87
|
+
sourceMaps: false, // boolean | "inline" | "both"
|
|
88
|
+
sourceType: 'unambiguous', // "script" | "module" | "unambiguous" 缺省 "module"
|
|
89
|
+
comments: true, // 保留备注 缺省 true
|
|
90
|
+
minified: false, // Default: false,压缩代码
|
|
91
|
+
};
|
package/babel.web.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 代码转换时,控制语法转换与功能补全
|
|
3
|
+
* umd 格式,es5语法,runtime 补全
|
|
4
|
+
*/
|
|
5
|
+
const loose = true;
|
|
6
|
+
|
|
7
|
+
const presets = [
|
|
8
|
+
// '@babel/preset-react', // 支持 jsx 语法,如果前端项目中使用jsx,需安装并设置
|
|
9
|
+
[
|
|
10
|
+
'@babel/preset-env', // 预设,已经包含大部分新语法
|
|
11
|
+
/*
|
|
12
|
+
1、影响语法转换与功能补全,不指定则将代码转为ES5语法,补全由useBuiltIns决定
|
|
13
|
+
2、指定目标targets,则目标环境已支持的语法、功能不转换、不补全,减少代码
|
|
14
|
+
3、库、后端打包,无需考虑语法转换和补全,目标设置为node,转换、补全留给前端项目完成
|
|
15
|
+
前端项目需考虑浏览器功能缺失,建议设置较低浏览器版本,避免功能不全报错
|
|
16
|
+
后端项目或库,需支持特定node版本,可设置node版本,引入补全代码,可支持特定版本。
|
|
17
|
+
*/
|
|
18
|
+
{
|
|
19
|
+
loose,
|
|
20
|
+
// targets: 'defaults', // '> 0.5%, last 2 versions, Firefox ESR, not dead'
|
|
21
|
+
// targets: 'defaults and supports es6-module', //
|
|
22
|
+
// targets: {
|
|
23
|
+
// 浏览器设置规则请参加:https://github.com/browserslist/browserslist
|
|
24
|
+
// browsers: ['>1%', 'last 2 versions', 'Firefox ESR', 'ie >= 11'],
|
|
25
|
+
// node: 'current', // 按系统安装的node版本作为目标,后台项目
|
|
26
|
+
// node: '14.0', // 指定兼容到node版本,避免低版本node无法运行,后端项目需要
|
|
27
|
+
// },
|
|
28
|
+
/*
|
|
29
|
+
1、用于补全,false不补全,由外部polyfill或runtime corejs补全,否则运行报错
|
|
30
|
+
2、库、后端无需补全,但需开启runtime的 helpers,引用辅助函数代替内置,减少体积
|
|
31
|
+
3、usage 通过自动添加使用方法的的corejs引用实现补全,用于前端项目打包
|
|
32
|
+
如:require("core-js/modules/es.promise.js");
|
|
33
|
+
4、需安装 core-js,属于替换全局的补全方案
|
|
34
|
+
5、UMD页面加载库,需通过runtime的corejs补全,避免污染全局
|
|
35
|
+
*/
|
|
36
|
+
// useBuiltIns: 'usage', // 'usage' | 'entry' | false, 缺省为 false
|
|
37
|
+
// usage 需安装并配置corejs版本,defaults to "2.0"
|
|
38
|
+
// corejs: `${require('core-js/package.json').version}`,
|
|
39
|
+
/*
|
|
40
|
+
1、是否将es6模块语法改成其他模块语法,如cjs
|
|
41
|
+
2、false则保留es6语法,可以被rollup或webpack打包时摇树,减少包大小
|
|
42
|
+
3、后端库不需要摇树,直接设置为cjs,除非前端库输出es6版本,方便用户输出时摇树
|
|
43
|
+
*/
|
|
44
|
+
modules: false, // 'cjs' | 'auto' | false, 缺省 auto
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
const plugins = [
|
|
50
|
+
[
|
|
51
|
+
/*
|
|
52
|
+
1、将语法转换用到的辅助函数(包括异步await)从内置改为外部runtime引用,避免重复代码
|
|
53
|
+
2、需安装 @babel/runtime-corejs3 是 @babel/runtime、runtime-corejs2 的升级版
|
|
54
|
+
3、corejs: 3,所有用到的es6功能(不管targets),通过runtime-corejs3引用实现补全。
|
|
55
|
+
umd打包页面加载库时,代替usage实现补全,不污染全局空间。
|
|
56
|
+
4、与usage不同的是转换方法名称,不污染全局空间,usage 引用core-js/modules模块,如
|
|
57
|
+
require("core-js/modules/es.promise.js");
|
|
58
|
+
替换为:
|
|
59
|
+
var _promise = require("@babel/runtime-corejs3/core-js-stable/promise");
|
|
60
|
+
5、usage 与 corjs并存时,自动用runtime替换core-js/modules模块
|
|
61
|
+
6、usage时,不使用 runtime,文件引用大量 core-js/modules,使用后引用模块数大量减少
|
|
62
|
+
*/
|
|
63
|
+
'@babel/plugin-transform-runtime',
|
|
64
|
+
{
|
|
65
|
+
// helpers: true, // 语法辅助函数,缺省 true,将内置改为对引用,减少文件大小
|
|
66
|
+
// corejs: 3, // false, 2, 3, 缺省 false.
|
|
67
|
+
// require("@babel/runtime/helpers/asyncToGenerator")
|
|
68
|
+
// 设置为 true/false 好像无变化
|
|
69
|
+
// regenerator: true, // asynt/await支持函数asyncToGenerator转换,缺省 true
|
|
70
|
+
// absoluteRuntime: false, // runtime 路径,缺省false
|
|
71
|
+
// 指定runtime 版本,如 runtime-corejs3@7.20.1,缺省 @babel/runtime@7.0.0
|
|
72
|
+
version: `^${require('@babel/runtime-corejs3/package.json').version}`,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
module.exports = {
|
|
78
|
+
presets,
|
|
79
|
+
plugins,
|
|
80
|
+
only: ['./src'],
|
|
81
|
+
ignore: ['./dist'],
|
|
82
|
+
sourceMaps: false, // boolean | "inline" | "both"
|
|
83
|
+
// sourceType: 'unambiguous', // "script" | "module" | "unambiguous" 缺省 "module"
|
|
84
|
+
comments: false, // 保留备注 缺省 true
|
|
85
|
+
minified: false, // Default: false,压缩代码
|
|
86
|
+
};
|