@modern-js/server-utils 2.11.0 → 2.11.1-alpha.1
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.
|
@@ -97,11 +97,17 @@ const compileByTs = async (appDirectory, config, compileOptions) => {
|
|
|
97
97
|
before: [tsconfigPathsPlugin]
|
|
98
98
|
});
|
|
99
99
|
const allDiagnostics = ts2.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
100
|
+
const { noEmitOnError } = options;
|
|
100
101
|
if (allDiagnostics.length > 0) {
|
|
101
102
|
import_utils.logger.error(
|
|
102
|
-
ts2.formatDiagnosticsWithColorAndContext(
|
|
103
|
+
ts2.formatDiagnosticsWithColorAndContext(
|
|
104
|
+
[...new Set(allDiagnostics)],
|
|
105
|
+
formatHost
|
|
106
|
+
)
|
|
103
107
|
);
|
|
104
|
-
|
|
108
|
+
if (typeof noEmitOnError === "undefined" || noEmitOnError === true) {
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
for (const source of sourceDirs) {
|
|
107
113
|
await copyFiles(source, distDir, appDirectory, tsconfigPath);
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _arrayLikeToArray(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _arrayWithoutHoles(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
8
|
+
}
|
|
1
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
10
|
try {
|
|
3
11
|
var info = gen[key](arg);
|
|
@@ -40,6 +48,12 @@ function _defineProperty(obj, key, value) {
|
|
|
40
48
|
}
|
|
41
49
|
return obj;
|
|
42
50
|
}
|
|
51
|
+
function _iterableToArray(iter) {
|
|
52
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
53
|
+
}
|
|
54
|
+
function _nonIterableSpread() {
|
|
55
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
56
|
+
}
|
|
43
57
|
function _objectSpread(target) {
|
|
44
58
|
for(var i = 1; i < arguments.length; i++){
|
|
45
59
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -55,6 +69,17 @@ function _objectSpread(target) {
|
|
|
55
69
|
}
|
|
56
70
|
return target;
|
|
57
71
|
}
|
|
72
|
+
function _toConsumableArray(arr) {
|
|
73
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
74
|
+
}
|
|
75
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
76
|
+
if (!o) return;
|
|
77
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
78
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
79
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
80
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
81
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
82
|
+
}
|
|
58
83
|
var __generator = this && this.__generator || function(thisArg, body) {
|
|
59
84
|
var f, y, t, g, _ = {
|
|
60
85
|
label: 0,
|
|
@@ -207,7 +232,7 @@ var copyFiles = function() {
|
|
|
207
232
|
}();
|
|
208
233
|
var compileByTs = function() {
|
|
209
234
|
var _ref = _asyncToGenerator(function(appDirectory, config, compileOptions) {
|
|
210
|
-
var sourceDirs, distDir, tsconfigPath, ts2, createProgram, formatHost, alias, aliasOption, _aliasOption_paths, paths, _aliasOption_absoluteBaseUrl, absoluteBaseUrl, _readTsConfigByFile, options, fileNames, projectReferences, sourcePosixPaths, rootNames, program, tsconfigPathsPlugin, emitResult, allDiagnostics, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, source, err;
|
|
235
|
+
var sourceDirs, distDir, tsconfigPath, ts2, createProgram, formatHost, alias, aliasOption, _aliasOption_paths, paths, _aliasOption_absoluteBaseUrl, absoluteBaseUrl, _readTsConfigByFile, options, fileNames, projectReferences, sourcePosixPaths, rootNames, program, tsconfigPathsPlugin, emitResult, allDiagnostics, noEmitOnError, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, source, err;
|
|
211
236
|
return __generator(this, function(_state) {
|
|
212
237
|
switch(_state.label){
|
|
213
238
|
case 0:
|
|
@@ -253,9 +278,12 @@ var compileByTs = function() {
|
|
|
253
278
|
]
|
|
254
279
|
});
|
|
255
280
|
allDiagnostics = ts2.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
281
|
+
noEmitOnError = options.noEmitOnError;
|
|
256
282
|
if (allDiagnostics.length > 0) {
|
|
257
|
-
logger.error(ts2.formatDiagnosticsWithColorAndContext(allDiagnostics, formatHost));
|
|
258
|
-
|
|
283
|
+
logger.error(ts2.formatDiagnosticsWithColorAndContext(_toConsumableArray(new Set(allDiagnostics)), formatHost));
|
|
284
|
+
if (typeof noEmitOnError === "undefined" || noEmitOnError === true) {
|
|
285
|
+
process.exit(1);
|
|
286
|
+
}
|
|
259
287
|
}
|
|
260
288
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
261
289
|
_state.label = 1;
|
|
@@ -65,11 +65,17 @@ const compileByTs = async (appDirectory, config, compileOptions) => {
|
|
|
65
65
|
before: [tsconfigPathsPlugin]
|
|
66
66
|
});
|
|
67
67
|
const allDiagnostics = ts2.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
68
|
+
const { noEmitOnError } = options;
|
|
68
69
|
if (allDiagnostics.length > 0) {
|
|
69
70
|
logger.error(
|
|
70
|
-
ts2.formatDiagnosticsWithColorAndContext(
|
|
71
|
+
ts2.formatDiagnosticsWithColorAndContext(
|
|
72
|
+
[...new Set(allDiagnostics)],
|
|
73
|
+
formatHost
|
|
74
|
+
)
|
|
71
75
|
);
|
|
72
|
-
|
|
76
|
+
if (typeof noEmitOnError === "undefined" || noEmitOnError === true) {
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
73
79
|
}
|
|
74
80
|
for (const source of sourceDirs) {
|
|
75
81
|
await copyFiles(source, distDir, appDirectory, tsconfigPath);
|