balm-core 3.19.0 → 3.21.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.
Files changed (101) hide show
  1. package/index.d.ts +3 -0
  2. package/lib/balm.js +5 -1
  3. package/lib/bootstrap/index.js +1 -4
  4. package/lib/bundler/esbuild/transform.js +39 -45
  5. package/lib/bundler/rollup/index.js +37 -43
  6. package/lib/bundler/webpack/config/common.js +2 -2
  7. package/lib/bundler/webpack/config/prod.js +4 -13
  8. package/lib/bundler/webpack/config/regex.js +1 -1
  9. package/lib/bundler/webpack/index.js +1 -1
  10. package/lib/bundler/webpack/output.js +1 -1
  11. package/lib/config/constants.js +1 -1
  12. package/lib/config/index.js +0 -1
  13. package/lib/index.js +5 -5
  14. package/lib/middlewares/proxy.js +3 -1
  15. package/lib/plugins/less.js +55 -4
  16. package/lib/plugins/plumber.js +1 -1
  17. package/lib/plugins/postcss.js +1 -0
  18. package/lib/plugins/replace.js +2 -2
  19. package/lib/plugins/sass.js +8 -16
  20. package/lib/tasks/foundation/balm_style.js +1 -1
  21. package/lib/tasks/index.js +3 -1
  22. package/lib/tasks/private/build.js +3 -1
  23. package/lib/tasks/private/cache.js +4 -2
  24. package/lib/tasks/private/clean.js +5 -1
  25. package/lib/tasks/private/extra.js +3 -1
  26. package/lib/tasks/private/font.js +3 -1
  27. package/lib/tasks/private/image.js +3 -1
  28. package/lib/tasks/private/lint.js +3 -1
  29. package/lib/tasks/private/media.js +3 -1
  30. package/lib/tasks/private/modernizr.js +10 -4
  31. package/lib/tasks/private/sprite.js +6 -2
  32. package/lib/tasks/private/start.js +3 -1
  33. package/lib/tasks/private/workbox-sw.js +3 -1
  34. package/lib/tasks/public/ftp.js +3 -1
  35. package/lib/tasks/public/html.js +6 -2
  36. package/lib/tasks/public/publish.js +5 -1
  37. package/lib/tasks/public/remove.js +5 -1
  38. package/lib/tasks/public/server.js +9 -3
  39. package/lib/tasks/public/url.js +5 -1
  40. package/lib/utilities/cache-core.js +4 -3
  41. package/lib/utilities/compiling.js +5 -1
  42. package/lib/utilities/loading.js +7 -3
  43. package/lib/utilities/logger.js +5 -1
  44. package/package.json +32 -32
  45. package/tslib/balm.js +9 -9
  46. package/tslib/bootstrap/index.js +4 -6
  47. package/tslib/bundler/esbuild/index.js +4 -4
  48. package/tslib/bundler/esbuild/transform.js +2 -2
  49. package/tslib/bundler/rollup/entry.js +1 -1
  50. package/tslib/bundler/rollup/index.js +8 -8
  51. package/tslib/bundler/rollup/output.js +1 -1
  52. package/tslib/bundler/webpack/config/common.js +4 -4
  53. package/tslib/bundler/webpack/config/dev.js +3 -3
  54. package/tslib/bundler/webpack/config/index.js +4 -4
  55. package/tslib/bundler/webpack/config/prod.js +5 -14
  56. package/tslib/bundler/webpack/index.js +8 -8
  57. package/tslib/bundler/webpack/loaders.js +4 -4
  58. package/tslib/bundler/webpack/output.js +1 -1
  59. package/tslib/config/globals.js +3 -3
  60. package/tslib/config/index.js +13 -14
  61. package/tslib/config/version.js +1 -1
  62. package/tslib/hello.js +2 -2
  63. package/tslib/hooks/index.js +1 -1
  64. package/tslib/index.js +2 -2
  65. package/tslib/middlewares/index.js +6 -6
  66. package/tslib/middlewares/proxy.js +2 -1
  67. package/tslib/plugins/imagemin.js +6 -4
  68. package/tslib/plugins/index.js +11 -11
  69. package/tslib/plugins/less.js +54 -9
  70. package/tslib/plugins/postcss.js +2 -2
  71. package/tslib/plugins/replace.js +2 -2
  72. package/tslib/plugins/sass.js +13 -12
  73. package/tslib/plugins/sftp.js +1 -1
  74. package/tslib/tasks/foundation/balm_style.js +2 -2
  75. package/tslib/tasks/foundation/index.js +2 -2
  76. package/tslib/tasks/index.js +7 -6
  77. package/tslib/tasks/private/cache.js +1 -1
  78. package/tslib/tasks/private/clean.js +2 -2
  79. package/tslib/tasks/private/image.js +1 -1
  80. package/tslib/tasks/private/modernizr.js +4 -4
  81. package/tslib/tasks/private/sprite.js +5 -5
  82. package/tslib/tasks/public/esbuild.js +2 -2
  83. package/tslib/tasks/public/ftp.js +2 -1
  84. package/tslib/tasks/public/html.js +5 -5
  85. package/tslib/tasks/public/publish.js +4 -4
  86. package/tslib/tasks/public/remove.js +1 -1
  87. package/tslib/tasks/public/rollup.js +2 -2
  88. package/tslib/tasks/public/server.js +13 -12
  89. package/tslib/tasks/public/url.js +2 -2
  90. package/tslib/tasks/public/webpack.js +2 -2
  91. package/tslib/utilities/address.js +1 -1
  92. package/tslib/utilities/cache-core.js +10 -9
  93. package/tslib/utilities/color.js +1 -1
  94. package/tslib/utilities/compiling.js +4 -4
  95. package/tslib/utilities/detect-port.js +2 -2
  96. package/tslib/utilities/file.js +3 -3
  97. package/tslib/utilities/index.js +4 -4
  98. package/tslib/utilities/loading.js +9 -8
  99. package/tslib/utilities/logger.js +9 -9
  100. package/tslib/utilities/replacestream.js +3 -3
  101. package/tslib/utilities/utils.js +4 -4
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDefaultImagePlugins = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const pretty_bytes_1 = tslib_1.__importDefault(require("pretty-bytes"));
5
+ const pretty_bytes_1 = (0, tslib_1.__importDefault)(require("pretty-bytes"));
6
6
  const PLUGIN_NAME = 'imagemin';
7
7
  const defaultPlugins = ['gifsicle', 'mozjpeg', 'optipng', 'svgo'];
8
8
  const loadPlugin = (plugin, ...args) => {
@@ -50,7 +50,7 @@ const gulpImagemin = (customPlugins) => {
50
50
  const optimizedSize = data.length;
51
51
  const saved = originalSize - optimizedSize;
52
52
  const percent = originalSize > 0 ? (saved / originalSize) * 100 : 0;
53
- const savedMsg = `saved ${pretty_bytes_1.default(saved)} - ${percent
53
+ const savedMsg = `saved ${(0, pretty_bytes_1.default)(saved)} - ${percent
54
54
  .toFixed(1)
55
55
  .replace(/\.0$/, '')}%`;
56
56
  const msg = saved > 0 ? savedMsg : 'already optimized';
@@ -64,7 +64,9 @@ const gulpImagemin = (customPlugins) => {
64
64
  callback(null, file);
65
65
  }
66
66
  catch (error) {
67
- callback(new PluginError(PLUGIN_NAME, error, { fileName: file.path }));
67
+ callback(new PluginError(PLUGIN_NAME, error, {
68
+ fileName: file.path
69
+ }));
68
70
  }
69
71
  })();
70
72
  }
@@ -72,7 +74,7 @@ const gulpImagemin = (customPlugins) => {
72
74
  const percent = totalBytes > 0 ? (totalSavedBytes / totalBytes) * 100 : 0;
73
75
  let msg = `Minified ${totalFiles} image${totalFiles > 1 ? 's' : ''}`;
74
76
  if (totalFiles > 0) {
75
- msg += ` (saved ${pretty_bytes_1.default(totalSavedBytes)} - ${percent
77
+ msg += ` (saved ${(0, pretty_bytes_1.default)(totalSavedBytes)} - ${percent
76
78
  .toFixed(1)
77
79
  .replace(/\.0$/, '')}%)`;
78
80
  }
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const htmlmin_1 = tslib_1.__importDefault(require("./htmlmin"));
5
- const imagemin_1 = tslib_1.__importDefault(require("./imagemin"));
6
- const jsmin_1 = tslib_1.__importDefault(require("./jsmin"));
7
- const less_1 = tslib_1.__importDefault(require("./less"));
8
- const plumber_1 = tslib_1.__importDefault(require("./plumber"));
9
- const postcss_1 = tslib_1.__importDefault(require("./postcss"));
10
- const postcss_plugins_1 = tslib_1.__importDefault(require("./postcss-plugins"));
11
- const rename_1 = tslib_1.__importDefault(require("./rename"));
12
- const replace_1 = tslib_1.__importDefault(require("./replace"));
13
- const sass_1 = tslib_1.__importDefault(require("./sass"));
14
- const sftp_1 = tslib_1.__importDefault(require("./sftp"));
4
+ const htmlmin_1 = (0, tslib_1.__importDefault)(require("./htmlmin"));
5
+ const imagemin_1 = (0, tslib_1.__importDefault)(require("./imagemin"));
6
+ const jsmin_1 = (0, tslib_1.__importDefault)(require("./jsmin"));
7
+ const less_1 = (0, tslib_1.__importDefault)(require("./less"));
8
+ const plumber_1 = (0, tslib_1.__importDefault)(require("./plumber"));
9
+ const postcss_1 = (0, tslib_1.__importDefault)(require("./postcss"));
10
+ const postcss_plugins_1 = (0, tslib_1.__importDefault)(require("./postcss-plugins"));
11
+ const rename_1 = (0, tslib_1.__importDefault)(require("./rename"));
12
+ const replace_1 = (0, tslib_1.__importDefault)(require("./replace"));
13
+ const sass_1 = (0, tslib_1.__importDefault)(require("./sass"));
14
+ const sftp_1 = (0, tslib_1.__importDefault)(require("./sftp"));
15
15
  const plugins = {
16
16
  htmlmin: htmlmin_1.default,
17
17
  imagemin: imagemin_1.default,
@@ -1,9 +1,55 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const replace_ext_1 = tslib_1.__importDefault(require("replace-ext"));
5
- const vinyl_sourcemaps_apply_1 = tslib_1.__importDefault(require("vinyl-sourcemaps-apply"));
4
+ const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
5
+ const replace_ext_1 = (0, tslib_1.__importDefault)(require("replace-ext"));
6
+ const vinyl_sourcemaps_apply_1 = (0, tslib_1.__importDefault)(require("vinyl-sourcemaps-apply"));
6
7
  const PLUGIN_NAME = 'less';
8
+ function inlineSources(sourcemap) {
9
+ if (sourcemap.sourcesContent) {
10
+ return Promise.resolve(sourcemap);
11
+ }
12
+ return Promise.all(sourcemap.sources.map((source) => {
13
+ return new Promise((resolve, reject) => {
14
+ fs_1.default.readFile(source, 'utf8', (err, data) => {
15
+ if (err) {
16
+ reject(err);
17
+ }
18
+ else {
19
+ resolve(data);
20
+ }
21
+ });
22
+ });
23
+ })).then((contents) => {
24
+ sourcemap.sourcesContent = contents;
25
+ return sourcemap;
26
+ }, () => sourcemap);
27
+ }
28
+ function renderLess(str, opts) {
29
+ return new Promise((resolve, reject) => {
30
+ require('less').render(str, opts, (err, res) => {
31
+ if (err) {
32
+ reject(err);
33
+ }
34
+ else {
35
+ const obj = {
36
+ result: res.css,
37
+ imports: res.imports
38
+ };
39
+ if (opts.sourceMap && res.map) {
40
+ obj.sourcemap = JSON.parse(res.map);
41
+ inlineSources(obj.sourcemap).then((map) => {
42
+ obj.sourcemap = map;
43
+ resolve(obj);
44
+ });
45
+ }
46
+ else {
47
+ resolve(obj);
48
+ }
49
+ }
50
+ });
51
+ });
52
+ }
7
53
  function gulpLess(options) {
8
54
  const opts = Object.assign({}, {
9
55
  compress: false,
@@ -18,18 +64,17 @@ function gulpLess(options) {
18
64
  }
19
65
  const str = file.contents.toString();
20
66
  opts.filename = file.path;
21
- if (file.sourceMap) {
22
- opts.sourcemap = true;
67
+ if (file.sourceMap || opts.sourcemap) {
68
+ opts.sourceMap = true;
23
69
  }
24
- require('less')
25
- .render(str, opts)
70
+ renderLess(str, opts)
26
71
  .then((res) => {
27
- file.contents = Buffer.from(res.css);
28
- file.path = replace_ext_1.default(file.path, '.css');
72
+ file.contents = Buffer.from(res.result);
73
+ file.path = (0, replace_ext_1.default)(file.path, '.css');
29
74
  if (res.sourcemap) {
30
75
  res.sourcemap.file = file.relative;
31
76
  res.sourcemap.sources = res.sourcemap.sources.map((source) => path.relative(file.base, source));
32
- vinyl_sourcemaps_apply_1.default(file, res.sourcemap);
77
+ (0, vinyl_sourcemaps_apply_1.default)(file, res.sourcemap);
33
78
  }
34
79
  return file;
35
80
  })
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const stream_1 = require("stream");
5
- const vinyl_sourcemaps_apply_1 = tslib_1.__importDefault(require("vinyl-sourcemaps-apply"));
5
+ const vinyl_sourcemaps_apply_1 = (0, tslib_1.__importDefault)(require("vinyl-sourcemaps-apply"));
6
6
  const PLUGIN_NAME = 'postcss';
7
7
  function gulpPostcss(cb) {
8
8
  return function (plugins, options) {
@@ -81,7 +81,7 @@ exports.default = gulpPostcss((loadConfig) => {
81
81
  map.sources = [].map.call(map.sources, function (source) {
82
82
  return path.join(path.dirname(file.relative), source);
83
83
  });
84
- vinyl_sourcemaps_apply_1.default(file, map);
84
+ (0, vinyl_sourcemaps_apply_1.default)(file, map);
85
85
  }
86
86
  if (warnings) {
87
87
  BalmJS.logger.info(PLUGIN_NAME, `${file.relative}\nwarnings`);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const stream_1 = require("stream");
5
- const replacestream_1 = tslib_1.__importDefault(require("../utilities/replacestream"));
5
+ const replacestream_1 = (0, tslib_1.__importDefault)(require("../utilities/replacestream"));
6
6
  const defaultOptions = {
7
7
  skipBinary: true
8
8
  };
@@ -20,7 +20,7 @@ function gulpReplace(search, _replacement, options = {}) {
20
20
  }
21
21
  function doReplace() {
22
22
  if (file.isStream()) {
23
- file.contents = file.contents.pipe(replacestream_1.default(search, replacement));
23
+ file.contents = file.contents.pipe((0, replacestream_1.default)(search, replacement));
24
24
  return callback(null, file);
25
25
  }
26
26
  if (file.isBuffer()) {
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const sass_1 = tslib_1.__importDefault(require("sass"));
5
- const replace_ext_1 = tslib_1.__importDefault(require("replace-ext"));
6
- const vinyl_sourcemaps_apply_1 = tslib_1.__importDefault(require("vinyl-sourcemaps-apply"));
4
+ const replace_ext_1 = (0, tslib_1.__importDefault)(require("replace-ext"));
5
+ const vinyl_sourcemaps_apply_1 = (0, tslib_1.__importDefault)(require("vinyl-sourcemaps-apply"));
7
6
  const PLUGIN_NAME = 'sass';
8
7
  const gulpSass = (options) => through2.obj((file, encoding, cb) => {
9
8
  if (file.isNull()) {
@@ -16,7 +15,7 @@ const gulpSass = (options) => through2.obj((file, encoding, cb) => {
16
15
  return cb();
17
16
  }
18
17
  if (!file.contents.length) {
19
- file.path = replace_ext_1.default(file.path, '.css');
18
+ file.path = (0, replace_ext_1.default)(file.path, '.css');
20
19
  return cb(null, file);
21
20
  }
22
21
  const opts = (options || {});
@@ -59,18 +58,19 @@ const gulpSass = (options) => through2.obj((file, encoding, cb) => {
59
58
  });
60
59
  }
61
60
  sassMap.sources = sassMap.sources.filter((src) => src !== 'stdin' && src);
62
- sassMap.file = replace_ext_1.default(sassFileSrc, '.css');
63
- vinyl_sourcemaps_apply_1.default(file, sassMap);
61
+ sassMap.file = (0, replace_ext_1.default)(sassFileSrc, '.css');
62
+ (0, vinyl_sourcemaps_apply_1.default)(file, sassMap);
64
63
  }
65
64
  file.contents = sassObj.css;
66
- file.path = replace_ext_1.default(file.path, '.css');
65
+ file.path = (0, replace_ext_1.default)(file.path, '.css');
67
66
  if (file.stat) {
68
67
  file.stat.atime = file.stat.mtime = file.stat.ctime = new Date();
69
68
  }
70
69
  cb(null, file);
71
70
  };
72
71
  const errorM = (error) => {
73
- const filePath = (error.file === 'stdin' ? file.path : error.file) || file.path;
72
+ const filePath = ((error.file === 'stdin' ? file.path : error.file) ||
73
+ file.path);
74
74
  const relativePath = path.relative(process.cwd(), filePath);
75
75
  const message = [relativePath, error.formatted].join('\n');
76
76
  error.messageFormatted = message;
@@ -80,12 +80,13 @@ const gulpSass = (options) => through2.obj((file, encoding, cb) => {
80
80
  return cb(new PluginError(PLUGIN_NAME, error));
81
81
  };
82
82
  try {
83
- filePush(gulpSass.compiler.renderSync(opts));
83
+ gulpSass.compiler && filePush(gulpSass.compiler.renderSync(opts));
84
84
  }
85
85
  catch (error) {
86
86
  return errorM(error);
87
87
  }
88
88
  });
89
- gulpSass.sync = (options) => gulpSass(options);
90
- gulpSass.compiler = sass_1.default;
91
- exports.default = gulpSass;
89
+ exports.default = (options) => {
90
+ gulpSass.compiler = require('sass');
91
+ return gulpSass(options);
92
+ };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const fs_1 = tslib_1.__importDefault(require("fs"));
4
+ const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
5
5
  const PLUGIN_NAME = 'sftp';
6
6
  const normalizePath = (_path) => _path.replace(/\\/g, '/');
7
7
  function resolveHomePath(key) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const balm_1 = tslib_1.__importDefault(require("./balm"));
4
+ const balm_1 = (0, tslib_1.__importDefault)(require("./balm"));
5
5
  const constants_1 = require("../../config/constants");
6
6
  class BalmStyleTask extends balm_1.default {
7
7
  constructor(name) {
@@ -37,7 +37,7 @@ class BalmStyleTask extends balm_1.default {
37
37
  }));
38
38
  switch (style) {
39
39
  case 'sass':
40
- stream = stream.pipe(BalmJS.plugins.sass.sync(options));
40
+ stream = stream.pipe(BalmJS.plugins.sass(options));
41
41
  break;
42
42
  case 'less':
43
43
  stream = stream.pipe(BalmJS.plugins.less(options));
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const balm_1 = tslib_1.__importDefault(require("./balm"));
5
- const balm_style_1 = tslib_1.__importDefault(require("./balm_style"));
4
+ const balm_1 = (0, tslib_1.__importDefault)(require("./balm"));
5
+ const balm_style_1 = (0, tslib_1.__importDefault)(require("./balm_style"));
6
6
  BalmJS.BalmTask = balm_1.default;
7
7
  BalmJS.BalmStyleTask = balm_style_1.default;
8
8
  BalmJS.tasks = new Map();
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  require("./foundation");
5
- const require_dir_1 = tslib_1.__importDefault(require("require-dir"));
6
- const default_1 = tslib_1.__importDefault(require("./default"));
7
- const hooks_1 = tslib_1.__importDefault(require("../hooks"));
8
- const PRIVATE_TASKS = require_dir_1.default('./private');
9
- const PUBLIC_TASKS = require_dir_1.default('./public');
5
+ const require_dir_1 = (0, tslib_1.__importDefault)(require("require-dir"));
6
+ const default_1 = (0, tslib_1.__importDefault)(require("./default"));
7
+ const hooks_1 = (0, tslib_1.__importDefault)(require("../hooks"));
8
+ const PRIVATE_TASKS = (0, require_dir_1.default)('./private');
9
+ const PUBLIC_TASKS = (0, require_dir_1.default)('./public');
10
10
  function registerTasks(recipe) {
11
11
  const AwesomeTasks = BalmJS.utils.deepMerge(PRIVATE_TASKS, PUBLIC_TASKS);
12
12
  const depsTasks = [];
@@ -37,7 +37,8 @@ function registerTasks(recipe) {
37
37
  recipe(new hooks_1.default());
38
38
  }
39
39
  catch (error) {
40
- BalmJS.logger.error('balm hook', error.message);
40
+ const { message } = error;
41
+ BalmJS.logger.error('balm hook', message);
41
42
  }
42
43
  const defaultTask = new default_1.default();
43
44
  gulp.task(defaultTask.taskName, gulp.series(...defaultTask.startTask, ...defaultTask.mainTasks, ...defaultTask.subTasks, ...defaultTask.endTask));
@@ -14,7 +14,7 @@ class CacheTask extends BalmJS.BalmTask {
14
14
  .pipe($.revAll.manifestFile())
15
15
  .pipe(gulp.dest(this.output));
16
16
  };
17
- const defaultIncludes = BalmJS.useCache
17
+ const defaultIncludes = BalmJS.config.scripts.useCache
18
18
  ? constants_1.ASSETS_KEYS.filter((assetKey) => assetKey !== 'js').map((assetKey) => BalmJS.file.matchAllFiles(BalmJS.config.dest[assetKey]))
19
19
  : constants_1.ASSETS_KEYS.map((assetKey) => BalmJS.file.matchAllFiles(BalmJS.config.dest[assetKey]));
20
20
  const defaultExcludes = [
@@ -52,7 +52,7 @@ class CleanTask extends BalmJS.BalmTask {
52
52
  get remoteAppDir() {
53
53
  return BalmJS.config.assets.subDir
54
54
  ? [BalmJS.config.assets.static]
55
- : tslib_1.__classPrivateFieldGet(this, _CleanTask_getAssetsDir, "f").call(this);
55
+ : (0, tslib_1.__classPrivateFieldGet)(this, _CleanTask_getAssetsDir, "f").call(this);
56
56
  }
57
57
  get dirInFrontend() {
58
58
  const isLocal = !path.isAbsolute(BalmJS.config.assets.root);
@@ -76,7 +76,7 @@ class CleanTask extends BalmJS.BalmTask {
76
76
  return [
77
77
  ...(BalmJS.config.env.isProd && hasBuildDir
78
78
  ? buildDirInProd
79
- : [...buildDirInDev, ...tslib_1.__classPrivateFieldGet(this, _CleanTask_getAssetsDir, "f").call(this, 'dest')])
79
+ : [...buildDirInDev, ...(0, tslib_1.__classPrivateFieldGet)(this, _CleanTask_getAssetsDir, "f").call(this, 'dest')])
80
80
  ];
81
81
  }
82
82
  }
@@ -33,7 +33,7 @@ class ImageTask extends BalmJS.BalmTask {
33
33
  this.plugins = BalmJS.config.images.plugins;
34
34
  }
35
35
  else {
36
- const defaultPlugins = Object.assign(imagemin_1.getDefaultImagePlugins(), BalmJS.config.images.plugins);
36
+ const defaultPlugins = Object.assign((0, imagemin_1.getDefaultImagePlugins)(), BalmJS.config.images.plugins);
37
37
  const enablePlugins = Object.keys(defaultPlugins).filter((key) => defaultPlugins[key]);
38
38
  this.plugins = enablePlugins.map((key) => defaultPlugins[key]);
39
39
  BalmJS.logger.debug(`${this.name} task - plugins`, enablePlugins);
@@ -2,7 +2,7 @@
2
2
  var _ModernizrTask_readConfig, _ModernizrTask_createDir, _ModernizrTask_generateScript;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
- const fs_1 = tslib_1.__importDefault(require("fs"));
5
+ const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
6
6
  class ModernizrTask extends BalmJS.BalmTask {
7
7
  constructor() {
8
8
  super('modernizr');
@@ -39,10 +39,10 @@ class ModernizrTask extends BalmJS.BalmTask {
39
39
  this.init();
40
40
  if (fs_1.default.existsSync(this.input)) {
41
41
  const [config] = await Promise.all([
42
- tslib_1.__classPrivateFieldGet(this, _ModernizrTask_readConfig, "f").call(this),
43
- tslib_1.__classPrivateFieldGet(this, _ModernizrTask_createDir, "f").call(this)
42
+ (0, tslib_1.__classPrivateFieldGet)(this, _ModernizrTask_readConfig, "f").call(this),
43
+ (0, tslib_1.__classPrivateFieldGet)(this, _ModernizrTask_createDir, "f").call(this)
44
44
  ]);
45
- await tslib_1.__classPrivateFieldGet(this, _ModernizrTask_generateScript, "f").call(this, config);
45
+ await (0, tslib_1.__classPrivateFieldGet)(this, _ModernizrTask_generateScript, "f").call(this, config);
46
46
  }
47
47
  else {
48
48
  BalmJS.logger.warn(`${this.name} task`, `The '${this.input}' does not exist`, {
@@ -2,7 +2,7 @@
2
2
  var _SpriteTask_tasks, _SpriteTask_getParams;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
- const merge_stream_1 = tslib_1.__importDefault(require("../../utilities/merge-stream"));
5
+ const merge_stream_1 = (0, tslib_1.__importDefault)(require("../../utilities/merge-stream"));
6
6
  class SpriteTask extends BalmJS.BalmTask {
7
7
  constructor() {
8
8
  super('sprite');
@@ -66,7 +66,7 @@ class SpriteTask extends BalmJS.BalmTask {
66
66
  BalmJS.logger.debug(`${this.name} task`, spriteConfig, {
67
67
  pre: true
68
68
  });
69
- spriteConfig.params = tslib_1.__classPrivateFieldGet(this, _SpriteTask_getParams, "f").call(this, spriteItem, spriteOptions);
69
+ spriteConfig.params = (0, tslib_1.__classPrivateFieldGet)(this, _SpriteTask_getParams, "f").call(this, spriteItem, spriteOptions);
70
70
  gulp.task(BalmJS.toNamespace(spriteTaskName), () => {
71
71
  const spriteData = gulp
72
72
  .src(spriteConfig.input)
@@ -76,9 +76,9 @@ class SpriteTask extends BalmJS.BalmTask {
76
76
  .pipe($.spritesmith(spriteConfig.params));
77
77
  const imgStream = spriteData.img.pipe(gulp.dest(spriteConfig.imgOutput));
78
78
  const cssStream = spriteData.css.pipe(gulp.dest(spriteConfig.cssOutput));
79
- return merge_stream_1.default(imgStream, cssStream);
79
+ return (0, merge_stream_1.default)(imgStream, cssStream);
80
80
  });
81
- tslib_1.__classPrivateFieldGet(this, _SpriteTask_tasks, "f").push(spriteTaskName);
81
+ (0, tslib_1.__classPrivateFieldGet)(this, _SpriteTask_tasks, "f").push(spriteTaskName);
82
82
  }
83
83
  }
84
84
  recipe(input, output, spriteOptions = {}) {
@@ -91,7 +91,7 @@ class SpriteTask extends BalmJS.BalmTask {
91
91
  }
92
92
  }
93
93
  get deps() {
94
- return tslib_1.__classPrivateFieldGet(this, _SpriteTask_tasks, "f");
94
+ return (0, tslib_1.__classPrivateFieldGet)(this, _SpriteTask_tasks, "f");
95
95
  }
96
96
  }
97
97
  _SpriteTask_tasks = new WeakMap(), _SpriteTask_getParams = new WeakMap();
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const esbuild_1 = tslib_1.__importDefault(require("../../bundler/esbuild"));
4
+ const esbuild_1 = (0, tslib_1.__importDefault)(require("../../bundler/esbuild"));
5
5
  class EsbuildTask extends BalmJS.BalmTask {
6
6
  constructor() {
7
7
  super('esbuild');
@@ -10,7 +10,7 @@ class EsbuildTask extends BalmJS.BalmTask {
10
10
  recipe(input, output, customOptions = {}) {
11
11
  const balmBundler = (callback) => {
12
12
  this.init(input || BalmJS.config.scripts.entry, output);
13
- esbuild_1.default(this.input || BalmJS.file.defaultEntry, this.output, customOptions, callback);
13
+ (0, esbuild_1.default)(this.input || BalmJS.file.defaultEntry, this.output, customOptions, callback);
14
14
  };
15
15
  return balmBundler;
16
16
  }
@@ -23,7 +23,8 @@ class FtpTask extends BalmJS.BalmTask {
23
23
  stream = stream.pipe(BalmJS.plugins.sftp(this.options));
24
24
  }
25
25
  catch (error) {
26
- BalmJS.logger.error(taskName, error.message);
26
+ const { message } = error;
27
+ BalmJS.logger.error(taskName, message);
27
28
  }
28
29
  return stream;
29
30
  }
@@ -48,9 +48,9 @@ class HtmlTask extends BalmJS.BalmTask {
48
48
  ['css', 'js', 'img', 'media', 'manifest'].forEach((type) => {
49
49
  const canUpdate = type === 'manifest'
50
50
  ? BalmJS.config.pwa.enabled
51
- : tslib_1.__classPrivateFieldGet(this, _HtmlTask_hasSourcePath, "f").call(this, type);
51
+ : (0, tslib_1.__classPrivateFieldGet)(this, _HtmlTask_hasSourcePath, "f").call(this, type);
52
52
  if (canUpdate) {
53
- stream = stream.pipe(tslib_1.__classPrivateFieldGet(this, _HtmlTask_updateAssetsPath, "f").call(this, type));
53
+ stream = stream.pipe((0, tslib_1.__classPrivateFieldGet)(this, _HtmlTask_updateAssetsPath, "f").call(this, type));
54
54
  }
55
55
  });
56
56
  stream = BalmJS.config.assets.cache
@@ -60,10 +60,10 @@ class HtmlTask extends BalmJS.BalmTask {
60
60
  else {
61
61
  ['css', 'js', 'img', 'media'].forEach((type, index) => {
62
62
  const canUpdate = index > 1
63
- ? tslib_1.__classPrivateFieldGet(this, _HtmlTask_hasSourcePath, "f").call(this, type) && !BalmJS.config.inFrontend
64
- : tslib_1.__classPrivateFieldGet(this, _HtmlTask_hasSourcePath, "f").call(this, type);
63
+ ? (0, tslib_1.__classPrivateFieldGet)(this, _HtmlTask_hasSourcePath, "f").call(this, type) && !BalmJS.config.inFrontend
64
+ : (0, tslib_1.__classPrivateFieldGet)(this, _HtmlTask_hasSourcePath, "f").call(this, type);
65
65
  if (canUpdate) {
66
- stream = stream.pipe(tslib_1.__classPrivateFieldGet(this, _HtmlTask_updateAssetsPath, "f").call(this, type));
66
+ stream = stream.pipe((0, tslib_1.__classPrivateFieldGet)(this, _HtmlTask_updateAssetsPath, "f").call(this, type));
67
67
  }
68
68
  });
69
69
  stream = stream.pipe(BalmJS.file.setPublicPath());
@@ -2,7 +2,7 @@
2
2
  var _PublishTask_release;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
- const merge_stream_1 = tslib_1.__importDefault(require("../../utilities/merge-stream"));
5
+ const merge_stream_1 = (0, tslib_1.__importDefault)(require("../../utilities/merge-stream"));
6
6
  class PublishTask extends BalmJS.BalmTask {
7
7
  constructor() {
8
8
  super('publish');
@@ -27,11 +27,11 @@ class PublishTask extends BalmJS.BalmTask {
27
27
  const balmPublish = (callback) => {
28
28
  if (BalmJS.config.env.isProd) {
29
29
  if (BalmJS.utils.isArray(input)) {
30
- const tasks = input.map((template) => tslib_1.__classPrivateFieldGet(this, _PublishTask_release, "f").call(this, template.input, template.output, template.renameOptions));
31
- return merge_stream_1.default(...tasks);
30
+ const tasks = input.map((template) => (0, tslib_1.__classPrivateFieldGet)(this, _PublishTask_release, "f").call(this, template.input, template.output, template.renameOptions));
31
+ return (0, merge_stream_1.default)(...tasks);
32
32
  }
33
33
  else {
34
- return tslib_1.__classPrivateFieldGet(this, _PublishTask_release, "f").call(this, input, output, renameOptions);
34
+ return (0, tslib_1.__classPrivateFieldGet)(this, _PublishTask_release, "f").call(this, input, output, renameOptions);
35
35
  }
36
36
  }
37
37
  else {
@@ -18,7 +18,7 @@ class RemoveTask extends BalmJS.BalmTask {
18
18
  const canDel = !!((BalmJS.utils.isString(input) && input.trim()) ||
19
19
  (BalmJS.utils.isArray(input) && input.length));
20
20
  if (canDel) {
21
- const files = tslib_1.__classPrivateFieldGet(this, _RemoveTask_getFiles, "f").call(this, input);
21
+ const files = (0, tslib_1.__classPrivateFieldGet)(this, _RemoveTask_getFiles, "f").call(this, input);
22
22
  BalmJS.logger.debug(`${this.name} task`, {
23
23
  files
24
24
  }, {
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const rollup_1 = tslib_1.__importDefault(require("../../bundler/rollup"));
4
+ const rollup_1 = (0, tslib_1.__importDefault)(require("../../bundler/rollup"));
5
5
  class RollupTask extends BalmJS.BalmTask {
6
6
  constructor() {
7
7
  super('rollup');
8
8
  }
9
9
  recipe(input, output) {
10
10
  const balmBundler = async (callback) => {
11
- await rollup_1.default(input, output);
11
+ await (0, rollup_1.default)(input, output);
12
12
  callback();
13
13
  };
14
14
  return balmBundler;
@@ -2,8 +2,8 @@
2
2
  var _ServerTask_watchTask, _ServerTask_onWatch;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
- const detect_port_1 = tslib_1.__importDefault(require("../../utilities/detect-port"));
6
- const middlewares_1 = tslib_1.__importDefault(require("../../middlewares"));
5
+ const detect_port_1 = (0, tslib_1.__importDefault)(require("../../utilities/detect-port"));
6
+ const middlewares_1 = (0, tslib_1.__importDefault)(require("../../middlewares"));
7
7
  class ServerTask extends BalmJS.BalmTask {
8
8
  constructor() {
9
9
  super('serve');
@@ -25,23 +25,23 @@ class ServerTask extends BalmJS.BalmTask {
25
25
  `${BalmJS.config.dest.font}/**/*`,
26
26
  ...BalmJS.config.server.extraWatchFiles
27
27
  ], watchOptions).on('change', server.reload);
28
- watch(`${BalmJS.file.templateBasePath}/*.html`, watchOptions, tslib_1.__classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, 'html', true));
29
- watch(`${BalmJS.config.src.css}/**/*.${BalmJS.config.styles.extname}`, watchOptions, tslib_1.__classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, BalmJS.config.inFrontend ? this.styleName : 'style'));
28
+ watch(`${BalmJS.file.templateBasePath}/*.html`, watchOptions, (0, tslib_1.__classPrivateFieldGet)(this, _ServerTask_watchTask, "f").call(this, 'html', true));
29
+ watch(`${BalmJS.config.src.css}/**/*.${BalmJS.config.styles.extname}`, watchOptions, (0, tslib_1.__classPrivateFieldGet)(this, _ServerTask_watchTask, "f").call(this, BalmJS.config.inFrontend ? this.styleName : 'style'));
30
30
  if (!BalmJS.config.server.useHMR) {
31
- watch(`${BalmJS.config.src.js}/**/*`, watchOptions, tslib_1.__classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, BalmJS.config.scripts.bundler, true));
31
+ watch(`${BalmJS.config.src.js}/**/*`, watchOptions, (0, tslib_1.__classPrivateFieldGet)(this, _ServerTask_watchTask, "f").call(this, BalmJS.config.scripts.bundler, true));
32
32
  }
33
- watch(`${BalmJS.config.src.base}/modernizr.json`, watchOptions, tslib_1.__classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, 'modernizr'));
34
- watch(`${BalmJS.config.src.font}/**/*`, watchOptions, tslib_1.__classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, 'font'));
33
+ watch(`${BalmJS.config.src.base}/modernizr.json`, watchOptions, (0, tslib_1.__classPrivateFieldGet)(this, _ServerTask_watchTask, "f").call(this, 'modernizr'));
34
+ watch(`${BalmJS.config.src.font}/**/*`, watchOptions, (0, tslib_1.__classPrivateFieldGet)(this, _ServerTask_watchTask, "f").call(this, 'font'));
35
35
  if (BalmJS.config.ftp.watchFiles.length) {
36
36
  watch(BalmJS.config.ftp.watchFiles, watchOptions).on('change', (path) => {
37
37
  BalmJS.logger.debug(`${this.name} task`, `File ${path} was changed`);
38
38
  BalmJS.watchFtpFile = path;
39
- tslib_1.__classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, 'ftp', true)();
39
+ (0, tslib_1.__classPrivateFieldGet)(this, _ServerTask_watchTask, "f").call(this, 'ftp', true)();
40
40
  });
41
41
  }
42
42
  });
43
43
  if (BalmJS.config.env.isDev) {
44
- detect_port_1.default(BalmJS.config.server.port, BalmJS.config.server.host).then((port) => {
44
+ (0, detect_port_1.default)(BalmJS.config.server.port, BalmJS.config.server.host).then((port) => {
45
45
  if (BalmJS.config.server.port !== port) {
46
46
  BalmJS.logger.warn('server task', `port: ${BalmJS.config.server.port} was occupied, try port: ${port}`);
47
47
  BalmJS.config.server.port = port;
@@ -98,13 +98,13 @@ class ServerTask extends BalmJS.BalmTask {
98
98
  };
99
99
  }
100
100
  bsOptions.middleware = BalmJS.config.env.isDev
101
- ? middlewares_1.default()
101
+ ? (0, middlewares_1.default)()
102
102
  : false;
103
103
  bsOptions = BalmJS.utils.deepMerge(bsOptions, serverConfig.options);
104
104
  if (BalmJS.config.env.isDev) {
105
105
  BalmJS.server = server.init(bsOptions);
106
106
  if (BalmJS.config.useDefaults) {
107
- tslib_1.__classPrivateFieldGet(this, _ServerTask_onWatch, "f").call(this);
107
+ (0, tslib_1.__classPrivateFieldGet)(this, _ServerTask_onWatch, "f").call(this);
108
108
  }
109
109
  else {
110
110
  BalmJS.watching = true;
@@ -116,7 +116,8 @@ class ServerTask extends BalmJS.BalmTask {
116
116
  customHandler && customHandler(watcher, server.reload);
117
117
  }
118
118
  catch (error) {
119
- BalmJS.logger.error('balm hook', error.message);
119
+ const { message } = error;
120
+ BalmJS.logger.error('balm hook', message);
120
121
  }
121
122
  }
122
123
  }
@@ -26,8 +26,8 @@ class UrlTask extends BalmJS.BalmTask {
26
26
  const balmUrl = () => {
27
27
  this.init(input, output);
28
28
  return this.src
29
- .pipe(tslib_1.__classPrivateFieldGet(this, _UrlTask_urlProcessing, "f").call(this, 'img'))
30
- .pipe(tslib_1.__classPrivateFieldGet(this, _UrlTask_urlProcessing, "f").call(this, 'font'))
29
+ .pipe((0, tslib_1.__classPrivateFieldGet)(this, _UrlTask_urlProcessing, "f").call(this, 'img'))
30
+ .pipe((0, tslib_1.__classPrivateFieldGet)(this, _UrlTask_urlProcessing, "f").call(this, 'font'))
31
31
  .pipe(gulp.dest(this.output));
32
32
  };
33
33
  return balmUrl;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const webpack_1 = require("../../bundler/webpack");
5
- const compiling_1 = tslib_1.__importDefault(require("../../utilities/compiling"));
5
+ const compiling_1 = (0, tslib_1.__importDefault)(require("../../utilities/compiling"));
6
6
  class WebpackTask extends BalmJS.BalmTask {
7
7
  constructor() {
8
8
  super('webpack');
@@ -12,7 +12,7 @@ class WebpackTask extends BalmJS.BalmTask {
12
12
  this.init(input || BalmJS.config.scripts.entry, output);
13
13
  const isHook = !!input;
14
14
  compiling_1.default.start();
15
- BalmJS.webpackCompiler = webpack_1.webpack(webpack_1.webpackConfig(this.input, this.output, customOptions, isHook), (error, stats) => {
15
+ BalmJS.webpackCompiler = (0, webpack_1.webpack)((0, webpack_1.webpackConfig)(this.input, this.output, customOptions, isHook), (error, stats) => {
16
16
  compiling_1.default.stop();
17
17
  const scriptLogLevel = stats.hasErrors()
18
18
  ? BalmJS.LogLevel.Error