weboptimizer 2.0.1270 → 2.0.1272
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/declarations.d.ts +4 -0
- package/index.js +120 -164
- package/package.json +21 -36
- package/type.d.ts +2 -9
package/declarations.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ interface PostcssTransformer {
|
|
|
14
14
|
|
|
15
15
|
/** @module declarations */
|
|
16
16
|
declare module 'babel-preset-minify'
|
|
17
|
+
declare module 'glob-all' {
|
|
18
|
+
export default function(globs:Array<string>):Promise<Array<string>>
|
|
19
|
+
export function sync(globs:Array<string>):Array<string>
|
|
20
|
+
}
|
|
17
21
|
declare module 'html-loader'
|
|
18
22
|
declare module 'postcss-fontpath' {
|
|
19
23
|
export default function(options:Partial<{
|
package/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var _child_process = require("child_process");
|
|
|
32
32
|
var _clientnode = _interopRequireWildcard(require("clientnode"));
|
|
33
33
|
var _fs = require("fs");
|
|
34
34
|
var _promises = require("fs/promises");
|
|
35
|
+
var _globAll = require("glob-all");
|
|
35
36
|
var _path = _interopRequireWildcard(require("path"));
|
|
36
37
|
var _rimraf = _interopRequireWildcard(require("rimraf"));
|
|
37
38
|
var _configurator = require("./configurator");
|
|
@@ -64,7 +65,7 @@ var main = function main(context) {
|
|
|
64
65
|
var webOptimizerPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : __dirname;
|
|
65
66
|
var environment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : eval('process.env');
|
|
66
67
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
67
|
-
var configuration, clear, processOptions, childProcessOptions, childProcesses, processPromises, possibleArguments, closeEventHandlers, dynamicConfiguration, count, filePath, additionalArguments, _iterator, _step, file, _iterator2, _step2, _filePath,
|
|
68
|
+
var configuration, clear, processOptions, childProcessOptions, childProcesses, processPromises, possibleArguments, closeEventHandlers, dynamicConfiguration, count, filePath, additionalArguments, _iterator, _step, file, _iterator2, _step2, _filePath, buildConfigurations, tidiedUp, tidyUp, testModuleFilePaths, _iterator7, _step7, buildConfiguration, expression, _iterator8, _step8, _loop, handleTask, finished, closeHandler, _iterator11, _step11, closeEventName;
|
|
68
69
|
return _regenerator["default"].wrap(function _callee2$(_context3) {
|
|
69
70
|
while (1) switch (_context3.prev = _context3.next) {
|
|
70
71
|
case 0:
|
|
@@ -85,7 +86,7 @@ var main = function main(context) {
|
|
|
85
86
|
possibleArguments = ['build', 'build:types', 'clear', 'document', 'lint', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report', 'check:types'];
|
|
86
87
|
closeEventHandlers = [];
|
|
87
88
|
if (!(configuration.givenCommandLineArguments.length > 2)) {
|
|
88
|
-
_context3.next =
|
|
89
|
+
_context3.next = 117;
|
|
89
90
|
break;
|
|
90
91
|
}
|
|
91
92
|
// region temporary save dynamically given configurations
|
|
@@ -136,7 +137,7 @@ var main = function main(context) {
|
|
|
136
137
|
during pre-install phase.
|
|
137
138
|
*/
|
|
138
139
|
if (!(!['build', 'build:types', 'preinstall', 'serve', 'test', 'test:browser', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2]) && possibleArguments.includes(configuration.givenCommandLineArguments[2]))) {
|
|
139
|
-
_context3.next =
|
|
140
|
+
_context3.next = 66;
|
|
140
141
|
break;
|
|
141
142
|
}
|
|
142
143
|
if (!((0, _path.resolve)(configuration.path.target.base) === (0, _path.resolve)(configuration.path.context))) {
|
|
@@ -176,13 +177,7 @@ var main = function main(context) {
|
|
|
176
177
|
break;
|
|
177
178
|
}
|
|
178
179
|
_context.next = 9;
|
|
179
|
-
return
|
|
180
|
-
return (0, _rimraf["default"])(file.path, {
|
|
181
|
-
glob: false
|
|
182
|
-
}, function (error) {
|
|
183
|
-
return error ? reject(error) : resolve();
|
|
184
|
-
});
|
|
185
|
-
});
|
|
180
|
+
return (0, _rimraf["default"])(file.path);
|
|
186
181
|
case 9:
|
|
187
182
|
return _context.abrupt("return", false);
|
|
188
183
|
case 10:
|
|
@@ -245,13 +240,7 @@ var main = function main(context) {
|
|
|
245
240
|
break;
|
|
246
241
|
case 56:
|
|
247
242
|
_context3.next = 58;
|
|
248
|
-
return
|
|
249
|
-
return (0, _rimraf["default"])(configuration.path.target.base, {
|
|
250
|
-
glob: false
|
|
251
|
-
}, function (error) {
|
|
252
|
-
return error ? reject(error) : resolve();
|
|
253
|
-
});
|
|
254
|
-
});
|
|
243
|
+
return (0, _rimraf["default"])(configuration.path.target.base);
|
|
255
244
|
case 58:
|
|
256
245
|
_context3.next = 60;
|
|
257
246
|
return _clientnode["default"].isDirectory(configuration.path.apiDocumentation);
|
|
@@ -261,13 +250,7 @@ var main = function main(context) {
|
|
|
261
250
|
break;
|
|
262
251
|
}
|
|
263
252
|
_context3.next = 63;
|
|
264
|
-
return
|
|
265
|
-
return (0, _rimraf["default"])(configuration.path.apiDocumentation, {
|
|
266
|
-
glob: false
|
|
267
|
-
}, function (error) {
|
|
268
|
-
return error ? reject(error) : resolve();
|
|
269
|
-
});
|
|
270
|
-
});
|
|
253
|
+
return (0, _rimraf["default"])(configuration.path.apiDocumentation);
|
|
271
254
|
case 63:
|
|
272
255
|
_iterator2 = _createForOfIteratorHelper(configuration.path.tidyUpOnClear);
|
|
273
256
|
try {
|
|
@@ -275,27 +258,15 @@ var main = function main(context) {
|
|
|
275
258
|
_filePath = _step2.value;
|
|
276
259
|
if (_filePath) if (_clientnode["default"].isFileSync(_filePath))
|
|
277
260
|
// NOTE: Close handler have to be synchronous.
|
|
278
|
-
(0, _fs.unlinkSync)(_filePath);else if (_clientnode["default"].isDirectorySync(_filePath)) (0, _rimraf.sync)(_filePath
|
|
279
|
-
glob: false
|
|
280
|
-
});
|
|
261
|
+
(0, _fs.unlinkSync)(_filePath);else if (_clientnode["default"].isDirectorySync(_filePath)) (0, _rimraf.sync)(_filePath);
|
|
281
262
|
}
|
|
282
263
|
} catch (err) {
|
|
283
264
|
_iterator2.e(err);
|
|
284
265
|
} finally {
|
|
285
266
|
_iterator2.f();
|
|
286
267
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
290
|
-
filePathPattern = _step3.value;
|
|
291
|
-
if (filePathPattern) (0, _rimraf.sync)(filePathPattern, configuration.path.tidyUpOnClearGlobs.options);
|
|
292
|
-
}
|
|
293
|
-
} catch (err) {
|
|
294
|
-
_iterator3.e(err);
|
|
295
|
-
} finally {
|
|
296
|
-
_iterator3.f();
|
|
297
|
-
}
|
|
298
|
-
case 67:
|
|
268
|
+
(0, _rimraf.sync)((0, _globAll.sync)(configuration.path.tidyUpOnClearGlobs));
|
|
269
|
+
case 66:
|
|
299
270
|
// endregion
|
|
300
271
|
// region handle build
|
|
301
272
|
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) {
|
|
@@ -304,7 +275,7 @@ var main = function main(context) {
|
|
|
304
275
|
return !configuration.path.context.startsWith(filePath);
|
|
305
276
|
}), configuration["package"].main.fileNames);
|
|
306
277
|
if (!['build', 'document', 'test', 'test:coverage', 'test:coverage:report'].includes(commandLineArguments[2])) {
|
|
307
|
-
_context3.next =
|
|
278
|
+
_context3.next = 74;
|
|
308
279
|
break;
|
|
309
280
|
}
|
|
310
281
|
tidiedUp = false;
|
|
@@ -319,11 +290,11 @@ var main = function main(context) {
|
|
|
319
290
|
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
320
291
|
chunkName = _Object$entries$_i[0],
|
|
321
292
|
chunk = _Object$entries$_i[1];
|
|
322
|
-
var
|
|
323
|
-
|
|
293
|
+
var _iterator3 = _createForOfIteratorHelper(chunk),
|
|
294
|
+
_step3;
|
|
324
295
|
try {
|
|
325
|
-
for (
|
|
326
|
-
var moduleID =
|
|
296
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
297
|
+
var moduleID = _step3.value;
|
|
327
298
|
var _filePath2 = _helper["default"].determineModuleFilePath(moduleID, configuration.module.aliases, configuration.module.replacements.normal, {
|
|
328
299
|
file: configuration.extensions.file.internal
|
|
329
300
|
}, configuration.path.context, configuration.path.source.asset.base, configuration.path.ignore, configuration.module.directoryNames, configuration["package"].main.fileNames, configuration["package"].main.propertyNames, configuration["package"].aliasPropertyNames, configuration.encoding);
|
|
@@ -341,39 +312,26 @@ var main = function main(context) {
|
|
|
341
312
|
}
|
|
342
313
|
}
|
|
343
314
|
} catch (err) {
|
|
344
|
-
|
|
315
|
+
_iterator3.e(err);
|
|
345
316
|
} finally {
|
|
346
|
-
|
|
317
|
+
_iterator3.f();
|
|
347
318
|
}
|
|
348
319
|
}
|
|
349
|
-
var
|
|
350
|
-
|
|
320
|
+
var _iterator4 = _createForOfIteratorHelper(configuration.path.tidyUp),
|
|
321
|
+
_step4;
|
|
351
322
|
try {
|
|
352
|
-
for (
|
|
353
|
-
var _filePath4 =
|
|
323
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
324
|
+
var _filePath4 = _step4.value;
|
|
354
325
|
if (_filePath4) if (_clientnode["default"].isFileSync(_filePath4))
|
|
355
326
|
// NOTE: Close handler have to be synchronous.
|
|
356
|
-
(0, _fs.unlinkSync)(_filePath4);else if (_clientnode["default"].isDirectorySync(_filePath4)) (0, _rimraf.sync)(_filePath4
|
|
357
|
-
glob: false
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
} catch (err) {
|
|
361
|
-
_iterator5.e(err);
|
|
362
|
-
} finally {
|
|
363
|
-
_iterator5.f();
|
|
364
|
-
}
|
|
365
|
-
var _iterator6 = _createForOfIteratorHelper(configuration.path.tidyUpGlobs.pattern),
|
|
366
|
-
_step6;
|
|
367
|
-
try {
|
|
368
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
369
|
-
var _filePathPattern = _step6.value;
|
|
370
|
-
if (_filePathPattern) (0, _rimraf.sync)(_filePathPattern, configuration.path.tidyUpOnClearGlobs.options);
|
|
327
|
+
(0, _fs.unlinkSync)(_filePath4);else if (_clientnode["default"].isDirectorySync(_filePath4)) (0, _rimraf.sync)(_filePath4);
|
|
371
328
|
}
|
|
372
329
|
} catch (err) {
|
|
373
|
-
|
|
330
|
+
_iterator4.e(err);
|
|
374
331
|
} finally {
|
|
375
|
-
|
|
332
|
+
_iterator4.f();
|
|
376
333
|
}
|
|
334
|
+
(0, _rimraf.sync)((0, _globAll.sync)(configuration.path.tidyUpGlobs));
|
|
377
335
|
};
|
|
378
336
|
closeEventHandlers.push(tidyUp);
|
|
379
337
|
|
|
@@ -392,52 +350,50 @@ var main = function main(context) {
|
|
|
392
350
|
childProcessOptions.env.PATH += ":".concat(webOptimizerPath, "/node_modules/.bin");
|
|
393
351
|
var childProcess = (0, _child_process.spawn)(configuration.commandLine.build.command, commandLineArguments, childProcessOptions);
|
|
394
352
|
var copyAdditionalFilesAndTidyUp = function copyAdditionalFilesAndTidyUp() {
|
|
395
|
-
var
|
|
396
|
-
|
|
353
|
+
var _iterator5 = _createForOfIteratorHelper(configuration.files.additionalPaths),
|
|
354
|
+
_step5;
|
|
397
355
|
try {
|
|
398
|
-
for (
|
|
399
|
-
var _filePath5 =
|
|
356
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
357
|
+
var _filePath5 = _step5.value;
|
|
400
358
|
var sourcePath = (0, _path.join)(configuration.path.source.base, _filePath5);
|
|
401
359
|
var targetPath = (0, _path.join)(configuration.path.target.base, _filePath5);
|
|
402
360
|
|
|
403
361
|
// NOTE: Close handler have to be synchronous.
|
|
404
362
|
if (_clientnode["default"].isDirectorySync(sourcePath)) {
|
|
405
|
-
if (_clientnode["default"].isDirectorySync(targetPath)) (0, _rimraf.sync)(targetPath
|
|
406
|
-
glob: false
|
|
407
|
-
});
|
|
363
|
+
if (_clientnode["default"].isDirectorySync(targetPath)) (0, _rimraf.sync)(targetPath);
|
|
408
364
|
_clientnode["default"].copyDirectoryRecursiveSync(sourcePath, targetPath);
|
|
409
365
|
} else if (_clientnode["default"].isFileSync(sourcePath)) _clientnode["default"].copyFileSync(sourcePath, targetPath);
|
|
410
366
|
}
|
|
411
367
|
} catch (err) {
|
|
412
|
-
|
|
368
|
+
_iterator5.e(err);
|
|
413
369
|
} finally {
|
|
414
|
-
|
|
370
|
+
_iterator5.f();
|
|
415
371
|
}
|
|
416
372
|
tidyUp();
|
|
417
373
|
};
|
|
418
374
|
var closeHandler = _clientnode["default"].getProcessCloseHandler(resolve, reject, null, commandLineArguments[2] === 'build' ? copyAdditionalFilesAndTidyUp : tidyUp);
|
|
419
|
-
var
|
|
420
|
-
|
|
375
|
+
var _iterator6 = _createForOfIteratorHelper(_clientnode.CloseEventNames),
|
|
376
|
+
_step6;
|
|
421
377
|
try {
|
|
422
|
-
for (
|
|
423
|
-
var closeEventName =
|
|
378
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
379
|
+
var closeEventName = _step6.value;
|
|
424
380
|
childProcess.on(closeEventName, closeHandler);
|
|
425
381
|
}
|
|
426
382
|
} catch (err) {
|
|
427
|
-
|
|
383
|
+
_iterator6.e(err);
|
|
428
384
|
} finally {
|
|
429
|
-
|
|
385
|
+
_iterator6.f();
|
|
430
386
|
}
|
|
431
387
|
childProcesses.push(childProcess);
|
|
432
388
|
return childProcesses;
|
|
433
389
|
}));
|
|
434
390
|
// endregion
|
|
435
391
|
// region handle pre-install
|
|
436
|
-
_context3.next =
|
|
392
|
+
_context3.next = 109;
|
|
437
393
|
break;
|
|
438
|
-
case
|
|
394
|
+
case 74:
|
|
439
395
|
if (!(configuration.library && configuration.givenCommandLineArguments[2] === 'preinstall')) {
|
|
440
|
-
_context3.next =
|
|
396
|
+
_context3.next = 109;
|
|
441
397
|
break;
|
|
442
398
|
}
|
|
443
399
|
// Perform all file specific preprocessing stuff.
|
|
@@ -445,24 +401,24 @@ var main = function main(context) {
|
|
|
445
401
|
if (_clientnode["default"].isPlainObject(configuration['test:browser'].injection) && configuration['test:browser'].injection.entry) testModuleFilePaths = _helper["default"].determineModuleLocations(configuration['test:browser'].injection.entry, configuration.module.aliases, configuration.module.replacements.normal, {
|
|
446
402
|
file: configuration.extensions.file.internal
|
|
447
403
|
}, configuration.path.context, configuration.path.source.asset.base, configuration.path.ignore).filePaths;
|
|
448
|
-
|
|
449
|
-
_context3.prev =
|
|
450
|
-
|
|
451
|
-
case
|
|
452
|
-
if ((
|
|
453
|
-
_context3.next =
|
|
404
|
+
_iterator7 = _createForOfIteratorHelper(buildConfigurations);
|
|
405
|
+
_context3.prev = 78;
|
|
406
|
+
_iterator7.s();
|
|
407
|
+
case 80:
|
|
408
|
+
if ((_step7 = _iterator7.n()).done) {
|
|
409
|
+
_context3.next = 101;
|
|
454
410
|
break;
|
|
455
411
|
}
|
|
456
|
-
buildConfiguration =
|
|
412
|
+
buildConfiguration = _step7.value;
|
|
457
413
|
expression = buildConfiguration[configuration.givenCommandLineArguments[2]].trim();
|
|
458
|
-
|
|
459
|
-
_context3.prev =
|
|
414
|
+
_iterator8 = _createForOfIteratorHelper(buildConfiguration.filePaths);
|
|
415
|
+
_context3.prev = 84;
|
|
460
416
|
_loop = /*#__PURE__*/_regenerator["default"].mark(function _loop() {
|
|
461
417
|
var filePath, evaluated;
|
|
462
418
|
return _regenerator["default"].wrap(function _loop$(_context2) {
|
|
463
419
|
while (1) switch (_context2.prev = _context2.next) {
|
|
464
420
|
case 0:
|
|
465
|
-
filePath =
|
|
421
|
+
filePath = _step8.value;
|
|
466
422
|
if (testModuleFilePaths.includes(filePath)) {
|
|
467
423
|
_context2.next = 7;
|
|
468
424
|
break;
|
|
@@ -498,51 +454,51 @@ var main = function main(context) {
|
|
|
498
454
|
}
|
|
499
455
|
}, _loop);
|
|
500
456
|
});
|
|
501
|
-
|
|
502
|
-
case
|
|
503
|
-
if ((
|
|
504
|
-
_context3.next =
|
|
457
|
+
_iterator8.s();
|
|
458
|
+
case 87:
|
|
459
|
+
if ((_step8 = _iterator8.n()).done) {
|
|
460
|
+
_context3.next = 91;
|
|
505
461
|
break;
|
|
506
462
|
}
|
|
507
|
-
return _context3.delegateYield(_loop(), "t3",
|
|
508
|
-
case
|
|
509
|
-
_context3.next =
|
|
463
|
+
return _context3.delegateYield(_loop(), "t3", 89);
|
|
464
|
+
case 89:
|
|
465
|
+
_context3.next = 87;
|
|
510
466
|
break;
|
|
511
|
-
case
|
|
512
|
-
_context3.next =
|
|
467
|
+
case 91:
|
|
468
|
+
_context3.next = 96;
|
|
513
469
|
break;
|
|
514
|
-
case
|
|
515
|
-
_context3.prev =
|
|
516
|
-
_context3.t4 = _context3["catch"](
|
|
517
|
-
|
|
518
|
-
case
|
|
519
|
-
_context3.prev =
|
|
520
|
-
|
|
521
|
-
return _context3.finish(
|
|
522
|
-
case
|
|
523
|
-
_context3.next =
|
|
470
|
+
case 93:
|
|
471
|
+
_context3.prev = 93;
|
|
472
|
+
_context3.t4 = _context3["catch"](84);
|
|
473
|
+
_iterator8.e(_context3.t4);
|
|
474
|
+
case 96:
|
|
475
|
+
_context3.prev = 96;
|
|
476
|
+
_iterator8.f();
|
|
477
|
+
return _context3.finish(96);
|
|
478
|
+
case 99:
|
|
479
|
+
_context3.next = 80;
|
|
524
480
|
break;
|
|
525
|
-
case
|
|
526
|
-
_context3.next =
|
|
481
|
+
case 101:
|
|
482
|
+
_context3.next = 106;
|
|
527
483
|
break;
|
|
528
|
-
case
|
|
529
|
-
_context3.prev =
|
|
530
|
-
_context3.t5 = _context3["catch"](
|
|
531
|
-
|
|
532
|
-
case
|
|
533
|
-
_context3.prev =
|
|
534
|
-
|
|
535
|
-
return _context3.finish(
|
|
536
|
-
case
|
|
484
|
+
case 103:
|
|
485
|
+
_context3.prev = 103;
|
|
486
|
+
_context3.t5 = _context3["catch"](78);
|
|
487
|
+
_iterator7.e(_context3.t5);
|
|
488
|
+
case 106:
|
|
489
|
+
_context3.prev = 106;
|
|
490
|
+
_iterator7.f();
|
|
491
|
+
return _context3.finish(106);
|
|
492
|
+
case 109:
|
|
537
493
|
// endregion
|
|
538
494
|
// region handle remaining tasks
|
|
539
495
|
handleTask = function handleTask(type) {
|
|
540
496
|
var tasks = Array.isArray(configuration.commandLine[type]) ? configuration.commandLine[type] : [configuration.commandLine[type]];
|
|
541
|
-
var
|
|
542
|
-
|
|
497
|
+
var _iterator9 = _createForOfIteratorHelper(tasks),
|
|
498
|
+
_step9;
|
|
543
499
|
try {
|
|
544
500
|
var _loop2 = function _loop2() {
|
|
545
|
-
var task =
|
|
501
|
+
var task = _step9.value;
|
|
546
502
|
var evaluated = _clientnode["default"].stringEvaluate(Object.prototype.hasOwnProperty.call(task, 'indicator') ? task.indicator : 'true', {
|
|
547
503
|
global: global,
|
|
548
504
|
self: configuration,
|
|
@@ -554,44 +510,44 @@ var main = function main(context) {
|
|
|
554
510
|
console.info('Running "' + ("".concat(task.command, " ") + commandLineArguments.join(' ')).trim() + '"');
|
|
555
511
|
var childProcess = (0, _child_process.spawn)(task.command, commandLineArguments, childProcessOptions);
|
|
556
512
|
var closeHandler = _clientnode["default"].getProcessCloseHandler(resolve, reject);
|
|
557
|
-
var
|
|
558
|
-
|
|
513
|
+
var _iterator10 = _createForOfIteratorHelper(_clientnode.CloseEventNames),
|
|
514
|
+
_step10;
|
|
559
515
|
try {
|
|
560
|
-
for (
|
|
561
|
-
var closeEventName =
|
|
516
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
517
|
+
var closeEventName = _step10.value;
|
|
562
518
|
childProcess.on(closeEventName, closeHandler);
|
|
563
519
|
}
|
|
564
520
|
} catch (err) {
|
|
565
|
-
|
|
521
|
+
_iterator10.e(err);
|
|
566
522
|
} finally {
|
|
567
|
-
|
|
523
|
+
_iterator10.f();
|
|
568
524
|
}
|
|
569
525
|
childProcesses.push(childProcess);
|
|
570
526
|
return childProcesses;
|
|
571
527
|
}));
|
|
572
528
|
};
|
|
573
|
-
for (
|
|
529
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
574
530
|
_loop2();
|
|
575
531
|
}
|
|
576
532
|
} catch (err) {
|
|
577
|
-
|
|
533
|
+
_iterator9.e(err);
|
|
578
534
|
} finally {
|
|
579
|
-
|
|
535
|
+
_iterator9.f();
|
|
580
536
|
}
|
|
581
537
|
}; /// region a-/synchronous
|
|
582
538
|
if (!['document', 'test', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2])) {
|
|
583
|
-
_context3.next =
|
|
539
|
+
_context3.next = 116;
|
|
584
540
|
break;
|
|
585
541
|
}
|
|
586
|
-
_context3.next =
|
|
542
|
+
_context3.next = 113;
|
|
587
543
|
return Promise.all(processPromises);
|
|
588
|
-
case
|
|
544
|
+
case 113:
|
|
589
545
|
handleTask(configuration.givenCommandLineArguments[2]);
|
|
590
|
-
_context3.next =
|
|
546
|
+
_context3.next = 117;
|
|
591
547
|
break;
|
|
592
|
-
case
|
|
548
|
+
case 116:
|
|
593
549
|
if (['build:types', 'check:types', 'lint', 'serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) handleTask(configuration.givenCommandLineArguments[2]);
|
|
594
|
-
case
|
|
550
|
+
case 117:
|
|
595
551
|
finished = false;
|
|
596
552
|
closeHandler = function closeHandler() {
|
|
597
553
|
if (!finished) for (var _i2 = 0, _closeEventHandlers = closeEventHandlers; _i2 < _closeEventHandlers.length; _i2++) {
|
|
@@ -600,51 +556,51 @@ var main = function main(context) {
|
|
|
600
556
|
}
|
|
601
557
|
finished = true;
|
|
602
558
|
};
|
|
603
|
-
|
|
559
|
+
_iterator11 = _createForOfIteratorHelper(_clientnode.CloseEventNames);
|
|
604
560
|
try {
|
|
605
|
-
for (
|
|
606
|
-
closeEventName =
|
|
561
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
562
|
+
closeEventName = _step11.value;
|
|
607
563
|
process.on(closeEventName, closeHandler);
|
|
608
564
|
}
|
|
609
565
|
} catch (err) {
|
|
610
|
-
|
|
566
|
+
_iterator11.e(err);
|
|
611
567
|
} finally {
|
|
612
|
-
|
|
568
|
+
_iterator11.f();
|
|
613
569
|
}
|
|
614
570
|
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');
|
|
615
571
|
// endregion
|
|
616
572
|
// region forward nested return codes
|
|
617
|
-
_context3.prev =
|
|
618
|
-
_context3.next =
|
|
573
|
+
_context3.prev = 122;
|
|
574
|
+
_context3.next = 125;
|
|
619
575
|
return Promise.all(processPromises);
|
|
620
|
-
case
|
|
621
|
-
_context3.next =
|
|
576
|
+
case 125:
|
|
577
|
+
_context3.next = 131;
|
|
622
578
|
break;
|
|
623
|
-
case
|
|
624
|
-
_context3.prev =
|
|
625
|
-
_context3.t6 = _context3["catch"](
|
|
579
|
+
case 127:
|
|
580
|
+
_context3.prev = 127;
|
|
581
|
+
_context3.t6 = _context3["catch"](122);
|
|
626
582
|
console.error(_context3.t6);
|
|
627
583
|
process.exit(_context3.t6.returnCode);
|
|
628
|
-
case
|
|
629
|
-
_context3.next =
|
|
584
|
+
case 131:
|
|
585
|
+
_context3.next = 140;
|
|
630
586
|
break;
|
|
631
|
-
case
|
|
632
|
-
_context3.prev =
|
|
587
|
+
case 133:
|
|
588
|
+
_context3.prev = 133;
|
|
633
589
|
_context3.t7 = _context3["catch"](2);
|
|
634
590
|
if (!configuration.debug) {
|
|
635
|
-
_context3.next =
|
|
591
|
+
_context3.next = 139;
|
|
636
592
|
break;
|
|
637
593
|
}
|
|
638
594
|
throw _context3.t7;
|
|
639
|
-
case
|
|
595
|
+
case 139:
|
|
640
596
|
console.error(_context3.t7);
|
|
641
|
-
case
|
|
597
|
+
case 140:
|
|
642
598
|
return _context3.abrupt("return", clear);
|
|
643
|
-
case
|
|
599
|
+
case 141:
|
|
644
600
|
case "end":
|
|
645
601
|
return _context3.stop();
|
|
646
602
|
}
|
|
647
|
-
}, _callee2, null, [[2,
|
|
603
|
+
}, _callee2, null, [[2, 133], [37, 48, 51, 54], [78, 103, 106, 109], [84, 93, 96, 99], [122, 127]]);
|
|
648
604
|
}))();
|
|
649
605
|
} catch (e) {
|
|
650
606
|
return Promise.reject(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1272",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -132,6 +132,7 @@
|
|
|
132
132
|
"eslint-plugin-jsdoc": "*",
|
|
133
133
|
"favicons": "*",
|
|
134
134
|
"favicons-webpack-plugin": "*",
|
|
135
|
+
"glob-all": "*",
|
|
135
136
|
"image-minimizer-webpack-plugin": "*",
|
|
136
137
|
"jest": "*",
|
|
137
138
|
"jsdoc": "*",
|
|
@@ -1356,24 +1357,16 @@
|
|
|
1356
1357
|
"__evaluate__": "self.files.compose.image ? path.resolve(self.path.source.asset.image, path.relative(self.path.target.asset.image, self.files.compose.image)) : null"
|
|
1357
1358
|
}
|
|
1358
1359
|
],
|
|
1359
|
-
"tidyUpGlobs":
|
|
1360
|
-
|
|
1361
|
-
"
|
|
1362
|
-
"ignore": [
|
|
1363
|
-
"node_modules/**/*.css.js",
|
|
1364
|
-
"**/node_modules/**/*.css.js"
|
|
1365
|
-
]
|
|
1366
|
-
}
|
|
1360
|
+
"tidyUpGlobs": [
|
|
1361
|
+
{
|
|
1362
|
+
"__evaluate__": "path.resolve(self.path.target.base, '*.css.js')"
|
|
1367
1363
|
},
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
}
|
|
1375
|
-
]
|
|
1376
|
-
},
|
|
1364
|
+
{
|
|
1365
|
+
"__evaluate__": "path.resolve(self.path.target.base, '**/*.css.js')"
|
|
1366
|
+
},
|
|
1367
|
+
"!node_modules/**/*.css.js",
|
|
1368
|
+
"!**/node_modules/**/*.css.js"
|
|
1369
|
+
],
|
|
1377
1370
|
"tidyUpOnClear": [
|
|
1378
1371
|
{
|
|
1379
1372
|
"__evaluate__": "path.resolve(self.path.target.base, 'yarn-error.log')"
|
|
@@ -1385,25 +1378,17 @@
|
|
|
1385
1378
|
"__evaluate__": "path.resolve(self.path.target.base, '.nyc_output')"
|
|
1386
1379
|
}
|
|
1387
1380
|
],
|
|
1388
|
-
"tidyUpOnClearGlobs":
|
|
1389
|
-
|
|
1390
|
-
"
|
|
1391
|
-
"ignore": [
|
|
1392
|
-
"node_modules/**/*.d.ts",
|
|
1393
|
-
"**/node_modules/**/*.d.ts",
|
|
1394
|
-
"**/declarations.d.ts"
|
|
1395
|
-
]
|
|
1396
|
-
}
|
|
1381
|
+
"tidyUpOnClearGlobs": [
|
|
1382
|
+
{
|
|
1383
|
+
"__evaluate__": "path.resolve(self.path.target.base, '*.d.ts')"
|
|
1397
1384
|
},
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
]
|
|
1406
|
-
}
|
|
1385
|
+
{
|
|
1386
|
+
"__evaluate__": "path.resolve(self.path.target.base, '**/*.d.ts')"
|
|
1387
|
+
},
|
|
1388
|
+
"!node_modules/**/*.d.ts",
|
|
1389
|
+
"!**/node_modules/**/*.d.ts",
|
|
1390
|
+
"!**/declarations.d.ts"
|
|
1391
|
+
]
|
|
1407
1392
|
},
|
|
1408
1393
|
"performanceHints": {
|
|
1409
1394
|
"hints": false
|
package/type.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
|
7
7
|
import ImageMinimizerWebpackPlugin, { PluginOptions as ImageMinimizerOptions } from 'image-minimizer-webpack-plugin';
|
|
8
8
|
import { JSDOM } from 'jsdom';
|
|
9
9
|
import MiniCSSExtractPlugin from 'mini-css-extract-plugin';
|
|
10
|
-
import { Options as RemoveDirectoryRecursivelyOptions } from 'rimraf';
|
|
11
10
|
import TerserWebpackPlugin from 'terser-webpack-plugin';
|
|
12
11
|
import { DefinePlugin as WebpackDefinePlugin, Configuration as BaseWebpackConfiguration, IgnorePlugin as WebpackIgnorePlugin, library as webpackLibrary, ModuleOptions as WebpackModuleOptions, RuleSetRule as WebpackRuleSetRule, RuleSetUseItem as WebpackRuleSetUseItem, WebpackOptionsNormalized } from 'webpack';
|
|
13
12
|
import { WebpackPartial as WorkboxBaseCommonOptions, BasePartial as WorkboxCommonOptions, WebpackGenerateSWOptions as WorkboxGenerateSWOptions, WebpackInjectManifestOptions as WorkboxInjectManifestOptions } from 'workbox-build';
|
|
@@ -110,15 +109,9 @@ export interface PathConfiguration extends BasePathConfiguration {
|
|
|
110
109
|
context: string;
|
|
111
110
|
ignore: Array<string>;
|
|
112
111
|
tidyUp: Array<string>;
|
|
113
|
-
tidyUpGlobs:
|
|
114
|
-
options: RemoveDirectoryRecursivelyOptions;
|
|
115
|
-
pattern: Array<string>;
|
|
116
|
-
};
|
|
112
|
+
tidyUpGlobs: Array<string>;
|
|
117
113
|
tidyUpOnClear: Array<string>;
|
|
118
|
-
tidyUpOnClearGlobs:
|
|
119
|
-
options: RemoveDirectoryRecursivelyOptions;
|
|
120
|
-
pattern: Array<string>;
|
|
121
|
-
};
|
|
114
|
+
tidyUpOnClearGlobs: Array<string>;
|
|
122
115
|
}
|
|
123
116
|
export type DefaultPathConfiguration = BasePathConfiguration & Resolvable;
|
|
124
117
|
export interface BuildConfigurationItem {
|