weboptimizer 2.0.1369 → 2.0.1370
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 +11 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var _fs = require("fs");
|
|
|
34
34
|
var _promises = require("fs/promises");
|
|
35
35
|
var _globAll = require("glob-all");
|
|
36
36
|
var _path = _interopRequireWildcard(require("path"));
|
|
37
|
-
var
|
|
37
|
+
var _esm = require("rimraf/dist/esm");
|
|
38
38
|
var _configurator = require("./configurator");
|
|
39
39
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
40
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -43,7 +43,8 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
|
43
43
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
44
44
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
45
45
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
46
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
46
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // TODO Workaround for https://github.com/isaacs/rimraf/issues/290
|
|
47
|
+
// When fixed just use 'rimraf'
|
|
47
48
|
// endregion
|
|
48
49
|
// NOTE: Environment variables can only be strings.
|
|
49
50
|
process.env.UV_THREADPOOL_SIZE = '128';
|
|
@@ -177,7 +178,7 @@ var main = function main(context) {
|
|
|
177
178
|
break;
|
|
178
179
|
}
|
|
179
180
|
_context.next = 9;
|
|
180
|
-
return (0,
|
|
181
|
+
return (0, _esm.rimraf)(file.path);
|
|
181
182
|
case 9:
|
|
182
183
|
return _context.abrupt("return", false);
|
|
183
184
|
case 10:
|
|
@@ -240,7 +241,7 @@ var main = function main(context) {
|
|
|
240
241
|
break;
|
|
241
242
|
case 56:
|
|
242
243
|
_context3.next = 58;
|
|
243
|
-
return (0,
|
|
244
|
+
return (0, _esm.rimraf)(configuration.path.target.base);
|
|
244
245
|
case 58:
|
|
245
246
|
_context3.next = 60;
|
|
246
247
|
return _clientnode["default"].isDirectory(configuration.path.apiDocumentation);
|
|
@@ -250,7 +251,7 @@ var main = function main(context) {
|
|
|
250
251
|
break;
|
|
251
252
|
}
|
|
252
253
|
_context3.next = 63;
|
|
253
|
-
return (0,
|
|
254
|
+
return (0, _esm.rimraf)(configuration.path.apiDocumentation);
|
|
254
255
|
case 63:
|
|
255
256
|
_iterator2 = _createForOfIteratorHelper(configuration.path.tidyUpOnClear);
|
|
256
257
|
try {
|
|
@@ -258,14 +259,14 @@ var main = function main(context) {
|
|
|
258
259
|
_filePath = _step2.value;
|
|
259
260
|
if (_filePath) if (_clientnode["default"].isFileSync(_filePath))
|
|
260
261
|
// NOTE: Close handler have to be synchronous.
|
|
261
|
-
(0, _fs.unlinkSync)(_filePath);else if (_clientnode["default"].isDirectorySync(_filePath)) (0,
|
|
262
|
+
(0, _fs.unlinkSync)(_filePath);else if (_clientnode["default"].isDirectorySync(_filePath)) (0, _esm.sync)(_filePath);
|
|
262
263
|
}
|
|
263
264
|
} catch (err) {
|
|
264
265
|
_iterator2.e(err);
|
|
265
266
|
} finally {
|
|
266
267
|
_iterator2.f();
|
|
267
268
|
}
|
|
268
|
-
(0,
|
|
269
|
+
(0, _esm.sync)((0, _globAll.sync)(configuration.path.tidyUpOnClearGlobs));
|
|
269
270
|
case 66:
|
|
270
271
|
// endregion
|
|
271
272
|
// region handle build
|
|
@@ -324,14 +325,14 @@ var main = function main(context) {
|
|
|
324
325
|
var _filePath4 = _step4.value;
|
|
325
326
|
if (_filePath4) if (_clientnode["default"].isFileSync(_filePath4))
|
|
326
327
|
// NOTE: Close handler have to be synchronous.
|
|
327
|
-
(0, _fs.unlinkSync)(_filePath4);else if (_clientnode["default"].isDirectorySync(_filePath4)) (0,
|
|
328
|
+
(0, _fs.unlinkSync)(_filePath4);else if (_clientnode["default"].isDirectorySync(_filePath4)) (0, _esm.sync)(_filePath4);
|
|
328
329
|
}
|
|
329
330
|
} catch (err) {
|
|
330
331
|
_iterator4.e(err);
|
|
331
332
|
} finally {
|
|
332
333
|
_iterator4.f();
|
|
333
334
|
}
|
|
334
|
-
(0,
|
|
335
|
+
(0, _esm.sync)((0, _globAll.sync)(configuration.path.tidyUpGlobs));
|
|
335
336
|
};
|
|
336
337
|
closeEventHandlers.push(tidyUp);
|
|
337
338
|
|
|
@@ -360,7 +361,7 @@ var main = function main(context) {
|
|
|
360
361
|
|
|
361
362
|
// NOTE: Close handler have to be synchronous.
|
|
362
363
|
if (_clientnode["default"].isDirectorySync(sourcePath)) {
|
|
363
|
-
if (_clientnode["default"].isDirectorySync(targetPath)) (0,
|
|
364
|
+
if (_clientnode["default"].isDirectorySync(targetPath)) (0, _esm.sync)(targetPath);
|
|
364
365
|
_clientnode["default"].copyDirectoryRecursiveSync(sourcePath, targetPath);
|
|
365
366
|
} else if (_clientnode["default"].isFileSync(sourcePath)) _clientnode["default"].copyFileSync(sourcePath, targetPath);
|
|
366
367
|
}
|