weboptimizer 2.0.1439 → 2.0.1440
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/index.js +101 -100
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -69,9 +69,10 @@ var main = function main(context) {
|
|
|
69
69
|
return _regenerator["default"].wrap(function _callee2$(_context3) {
|
|
70
70
|
while (1) switch (_context3.prev = _context3.next) {
|
|
71
71
|
case 0:
|
|
72
|
+
if (environment.PATH && !environment.PATH.includes(':node_modules/.bin')) environment.PATH += ':node_modules/.bin';else environment.PATH = 'node_modules/.bin';
|
|
72
73
|
configuration = (0, _configurator.load)(context, currentWorkingDirectory, commandLineArguments, webOptimizerPath, environment);
|
|
73
74
|
clear = _clientnode["default"].noop();
|
|
74
|
-
_context3.prev =
|
|
75
|
+
_context3.prev = 3;
|
|
75
76
|
// region controller
|
|
76
77
|
processOptions = {
|
|
77
78
|
cwd: configuration.path.context,
|
|
@@ -86,7 +87,7 @@ var main = function main(context) {
|
|
|
86
87
|
possibleArguments = ['build', 'build:types', 'clear', 'document', 'lint', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report', 'check:types'];
|
|
87
88
|
closeEventHandlers = [];
|
|
88
89
|
if (!(configuration.givenCommandLineArguments.length > 2)) {
|
|
89
|
-
_context3.next =
|
|
90
|
+
_context3.next = 118;
|
|
90
91
|
break;
|
|
91
92
|
}
|
|
92
93
|
// region temporary save dynamically given configurations
|
|
@@ -97,28 +98,28 @@ var main = function main(context) {
|
|
|
97
98
|
if (configuration.givenCommandLineArguments.length > 3 && _clientnode["default"].stringParseEncodedObject(configuration.givenCommandLineArguments[configuration.givenCommandLineArguments.length - 1], configuration, 'configuration')) configuration.givenCommandLineArguments.pop();
|
|
98
99
|
count = 0;
|
|
99
100
|
filePath = (0, _path.resolve)(configuration.path.context, ".dynamicConfiguration-".concat(count, ".json"));
|
|
100
|
-
case
|
|
101
|
+
case 15:
|
|
101
102
|
if (!true) {
|
|
102
|
-
_context3.next =
|
|
103
|
+
_context3.next = 24;
|
|
103
104
|
break;
|
|
104
105
|
}
|
|
105
106
|
filePath = (0, _path.resolve)(configuration.path.context, ".dynamicConfiguration-".concat(count, ".json"));
|
|
106
|
-
_context3.next =
|
|
107
|
+
_context3.next = 19;
|
|
107
108
|
return _clientnode["default"].isFile(filePath);
|
|
108
|
-
case
|
|
109
|
+
case 19:
|
|
109
110
|
if (_context3.sent) {
|
|
110
|
-
_context3.next =
|
|
111
|
+
_context3.next = 21;
|
|
111
112
|
break;
|
|
112
113
|
}
|
|
113
|
-
return _context3.abrupt("break",
|
|
114
|
-
case
|
|
114
|
+
return _context3.abrupt("break", 24);
|
|
115
|
+
case 21:
|
|
115
116
|
count += 1;
|
|
116
|
-
_context3.next =
|
|
117
|
+
_context3.next = 15;
|
|
117
118
|
break;
|
|
118
|
-
case
|
|
119
|
-
_context3.next =
|
|
119
|
+
case 24:
|
|
120
|
+
_context3.next = 26;
|
|
120
121
|
return (0, _promises.writeFile)(filePath, JSON.stringify(dynamicConfiguration));
|
|
121
|
-
case
|
|
122
|
+
case 26:
|
|
122
123
|
additionalArguments = commandLineArguments.splice(3); /// region register exit handler to tidy up
|
|
123
124
|
clear = function clear(error) {
|
|
124
125
|
// NOTE: Close handler have to be synchronous.
|
|
@@ -137,14 +138,14 @@ var main = function main(context) {
|
|
|
137
138
|
during pre-install phase.
|
|
138
139
|
*/
|
|
139
140
|
if (!(!['build', 'build:types', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2]) && possibleArguments.includes(configuration.givenCommandLineArguments[2]))) {
|
|
140
|
-
_context3.next =
|
|
141
|
+
_context3.next = 67;
|
|
141
142
|
break;
|
|
142
143
|
}
|
|
143
144
|
if (!((0, _path.resolve)(configuration.path.target.base) === (0, _path.resolve)(configuration.path.context))) {
|
|
144
|
-
_context3.next =
|
|
145
|
+
_context3.next = 57;
|
|
145
146
|
break;
|
|
146
147
|
}
|
|
147
|
-
_context3.next =
|
|
148
|
+
_context3.next = 33;
|
|
148
149
|
return _clientnode["default"].walkDirectoryRecursively(configuration.path.target.base, /*#__PURE__*/function () {
|
|
149
150
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file) {
|
|
150
151
|
var type, _file$stats;
|
|
@@ -198,60 +199,60 @@ var main = function main(context) {
|
|
|
198
199
|
return _ref2.apply(this, arguments);
|
|
199
200
|
};
|
|
200
201
|
}());
|
|
201
|
-
case
|
|
202
|
+
case 33:
|
|
202
203
|
_context3.t0 = _createForOfIteratorHelper;
|
|
203
|
-
_context3.next =
|
|
204
|
+
_context3.next = 36;
|
|
204
205
|
return _clientnode["default"].walkDirectoryRecursively(configuration.path.target.base, function () {
|
|
205
206
|
return false;
|
|
206
207
|
}, configuration.encoding);
|
|
207
|
-
case
|
|
208
|
+
case 36:
|
|
208
209
|
_context3.t1 = _context3.sent;
|
|
209
210
|
_iterator = (0, _context3.t0)(_context3.t1);
|
|
210
|
-
_context3.prev =
|
|
211
|
+
_context3.prev = 38;
|
|
211
212
|
_iterator.s();
|
|
212
|
-
case
|
|
213
|
+
case 40:
|
|
213
214
|
if ((_step = _iterator.n()).done) {
|
|
214
|
-
_context3.next =
|
|
215
|
+
_context3.next = 47;
|
|
215
216
|
break;
|
|
216
217
|
}
|
|
217
218
|
file = _step.value;
|
|
218
219
|
if (!file.name.startsWith('npm-debug')) {
|
|
219
|
-
_context3.next =
|
|
220
|
+
_context3.next = 45;
|
|
220
221
|
break;
|
|
221
222
|
}
|
|
222
|
-
_context3.next =
|
|
223
|
+
_context3.next = 45;
|
|
223
224
|
return (0, _promises.unlink)(file.path);
|
|
224
|
-
case
|
|
225
|
-
_context3.next =
|
|
225
|
+
case 45:
|
|
226
|
+
_context3.next = 40;
|
|
226
227
|
break;
|
|
227
|
-
case
|
|
228
|
-
_context3.next =
|
|
228
|
+
case 47:
|
|
229
|
+
_context3.next = 52;
|
|
229
230
|
break;
|
|
230
|
-
case
|
|
231
|
-
_context3.prev =
|
|
232
|
-
_context3.t2 = _context3["catch"](
|
|
231
|
+
case 49:
|
|
232
|
+
_context3.prev = 49;
|
|
233
|
+
_context3.t2 = _context3["catch"](38);
|
|
233
234
|
_iterator.e(_context3.t2);
|
|
234
|
-
case
|
|
235
|
-
_context3.prev =
|
|
235
|
+
case 52:
|
|
236
|
+
_context3.prev = 52;
|
|
236
237
|
_iterator.f();
|
|
237
|
-
return _context3.finish(
|
|
238
|
-
case
|
|
239
|
-
_context3.next =
|
|
238
|
+
return _context3.finish(52);
|
|
239
|
+
case 55:
|
|
240
|
+
_context3.next = 59;
|
|
240
241
|
break;
|
|
241
|
-
case
|
|
242
|
-
_context3.next =
|
|
242
|
+
case 57:
|
|
243
|
+
_context3.next = 59;
|
|
243
244
|
return (0, _rimraf.rimraf)(configuration.path.target.base);
|
|
244
|
-
case
|
|
245
|
-
_context3.next =
|
|
245
|
+
case 59:
|
|
246
|
+
_context3.next = 61;
|
|
246
247
|
return _clientnode["default"].isDirectory(configuration.path.apiDocumentation);
|
|
247
|
-
case
|
|
248
|
+
case 61:
|
|
248
249
|
if (!_context3.sent) {
|
|
249
|
-
_context3.next =
|
|
250
|
+
_context3.next = 64;
|
|
250
251
|
break;
|
|
251
252
|
}
|
|
252
|
-
_context3.next =
|
|
253
|
+
_context3.next = 64;
|
|
253
254
|
return (0, _rimraf.rimraf)(configuration.path.apiDocumentation);
|
|
254
|
-
case
|
|
255
|
+
case 64:
|
|
255
256
|
_iterator2 = _createForOfIteratorHelper(configuration.path.tidyUpOnClear);
|
|
256
257
|
try {
|
|
257
258
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
@@ -266,7 +267,7 @@ var main = function main(context) {
|
|
|
266
267
|
_iterator2.f();
|
|
267
268
|
}
|
|
268
269
|
(0, _rimraf.sync)((0, _globAll.sync)(configuration.path.tidyUpOnClearGlobs));
|
|
269
|
-
case
|
|
270
|
+
case 67:
|
|
270
271
|
// endregion
|
|
271
272
|
// region handle build
|
|
272
273
|
buildConfigurations = _helper["default"].resolveBuildConfigurationFilePaths(configuration.buildContext.types, configuration.path.source.asset.base, configuration.path.ignore.concat(configuration.module.directoryNames, configuration.loader.directoryNames).map(function (filePath) {
|
|
@@ -275,7 +276,7 @@ var main = function main(context) {
|
|
|
275
276
|
return !configuration.path.context.startsWith(filePath);
|
|
276
277
|
}), configuration["package"].main.fileNames);
|
|
277
278
|
if (!['build', 'document', 'test', 'test:coverage', 'test:coverage:report'].includes(commandLineArguments[2])) {
|
|
278
|
-
_context3.next =
|
|
279
|
+
_context3.next = 75;
|
|
279
280
|
break;
|
|
280
281
|
}
|
|
281
282
|
tidiedUp = false;
|
|
@@ -389,11 +390,11 @@ var main = function main(context) {
|
|
|
389
390
|
}));
|
|
390
391
|
// endregion
|
|
391
392
|
// region handle pre-install
|
|
392
|
-
_context3.next =
|
|
393
|
+
_context3.next = 110;
|
|
393
394
|
break;
|
|
394
|
-
case
|
|
395
|
+
case 75:
|
|
395
396
|
if (!(configuration.library && configuration.givenCommandLineArguments[2] === 'preinstall')) {
|
|
396
|
-
_context3.next =
|
|
397
|
+
_context3.next = 110;
|
|
397
398
|
break;
|
|
398
399
|
}
|
|
399
400
|
// Perform all file specific preprocessing stuff.
|
|
@@ -402,17 +403,17 @@ var main = function main(context) {
|
|
|
402
403
|
file: configuration.extensions.file.internal
|
|
403
404
|
}, configuration.path.context, configuration.path.source.asset.base, configuration.path.ignore).filePaths;
|
|
404
405
|
_iterator7 = _createForOfIteratorHelper(buildConfigurations);
|
|
405
|
-
_context3.prev =
|
|
406
|
+
_context3.prev = 79;
|
|
406
407
|
_iterator7.s();
|
|
407
|
-
case
|
|
408
|
+
case 81:
|
|
408
409
|
if ((_step7 = _iterator7.n()).done) {
|
|
409
|
-
_context3.next =
|
|
410
|
+
_context3.next = 102;
|
|
410
411
|
break;
|
|
411
412
|
}
|
|
412
413
|
buildConfiguration = _step7.value;
|
|
413
414
|
expression = buildConfiguration[configuration.givenCommandLineArguments[2]].trim();
|
|
414
415
|
_iterator8 = _createForOfIteratorHelper(buildConfiguration.filePaths);
|
|
415
|
-
_context3.prev =
|
|
416
|
+
_context3.prev = 85;
|
|
416
417
|
_loop = /*#__PURE__*/_regenerator["default"].mark(function _loop() {
|
|
417
418
|
var filePath, evaluated;
|
|
418
419
|
return _regenerator["default"].wrap(function _loop$(_context2) {
|
|
@@ -455,41 +456,41 @@ var main = function main(context) {
|
|
|
455
456
|
}, _loop);
|
|
456
457
|
});
|
|
457
458
|
_iterator8.s();
|
|
458
|
-
case
|
|
459
|
+
case 88:
|
|
459
460
|
if ((_step8 = _iterator8.n()).done) {
|
|
460
|
-
_context3.next =
|
|
461
|
+
_context3.next = 92;
|
|
461
462
|
break;
|
|
462
463
|
}
|
|
463
|
-
return _context3.delegateYield(_loop(), "t3",
|
|
464
|
-
case
|
|
465
|
-
_context3.next =
|
|
464
|
+
return _context3.delegateYield(_loop(), "t3", 90);
|
|
465
|
+
case 90:
|
|
466
|
+
_context3.next = 88;
|
|
466
467
|
break;
|
|
467
|
-
case
|
|
468
|
-
_context3.next =
|
|
468
|
+
case 92:
|
|
469
|
+
_context3.next = 97;
|
|
469
470
|
break;
|
|
470
|
-
case
|
|
471
|
-
_context3.prev =
|
|
472
|
-
_context3.t4 = _context3["catch"](
|
|
471
|
+
case 94:
|
|
472
|
+
_context3.prev = 94;
|
|
473
|
+
_context3.t4 = _context3["catch"](85);
|
|
473
474
|
_iterator8.e(_context3.t4);
|
|
474
|
-
case
|
|
475
|
-
_context3.prev =
|
|
475
|
+
case 97:
|
|
476
|
+
_context3.prev = 97;
|
|
476
477
|
_iterator8.f();
|
|
477
|
-
return _context3.finish(
|
|
478
|
-
case
|
|
479
|
-
_context3.next =
|
|
478
|
+
return _context3.finish(97);
|
|
479
|
+
case 100:
|
|
480
|
+
_context3.next = 81;
|
|
480
481
|
break;
|
|
481
|
-
case
|
|
482
|
-
_context3.next =
|
|
482
|
+
case 102:
|
|
483
|
+
_context3.next = 107;
|
|
483
484
|
break;
|
|
484
|
-
case
|
|
485
|
-
_context3.prev =
|
|
486
|
-
_context3.t5 = _context3["catch"](
|
|
485
|
+
case 104:
|
|
486
|
+
_context3.prev = 104;
|
|
487
|
+
_context3.t5 = _context3["catch"](79);
|
|
487
488
|
_iterator7.e(_context3.t5);
|
|
488
|
-
case
|
|
489
|
-
_context3.prev =
|
|
489
|
+
case 107:
|
|
490
|
+
_context3.prev = 107;
|
|
490
491
|
_iterator7.f();
|
|
491
|
-
return _context3.finish(
|
|
492
|
-
case
|
|
492
|
+
return _context3.finish(107);
|
|
493
|
+
case 110:
|
|
493
494
|
// endregion
|
|
494
495
|
// region handle remaining tasks
|
|
495
496
|
handleTask = function handleTask(type) {
|
|
@@ -536,18 +537,18 @@ var main = function main(context) {
|
|
|
536
537
|
}
|
|
537
538
|
}; /// region a-/synchronous
|
|
538
539
|
if (!['document', 'test', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2])) {
|
|
539
|
-
_context3.next =
|
|
540
|
+
_context3.next = 117;
|
|
540
541
|
break;
|
|
541
542
|
}
|
|
542
|
-
_context3.next =
|
|
543
|
+
_context3.next = 114;
|
|
543
544
|
return Promise.all(processPromises);
|
|
544
|
-
case
|
|
545
|
+
case 114:
|
|
545
546
|
handleTask(configuration.givenCommandLineArguments[2]);
|
|
546
|
-
_context3.next =
|
|
547
|
+
_context3.next = 118;
|
|
547
548
|
break;
|
|
548
|
-
case 116:
|
|
549
|
-
if (['build:types', 'check:types', 'lint', 'serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) handleTask(configuration.givenCommandLineArguments[2]);
|
|
550
549
|
case 117:
|
|
550
|
+
if (['build:types', 'check:types', 'lint', 'serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) handleTask(configuration.givenCommandLineArguments[2]);
|
|
551
|
+
case 118:
|
|
551
552
|
finished = false;
|
|
552
553
|
closeHandler = function closeHandler() {
|
|
553
554
|
if (!finished) for (var _i2 = 0, _closeEventHandlers = closeEventHandlers; _i2 < _closeEventHandlers.length; _i2++) {
|
|
@@ -570,37 +571,37 @@ var main = function main(context) {
|
|
|
570
571
|
if (require.main === module && (configuration.givenCommandLineArguments.length < 3 || !possibleArguments.includes(configuration.givenCommandLineArguments[2]))) console.info("Give one of \"".concat(possibleArguments.join('", "'), "\" as command ") + 'line argument. You can provide a json string as second ' + 'parameter to dynamically overwrite some configurations.\n');
|
|
571
572
|
// endregion
|
|
572
573
|
// region forward nested return codes
|
|
573
|
-
_context3.prev =
|
|
574
|
-
_context3.next =
|
|
574
|
+
_context3.prev = 123;
|
|
575
|
+
_context3.next = 126;
|
|
575
576
|
return Promise.all(processPromises);
|
|
576
|
-
case
|
|
577
|
-
_context3.next =
|
|
577
|
+
case 126:
|
|
578
|
+
_context3.next = 132;
|
|
578
579
|
break;
|
|
579
|
-
case
|
|
580
|
-
_context3.prev =
|
|
581
|
-
_context3.t6 = _context3["catch"](
|
|
580
|
+
case 128:
|
|
581
|
+
_context3.prev = 128;
|
|
582
|
+
_context3.t6 = _context3["catch"](123);
|
|
582
583
|
console.error(_context3.t6);
|
|
583
584
|
process.exit(_context3.t6.returnCode);
|
|
584
|
-
case
|
|
585
|
-
_context3.next =
|
|
585
|
+
case 132:
|
|
586
|
+
_context3.next = 141;
|
|
586
587
|
break;
|
|
587
|
-
case
|
|
588
|
-
_context3.prev =
|
|
589
|
-
_context3.t7 = _context3["catch"](
|
|
588
|
+
case 134:
|
|
589
|
+
_context3.prev = 134;
|
|
590
|
+
_context3.t7 = _context3["catch"](3);
|
|
590
591
|
if (!configuration.debug) {
|
|
591
|
-
_context3.next =
|
|
592
|
+
_context3.next = 140;
|
|
592
593
|
break;
|
|
593
594
|
}
|
|
594
595
|
throw _context3.t7;
|
|
595
|
-
case 139:
|
|
596
|
-
console.error(_context3.t7);
|
|
597
596
|
case 140:
|
|
598
|
-
|
|
597
|
+
console.error(_context3.t7);
|
|
599
598
|
case 141:
|
|
599
|
+
return _context3.abrupt("return", clear);
|
|
600
|
+
case 142:
|
|
600
601
|
case "end":
|
|
601
602
|
return _context3.stop();
|
|
602
603
|
}
|
|
603
|
-
}, _callee2, null, [[
|
|
604
|
+
}, _callee2, null, [[3, 134], [38, 49, 52, 55], [79, 104, 107, 110], [85, 94, 97, 100], [123, 128]]);
|
|
604
605
|
}))();
|
|
605
606
|
} catch (e) {
|
|
606
607
|
return Promise.reject(e);
|