@modern-js/server-utils 2.15.0 → 2.17.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.
@@ -1,179 +1,195 @@
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;
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length)
3
+ len = arr.length;
4
+ for (var i = 0, arr2 = new Array(len); i < len; i++)
5
+ arr2[i] = arr[i];
6
+ return arr2;
5
7
  }
6
- function _arrayWithoutHoles(arr) {
7
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
8
+ function _array_without_holes(arr) {
9
+ if (Array.isArray(arr))
10
+ return _array_like_to_array(arr);
8
11
  }
9
12
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10
- try {
11
- var info = gen[key](arg);
12
- var value = info.value;
13
- } catch (error) {
14
- reject(error);
15
- return;
16
- }
17
- if (info.done) {
18
- resolve(value);
19
- } else {
20
- Promise.resolve(value).then(_next, _throw);
21
- }
13
+ try {
14
+ var info = gen[key](arg);
15
+ var value = info.value;
16
+ } catch (error) {
17
+ reject(error);
18
+ return;
19
+ }
20
+ if (info.done) {
21
+ resolve(value);
22
+ } else {
23
+ Promise.resolve(value).then(_next, _throw);
24
+ }
22
25
  }
23
- function _asyncToGenerator(fn) {
24
- return function() {
25
- var self = this, args = arguments;
26
- return new Promise(function(resolve, reject) {
27
- var gen = fn.apply(self, args);
28
- function _next(value) {
29
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
30
- }
31
- function _throw(err) {
32
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
33
- }
34
- _next(undefined);
35
- });
36
- };
26
+ function _async_to_generator(fn) {
27
+ return function() {
28
+ var self = this, args = arguments;
29
+ return new Promise(function(resolve, reject) {
30
+ var gen = fn.apply(self, args);
31
+ function _next(value) {
32
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
33
+ }
34
+ function _throw(err) {
35
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
36
+ }
37
+ _next(void 0);
38
+ });
39
+ };
37
40
  }
38
- function _defineProperty(obj, key, value) {
39
- if (key in obj) {
40
- Object.defineProperty(obj, key, {
41
- value: value,
42
- enumerable: true,
43
- configurable: true,
44
- writable: true
45
- });
46
- } else {
47
- obj[key] = value;
48
- }
49
- return obj;
41
+ function _define_property(obj, key, value) {
42
+ if (key in obj) {
43
+ Object.defineProperty(obj, key, {
44
+ value,
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true
48
+ });
49
+ } else {
50
+ obj[key] = value;
51
+ }
52
+ return obj;
50
53
  }
51
- function _iterableToArray(iter) {
52
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
54
+ function _iterable_to_array(iter) {
55
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
56
+ return Array.from(iter);
53
57
  }
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.");
58
+ function _non_iterable_spread() {
59
+ 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
60
  }
57
- function _objectSpread(target) {
58
- for(var i = 1; i < arguments.length; i++){
59
- var source = arguments[i] != null ? arguments[i] : {};
60
- var ownKeys = Object.keys(source);
61
- if (typeof Object.getOwnPropertySymbols === "function") {
62
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
63
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
64
- }));
65
- }
66
- ownKeys.forEach(function(key) {
67
- _defineProperty(target, key, source[key]);
68
- });
61
+ function _object_spread(target) {
62
+ for (var i = 1; i < arguments.length; i++) {
63
+ var source = arguments[i] != null ? arguments[i] : {};
64
+ var ownKeys = Object.keys(source);
65
+ if (typeof Object.getOwnPropertySymbols === "function") {
66
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
67
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
68
+ }));
69
69
  }
70
- return target;
70
+ ownKeys.forEach(function(key) {
71
+ _define_property(target, key, source[key]);
72
+ });
73
+ }
74
+ return target;
71
75
  }
72
- function _toConsumableArray(arr) {
73
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
76
+ function _to_consumable_array(arr) {
77
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
74
78
  }
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);
79
+ function _unsupported_iterable_to_array(o, minLen) {
80
+ if (!o)
81
+ return;
82
+ if (typeof o === "string")
83
+ return _array_like_to_array(o, minLen);
84
+ var n = Object.prototype.toString.call(o).slice(8, -1);
85
+ if (n === "Object" && o.constructor)
86
+ n = o.constructor.name;
87
+ if (n === "Map" || n === "Set")
88
+ return Array.from(n);
89
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
90
+ return _array_like_to_array(o, minLen);
82
91
  }
83
- var __generator = this && this.__generator || function(thisArg, body) {
84
- var f, y, t, g, _ = {
85
- label: 0,
86
- sent: function() {
87
- if (t[0] & 1) throw t[1];
88
- return t[1];
89
- },
90
- trys: [],
91
- ops: []
92
+ var __generator = function(thisArg, body) {
93
+ var f, y, t, g, _ = {
94
+ label: 0,
95
+ sent: function() {
96
+ if (t[0] & 1)
97
+ throw t[1];
98
+ return t[1];
99
+ },
100
+ trys: [],
101
+ ops: []
102
+ };
103
+ return g = {
104
+ next: verb(0),
105
+ "throw": verb(1),
106
+ "return": verb(2)
107
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
108
+ return this;
109
+ }), g;
110
+ function verb(n) {
111
+ return function(v) {
112
+ return step([
113
+ n,
114
+ v
115
+ ]);
92
116
  };
93
- return(g = {
94
- next: verb(0),
95
- "throw": verb(1),
96
- "return": verb(2)
97
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
98
- return this;
99
- }), g);
100
- function verb(n) {
101
- return function(v) {
102
- return step([
103
- n,
104
- v
105
- ]);
106
- };
107
- }
108
- function step(op) {
109
- if (f) throw new TypeError("Generator is already executing.");
110
- while(_)try {
111
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
112
- if (y = 0, t) op = [
113
- op[0] & 2,
114
- t.value
115
- ];
116
- switch(op[0]){
117
- case 0:
118
- case 1:
119
- t = op;
120
- break;
121
- case 4:
122
- _.label++;
123
- return {
124
- value: op[1],
125
- done: false
126
- };
127
- case 5:
128
- _.label++;
129
- y = op[1];
130
- op = [
131
- 0
132
- ];
133
- continue;
134
- case 7:
135
- op = _.ops.pop();
136
- _.trys.pop();
137
- continue;
138
- default:
139
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
140
- _ = 0;
141
- continue;
142
- }
143
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
144
- _.label = op[1];
145
- break;
146
- }
147
- if (op[0] === 6 && _.label < t[1]) {
148
- _.label = t[1];
149
- t = op;
150
- break;
151
- }
152
- if (t && _.label < t[2]) {
153
- _.label = t[2];
154
- _.ops.push(op);
155
- break;
156
- }
157
- if (t[2]) _.ops.pop();
158
- _.trys.pop();
159
- continue;
160
- }
161
- op = body.call(thisArg, _);
162
- } catch (e) {
117
+ }
118
+ function step(op) {
119
+ if (f)
120
+ throw new TypeError("Generator is already executing.");
121
+ while (_)
122
+ try {
123
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
124
+ return t;
125
+ if (y = 0, t)
126
+ op = [
127
+ op[0] & 2,
128
+ t.value
129
+ ];
130
+ switch (op[0]) {
131
+ case 0:
132
+ case 1:
133
+ t = op;
134
+ break;
135
+ case 4:
136
+ _.label++;
137
+ return {
138
+ value: op[1],
139
+ done: false
140
+ };
141
+ case 5:
142
+ _.label++;
143
+ y = op[1];
163
144
  op = [
164
- 6,
165
- e
145
+ 0
166
146
  ];
167
- y = 0;
168
- } finally{
169
- f = t = 0;
147
+ continue;
148
+ case 7:
149
+ op = _.ops.pop();
150
+ _.trys.pop();
151
+ continue;
152
+ default:
153
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
154
+ _ = 0;
155
+ continue;
156
+ }
157
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
158
+ _.label = op[1];
159
+ break;
160
+ }
161
+ if (op[0] === 6 && _.label < t[1]) {
162
+ _.label = t[1];
163
+ t = op;
164
+ break;
165
+ }
166
+ if (t && _.label < t[2]) {
167
+ _.label = t[2];
168
+ _.ops.push(op);
169
+ break;
170
+ }
171
+ if (t[2])
172
+ _.ops.pop();
173
+ _.trys.pop();
174
+ continue;
170
175
  }
171
- if (op[0] & 5) throw op[1];
172
- return {
173
- value: op[0] ? op[1] : void 0,
174
- done: true
175
- };
176
- }
176
+ op = body.call(thisArg, _);
177
+ } catch (e) {
178
+ op = [
179
+ 6,
180
+ e
181
+ ];
182
+ y = 0;
183
+ } finally {
184
+ f = t = 0;
185
+ }
186
+ if (op[0] & 5)
187
+ throw op[1];
188
+ return {
189
+ value: op[0] ? op[1] : void 0,
190
+ done: true
191
+ };
192
+ }
177
193
  };
178
194
  import path from "path";
179
195
  import { logger, getAliasConfig, fs } from "@modern-js/utils";
@@ -181,187 +197,188 @@ import ts from "typescript";
181
197
  import { TypescriptLoader } from "./typescriptLoader";
182
198
  import { tsconfigPathsBeforeHookFactory } from "./tsconfigPathsPlugin";
183
199
  var readTsConfigByFile = function(tsConfigFile) {
184
- var parsedCmd = ts.getParsedCommandLineOfConfigFile(tsConfigFile, void 0, ts.sys);
185
- var options = parsedCmd.options, fileNames = parsedCmd.fileNames, projectReferences = parsedCmd.projectReferences;
186
- return {
187
- options: options,
188
- fileNames: fileNames,
189
- projectReferences: projectReferences
190
- };
200
+ var parsedCmd = ts.getParsedCommandLineOfConfigFile(tsConfigFile, void 0, ts.sys);
201
+ var options = parsedCmd.options, fileNames = parsedCmd.fileNames, projectReferences = parsedCmd.projectReferences;
202
+ return {
203
+ options,
204
+ fileNames,
205
+ projectReferences
206
+ };
191
207
  };
192
208
  var copyFiles = function() {
193
- var _ref = _asyncToGenerator(function(from, to, appDirectory, tsconfigPath) {
194
- var relativePath, targetDir;
195
- return __generator(this, function(_state) {
196
- switch(_state.label){
197
- case 0:
198
- return [
199
- 4,
200
- fs.pathExists(from)
201
- ];
202
- case 1:
203
- if (!_state.sent()) return [
204
- 3,
205
- 3
206
- ];
207
- relativePath = path.relative(appDirectory, from);
208
- targetDir = path.join(to, relativePath);
209
- return [
210
- 4,
211
- fs.copy(from, targetDir, {
212
- filter: function(src) {
213
- return ![
214
- ".ts"
215
- ].includes(path.extname(src)) && src !== tsconfigPath;
216
- }
217
- })
218
- ];
219
- case 2:
220
- _state.sent();
221
- _state.label = 3;
222
- case 3:
223
- return [
224
- 2
225
- ];
226
- }
227
- });
209
+ var _ref = _async_to_generator(function(from, to, appDirectory, tsconfigPath) {
210
+ var relativePath, targetDir;
211
+ return __generator(this, function(_state) {
212
+ switch (_state.label) {
213
+ case 0:
214
+ return [
215
+ 4,
216
+ fs.pathExists(from)
217
+ ];
218
+ case 1:
219
+ if (!_state.sent())
220
+ return [
221
+ 3,
222
+ 3
223
+ ];
224
+ relativePath = path.relative(appDirectory, from);
225
+ targetDir = path.join(to, relativePath);
226
+ return [
227
+ 4,
228
+ fs.copy(from, targetDir, {
229
+ filter: function(src) {
230
+ return ![
231
+ ".ts"
232
+ ].includes(path.extname(src)) && src !== tsconfigPath;
233
+ }
234
+ })
235
+ ];
236
+ case 2:
237
+ _state.sent();
238
+ _state.label = 3;
239
+ case 3:
240
+ return [
241
+ 2
242
+ ];
243
+ }
228
244
  });
229
- return function copyFiles(from, to, appDirectory, tsconfigPath) {
230
- return _ref.apply(this, arguments);
231
- };
245
+ });
246
+ return function copyFiles2(from, to, appDirectory, tsconfigPath) {
247
+ return _ref.apply(this, arguments);
248
+ };
232
249
  }();
233
- var compileByTs = function() {
234
- var _ref = _asyncToGenerator(function(appDirectory, config, compileOptions) {
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;
236
- return __generator(this, function(_state) {
237
- switch(_state.label){
238
- case 0:
239
- logger.info("Running ts compile...");
240
- sourceDirs = compileOptions.sourceDirs, distDir = compileOptions.distDir, tsconfigPath = compileOptions.tsconfigPath;
241
- if (!tsconfigPath) {
242
- return [
243
- 2
244
- ];
245
- }
246
- ts2 = new TypescriptLoader({
247
- appDirectory: appDirectory
248
- }).load();
249
- createProgram = ts2.createIncrementalProgram || ts2.createProgram;
250
- formatHost = getFormatHost(ts2);
251
- alias = config.alias;
252
- aliasOption = getAliasConfig(alias, {
253
- appDirectory: appDirectory,
254
- tsconfigPath: tsconfigPath
255
- });
256
- _aliasOption_paths = aliasOption.paths, paths = _aliasOption_paths === void 0 ? {} : _aliasOption_paths, _aliasOption_absoluteBaseUrl = aliasOption.absoluteBaseUrl, absoluteBaseUrl = _aliasOption_absoluteBaseUrl === void 0 ? "./" : _aliasOption_absoluteBaseUrl;
257
- _readTsConfigByFile = readTsConfigByFile(tsconfigPath), options = _readTsConfigByFile.options, fileNames = _readTsConfigByFile.fileNames, projectReferences = _readTsConfigByFile.projectReferences;
258
- sourcePosixPaths = sourceDirs.map(function(sourceDir) {
259
- return sourceDir.split(path.sep).join(path.posix.sep);
260
- });
261
- rootNames = fileNames.filter(function(fileName) {
262
- return fileName.endsWith(".d.ts") || sourcePosixPaths.some(function(sourceDir) {
263
- return fileName.includes(sourceDir);
264
- });
265
- });
266
- program = createProgram.call(ts2, {
267
- rootNames: rootNames,
268
- projectReferences: projectReferences,
269
- options: _objectSpread({
270
- rootDir: appDirectory,
271
- outDir: distDir
272
- }, options)
273
- });
274
- tsconfigPathsPlugin = tsconfigPathsBeforeHookFactory(ts2, absoluteBaseUrl, paths);
275
- emitResult = program.emit(void 0, void 0, void 0, void 0, {
276
- before: [
277
- tsconfigPathsPlugin
278
- ]
279
- });
280
- allDiagnostics = ts2.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
281
- noEmitOnError = options.noEmitOnError;
282
- if (allDiagnostics.length > 0) {
283
- logger.error(ts2.formatDiagnosticsWithColorAndContext(_toConsumableArray(new Set(allDiagnostics)), formatHost));
284
- if (typeof noEmitOnError === "undefined" || noEmitOnError === true) {
285
- process.exit(1);
286
- }
287
- }
288
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
289
- _state.label = 1;
290
- case 1:
291
- _state.trys.push([
292
- 1,
293
- 6,
294
- 7,
295
- 8
296
- ]);
297
- _iterator = sourceDirs[Symbol.iterator]();
298
- _state.label = 2;
299
- case 2:
300
- if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
301
- 3,
302
- 5
303
- ];
304
- source = _step.value;
305
- return [
306
- 4,
307
- copyFiles(source, distDir, appDirectory, tsconfigPath)
308
- ];
309
- case 3:
310
- _state.sent();
311
- _state.label = 4;
312
- case 4:
313
- _iteratorNormalCompletion = true;
314
- return [
315
- 3,
316
- 2
317
- ];
318
- case 5:
319
- return [
320
- 3,
321
- 8
322
- ];
323
- case 6:
324
- err = _state.sent();
325
- _didIteratorError = true;
326
- _iteratorError = err;
327
- return [
328
- 3,
329
- 8
330
- ];
331
- case 7:
332
- try {
333
- if (!_iteratorNormalCompletion && _iterator.return != null) {
334
- _iterator.return();
335
- }
336
- } finally{
337
- if (_didIteratorError) {
338
- throw _iteratorError;
339
- }
340
- }
341
- return [
342
- 7
343
- ];
344
- case 8:
345
- logger.info("Ts compile succeed");
346
- return [
347
- 2
348
- ];
250
+ export var compileByTs = function() {
251
+ var _ref = _async_to_generator(function(appDirectory, config, compileOptions) {
252
+ 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;
253
+ return __generator(this, function(_state) {
254
+ switch (_state.label) {
255
+ case 0:
256
+ logger.info("Running ts compile...");
257
+ sourceDirs = compileOptions.sourceDirs, distDir = compileOptions.distDir, tsconfigPath = compileOptions.tsconfigPath;
258
+ if (!tsconfigPath) {
259
+ return [
260
+ 2
261
+ ];
262
+ }
263
+ ts2 = new TypescriptLoader({
264
+ appDirectory
265
+ }).load();
266
+ createProgram = ts2.createIncrementalProgram || ts2.createProgram;
267
+ formatHost = getFormatHost(ts2);
268
+ alias = config.alias;
269
+ aliasOption = getAliasConfig(alias, {
270
+ appDirectory,
271
+ tsconfigPath
272
+ });
273
+ _aliasOption_paths = aliasOption.paths, paths = _aliasOption_paths === void 0 ? {} : _aliasOption_paths, _aliasOption_absoluteBaseUrl = aliasOption.absoluteBaseUrl, absoluteBaseUrl = _aliasOption_absoluteBaseUrl === void 0 ? "./" : _aliasOption_absoluteBaseUrl;
274
+ _readTsConfigByFile = readTsConfigByFile(tsconfigPath), options = _readTsConfigByFile.options, fileNames = _readTsConfigByFile.fileNames, projectReferences = _readTsConfigByFile.projectReferences;
275
+ sourcePosixPaths = sourceDirs.map(function(sourceDir) {
276
+ return sourceDir.split(path.sep).join(path.posix.sep);
277
+ });
278
+ rootNames = fileNames.filter(function(fileName) {
279
+ return fileName.endsWith(".d.ts") || sourcePosixPaths.some(function(sourceDir) {
280
+ return fileName.includes(sourceDir);
281
+ });
282
+ });
283
+ program = createProgram.call(ts2, {
284
+ rootNames,
285
+ projectReferences,
286
+ options: _object_spread({
287
+ rootDir: appDirectory,
288
+ outDir: distDir
289
+ }, options)
290
+ });
291
+ tsconfigPathsPlugin = tsconfigPathsBeforeHookFactory(ts2, absoluteBaseUrl, paths);
292
+ emitResult = program.emit(void 0, void 0, void 0, void 0, {
293
+ before: [
294
+ tsconfigPathsPlugin
295
+ ]
296
+ });
297
+ allDiagnostics = ts2.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
298
+ noEmitOnError = options.noEmitOnError;
299
+ if (allDiagnostics.length > 0) {
300
+ logger.error(ts2.formatDiagnosticsWithColorAndContext(_to_consumable_array(new Set(allDiagnostics)), formatHost));
301
+ if (typeof noEmitOnError === "undefined" || noEmitOnError === true) {
302
+ process.exit(1);
349
303
  }
350
- });
304
+ }
305
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
306
+ _state.label = 1;
307
+ case 1:
308
+ _state.trys.push([
309
+ 1,
310
+ 6,
311
+ 7,
312
+ 8
313
+ ]);
314
+ _iterator = sourceDirs[Symbol.iterator]();
315
+ _state.label = 2;
316
+ case 2:
317
+ if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
318
+ return [
319
+ 3,
320
+ 5
321
+ ];
322
+ source = _step.value;
323
+ return [
324
+ 4,
325
+ copyFiles(source, distDir, appDirectory, tsconfigPath)
326
+ ];
327
+ case 3:
328
+ _state.sent();
329
+ _state.label = 4;
330
+ case 4:
331
+ _iteratorNormalCompletion = true;
332
+ return [
333
+ 3,
334
+ 2
335
+ ];
336
+ case 5:
337
+ return [
338
+ 3,
339
+ 8
340
+ ];
341
+ case 6:
342
+ err = _state.sent();
343
+ _didIteratorError = true;
344
+ _iteratorError = err;
345
+ return [
346
+ 3,
347
+ 8
348
+ ];
349
+ case 7:
350
+ try {
351
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
352
+ _iterator.return();
353
+ }
354
+ } finally {
355
+ if (_didIteratorError) {
356
+ throw _iteratorError;
357
+ }
358
+ }
359
+ return [
360
+ 7
361
+ ];
362
+ case 8:
363
+ logger.info("Ts compile succeed");
364
+ return [
365
+ 2
366
+ ];
367
+ }
351
368
  });
352
- return function compileByTs(appDirectory, config, compileOptions) {
353
- return _ref.apply(this, arguments);
354
- };
369
+ });
370
+ return function compileByTs2(appDirectory, config, compileOptions) {
371
+ return _ref.apply(this, arguments);
372
+ };
355
373
  }();
356
374
  var getFormatHost = function(ts2) {
357
- return {
358
- getCanonicalFileName: function(path2) {
359
- return path2;
360
- },
361
- getCurrentDirectory: ts2.sys.getCurrentDirectory,
362
- getNewLine: function() {
363
- return ts2.sys.newLine;
364
- }
365
- };
375
+ return {
376
+ getCanonicalFileName: function(path2) {
377
+ return path2;
378
+ },
379
+ getCurrentDirectory: ts2.sys.getCurrentDirectory,
380
+ getNewLine: function() {
381
+ return ts2.sys.newLine;
382
+ }
383
+ };
366
384
  };
367
- export { compileByTs };