@modern-js/babel-compiler 2.14.0 → 2.16.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.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/build.js +16 -47
- package/dist/cjs/buildWatch.js +119 -89
- package/dist/cjs/compiler.js +73 -75
- package/dist/cjs/compilerErrorResult.js +28 -34
- package/dist/cjs/constants.js +7 -25
- package/dist/cjs/defaults.js +9 -27
- package/dist/cjs/getFinalOption.js +33 -50
- package/dist/cjs/index.js +29 -36
- package/dist/cjs/type.js +4 -15
- package/dist/cjs/utils.js +49 -37
- package/dist/cjs/validate.js +21 -33
- package/dist/esm/build.js +217 -210
- package/dist/esm/buildWatch.js +389 -375
- package/dist/esm/compiler.js +118 -119
- package/dist/esm/compilerErrorResult.js +103 -100
- package/dist/esm/constants.js +5 -6
- package/dist/esm/defaults.js +36 -37
- package/dist/esm/getFinalOption.js +124 -116
- package/dist/esm/index.js +154 -148
- package/dist/esm/type.js +1 -1
- package/dist/esm/utils.js +2 -3
- package/dist/esm/validate.js +31 -32
- package/dist/esm-node/build.js +4 -20
- package/dist/esm-node/buildWatch.js +60 -51
- package/dist/esm-node/compiler.js +8 -31
- package/dist/esm-node/compilerErrorResult.js +21 -12
- package/dist/esm-node/constants.js +1 -4
- package/dist/esm-node/defaults.js +1 -4
- package/dist/esm-node/getFinalOption.js +16 -24
- package/dist/esm-node/index.js +1 -4
- package/dist/esm-node/type.js +1 -0
- package/dist/esm-node/utils.js +1 -4
- package/dist/esm-node/validate.js +10 -13
- package/package.json +9 -5
package/dist/esm/compiler.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
ownKeys.forEach(function(key) {
|
|
24
|
-
_defineProperty(target, key, source[key]);
|
|
25
|
-
});
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys2 = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
26
22
|
}
|
|
27
|
-
|
|
23
|
+
ownKeys2.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
28
|
}
|
|
29
29
|
function ownKeys(object, enumerableOnly) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
keys.push.apply(keys, symbols);
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
39
37
|
}
|
|
40
|
-
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
52
|
}
|
|
53
53
|
import * as path from "path";
|
|
54
54
|
import * as babel from "@babel/core";
|
|
@@ -56,85 +56,84 @@ import { logger, fs } from "@modern-js/utils";
|
|
|
56
56
|
import * as utils from "./utils";
|
|
57
57
|
import { defaultDistFileExtMap } from "./constants";
|
|
58
58
|
var defaultDistDir = "dist";
|
|
59
|
-
var isRes = function(r) {
|
|
60
|
-
|
|
59
|
+
export var isRes = function(r) {
|
|
60
|
+
return Boolean(r);
|
|
61
61
|
};
|
|
62
|
-
var getDistFilePath = function(option) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
export var getDistFilePath = function(option) {
|
|
63
|
+
var filepath = option.filepath, rootDir = option.rootDir, distDir = option.distDir, extMap = option.extMap;
|
|
64
|
+
var ext = path.extname(filepath);
|
|
65
|
+
return path.join(distDir, path.relative(rootDir, filepath).replace(ext, extMap[ext]));
|
|
66
66
|
};
|
|
67
|
-
var resolveSourceMap = function(option) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return sourceMapVirtualDist;
|
|
83
|
-
}
|
|
84
|
-
fs.ensureDirSync(path.dirname(mapLoc));
|
|
85
|
-
fs.writeFileSync(mapLoc, JSON.stringify(babelRes.map));
|
|
67
|
+
export var resolveSourceMap = function(option) {
|
|
68
|
+
var babelRes = option.babelRes, sourceFilePath = option.sourceFilePath, distFilePath = option.distFilePath, _option_enableVirtualDist = option.enableVirtualDist, enableVirtualDist = _option_enableVirtualDist === void 0 ? false : _option_enableVirtualDist;
|
|
69
|
+
var mapLoc = "".concat(distFilePath, ".map");
|
|
70
|
+
babelRes.code = utils.addSourceMappingUrl(babelRes.code, mapLoc);
|
|
71
|
+
if (babelRes.map) {
|
|
72
|
+
babelRes.map.file = path.basename(distFilePath);
|
|
73
|
+
babelRes.map.sources = [
|
|
74
|
+
path.relative(path.dirname(distFilePath), sourceFilePath)
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
var sourceMapVirtualDist = {
|
|
78
|
+
sourcemap: JSON.stringify(babelRes.map),
|
|
79
|
+
sourceMapPath: mapLoc
|
|
80
|
+
};
|
|
81
|
+
if (enableVirtualDist) {
|
|
86
82
|
return sourceMapVirtualDist;
|
|
83
|
+
}
|
|
84
|
+
fs.ensureDirSync(path.dirname(mapLoc));
|
|
85
|
+
fs.writeFileSync(mapLoc, JSON.stringify(babelRes.map));
|
|
86
|
+
return sourceMapVirtualDist;
|
|
87
87
|
};
|
|
88
|
-
var compiler = function(option) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (virtualDist) {
|
|
111
|
-
virtualDist = _objectSpread({}, virtualDist, resolveSourceMap({
|
|
112
|
-
babelRes: babelRes,
|
|
113
|
-
sourceFilePath: filepath,
|
|
114
|
-
distFilePath: distFilePath,
|
|
115
|
-
enableVirtualDist: enableVirtualDist
|
|
116
|
-
}));
|
|
117
|
-
} else {
|
|
118
|
-
resolveSourceMap({
|
|
119
|
-
babelRes: babelRes,
|
|
120
|
-
sourceFilePath: filepath,
|
|
121
|
-
distFilePath: distFilePath,
|
|
122
|
-
enableVirtualDist: enableVirtualDist
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
88
|
+
export var compiler = function(option) {
|
|
89
|
+
var filepath = option.filepath, rootDir = option.rootDir, _option_enableVirtualDist = option.enableVirtualDist, enableVirtualDist = _option_enableVirtualDist === void 0 ? false : _option_enableVirtualDist, _option_distDir = option.distDir, distDir = _option_distDir === void 0 ? path.join(path.dirname(rootDir), defaultDistDir) : _option_distDir, _option_verbose = option.verbose, verbose = _option_verbose === void 0 ? false : _option_verbose, _option_babelConfig = option.babelConfig, babelConfig = _option_babelConfig === void 0 ? {} : _option_babelConfig, _option_distFileExtMap = option.distFileExtMap, distFileExtMap = _option_distFileExtMap === void 0 ? defaultDistFileExtMap : _option_distFileExtMap, _option_quiet = option.quiet, quiet = _option_quiet === void 0 ? false : _option_quiet;
|
|
90
|
+
var babelRes = babel.transformFileSync(filepath, babelConfig);
|
|
91
|
+
var virtualDist = null;
|
|
92
|
+
if (!isRes(babelRes)) {
|
|
93
|
+
throw new Error("".concat(filepath, " happen error"));
|
|
94
|
+
}
|
|
95
|
+
var distFilePath = getDistFilePath({
|
|
96
|
+
filepath,
|
|
97
|
+
rootDir,
|
|
98
|
+
distDir,
|
|
99
|
+
extMap: distFileExtMap
|
|
100
|
+
});
|
|
101
|
+
if (enableVirtualDist) {
|
|
102
|
+
virtualDist = {
|
|
103
|
+
distPath: distFilePath,
|
|
104
|
+
sourceMapPath: "",
|
|
105
|
+
code: "",
|
|
106
|
+
sourcemap: ""
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if ((babelRes === null || babelRes === void 0 ? void 0 : babelRes.map) && babelConfig.sourceMaps && babelConfig.sourceMaps !== "inline") {
|
|
126
110
|
if (virtualDist) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
111
|
+
virtualDist = _object_spread({}, virtualDist, resolveSourceMap({
|
|
112
|
+
babelRes,
|
|
113
|
+
sourceFilePath: filepath,
|
|
114
|
+
distFilePath,
|
|
115
|
+
enableVirtualDist
|
|
116
|
+
}));
|
|
131
117
|
} else {
|
|
132
|
-
|
|
133
|
-
|
|
118
|
+
resolveSourceMap({
|
|
119
|
+
babelRes,
|
|
120
|
+
sourceFilePath: filepath,
|
|
121
|
+
distFilePath,
|
|
122
|
+
enableVirtualDist
|
|
123
|
+
});
|
|
134
124
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
125
|
+
}
|
|
126
|
+
if (virtualDist) {
|
|
127
|
+
virtualDist = _object_spread_props(_object_spread({}, virtualDist), {
|
|
128
|
+
distPath: distFilePath,
|
|
129
|
+
code: babelRes.code
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
fs.ensureDirSync(path.dirname(distFilePath));
|
|
133
|
+
fs.writeFileSync(distFilePath, babelRes.code);
|
|
134
|
+
}
|
|
135
|
+
if (verbose && !quiet) {
|
|
136
|
+
logger.info("".concat(filepath, " => ").concat(distFilePath));
|
|
137
|
+
}
|
|
138
|
+
return virtualDist;
|
|
139
139
|
};
|
|
140
|
-
export { compiler, getDistFilePath, isRes, resolveSourceMap };
|
|
@@ -1,110 +1,113 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
function _class_call_check(instance, Constructor) {
|
|
2
|
+
if (!(instance instanceof Constructor)) {
|
|
3
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4
|
+
}
|
|
5
5
|
}
|
|
6
6
|
function _defineProperties(target, props) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
for (var i = 0; i < props.length; i++) {
|
|
8
|
+
var descriptor = props[i];
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ("value" in descriptor)
|
|
12
|
+
descriptor.writable = true;
|
|
13
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
14
|
+
}
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
17
|
+
if (protoProps)
|
|
18
|
+
_defineProperties(Constructor.prototype, protoProps);
|
|
19
|
+
if (staticProps)
|
|
20
|
+
_defineProperties(Constructor, staticProps);
|
|
21
|
+
return Constructor;
|
|
19
22
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
function _define_property(obj, key, value) {
|
|
24
|
+
if (key in obj) {
|
|
25
|
+
Object.defineProperty(obj, key, {
|
|
26
|
+
value,
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
obj[key] = value;
|
|
33
|
+
}
|
|
34
|
+
return obj;
|
|
32
35
|
}
|
|
33
|
-
var CompilerErrorResult =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
export var CompilerErrorResult = /* @__PURE__ */ function() {
|
|
37
|
+
"use strict";
|
|
38
|
+
function CompilerErrorResult2(initErrorResult) {
|
|
39
|
+
_class_call_check(this, CompilerErrorResult2);
|
|
40
|
+
_define_property(this, "_messageDetails", void 0);
|
|
41
|
+
this.init(initErrorResult);
|
|
42
|
+
}
|
|
43
|
+
_create_class(CompilerErrorResult2, [
|
|
44
|
+
{
|
|
45
|
+
key: "init",
|
|
46
|
+
value: function init(initErrorResult) {
|
|
47
|
+
this._messageDetails = (initErrorResult === null || initErrorResult === void 0 ? void 0 : initErrorResult.messageDetails) || [];
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: "update",
|
|
52
|
+
value: function update(messageDetails) {
|
|
53
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
54
|
+
try {
|
|
55
|
+
var _this = this, _loop = function() {
|
|
56
|
+
var messageDetail = _step.value;
|
|
57
|
+
var addError = !_this._messageDetails.some(function(detail) {
|
|
58
|
+
if (detail.filename === messageDetail.filename) {
|
|
59
|
+
detail.content = messageDetail.content;
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
});
|
|
64
|
+
if (addError) {
|
|
65
|
+
_this._messageDetails.push(messageDetail);
|
|
45
66
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
detail.content = messageDetail.content;
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
});
|
|
61
|
-
if (addError) {
|
|
62
|
-
_this._messageDetails.push(messageDetail);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
for(var _iterator = messageDetails[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
66
|
-
} catch (err) {
|
|
67
|
-
_didIteratorError = true;
|
|
68
|
-
_iteratorError = err;
|
|
69
|
-
} finally{
|
|
70
|
-
try {
|
|
71
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
72
|
-
_iterator.return();
|
|
73
|
-
}
|
|
74
|
-
} finally{
|
|
75
|
-
if (_didIteratorError) {
|
|
76
|
-
throw _iteratorError;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
67
|
+
};
|
|
68
|
+
for (var _iterator = messageDetails[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)
|
|
69
|
+
_loop();
|
|
70
|
+
} catch (err) {
|
|
71
|
+
_didIteratorError = true;
|
|
72
|
+
_iteratorError = err;
|
|
73
|
+
} finally {
|
|
74
|
+
try {
|
|
75
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
76
|
+
_iterator.return();
|
|
80
77
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
value: function removeByFileName(filename) {
|
|
85
|
-
this._messageDetails = this._messageDetails.filter(function(detail) {
|
|
86
|
-
return detail.filename !== filename;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
key: "value",
|
|
92
|
-
get: function get() {
|
|
93
|
-
var _this__messageDetails;
|
|
94
|
-
return {
|
|
95
|
-
code: 1,
|
|
96
|
-
message: "Compilation failure ".concat((_this__messageDetails = this._messageDetails) === null || _this__messageDetails === void 0 ? void 0 : _this__messageDetails.length, " files with Babel."),
|
|
97
|
-
messageDetails: this._messageDetails
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
key: "checkExistError",
|
|
103
|
-
value: function checkExistError() {
|
|
104
|
-
return this._messageDetails.length > 0;
|
|
78
|
+
} finally {
|
|
79
|
+
if (_didIteratorError) {
|
|
80
|
+
throw _iteratorError;
|
|
105
81
|
}
|
|
82
|
+
}
|
|
106
83
|
}
|
|
107
|
-
|
|
108
|
-
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: "removeByFileName",
|
|
88
|
+
value: function removeByFileName(filename) {
|
|
89
|
+
this._messageDetails = this._messageDetails.filter(function(detail) {
|
|
90
|
+
return detail.filename !== filename;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: "value",
|
|
96
|
+
get: function get() {
|
|
97
|
+
var _this__messageDetails;
|
|
98
|
+
return {
|
|
99
|
+
code: 1,
|
|
100
|
+
message: "Compilation failure ".concat((_this__messageDetails = this._messageDetails) === null || _this__messageDetails === void 0 ? void 0 : _this__messageDetails.length, " files with Babel."),
|
|
101
|
+
messageDetails: this._messageDetails
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: "checkExistError",
|
|
107
|
+
value: function checkExistError() {
|
|
108
|
+
return this._messageDetails.length > 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]);
|
|
112
|
+
return CompilerErrorResult2;
|
|
109
113
|
}();
|
|
110
|
-
export { CompilerErrorResult };
|
package/dist/esm/constants.js
CHANGED
package/dist/esm/defaults.js
CHANGED
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
ownKeys.forEach(function(key) {
|
|
24
|
-
_defineProperty(target, key, source[key]);
|
|
25
|
-
});
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
26
22
|
}
|
|
27
|
-
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
28
|
}
|
|
29
29
|
import { defaultDistFileExtMap } from "./constants";
|
|
30
30
|
var defaultOptions = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
enableWatch: false,
|
|
32
|
+
enableVirtualDist: false,
|
|
33
|
+
extensions: [],
|
|
34
|
+
filenames: [],
|
|
35
|
+
distFileExtMap: defaultDistFileExtMap,
|
|
36
|
+
ignore: [],
|
|
37
|
+
quiet: false,
|
|
38
|
+
verbose: false,
|
|
39
|
+
clean: false
|
|
40
40
|
};
|
|
41
|
-
var mergeDefaultOption = function(compilerOptions) {
|
|
42
|
-
|
|
41
|
+
export var mergeDefaultOption = function(compilerOptions) {
|
|
42
|
+
return _object_spread({}, defaultOptions, compilerOptions);
|
|
43
43
|
};
|
|
44
|
-
export { mergeDefaultOption };
|