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.
Files changed (2) hide show
  1. package/index.js +101 -100
  2. 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 = 2;
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 = 117;
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 14:
101
+ case 15:
101
102
  if (!true) {
102
- _context3.next = 23;
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 = 18;
107
+ _context3.next = 19;
107
108
  return _clientnode["default"].isFile(filePath);
108
- case 18:
109
+ case 19:
109
110
  if (_context3.sent) {
110
- _context3.next = 20;
111
+ _context3.next = 21;
111
112
  break;
112
113
  }
113
- return _context3.abrupt("break", 23);
114
- case 20:
114
+ return _context3.abrupt("break", 24);
115
+ case 21:
115
116
  count += 1;
116
- _context3.next = 14;
117
+ _context3.next = 15;
117
118
  break;
118
- case 23:
119
- _context3.next = 25;
119
+ case 24:
120
+ _context3.next = 26;
120
121
  return (0, _promises.writeFile)(filePath, JSON.stringify(dynamicConfiguration));
121
- case 25:
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 = 66;
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 = 56;
145
+ _context3.next = 57;
145
146
  break;
146
147
  }
147
- _context3.next = 32;
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 32:
202
+ case 33:
202
203
  _context3.t0 = _createForOfIteratorHelper;
203
- _context3.next = 35;
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 35:
208
+ case 36:
208
209
  _context3.t1 = _context3.sent;
209
210
  _iterator = (0, _context3.t0)(_context3.t1);
210
- _context3.prev = 37;
211
+ _context3.prev = 38;
211
212
  _iterator.s();
212
- case 39:
213
+ case 40:
213
214
  if ((_step = _iterator.n()).done) {
214
- _context3.next = 46;
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 = 44;
220
+ _context3.next = 45;
220
221
  break;
221
222
  }
222
- _context3.next = 44;
223
+ _context3.next = 45;
223
224
  return (0, _promises.unlink)(file.path);
224
- case 44:
225
- _context3.next = 39;
225
+ case 45:
226
+ _context3.next = 40;
226
227
  break;
227
- case 46:
228
- _context3.next = 51;
228
+ case 47:
229
+ _context3.next = 52;
229
230
  break;
230
- case 48:
231
- _context3.prev = 48;
232
- _context3.t2 = _context3["catch"](37);
231
+ case 49:
232
+ _context3.prev = 49;
233
+ _context3.t2 = _context3["catch"](38);
233
234
  _iterator.e(_context3.t2);
234
- case 51:
235
- _context3.prev = 51;
235
+ case 52:
236
+ _context3.prev = 52;
236
237
  _iterator.f();
237
- return _context3.finish(51);
238
- case 54:
239
- _context3.next = 58;
238
+ return _context3.finish(52);
239
+ case 55:
240
+ _context3.next = 59;
240
241
  break;
241
- case 56:
242
- _context3.next = 58;
242
+ case 57:
243
+ _context3.next = 59;
243
244
  return (0, _rimraf.rimraf)(configuration.path.target.base);
244
- case 58:
245
- _context3.next = 60;
245
+ case 59:
246
+ _context3.next = 61;
246
247
  return _clientnode["default"].isDirectory(configuration.path.apiDocumentation);
247
- case 60:
248
+ case 61:
248
249
  if (!_context3.sent) {
249
- _context3.next = 63;
250
+ _context3.next = 64;
250
251
  break;
251
252
  }
252
- _context3.next = 63;
253
+ _context3.next = 64;
253
254
  return (0, _rimraf.rimraf)(configuration.path.apiDocumentation);
254
- case 63:
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 66:
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 = 74;
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 = 109;
393
+ _context3.next = 110;
393
394
  break;
394
- case 74:
395
+ case 75:
395
396
  if (!(configuration.library && configuration.givenCommandLineArguments[2] === 'preinstall')) {
396
- _context3.next = 109;
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 = 78;
406
+ _context3.prev = 79;
406
407
  _iterator7.s();
407
- case 80:
408
+ case 81:
408
409
  if ((_step7 = _iterator7.n()).done) {
409
- _context3.next = 101;
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 = 84;
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 87:
459
+ case 88:
459
460
  if ((_step8 = _iterator8.n()).done) {
460
- _context3.next = 91;
461
+ _context3.next = 92;
461
462
  break;
462
463
  }
463
- return _context3.delegateYield(_loop(), "t3", 89);
464
- case 89:
465
- _context3.next = 87;
464
+ return _context3.delegateYield(_loop(), "t3", 90);
465
+ case 90:
466
+ _context3.next = 88;
466
467
  break;
467
- case 91:
468
- _context3.next = 96;
468
+ case 92:
469
+ _context3.next = 97;
469
470
  break;
470
- case 93:
471
- _context3.prev = 93;
472
- _context3.t4 = _context3["catch"](84);
471
+ case 94:
472
+ _context3.prev = 94;
473
+ _context3.t4 = _context3["catch"](85);
473
474
  _iterator8.e(_context3.t4);
474
- case 96:
475
- _context3.prev = 96;
475
+ case 97:
476
+ _context3.prev = 97;
476
477
  _iterator8.f();
477
- return _context3.finish(96);
478
- case 99:
479
- _context3.next = 80;
478
+ return _context3.finish(97);
479
+ case 100:
480
+ _context3.next = 81;
480
481
  break;
481
- case 101:
482
- _context3.next = 106;
482
+ case 102:
483
+ _context3.next = 107;
483
484
  break;
484
- case 103:
485
- _context3.prev = 103;
486
- _context3.t5 = _context3["catch"](78);
485
+ case 104:
486
+ _context3.prev = 104;
487
+ _context3.t5 = _context3["catch"](79);
487
488
  _iterator7.e(_context3.t5);
488
- case 106:
489
- _context3.prev = 106;
489
+ case 107:
490
+ _context3.prev = 107;
490
491
  _iterator7.f();
491
- return _context3.finish(106);
492
- case 109:
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 = 116;
540
+ _context3.next = 117;
540
541
  break;
541
542
  }
542
- _context3.next = 113;
543
+ _context3.next = 114;
543
544
  return Promise.all(processPromises);
544
- case 113:
545
+ case 114:
545
546
  handleTask(configuration.givenCommandLineArguments[2]);
546
- _context3.next = 117;
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 = 122;
574
- _context3.next = 125;
574
+ _context3.prev = 123;
575
+ _context3.next = 126;
575
576
  return Promise.all(processPromises);
576
- case 125:
577
- _context3.next = 131;
577
+ case 126:
578
+ _context3.next = 132;
578
579
  break;
579
- case 127:
580
- _context3.prev = 127;
581
- _context3.t6 = _context3["catch"](122);
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 131:
585
- _context3.next = 140;
585
+ case 132:
586
+ _context3.next = 141;
586
587
  break;
587
- case 133:
588
- _context3.prev = 133;
589
- _context3.t7 = _context3["catch"](2);
588
+ case 134:
589
+ _context3.prev = 134;
590
+ _context3.t7 = _context3["catch"](3);
590
591
  if (!configuration.debug) {
591
- _context3.next = 139;
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
- return _context3.abrupt("return", clear);
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, [[2, 133], [37, 48, 51, 54], [78, 103, 106, 109], [84, 93, 96, 99], [122, 127]]);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weboptimizer",
3
- "version": "2.0.1439",
3
+ "version": "2.0.1440",
4
4
  "description": "A generic web optimizer, (module) bundler and development environment.",
5
5
  "keywords": [
6
6
  "webpack",