balm-core 3.30.0 → 3.31.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.
@@ -63,42 +63,40 @@ var gulpImagemin = function gulpImagemin(customPlugins) {
63
63
  (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
64
64
  var data, originalSize, optimizedSize, saved, percent, savedMsg, msg;
65
65
  return _regenerator["default"].wrap(function _callee$(_context) {
66
- while (1) {
67
- switch (_context.prev = _context.next) {
68
- case 0:
69
- _context.prev = 0;
70
- _context.next = 3;
71
- return require('imagemin').buffer(file.contents, {
72
- plugins: plugins
73
- });
74
- case 3:
75
- data = _context.sent;
76
- originalSize = file.contents.length;
77
- optimizedSize = data.length;
78
- saved = originalSize - optimizedSize;
79
- percent = originalSize > 0 ? saved / originalSize * 100 : 0;
80
- savedMsg = "saved ".concat((0, _prettyBytes["default"])(saved), " - ").concat(percent.toFixed(1).replace(/\.0$/, ''), "%");
81
- msg = saved > 0 ? savedMsg : 'already optimized';
82
- if (saved > 0) {
83
- totalBytes += originalSize;
84
- totalSavedBytes += saved;
85
- totalFiles++;
86
- }
87
- BalmJS.logger.debug(PLUGIN_NAME, "".concat(file.relative, " (").concat(msg, ")"));
88
- file.contents = data;
89
- callback(null, file);
90
- _context.next = 19;
91
- break;
92
- case 16:
93
- _context.prev = 16;
94
- _context.t0 = _context["catch"](0);
95
- callback(new PluginError(PLUGIN_NAME, _context.t0, {
96
- fileName: file.path
97
- }));
98
- case 19:
99
- case "end":
100
- return _context.stop();
101
- }
66
+ while (1) switch (_context.prev = _context.next) {
67
+ case 0:
68
+ _context.prev = 0;
69
+ _context.next = 3;
70
+ return require('imagemin').buffer(file.contents, {
71
+ plugins: plugins
72
+ });
73
+ case 3:
74
+ data = _context.sent;
75
+ originalSize = file.contents.length;
76
+ optimizedSize = data.length;
77
+ saved = originalSize - optimizedSize;
78
+ percent = originalSize > 0 ? saved / originalSize * 100 : 0;
79
+ savedMsg = "saved ".concat((0, _prettyBytes["default"])(saved), " - ").concat(percent.toFixed(1).replace(/\.0$/, ''), "%");
80
+ msg = saved > 0 ? savedMsg : 'already optimized';
81
+ if (saved > 0) {
82
+ totalBytes += originalSize;
83
+ totalSavedBytes += saved;
84
+ totalFiles++;
85
+ }
86
+ BalmJS.logger.debug(PLUGIN_NAME, "".concat(file.relative, " (").concat(msg, ")"));
87
+ file.contents = data;
88
+ callback(null, file);
89
+ _context.next = 19;
90
+ break;
91
+ case 16:
92
+ _context.prev = 16;
93
+ _context.t0 = _context["catch"](0);
94
+ callback(new PluginError(PLUGIN_NAME, _context.t0, {
95
+ fileName: file.path
96
+ }));
97
+ case 19:
98
+ case "end":
99
+ return _context.stop();
102
100
  }
103
101
  }, _callee, null, [[0, 16]]);
104
102
  }))();
@@ -15,44 +15,42 @@ function _jsMinify() {
15
15
  _jsMinify = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file, opts, cb) {
16
16
  var terser, extname, code, content, result, error;
17
17
  return _regenerator["default"].wrap(function _callee$(_context) {
18
- while (1) {
19
- switch (_context.prev = _context.next) {
20
- case 0:
21
- terser = require('terser');
22
- extname = path.extname(file.path);
23
- if (!(extname === '.js')) {
24
- _context.next = 21;
25
- break;
26
- }
27
- code = {};
28
- content = file.contents.toString();
29
- code[path.basename(file.path)] = content;
30
- _context.prev = 6;
31
- _context.next = 9;
32
- return terser.minify(code, opts);
33
- case 9:
34
- result = _context.sent;
35
- content = result.code;
36
- file.contents = Buffer.from(content);
37
- cb(null, file);
38
- _context.next = 19;
18
+ while (1) switch (_context.prev = _context.next) {
19
+ case 0:
20
+ terser = require('terser');
21
+ extname = path.extname(file.path);
22
+ if (!(extname === '.js')) {
23
+ _context.next = 21;
39
24
  break;
40
- case 15:
41
- _context.prev = 15;
42
- _context.t0 = _context["catch"](6);
43
- error = new PluginError(PLUGIN_NAME, _context.t0);
44
- cb(error);
45
- case 19:
46
- _context.next = 22;
47
- break;
48
- case 21:
49
- BalmJS.logger.error(PLUGIN_NAME, 'Invalid JS file');
50
- case 22:
51
- return _context.abrupt("return", file);
52
- case 23:
53
- case "end":
54
- return _context.stop();
55
- }
25
+ }
26
+ code = {};
27
+ content = file.contents.toString();
28
+ code[path.basename(file.path)] = content;
29
+ _context.prev = 6;
30
+ _context.next = 9;
31
+ return terser.minify(code, opts);
32
+ case 9:
33
+ result = _context.sent;
34
+ content = result.code;
35
+ file.contents = Buffer.from(content);
36
+ cb(null, file);
37
+ _context.next = 19;
38
+ break;
39
+ case 15:
40
+ _context.prev = 15;
41
+ _context.t0 = _context["catch"](6);
42
+ error = new PluginError(PLUGIN_NAME, _context.t0);
43
+ cb(error);
44
+ case 19:
45
+ _context.next = 22;
46
+ break;
47
+ case 21:
48
+ BalmJS.logger.error(PLUGIN_NAME, 'Invalid JS file');
49
+ case 22:
50
+ return _context.abrupt("return", file);
51
+ case 23:
52
+ case "end":
53
+ return _context.stop();
56
54
  }
57
55
  }, _callee, null, [[6, 15]]);
58
56
  }));
@@ -8,13 +8,15 @@ exports["default"] = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  function getDefaultPostcssPlugins() {
10
10
  var isPostCSS = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
11
- var postcssPresetEnv = require('postcss-preset-env');
11
+ var useTailwind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12
12
  var atImport = require('postcss-import');
13
+ var postcssFlexbugsFixes = require('postcss-flexbugs-fixes');
14
+ var postcssPresetEnv = require('postcss-preset-env');
13
15
  var autoprefixer = require('autoprefixer');
14
16
  var cssnano = require('cssnano');
15
- var defaultPostcssPlugins = isPostCSS || BalmJS.config.styles.extname === 'css' ? [postcssPresetEnv(BalmJS.config.styles.postcssEnvOptions), atImport({
17
+ var defaultPostcssPlugins = isPostCSS || BalmJS.config.styles.extname === 'css' ? [].concat((0, _toConsumableArray2["default"])(useTailwind ? ['tailwindcss'] : []), [atImport({
16
18
  path: BalmJS.file.stylePaths
17
- })] : [];
19
+ }), postcssFlexbugsFixes(), postcssPresetEnv(BalmJS.config.styles.postcssEnvOptions)]) : [];
18
20
  var cssnanoPlugin = BalmJS.config.env.isProd || BalmJS.config.styles.minify ? [cssnano(Object.assign(BalmJS.config.styles.options, {
19
21
  autoprefixer: false
20
22
  }))] : [];
@@ -54,35 +54,33 @@ var CleanTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
54
54
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
55
55
  var taskName, directories, deletedPaths;
56
56
  return _regenerator["default"].wrap(function _callee$(_context) {
57
- while (1) {
58
- switch (_context.prev = _context.next) {
59
- case 0:
60
- taskName = "".concat(_this.name, " task");
61
- directories = BalmJS.config.inFrontend ? _this.dirInFrontend : _this.dirInBackend;
62
- if (BalmJS.config.env.isProd && !BalmJS.config.assets.root) {
63
- BalmJS.logger.warn(taskName, 'Remote root path is empty');
64
- }
65
- BalmJS.logger.debug(taskName, {
66
- directories: directories
67
- }, {
68
- pre: true
69
- });
70
- _context.next = 6;
71
- return require('del')(directories, {
72
- force: true
73
- });
74
- case 6:
75
- deletedPaths = _context.sent;
76
- BalmJS.logger.warn(taskName, {
77
- deletedPaths: deletedPaths
78
- }, {
79
- pre: true
80
- });
81
- callback();
82
- case 9:
83
- case "end":
84
- return _context.stop();
85
- }
57
+ while (1) switch (_context.prev = _context.next) {
58
+ case 0:
59
+ taskName = "".concat(_this.name, " task");
60
+ directories = BalmJS.config.inFrontend ? _this.dirInFrontend : _this.dirInBackend;
61
+ if (BalmJS.config.env.isProd && !BalmJS.config.assets.root) {
62
+ BalmJS.logger.warn(taskName, 'Remote root path is empty');
63
+ }
64
+ BalmJS.logger.debug(taskName, {
65
+ directories: directories
66
+ }, {
67
+ pre: true
68
+ });
69
+ _context.next = 6;
70
+ return require('del')(directories, {
71
+ force: true
72
+ });
73
+ case 6:
74
+ deletedPaths = _context.sent;
75
+ BalmJS.logger.warn(taskName, {
76
+ deletedPaths: deletedPaths
77
+ }, {
78
+ pre: true
79
+ });
80
+ callback();
81
+ case 9:
82
+ case "end":
83
+ return _context.stop();
86
84
  }
87
85
  }, _callee);
88
86
  }));
@@ -26,23 +26,21 @@ var EndTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
26
26
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "fn", /*#__PURE__*/function () {
27
27
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
28
28
  return _regenerator["default"].wrap(function _callee$(_context) {
29
- while (1) {
30
- switch (_context.prev = _context.next) {
31
- case 0:
32
- if (!BalmJS.utils.isFunction(BalmJS.afterTask)) {
33
- _context.next = 3;
34
- break;
35
- }
29
+ while (1) switch (_context.prev = _context.next) {
30
+ case 0:
31
+ if (!BalmJS.utils.isFunction(BalmJS.afterTask)) {
36
32
  _context.next = 3;
37
- return BalmJS.afterTask();
38
- case 3:
39
- _this.time();
40
- BalmJS.emitter.emit('exit');
41
- callback();
42
- case 6:
43
- case "end":
44
- return _context.stop();
45
- }
33
+ break;
34
+ }
35
+ _context.next = 3;
36
+ return BalmJS.afterTask();
37
+ case 3:
38
+ _this.time();
39
+ BalmJS.emitter.emit('exit');
40
+ callback();
41
+ case 6:
42
+ case "end":
43
+ return _context.stop();
46
44
  }
47
45
  }, _callee);
48
46
  }));
@@ -14,7 +14,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
16
16
  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); }
17
- 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; }
17
+ 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; }
18
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
19
19
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
20
  var ExtraTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
@@ -15,7 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
15
15
  var _imagemin = require("../../plugins/imagemin");
16
16
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
17
17
  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); }
18
- 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; }
18
+ 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; }
19
19
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
20
20
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
21
21
  var ImageTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
@@ -72,35 +72,33 @@ var ModernizrTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
72
72
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
73
73
  var _yield$Promise$all, _yield$Promise$all2, config;
74
74
  return _regenerator["default"].wrap(function _callee$(_context) {
75
- while (1) {
76
- switch (_context.prev = _context.next) {
77
- case 0:
78
- _this.init();
79
- if (!_fs["default"].existsSync(_this.input)) {
80
- _context.next = 11;
81
- break;
82
- }
83
- _context.next = 4;
84
- return Promise.all([(0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _readConfig).call((0, _assertThisInitialized2["default"])(_this)), (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _createDir).call((0, _assertThisInitialized2["default"])(_this))]);
85
- case 4:
86
- _yield$Promise$all = _context.sent;
87
- _yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 1);
88
- config = _yield$Promise$all2[0];
89
- _context.next = 9;
90
- return (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _generateScript).call((0, _assertThisInitialized2["default"])(_this), config);
91
- case 9:
92
- _context.next = 12;
75
+ while (1) switch (_context.prev = _context.next) {
76
+ case 0:
77
+ _this.init();
78
+ if (!_fs["default"].existsSync(_this.input)) {
79
+ _context.next = 11;
93
80
  break;
94
- case 11:
95
- BalmJS.logger.warn("".concat(_this.name, " task"), "The '".concat(_this.input, "' does not exist"), {
96
- logLevel: BalmJS.LogLevel.Info
97
- });
98
- case 12:
99
- callback();
100
- case 13:
101
- case "end":
102
- return _context.stop();
103
- }
81
+ }
82
+ _context.next = 4;
83
+ return Promise.all([(0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _readConfig).call((0, _assertThisInitialized2["default"])(_this)), (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _createDir).call((0, _assertThisInitialized2["default"])(_this))]);
84
+ case 4:
85
+ _yield$Promise$all = _context.sent;
86
+ _yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 1);
87
+ config = _yield$Promise$all2[0];
88
+ _context.next = 9;
89
+ return (0, _classPrivateFieldGet2["default"])((0, _assertThisInitialized2["default"])(_this), _generateScript).call((0, _assertThisInitialized2["default"])(_this), config);
90
+ case 9:
91
+ _context.next = 12;
92
+ break;
93
+ case 11:
94
+ BalmJS.logger.warn("".concat(_this.name, " task"), "The '".concat(_this.input, "' does not exist"), {
95
+ logLevel: BalmJS.LogLevel.Info
96
+ });
97
+ case 12:
98
+ callback();
99
+ case 13:
100
+ case "end":
101
+ return _context.stop();
104
102
  }
105
103
  }, _callee);
106
104
  }));
@@ -100,7 +100,7 @@ var SpriteTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
100
100
  folderName: spriteName
101
101
  });
102
102
  }
103
- var _loop = function _loop(key, len) {
103
+ var _loop = function _loop() {
104
104
  var spriteItem = spriteList[key];
105
105
  var spriteTaskName = "".concat(_this2.name, ":").concat(spriteItem.folderName); // E.g. 'sprite:awesome'
106
106
  var spriteConfig = {
@@ -124,7 +124,7 @@ var SpriteTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
124
124
  (0, _classPrivateFieldGet2["default"])(_this2, _tasks).push(spriteTaskName);
125
125
  };
126
126
  for (var key = 0, len = spriteList.length; key < len; key++) {
127
- _loop(key, len);
127
+ _loop();
128
128
  }
129
129
  }
130
130
  }, {
@@ -26,22 +26,20 @@ var StartTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
26
26
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "fn", /*#__PURE__*/function () {
27
27
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
28
28
  return _regenerator["default"].wrap(function _callee$(_context) {
29
- while (1) {
30
- switch (_context.prev = _context.next) {
31
- case 0:
32
- BalmJS.start = process.hrtime();
33
- if (!BalmJS.utils.isFunction(BalmJS.beforeTask)) {
34
- _context.next = 4;
35
- break;
36
- }
29
+ while (1) switch (_context.prev = _context.next) {
30
+ case 0:
31
+ BalmJS.start = process.hrtime();
32
+ if (!BalmJS.utils.isFunction(BalmJS.beforeTask)) {
37
33
  _context.next = 4;
38
- return BalmJS.beforeTask();
39
- case 4:
40
- callback();
41
- case 5:
42
- case "end":
43
- return _context.stop();
44
- }
34
+ break;
35
+ }
36
+ _context.next = 4;
37
+ return BalmJS.beforeTask();
38
+ case 4:
39
+ callback();
40
+ case 5:
41
+ case "end":
42
+ return _context.stop();
45
43
  }
46
44
  }, _callee);
47
45
  }));
@@ -41,62 +41,60 @@ var PwaTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
41
41
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
42
42
  var mode, options, globDirectory, swDest, swSrc, valid;
43
43
  return _regenerator["default"].wrap(function _callee$(_context) {
44
- while (1) {
45
- switch (_context.prev = _context.next) {
46
- case 0:
47
- mode = customMode || BalmJS.config.pwa.mode;
48
- options = {};
49
- globDirectory = BalmJS.config.dest.base;
50
- swDest = BalmJS.file.absPath("".concat(globDirectory, "/").concat(BalmJS.config.pwa.swDestFilename));
51
- swSrc = BalmJS.file.absPath("".concat(BalmJS.config.src.base, "/").concat(BalmJS.config.pwa.swSrcFilename));
52
- valid = true;
53
- _context.t0 = mode;
54
- _context.next = _context.t0 === 'generateSW' ? 9 : _context.t0 === 'injectManifest' ? 11 : 13;
44
+ while (1) switch (_context.prev = _context.next) {
45
+ case 0:
46
+ mode = customMode || BalmJS.config.pwa.mode;
47
+ options = {};
48
+ globDirectory = BalmJS.config.dest.base;
49
+ swDest = BalmJS.file.absPath("".concat(globDirectory, "/").concat(BalmJS.config.pwa.swDestFilename));
50
+ swSrc = BalmJS.file.absPath("".concat(BalmJS.config.src.base, "/").concat(BalmJS.config.pwa.swSrcFilename));
51
+ valid = true;
52
+ _context.t0 = mode;
53
+ _context.next = _context.t0 === 'generateSW' ? 9 : _context.t0 === 'injectManifest' ? 11 : 13;
54
+ break;
55
+ case 9:
56
+ options = Object.assign({
57
+ globDirectory: globDirectory,
58
+ swDest: swDest
59
+ }, BalmJS.config.pwa.options, customOptions);
60
+ return _context.abrupt("break", 14);
61
+ case 11:
62
+ options = Object.assign({
63
+ globDirectory: globDirectory,
64
+ swDest: swDest,
65
+ swSrc: swSrc
66
+ }, BalmJS.config.pwa.options, customOptions);
67
+ return _context.abrupt("break", 14);
68
+ case 13:
69
+ valid = false;
70
+ case 14:
71
+ if (!valid) {
72
+ _context.next = 22;
55
73
  break;
56
- case 9:
57
- options = Object.assign({
58
- globDirectory: globDirectory,
59
- swDest: swDest
60
- }, BalmJS.config.pwa.options, customOptions);
61
- return _context.abrupt("break", 14);
62
- case 11:
63
- options = Object.assign({
64
- globDirectory: globDirectory,
65
- swDest: swDest,
66
- swSrc: swSrc
67
- }, BalmJS.config.pwa.options, customOptions);
68
- return _context.abrupt("break", 14);
69
- case 13:
70
- valid = false;
71
- case 14:
72
- if (!valid) {
73
- _context.next = 22;
74
- break;
75
- }
76
- options = _this.setIgnores(options);
77
- BalmJS.logger.debug("pwa - ".concat(mode), options, {
78
- pre: true
79
- });
80
- _context.next = 19;
81
- return require('workbox-build')[mode](options).then(function (_ref2) {
82
- var count = _ref2.count,
83
- size = _ref2.size;
84
- BalmJS.logger.info("pwa - ".concat(mode), "Generated '".concat(swDest, "', which will precache ").concat(count, " files, totaling ").concat(size, " bytes"));
85
- gulp.parallel(BalmJS.toNamespace('pwa-cache'))();
86
- })["catch"](function (err) {
87
- BalmJS.logger.warn("pwa - ".concat(mode), "Service worker generation failed: ".concat(err));
88
- });
89
- case 19:
90
- callback();
91
- _context.next = 24;
92
- break;
93
- case 22:
94
- BalmJS.logger.warn('pwa task', 'Invalid PWA mode');
95
- callback();
96
- case 24:
97
- case "end":
98
- return _context.stop();
99
- }
74
+ }
75
+ options = _this.setIgnores(options);
76
+ BalmJS.logger.debug("pwa - ".concat(mode), options, {
77
+ pre: true
78
+ });
79
+ _context.next = 19;
80
+ return require('workbox-build')[mode](options).then(function (_ref2) {
81
+ var count = _ref2.count,
82
+ size = _ref2.size;
83
+ BalmJS.logger.info("pwa - ".concat(mode), "Generated '".concat(swDest, "', which will precache ").concat(count, " files, totaling ").concat(size, " bytes"));
84
+ gulp.parallel(BalmJS.toNamespace('pwa-cache'))();
85
+ })["catch"](function (err) {
86
+ BalmJS.logger.warn("pwa - ".concat(mode), "Service worker generation failed: ".concat(err));
87
+ });
88
+ case 19:
89
+ callback();
90
+ _context.next = 24;
91
+ break;
92
+ case 22:
93
+ BalmJS.logger.warn('pwa task', 'Invalid PWA mode');
94
+ callback();
95
+ case 24:
96
+ case "end":
97
+ return _context.stop();
100
98
  }
101
99
  }, _callee);
102
100
  }));
@@ -47,41 +47,39 @@ var RemoveTask = /*#__PURE__*/function (_BalmJS$BalmTask) {
47
47
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(callback) {
48
48
  var canDel, files, deletedPaths;
49
49
  return _regenerator["default"].wrap(function _callee$(_context) {
50
- while (1) {
51
- switch (_context.prev = _context.next) {
52
- case 0:
53
- canDel = !!(BalmJS.utils.isString(input) && input.trim() || BalmJS.utils.isArray(input) && input.length);
54
- if (!canDel) {
55
- _context.next = 10;
56
- break;
57
- }
58
- files = (0, _classPrivateFieldGet2["default"])(_this2, _getFiles).call(_this2, input);
59
- BalmJS.logger.debug("".concat(_this2.name, " task"), {
60
- files: files
61
- }, {
62
- pre: true
63
- });
64
- _context.next = 6;
65
- return require('del')(files, {
66
- force: true
67
- });
68
- case 6:
69
- deletedPaths = _context.sent;
70
- BalmJS.logger.warn("".concat(_this2.name, " task"), {
71
- deletedPaths: deletedPaths
72
- }, {
73
- pre: true
74
- });
75
- _context.next = 11;
50
+ while (1) switch (_context.prev = _context.next) {
51
+ case 0:
52
+ canDel = !!(BalmJS.utils.isString(input) && input.trim() || BalmJS.utils.isArray(input) && input.length);
53
+ if (!canDel) {
54
+ _context.next = 10;
76
55
  break;
77
- case 10:
78
- BalmJS.logger.error("".concat(_this2.name, " task"), 'Invalid input');
79
- case 11:
80
- callback();
81
- case 12:
82
- case "end":
83
- return _context.stop();
84
- }
56
+ }
57
+ files = (0, _classPrivateFieldGet2["default"])(_this2, _getFiles).call(_this2, input);
58
+ BalmJS.logger.debug("".concat(_this2.name, " task"), {
59
+ files: files
60
+ }, {
61
+ pre: true
62
+ });
63
+ _context.next = 6;
64
+ return require('del')(files, {
65
+ force: true
66
+ });
67
+ case 6:
68
+ deletedPaths = _context.sent;
69
+ BalmJS.logger.warn("".concat(_this2.name, " task"), {
70
+ deletedPaths: deletedPaths
71
+ }, {
72
+ pre: true
73
+ });
74
+ _context.next = 11;
75
+ break;
76
+ case 10:
77
+ BalmJS.logger.error("".concat(_this2.name, " task"), 'Invalid input');
78
+ case 11:
79
+ callback();
80
+ case 12:
81
+ case "end":
82
+ return _context.stop();
85
83
  }
86
84
  }, _callee);
87
85
  }));