@modern-js/babel-compiler 2.4.0 → 2.4.1-beta.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
CHANGED
|
@@ -127,13 +127,13 @@ import { defaultDistFileExtMap } from "./constants";
|
|
|
127
127
|
import { compiler } from "./compiler";
|
|
128
128
|
var build = function() {
|
|
129
129
|
var _ref = _asyncToGenerator(function(option) {
|
|
130
|
-
var babelConfig, rootDir, enableVirtualDist, filenames, clean, distDir,
|
|
130
|
+
var babelConfig, rootDir, enableVirtualDist, filenames, clean, distDir, _option_distFileExtMap, distFileExtMap, _option_verbose, verbose, _option_quiet, quiet, virtualDists, messageDetails, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, filename, dist, happenError;
|
|
131
131
|
var _arguments = arguments;
|
|
132
132
|
return __generator(this, function(_state) {
|
|
133
133
|
switch(_state.label){
|
|
134
134
|
case 0:
|
|
135
135
|
babelConfig = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
136
|
-
rootDir = option.rootDir, enableVirtualDist = option.enableVirtualDist, filenames = option.filenames, clean = option.clean, distDir = option.distDir,
|
|
136
|
+
rootDir = option.rootDir, enableVirtualDist = option.enableVirtualDist, filenames = option.filenames, clean = option.clean, distDir = option.distDir, _option_distFileExtMap = option.distFileExtMap, distFileExtMap = _option_distFileExtMap === void 0 ? defaultDistFileExtMap : _option_distFileExtMap, _option_verbose = option.verbose, verbose = _option_verbose === void 0 ? false : _option_verbose, _option_quiet = option.quiet, quiet = _option_quiet === void 0 ? false : _option_quiet;
|
|
137
137
|
virtualDists = [];
|
|
138
138
|
if (!clean) return [
|
|
139
139
|
3,
|
|
@@ -269,9 +269,9 @@ var BuildWatchEvent = {
|
|
|
269
269
|
compiling: "compiling",
|
|
270
270
|
watchingCompiler: "watching-compiler"
|
|
271
271
|
};
|
|
272
|
-
var BuildWatchEmitter = /*#__PURE__*/ function(
|
|
272
|
+
var BuildWatchEmitter = /*#__PURE__*/ function(_Event_EventEmitter) {
|
|
273
273
|
"use strict";
|
|
274
|
-
_inherits(BuildWatchEmitter,
|
|
274
|
+
_inherits(BuildWatchEmitter, _Event_EventEmitter);
|
|
275
275
|
var _super = _createSuper(BuildWatchEmitter);
|
|
276
276
|
function BuildWatchEmitter() {
|
|
277
277
|
_classCallCheck(this, BuildWatchEmitter);
|
|
@@ -65,7 +65,7 @@ var getDistFilePath = function(option) {
|
|
|
65
65
|
return path.join(distDir, path.relative(rootDir, filepath).replace(ext, extMap[ext]));
|
|
66
66
|
};
|
|
67
67
|
var resolveSourceMap = function(option) {
|
|
68
|
-
var babelRes = option.babelRes, sourceFilePath = option.sourceFilePath, distFilePath = option.distFilePath,
|
|
68
|
+
var babelRes = option.babelRes, sourceFilePath = option.sourceFilePath, distFilePath = option.distFilePath, _option_enableVirtualDist = option.enableVirtualDist, enableVirtualDist = _option_enableVirtualDist === void 0 ? false : _option_enableVirtualDist;
|
|
69
69
|
var mapLoc = "".concat(distFilePath, ".map");
|
|
70
70
|
babelRes.code = utils.addSourceMappingUrl(babelRes.code, mapLoc);
|
|
71
71
|
if (babelRes.map) {
|
|
@@ -86,7 +86,7 @@ var resolveSourceMap = function(option) {
|
|
|
86
86
|
return sourceMapVirtualDist;
|
|
87
87
|
};
|
|
88
88
|
var compiler = function(option) {
|
|
89
|
-
var filepath = option.filepath, rootDir = option.rootDir,
|
|
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
90
|
var babelRes = babel.transformFileSync(filepath, babelConfig);
|
|
91
91
|
var virtualDist = null;
|
|
92
92
|
if (!isRes(babelRes)) {
|
|
@@ -90,10 +90,10 @@ var CompilerErrorResult = /*#__PURE__*/ function() {
|
|
|
90
90
|
{
|
|
91
91
|
key: "value",
|
|
92
92
|
get: function get() {
|
|
93
|
-
var
|
|
93
|
+
var _this__messageDetails;
|
|
94
94
|
return {
|
|
95
95
|
code: 1,
|
|
96
|
-
message: "Compilation failure ".concat((
|
|
96
|
+
message: "Compilation failure ".concat((_this__messageDetails = this._messageDetails) === null || _this__messageDetails === void 0 ? void 0 : _this__messageDetails.length, " files with Babel."),
|
|
97
97
|
messageDetails: this._messageDetails
|
|
98
98
|
};
|
|
99
99
|
}
|
|
@@ -103,7 +103,7 @@ var getFinalExtensions = function(extensions) {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
var getFilesFromDir = function(param) {
|
|
106
|
-
var dir = param.dir,
|
|
106
|
+
var dir = param.dir, _param_finalExt = param.finalExt, finalExt = _param_finalExt === void 0 ? [] : _param_finalExt, _param_ignore = param.ignore, ignore = _param_ignore === void 0 ? [] : _param_ignore;
|
|
107
107
|
var globFindFilenames = [];
|
|
108
108
|
var globPattern = getGlobPattern(dir, finalExt);
|
|
109
109
|
globFindFilenames = glob.sync(globPattern, {
|
|
@@ -113,7 +113,7 @@ var getFilesFromDir = function(param) {
|
|
|
113
113
|
};
|
|
114
114
|
var getFinalCompilerOption = function(option) {
|
|
115
115
|
var optionWithDefault = mergeDefaultOption(option);
|
|
116
|
-
var sourceDir = option.sourceDir, ignore = option.ignore,
|
|
116
|
+
var sourceDir = option.sourceDir, ignore = option.ignore, _option_enableWatch = option.enableWatch, enableWatch = _option_enableWatch === void 0 ? false : _option_enableWatch, watchDir = option.watchDir, _option_extensions = option.extensions, extensions = _option_extensions === void 0 ? DEFAULT_EXTENSIONS : _option_extensions;
|
|
117
117
|
var globFindFilenames = [];
|
|
118
118
|
var finalExt = getFinalExtensions(extensions);
|
|
119
119
|
if (sourceDir) {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.4.0",
|
|
14
|
+
"version": "2.4.1-beta.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/core": "^7.18.0",
|
|
32
32
|
"@babel/runtime": "^7.18.0",
|
|
33
|
-
"@modern-js/utils": "2.4.0"
|
|
33
|
+
"@modern-js/utils": "2.4.1-beta.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/plugin-transform-classes": "^7.18.0",
|