balm-core 4.32.0 → 4.34.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.
package/index.d.ts CHANGED
@@ -1,3 +1,10 @@
1
+ export * from './types/vendors';
2
+ export * from './types/globals';
3
+ export * from './types/webworker';
4
+ export * from './types/balm';
5
+ export * from './types/gulp';
6
+ export * from './types/node';
7
+
1
8
  export interface LooseObject {
2
9
  [key: string]: any;
3
10
  }
@@ -5,8 +5,10 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
5
5
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
6
  // Reference `gulp-replace@1.1.4`
7
7
  import { Transform } from 'node:stream';
8
- import { isText } from 'istextorbinary';
8
+ // @ts-ignore
9
+ import * as isTextModule from 'istextorbinary';
9
10
  import rs from '../utilities/replacestream.js';
11
+ const isText = isTextModule.isText || isTextModule;
10
12
  const defaultOptions = {
11
13
  skipBinary: true
12
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "balm-core",
3
- "version": "4.32.0",
3
+ "version": "4.34.0",
4
4
  "description": "BalmJS compiler core",
5
5
  "keywords": [
6
6
  "balm",
@@ -41,25 +41,25 @@
41
41
  "directory": "packages/balm-core"
42
42
  },
43
43
  "dependencies": {
44
- "@rollup/plugin-terser": "^0.4.4",
44
+ "@rollup/plugin-terser": "^1.0.0",
45
45
  "ansi-colors": "^4.1.3",
46
46
  "async": "^3.2.6",
47
- "autoprefixer": "^10.4.21",
48
- "babel-loader": "^10.0.0",
47
+ "autoprefixer": "^10.5.0",
48
+ "babel-loader": "^10.1.1",
49
49
  "browser-sync": "^3.0.4",
50
50
  "connect-history-api-fallback": "^2.0.0",
51
- "css-loader": "^7.1.2",
52
- "css-minimizer-webpack-plugin": "^7.0.2",
53
- "cssnano": "^7.0.7",
54
- "del": "^8.0.0",
55
- "dotenv": "^16.5.0",
56
- "dotenv-expand": "^12.0.2",
57
- "esbuild": "^0.25.4",
51
+ "css-loader": "^7.1.4",
52
+ "css-minimizer-webpack-plugin": "^8.0.0",
53
+ "cssnano": "7",
54
+ "del": "^8.0.1",
55
+ "dotenv": "^17.4.2",
56
+ "dotenv-expand": "^13.0.0",
57
+ "esbuild": "^0.28.0",
58
58
  "fancy-log": "^2.0.0",
59
59
  "gulp-eslint": "^6.0.0",
60
60
  "gulp-if": "^3.0.0",
61
61
  "gulp-load-plugins": "^2.0.8",
62
- "gulp-rev-all": "^4.0.0",
62
+ "gulp-rev-all": "^5.1.0",
63
63
  "gulp-rev-delete-original": "^0.2.3",
64
64
  "gulp-size": "^5.0.0",
65
65
  "gulp-useref": "^5.0.0",
@@ -67,44 +67,44 @@
67
67
  "gulp.spritesmith": "^6.13.1",
68
68
  "html-loader": "^5.1.0",
69
69
  "html-minifier": "^4.0.0",
70
- "html-webpack-plugin": "^5.6.3",
71
- "http-proxy-middleware": "^3.0.5",
70
+ "html-webpack-plugin": "^5.6.7",
71
+ "http-proxy-middleware": "3",
72
72
  "imagemin": "^9.0.1",
73
73
  "istextorbinary": "^9.5.0",
74
- "less": "^4.3.0",
75
- "mini-css-extract-plugin": "^2.9.2",
74
+ "less": "^4.6.4",
75
+ "mini-css-extract-plugin": "^2.10.2",
76
76
  "modernizr": "^3.13.1",
77
77
  "parents": "^1.0.1",
78
78
  "plugin-error": "^2.0.1",
79
- "postcss": "^8.5.3",
79
+ "postcss": "^8.5.14",
80
80
  "postcss-flexbugs-fixes": "^5.0.2",
81
- "postcss-import": "^16.1.0",
81
+ "postcss-import": "^16.1.1",
82
82
  "postcss-load-config": "^6.0.1",
83
- "postcss-loader": "^8.1.1",
84
- "postcss-preset-env": "^10.1.6",
85
- "pretty-bytes": "^7.0.0",
83
+ "postcss-loader": "^8.2.1",
84
+ "postcss-preset-env": "^11.2.1",
85
+ "pretty-bytes": "^7.1.0",
86
86
  "readable-stream": "^4.7.0",
87
87
  "replace-ext": "^2.0.0",
88
- "rollup": "^4.41.0",
89
- "sass": "^1.89.0",
90
- "sass-loader": "^16.0.5",
91
- "semver": "^7.7.2",
92
- "ssh2": "^1.16.0",
93
- "strip-ansi": "^7.1.0",
88
+ "rollup": "^4.60.3",
89
+ "sass": "^1.99.0",
90
+ "sass-loader": "^16.0.8",
91
+ "semver": "^7.8.0",
92
+ "ssh2": "^1.17.0",
93
+ "strip-ansi": "^7.2.0",
94
94
  "style-loader": "^4.0.0",
95
- "tailwindcss": "^4.1.7",
96
- "terser": "^5.39.2",
97
- "terser-webpack-plugin": "^5.3.14",
98
- "through2": "^4.0.2",
95
+ "tailwindcss": "^4.3.0",
96
+ "terser": "^5.47.1",
97
+ "terser-webpack-plugin": "^5.6.0",
98
+ "through2": "^5.0.0",
99
99
  "through2-concurrent": "^2.0.0",
100
100
  "tslib": "^2.8.1",
101
101
  "vinyl-sourcemaps-apply": "^0.2.1",
102
- "webpack": "^5.99.8",
103
- "webpack-bundle-analyzer": "^4.10.2",
104
- "webpack-dev-middleware": "^7.4.2",
102
+ "webpack": "^5.106.2",
103
+ "webpack-bundle-analyzer": "^5.3.0",
104
+ "webpack-dev-middleware": "^8.0.3",
105
105
  "webpack-hot-middleware": "^2.26.1",
106
106
  "webpack-merge": "^6.0.1",
107
- "workbox-build": "^7.3.0"
107
+ "workbox-build": "^7.4.1"
108
108
  },
109
109
  "devDependencies": {
110
110
  "@types/async": "3",
@@ -129,7 +129,7 @@
129
129
  "imagemin-svgo": "^9.0.0"
130
130
  },
131
131
  "engines": {
132
- "node": "^20.10.0 || >=22.0.0"
132
+ "node": "^20.19.0 || >=22.0.0"
133
133
  },
134
- "gitHead": "0bfe647d62456b11dfbc8a27f533db5d9f109e31"
134
+ "gitHead": "6fd21fa82c698536e2ba0f9a7ee8d04a928b73ec"
135
135
  }
package/tslib/balm.js CHANGED
@@ -1,5 +1,3 @@
1
- var _Balm_config;
2
- import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
3
1
  import './config/index.js';
4
2
  import './utilities/index.js';
5
3
  import './plugins/index.js';
@@ -7,18 +5,18 @@ import registerTasks from './tasks/index.js';
7
5
  import { setConfig, setTask } from './bootstrap/index.js';
8
6
  import loading from './utilities/loading.js';
9
7
  class Balm {
8
+ #config;
10
9
  constructor() {
11
- _Balm_config.set(this, void 0);
12
10
  BalmJS.loading = false;
13
11
  loading.succeed();
14
- __classPrivateFieldSet(this, _Balm_config, setConfig({}), "f");
12
+ this.#config = setConfig({});
15
13
  }
16
14
  get config() {
17
- return __classPrivateFieldGet(this, _Balm_config, "f");
15
+ return this.#config;
18
16
  }
19
17
  set config(value) {
20
- __classPrivateFieldSet(this, _Balm_config, setConfig(value), "f");
21
- BalmJS.config = __classPrivateFieldGet(this, _Balm_config, "f");
18
+ this.#config = setConfig(value);
19
+ BalmJS.config = this.#config;
22
20
  }
23
21
  set beforeTask(name) {
24
22
  BalmJS.beforeTask = setTask(name);
@@ -43,5 +41,4 @@ class Balm {
43
41
  BalmJS.config.useDefaults = true;
44
42
  }
45
43
  }
46
- _Balm_config = new WeakMap();
47
44
  export default Balm;
@@ -1,6 +1,7 @@
1
1
  import { Transform } from 'node:stream';
2
- import { isText } from 'istextorbinary';
2
+ import * as isTextModule from 'istextorbinary';
3
3
  import rs from '../utilities/replacestream.js';
4
+ const isText = isTextModule.isText || isTextModule;
4
5
  const defaultOptions = {
5
6
  skipBinary: true
6
7
  };
@@ -1,11 +1,13 @@
1
1
  class BalmTask {
2
+ name;
3
+ taskName;
4
+ defaultInput = '';
5
+ defaultOutput = '';
6
+ input = '';
7
+ output = '';
8
+ customOptions = {};
9
+ gulpSrcOptions = {};
2
10
  constructor(name) {
3
- this.defaultInput = '';
4
- this.defaultOutput = '';
5
- this.input = '';
6
- this.output = '';
7
- this.customOptions = {};
8
- this.gulpSrcOptions = {};
9
11
  this.name = name;
10
12
  this.taskName = BalmJS.toNamespace(name);
11
13
  }
@@ -2,14 +2,14 @@ import gulpSize from 'gulp-size';
2
2
  class BuildTask extends BalmJS.BalmTask {
3
3
  constructor() {
4
4
  super('build');
5
- this.fn = () => {
6
- this.init();
7
- return this.src.pipe(gulpSize({
8
- title: this.name,
9
- gzip: true
10
- }));
11
- };
12
5
  this.defaultInput = BalmJS.file.matchAllFiles(BalmJS.config.dest.base);
13
6
  }
7
+ fn = () => {
8
+ this.init();
9
+ return this.src.pipe(gulpSize({
10
+ title: this.name,
11
+ gzip: true
12
+ }));
13
+ };
14
14
  }
15
15
  export default BuildTask;
@@ -3,16 +3,6 @@ import { ASSETS_TYPES, CHUNK, ASSET } from '../../config/constants.js';
3
3
  class CacheTask extends BalmJS.BalmTask {
4
4
  constructor() {
5
5
  super('cache');
6
- this.fn = () => {
7
- this.init();
8
- return this.src
9
- .pipe(revAll.revision(BalmJS.config.assets.options))
10
- .pipe($.if(/\.html$/, BalmJS.file.setPublicPath()))
11
- .pipe(gulp.dest(this.output))
12
- .pipe($.revDeleteOriginal())
13
- .pipe(revAll.manifestFile())
14
- .pipe(gulp.dest(this.output));
15
- };
16
6
  const defaultIncludes = BalmJS.config.scripts.useCache
17
7
  ? ASSETS_TYPES.filter((assetType) => assetType !== 'js').map((assetType) => BalmJS.file.matchAllFiles(BalmJS.config.dest[assetType]))
18
8
  : ASSETS_TYPES.map((assetType) => BalmJS.file.matchAllFiles(BalmJS.config.dest[assetType]));
@@ -38,5 +28,15 @@ class CacheTask extends BalmJS.BalmTask {
38
28
  ? BalmJS.config.dest.base
39
29
  : BalmJS.config.dest.static;
40
30
  }
31
+ fn = () => {
32
+ this.init();
33
+ return this.src
34
+ .pipe(revAll.revision(BalmJS.config.assets.options))
35
+ .pipe($.if(/\.html$/, BalmJS.file.setPublicPath()))
36
+ .pipe(gulp.dest(this.output))
37
+ .pipe($.revDeleteOriginal())
38
+ .pipe(revAll.manifestFile())
39
+ .pipe(gulp.dest(this.output));
40
+ };
41
41
  }
42
42
  export default CacheTask;
@@ -1,5 +1,3 @@
1
- var _CleanTask_getAssetsDir;
2
- import { __classPrivateFieldGet } from "tslib";
3
1
  import { deleteAsync } from 'del';
4
2
  import { ASSETS_TYPES } from '../../config/constants.js';
5
3
  function unique(arr) {
@@ -16,33 +14,10 @@ function unique(arr) {
16
14
  class CleanTask extends BalmJS.BalmTask {
17
15
  constructor() {
18
16
  super('clean');
19
- _CleanTask_getAssetsDir.set(this, (rootKey = 'assets') => {
20
- return unique(ASSETS_TYPES.map((assetType) => BalmJS.config[rootKey][assetType]));
21
- });
22
- this.fn = async (callback) => {
23
- const taskName = `${this.name} task`;
24
- const directories = BalmJS.config.inFrontend
25
- ? this.dirInFrontend
26
- : this.dirInBackend;
27
- if (BalmJS.config.env.isProd && !BalmJS.config.assets.root) {
28
- BalmJS.logger.warn(taskName, 'Remote root path is empty');
29
- }
30
- BalmJS.logger.debug(taskName, {
31
- directories
32
- }, {
33
- pre: true
34
- });
35
- const deletedPaths = await deleteAsync(directories, {
36
- force: true
37
- });
38
- BalmJS.logger.warn(taskName, {
39
- deletedPaths
40
- }, {
41
- pre: true
42
- });
43
- callback();
44
- };
45
17
  }
18
+ #getAssetsDir = (rootKey = 'assets') => {
19
+ return unique(ASSETS_TYPES.map((assetType) => BalmJS.config[rootKey][assetType]));
20
+ };
46
21
  get remoteRootDir() {
47
22
  return BalmJS.config.assets.root.trim().length
48
23
  ? [BalmJS.config.assets.root]
@@ -51,7 +26,7 @@ class CleanTask extends BalmJS.BalmTask {
51
26
  get remoteAppDir() {
52
27
  return BalmJS.config.assets.subDir
53
28
  ? [BalmJS.config.assets.static]
54
- : __classPrivateFieldGet(this, _CleanTask_getAssetsDir, "f").call(this);
29
+ : this.#getAssetsDir();
55
30
  }
56
31
  get dirInFrontend() {
57
32
  const isLocal = !node.path.isAbsolute(BalmJS.config.assets.root);
@@ -77,9 +52,31 @@ class CleanTask extends BalmJS.BalmTask {
77
52
  return [
78
53
  ...(BalmJS.config.env.isProd && hasBuildDir
79
54
  ? buildDirInProd
80
- : [...buildDirInDev, ...__classPrivateFieldGet(this, _CleanTask_getAssetsDir, "f").call(this, 'dest')])
55
+ : [...buildDirInDev, ...this.#getAssetsDir('dest')])
81
56
  ];
82
57
  }
58
+ fn = async (callback) => {
59
+ const taskName = `${this.name} task`;
60
+ const directories = BalmJS.config.inFrontend
61
+ ? this.dirInFrontend
62
+ : this.dirInBackend;
63
+ if (BalmJS.config.env.isProd && !BalmJS.config.assets.root) {
64
+ BalmJS.logger.warn(taskName, 'Remote root path is empty');
65
+ }
66
+ BalmJS.logger.debug(taskName, {
67
+ directories
68
+ }, {
69
+ pre: true
70
+ });
71
+ const deletedPaths = await deleteAsync(directories, {
72
+ force: true
73
+ });
74
+ BalmJS.logger.warn(taskName, {
75
+ deletedPaths
76
+ }, {
77
+ pre: true
78
+ });
79
+ callback();
80
+ };
83
81
  }
84
- _CleanTask_getAssetsDir = new WeakMap();
85
82
  export default CleanTask;
@@ -1,14 +1,6 @@
1
1
  class EndTask extends BalmJS.BalmTask {
2
2
  constructor() {
3
3
  super('end');
4
- this.fn = async (callback) => {
5
- if (BalmJS.utils.isFunction(BalmJS.afterTask)) {
6
- await BalmJS.afterTask();
7
- }
8
- this.time();
9
- BalmJS.emitter.emit('exit');
10
- callback();
11
- };
12
4
  }
13
5
  time() {
14
6
  const end = process.hrtime(BalmJS.start);
@@ -17,5 +9,13 @@ class EndTask extends BalmJS.BalmTask {
17
9
  logLevel: BalmJS.LogLevel.Error
18
10
  });
19
11
  }
12
+ fn = async (callback) => {
13
+ if (BalmJS.utils.isFunction(BalmJS.afterTask)) {
14
+ await BalmJS.afterTask();
15
+ }
16
+ this.time();
17
+ BalmJS.emitter.emit('exit');
18
+ callback();
19
+ };
20
20
  }
21
21
  export default EndTask;
@@ -1,13 +1,6 @@
1
1
  class ExtraTask extends BalmJS.BalmTask {
2
2
  constructor() {
3
3
  super('extra');
4
- this.fn = () => {
5
- this.init();
6
- this.gulpSrcOptions = {
7
- dot: true
8
- };
9
- return this.src.pipe(gulp.dest(this.output));
10
- };
11
4
  const includeGlobs = [];
12
5
  if (BalmJS.config.extras.includes.length) {
13
6
  for (const filename of BalmJS.config.extras.includes) {
@@ -30,5 +23,12 @@ class ExtraTask extends BalmJS.BalmTask {
30
23
  this.defaultInput = defaultGlobs;
31
24
  this.defaultOutput = BalmJS.config.dest.base;
32
25
  }
26
+ fn = () => {
27
+ this.init();
28
+ this.gulpSrcOptions = {
29
+ dot: true
30
+ };
31
+ return this.src.pipe(gulp.dest(this.output));
32
+ };
33
33
  }
34
34
  export default ExtraTask;
@@ -1,12 +1,12 @@
1
1
  class FontTask extends BalmJS.BalmTask {
2
2
  constructor() {
3
3
  super('font');
4
- this.fn = () => {
5
- this.init();
6
- return this.src.pipe(gulp.dest(this.output));
7
- };
8
4
  this.defaultInput = BalmJS.file.matchAllFiles(BalmJS.config.src.font, '*.{eot,svg,ttf,woff,woff2}');
9
5
  this.defaultOutput = BalmJS.config.dest.font;
10
6
  }
7
+ fn = () => {
8
+ this.init();
9
+ return this.src.pipe(gulp.dest(this.output));
10
+ };
11
11
  }
12
12
  export default FontTask;
@@ -2,21 +2,6 @@ import { getDefaultImagePlugins } from '../../plugins/imagemin.js';
2
2
  class ImageTask extends BalmJS.BalmTask {
3
3
  constructor() {
4
4
  super('image');
5
- this.fn = () => {
6
- this.init();
7
- const balmImage = () => {
8
- return gulp
9
- .src(BalmJS.file.absPaths(this.input), {
10
- since: gulp.lastRun(balmImage)
11
- })
12
- .pipe(BalmJS.plugins.plumber((error) => {
13
- BalmJS.logger.error(`${this.name} task`, error);
14
- }))
15
- .pipe(BalmJS.plugins.imagemin(this.plugins))
16
- .pipe(gulp.dest(this.output));
17
- };
18
- return balmImage();
19
- };
20
5
  const excludeGlobs = [];
21
6
  for (const imageFolder of BalmJS.config.styles.sprites) {
22
7
  excludeGlobs.push(node.path.join(`!${BalmJS.config.src.img}`, imageFolder));
@@ -37,5 +22,20 @@ class ImageTask extends BalmJS.BalmTask {
37
22
  BalmJS.logger.debug(`${this.name} task - plugins`, enablePlugins);
38
23
  }
39
24
  }
25
+ fn = () => {
26
+ this.init();
27
+ const balmImage = () => {
28
+ return gulp
29
+ .src(BalmJS.file.absPaths(this.input), {
30
+ since: gulp.lastRun(balmImage)
31
+ })
32
+ .pipe(BalmJS.plugins.plumber((error) => {
33
+ BalmJS.logger.error(`${this.name} task`, error);
34
+ }))
35
+ .pipe(BalmJS.plugins.imagemin(this.plugins))
36
+ .pipe(gulp.dest(this.output));
37
+ };
38
+ return balmImage();
39
+ };
40
40
  }
41
41
  export default ImageTask;
@@ -1,17 +1,17 @@
1
1
  class LintTask extends BalmJS.BalmTask {
2
2
  constructor() {
3
3
  super('lint');
4
- this.fn = () => {
5
- this.init();
6
- return this.src
7
- .pipe($.eslint({ fix: true }))
8
- .pipe(server.reload({ stream: true, once: true }))
9
- .pipe($.eslint.format())
10
- .pipe($.if(!server.active, $.eslint.failAfterError()))
11
- .pipe(gulp.dest(this.output));
12
- };
13
4
  this.defaultOutput = BalmJS.config.src.js;
14
5
  this.defaultInput = BalmJS.file.matchAllFiles(this.defaultOutput, '*.js');
15
6
  }
7
+ fn = () => {
8
+ this.init();
9
+ return this.src
10
+ .pipe($.eslint({ fix: true }))
11
+ .pipe(server.reload({ stream: true, once: true }))
12
+ .pipe($.eslint.format())
13
+ .pipe($.if(!server.active, $.eslint.failAfterError()))
14
+ .pipe(gulp.dest(this.output));
15
+ };
16
16
  }
17
17
  export default LintTask;
@@ -1,12 +1,12 @@
1
1
  class MediaTask extends BalmJS.BalmTask {
2
2
  constructor() {
3
3
  super('media');
4
- this.fn = () => {
5
- this.init();
6
- return this.src.pipe(gulp.dest(this.output));
7
- };
8
4
  this.defaultInput = BalmJS.file.matchAllFiles(BalmJS.config.src.media);
9
5
  this.defaultOutput = BalmJS.config.dest.media;
10
6
  }
7
+ fn = () => {
8
+ this.init();
9
+ return this.src.pipe(gulp.dest(this.output));
10
+ };
11
11
  }
12
12
  export default MediaTask;
@@ -1,57 +1,54 @@
1
- var _ModernizrTask_readConfig, _ModernizrTask_createDir, _ModernizrTask_generateScript;
2
- import { __classPrivateFieldGet } from "tslib";
3
1
  import { build } from 'modernizr';
4
2
  class ModernizrTask extends BalmJS.BalmTask {
5
3
  constructor() {
6
4
  super('modernizr');
7
- _ModernizrTask_readConfig.set(this, () => {
8
- return new Promise((resolve, reject) => {
9
- node.fs.readFile(this.input, 'utf8', (err, data) => {
10
- if (err)
11
- reject(err);
12
- resolve(JSON.parse(data));
13
- });
5
+ this.defaultInput = `${this.name}.json`;
6
+ this.defaultOutput = node.path.join(BalmJS.config.dest.js, `${this.name}.js`);
7
+ }
8
+ #readConfig = () => {
9
+ return new Promise((resolve, reject) => {
10
+ node.fs.readFile(this.input, 'utf8', (err, data) => {
11
+ if (err)
12
+ reject(err);
13
+ resolve(JSON.parse(data));
14
+ });
15
+ });
16
+ };
17
+ #createDir = () => {
18
+ return new Promise((resolve, reject) => {
19
+ node.fs.mkdir(BalmJS.file.absPath(BalmJS.config.dest.js), { recursive: true }, (err) => {
20
+ if (err)
21
+ reject(err);
22
+ resolve();
14
23
  });
15
24
  });
16
- _ModernizrTask_createDir.set(this, () => {
17
- return new Promise((resolve, reject) => {
18
- node.fs.mkdir(BalmJS.file.absPath(BalmJS.config.dest.js), { recursive: true }, (err) => {
25
+ };
26
+ #generateScript = (config) => {
27
+ return new Promise((resolve, reject) => {
28
+ build(config, (content) => {
29
+ node.fs.writeFile(this.output, content, (err) => {
19
30
  if (err)
20
31
  reject(err);
21
- resolve();
32
+ resolve(content);
22
33
  });
23
34
  });
24
35
  });
25
- _ModernizrTask_generateScript.set(this, (config) => {
26
- return new Promise((resolve, reject) => {
27
- build(config, (content) => {
28
- node.fs.writeFile(this.output, content, (err) => {
29
- if (err)
30
- reject(err);
31
- resolve(content);
32
- });
33
- });
36
+ };
37
+ fn = async (callback) => {
38
+ this.init();
39
+ if (node.fs.existsSync(this.input)) {
40
+ const [config] = await Promise.all([
41
+ this.#readConfig(),
42
+ this.#createDir()
43
+ ]);
44
+ await this.#generateScript(config);
45
+ }
46
+ else {
47
+ BalmJS.logger.warn(`${this.name} task`, `The '${this.input}' does not exist`, {
48
+ logLevel: BalmJS.LogLevel.Info
34
49
  });
35
- });
36
- this.fn = async (callback) => {
37
- this.init();
38
- if (node.fs.existsSync(this.input)) {
39
- const [config] = await Promise.all([
40
- __classPrivateFieldGet(this, _ModernizrTask_readConfig, "f").call(this),
41
- __classPrivateFieldGet(this, _ModernizrTask_createDir, "f").call(this)
42
- ]);
43
- await __classPrivateFieldGet(this, _ModernizrTask_generateScript, "f").call(this, config);
44
- }
45
- else {
46
- BalmJS.logger.warn(`${this.name} task`, `The '${this.input}' does not exist`, {
47
- logLevel: BalmJS.LogLevel.Info
48
- });
49
- }
50
- callback();
51
- };
52
- this.defaultInput = `${this.name}.json`;
53
- this.defaultOutput = node.path.join(BalmJS.config.dest.js, `${this.name}.js`);
54
- }
50
+ }
51
+ callback();
52
+ };
55
53
  }
56
- _ModernizrTask_readConfig = new WeakMap(), _ModernizrTask_createDir = new WeakMap(), _ModernizrTask_generateScript = new WeakMap();
57
54
  export default ModernizrTask;
@@ -2,17 +2,6 @@ import { deleteAsync } from 'del';
2
2
  class PwaCacheTask extends BalmJS.BalmTask {
3
3
  constructor() {
4
4
  super('pwa-cache');
5
- this.fn = () => {
6
- this.init();
7
- const newVersion = BalmJS.config.pwa.version || Date.now().toString();
8
- BalmJS.logger.info('pwa - version', newVersion);
9
- const stream = this.src
10
- .pipe(BalmJS.plugins.replace('{{ version }}', newVersion))
11
- .pipe($.if(BalmJS.config.env.isProd, BalmJS.plugins.jsmin(BalmJS.config.scripts.minifyOptions)))
12
- .pipe(gulp.dest(this.output));
13
- this.clear();
14
- return stream;
15
- };
16
5
  this.defaultOutput = BalmJS.config.dest.base;
17
6
  this.defaultInput = node.path.join(this.defaultOutput, BalmJS.config.pwa.swDestFilename);
18
7
  }
@@ -20,5 +9,16 @@ class PwaCacheTask extends BalmJS.BalmTask {
20
9
  const swOrigin = BalmJS.file.absPath(node.path.join(BalmJS.config.dest.base, BalmJS.config.pwa.swSrcFilename));
21
10
  deleteAsync(swOrigin, { force: true });
22
11
  }
12
+ fn = () => {
13
+ this.init();
14
+ const newVersion = BalmJS.config.pwa.version || Date.now().toString();
15
+ BalmJS.logger.info('pwa - version', newVersion);
16
+ const stream = this.src
17
+ .pipe(BalmJS.plugins.replace('{{ version }}', newVersion))
18
+ .pipe($.if(BalmJS.config.env.isProd, BalmJS.plugins.jsmin(BalmJS.config.scripts.minifyOptions)))
19
+ .pipe(gulp.dest(this.output));
20
+ this.clear();
21
+ return stream;
22
+ };
23
23
  }
24
24
  export default PwaCacheTask;
@@ -1,42 +1,8 @@
1
- var _SpriteTask_tasks, _SpriteTask_getParams;
2
- import { __classPrivateFieldGet } from "tslib";
3
1
  import mergeStream from '../../utilities/merge-stream.js';
4
2
  class SpriteTask extends BalmJS.BalmTask {
3
+ #tasks = [];
5
4
  constructor() {
6
5
  super('sprite');
7
- _SpriteTask_tasks.set(this, []);
8
- _SpriteTask_getParams.set(this, (spriteItem, spriteOptions) => {
9
- const stylesConfig = Object.assign(spriteOptions, BalmJS.config.styles);
10
- const spriteName = `${spriteItem.folderName}-${this.name}s`;
11
- const imageTarget = stylesConfig.imageTarget || BalmJS.config.paths.target.img;
12
- let defaultParams = Object.assign({
13
- padding: 1
14
- }, {
15
- imgName: `${spriteName}.png`,
16
- cssName: `_${spriteItem.folderName}.${stylesConfig.extname}`,
17
- imgPath: `${stylesConfig.imageBasePath}${imageTarget}/${spriteName}.png`,
18
- cssVarMap: (sprite) => {
19
- sprite.name = `${spriteItem.folderName}-${sprite.name}`;
20
- },
21
- cssSpritesheetName: `${spriteItem.folderName}-spritesheet`,
22
- cssOpts: {
23
- cssSelector: (sprite) => `.${sprite.name}`
24
- }
25
- });
26
- if (stylesConfig.spriteRetina) {
27
- defaultParams = Object.assign(defaultParams, {
28
- retinaSrcFilter: `${spriteItem.retinaSrc}`,
29
- retinaImgName: `${spriteName}@2x.png`,
30
- retinaImgPath: `${stylesConfig.imageBasePath}${imageTarget}/${spriteName}@2x.png`,
31
- cssVarMap: (sprite) => {
32
- sprite.name = `${spriteItem.folderName}-${sprite.name}`;
33
- },
34
- cssRetinaSpritesheetName: `${spriteItem.folderName}-spritesheet-2x`,
35
- cssRetinaGroupsName: `${spriteItem.folderName}-retina-groups`
36
- });
37
- }
38
- return Object.assign(defaultParams, stylesConfig.spriteParams);
39
- });
40
6
  this.defaultInput = BalmJS.config.styles.sprites;
41
7
  this.defaultOutput = BalmJS.config.dest.img;
42
8
  if (this.defaultInput.length) {
@@ -44,6 +10,38 @@ class SpriteTask extends BalmJS.BalmTask {
44
10
  this.collect();
45
11
  }
46
12
  }
13
+ #getParams = (spriteItem, spriteOptions) => {
14
+ const stylesConfig = Object.assign(spriteOptions, BalmJS.config.styles);
15
+ const spriteName = `${spriteItem.folderName}-${this.name}s`;
16
+ const imageTarget = stylesConfig.imageTarget || BalmJS.config.paths.target.img;
17
+ let defaultParams = Object.assign({
18
+ padding: 1
19
+ }, {
20
+ imgName: `${spriteName}.png`,
21
+ cssName: `_${spriteItem.folderName}.${stylesConfig.extname}`,
22
+ imgPath: `${stylesConfig.imageBasePath}${imageTarget}/${spriteName}.png`,
23
+ cssVarMap: (sprite) => {
24
+ sprite.name = `${spriteItem.folderName}-${sprite.name}`;
25
+ },
26
+ cssSpritesheetName: `${spriteItem.folderName}-spritesheet`,
27
+ cssOpts: {
28
+ cssSelector: (sprite) => `.${sprite.name}`
29
+ }
30
+ });
31
+ if (stylesConfig.spriteRetina) {
32
+ defaultParams = Object.assign(defaultParams, {
33
+ retinaSrcFilter: `${spriteItem.retinaSrc}`,
34
+ retinaImgName: `${spriteName}@2x.png`,
35
+ retinaImgPath: `${stylesConfig.imageBasePath}${imageTarget}/${spriteName}@2x.png`,
36
+ cssVarMap: (sprite) => {
37
+ sprite.name = `${spriteItem.folderName}-${sprite.name}`;
38
+ },
39
+ cssRetinaSpritesheetName: `${spriteItem.folderName}-spritesheet-2x`,
40
+ cssRetinaGroupsName: `${spriteItem.folderName}-retina-groups`
41
+ });
42
+ }
43
+ return Object.assign(defaultParams, stylesConfig.spriteParams);
44
+ };
47
45
  collect(spriteOptions = {}) {
48
46
  const spriteList = [];
49
47
  for (const spriteName of this.input) {
@@ -64,7 +62,7 @@ class SpriteTask extends BalmJS.BalmTask {
64
62
  BalmJS.logger.debug(`${this.name} task`, spriteConfig, {
65
63
  pre: true
66
64
  });
67
- spriteConfig.params = __classPrivateFieldGet(this, _SpriteTask_getParams, "f").call(this, spriteItem, spriteOptions);
65
+ spriteConfig.params = this.#getParams(spriteItem, spriteOptions);
68
66
  gulp.task(BalmJS.toNamespace(spriteTaskName), () => {
69
67
  const spriteData = gulp
70
68
  .src(spriteConfig.input)
@@ -76,7 +74,7 @@ class SpriteTask extends BalmJS.BalmTask {
76
74
  const cssStream = spriteData.css.pipe(gulp.dest(spriteConfig.cssOutput));
77
75
  return mergeStream(imgStream, cssStream);
78
76
  });
79
- __classPrivateFieldGet(this, _SpriteTask_tasks, "f").push(spriteTaskName);
77
+ this.#tasks.push(spriteTaskName);
80
78
  }
81
79
  }
82
80
  recipe(input, output, spriteOptions = {}) {
@@ -89,8 +87,7 @@ class SpriteTask extends BalmJS.BalmTask {
89
87
  }
90
88
  }
91
89
  get deps() {
92
- return __classPrivateFieldGet(this, _SpriteTask_tasks, "f");
90
+ return this.#tasks;
93
91
  }
94
92
  }
95
- _SpriteTask_tasks = new WeakMap(), _SpriteTask_getParams = new WeakMap();
96
93
  export default SpriteTask;
@@ -1,13 +1,13 @@
1
1
  class StartTask extends BalmJS.BalmTask {
2
2
  constructor() {
3
3
  super('start');
4
- this.fn = async (callback) => {
5
- BalmJS.start = process.hrtime();
6
- if (BalmJS.utils.isFunction(BalmJS.beforeTask)) {
7
- await BalmJS.beforeTask();
8
- }
9
- callback();
10
- };
11
4
  }
5
+ fn = async (callback) => {
6
+ BalmJS.start = process.hrtime();
7
+ if (BalmJS.utils.isFunction(BalmJS.beforeTask)) {
8
+ await BalmJS.beforeTask();
9
+ }
10
+ callback();
11
+ };
12
12
  }
13
13
  export default StartTask;
@@ -1,15 +1,15 @@
1
1
  class WorkboxSwTask extends BalmJS.BalmTask {
2
2
  constructor() {
3
3
  super('workbox-sw');
4
- this.fn = () => {
5
- this.init();
6
- return this.src.pipe(gulp.dest(this.output));
7
- };
8
4
  this.defaultInput = [
9
5
  BalmJS.config.pwa.workboxSw,
10
6
  `${BalmJS.config.pwa.workboxSw}.map`
11
7
  ];
12
8
  this.defaultOutput = BalmJS.config.dest.base;
13
9
  }
10
+ fn = () => {
11
+ this.init();
12
+ return this.src.pipe(gulp.dest(this.output));
13
+ };
14
14
  }
15
15
  export default WorkboxSwTask;
@@ -1,33 +1,31 @@
1
- var _HtmlTask_updateAssetsPath, _HtmlTask_hasSourcePath;
2
- import { __classPrivateFieldGet } from "tslib";
3
1
  import { PUBLIC_URL } from '../../config/constants.js';
4
2
  class HtmlTask extends BalmJS.BalmTask {
5
3
  constructor() {
6
4
  super('html');
7
- _HtmlTask_updateAssetsPath.set(this, (type) => {
8
- const isManifest = type === 'manifest';
9
- const assetsType = isManifest ? 'img' : type;
10
- const from = BalmJS.config.paths.source[assetsType];
11
- const to = BalmJS.file.assetsPath(BalmJS.config.paths.target[assetsType]);
12
- const assetsPathSrc = new RegExp(isManifest ? `/?${from}` : `${PUBLIC_URL}/${from}`, 'g');
13
- const assetsPathDest = `${PUBLIC_URL}/${to}`;
14
- BalmJS.logger.debug(`${this.name} task - assets path`, {
15
- regex: assetsPathSrc,
16
- replacement: assetsPathDest
17
- }, {
18
- pre: true
19
- });
20
- return BalmJS.plugins.replace(assetsPathSrc, assetsPathDest);
21
- });
22
- _HtmlTask_hasSourcePath.set(this, (type) => {
23
- return !!BalmJS.config.paths.source[type];
24
- });
25
5
  this.defaultInput = [
26
6
  node.path.join(BalmJS.file.templateBasePath, '*.html'),
27
7
  node.path.join(BalmJS.file.templateBasePath, BalmJS.config.pwa.manifest)
28
8
  ];
29
9
  this.defaultOutput = BalmJS.config.dest.base;
30
10
  }
11
+ #updateAssetsPath = (type) => {
12
+ const isManifest = type === 'manifest';
13
+ const assetsType = isManifest ? 'img' : type;
14
+ const from = BalmJS.config.paths.source[assetsType];
15
+ const to = BalmJS.file.assetsPath(BalmJS.config.paths.target[assetsType]);
16
+ const assetsPathSrc = new RegExp(isManifest ? `/?${from}` : `${PUBLIC_URL}/${from}`, 'g');
17
+ const assetsPathDest = `${PUBLIC_URL}/${to}`;
18
+ BalmJS.logger.debug(`${this.name} task - assets path`, {
19
+ regex: assetsPathSrc,
20
+ replacement: assetsPathDest
21
+ }, {
22
+ pre: true
23
+ });
24
+ return BalmJS.plugins.replace(assetsPathSrc, assetsPathDest);
25
+ };
26
+ #hasSourcePath = (type) => {
27
+ return !!BalmJS.config.paths.source[type];
28
+ };
31
29
  recipe(input, output) {
32
30
  const balmHtml = () => {
33
31
  this.init(input, output);
@@ -46,9 +44,9 @@ class HtmlTask extends BalmJS.BalmTask {
46
44
  ['css', 'js', 'img', 'media', 'manifest'].forEach((type) => {
47
45
  const canUpdate = type === 'manifest'
48
46
  ? BalmJS.config.pwa.enabled
49
- : __classPrivateFieldGet(this, _HtmlTask_hasSourcePath, "f").call(this, type);
47
+ : this.#hasSourcePath(type);
50
48
  if (canUpdate) {
51
- stream = stream.pipe(__classPrivateFieldGet(this, _HtmlTask_updateAssetsPath, "f").call(this, type));
49
+ stream = stream.pipe(this.#updateAssetsPath(type));
52
50
  }
53
51
  });
54
52
  stream = BalmJS.config.assets.cache
@@ -58,10 +56,10 @@ class HtmlTask extends BalmJS.BalmTask {
58
56
  else {
59
57
  ['css', 'js', 'img', 'media'].forEach((type, index) => {
60
58
  const canUpdate = index > 1
61
- ? __classPrivateFieldGet(this, _HtmlTask_hasSourcePath, "f").call(this, type) && !BalmJS.config.inFrontend
62
- : __classPrivateFieldGet(this, _HtmlTask_hasSourcePath, "f").call(this, type);
59
+ ? this.#hasSourcePath(type) && !BalmJS.config.inFrontend
60
+ : this.#hasSourcePath(type);
63
61
  if (canUpdate) {
64
- stream = stream.pipe(__classPrivateFieldGet(this, _HtmlTask_updateAssetsPath, "f").call(this, type));
62
+ stream = stream.pipe(this.#updateAssetsPath(type));
65
63
  }
66
64
  });
67
65
  stream = stream.pipe(BalmJS.file.setPublicPath());
@@ -74,5 +72,4 @@ class HtmlTask extends BalmJS.BalmTask {
74
72
  return this.recipe();
75
73
  }
76
74
  }
77
- _HtmlTask_updateAssetsPath = new WeakMap(), _HtmlTask_hasSourcePath = new WeakMap();
78
75
  export default HtmlTask;
@@ -1,35 +1,33 @@
1
- var _PublishTask_release;
2
- import { __classPrivateFieldGet } from "tslib";
3
1
  import mergeStream from '../../utilities/merge-stream.js';
4
2
  class PublishTask extends BalmJS.BalmTask {
5
3
  constructor() {
6
4
  super('publish');
7
- _PublishTask_release.set(this, (input, output, renameOptions = {}) => {
8
- if (input && output) {
9
- this.init(node.path.join(BalmJS.config.dest.base, input), node.path.join(BalmJS.config.assets.root, output));
10
- }
11
- else {
12
- this.init();
13
- }
14
- return this.src
15
- .pipe($.if(!BalmJS.utils.isArray(this.input), BalmJS.plugins.rename(renameOptions)))
16
- .pipe(gulp.dest(this.output));
17
- });
18
5
  this.defaultInput = [
19
6
  BalmJS.file.matchAllFiles(BalmJS.config.dest.static),
20
7
  node.path.join(`!${BalmJS.config.dest.base}`, '*.*')
21
8
  ];
22
9
  this.defaultOutput = BalmJS.config.assets.static;
23
10
  }
11
+ #release = (input, output, renameOptions = {}) => {
12
+ if (input && output) {
13
+ this.init(node.path.join(BalmJS.config.dest.base, input), node.path.join(BalmJS.config.assets.root, output));
14
+ }
15
+ else {
16
+ this.init();
17
+ }
18
+ return this.src
19
+ .pipe($.if(!BalmJS.utils.isArray(this.input), BalmJS.plugins.rename(renameOptions)))
20
+ .pipe(gulp.dest(this.output));
21
+ };
24
22
  recipe(input, output, renameOptions) {
25
23
  const balmPublish = (callback) => {
26
24
  if (BalmJS.config.env.isProd) {
27
25
  if (BalmJS.utils.isArray(input)) {
28
- const tasks = input.map((template) => __classPrivateFieldGet(this, _PublishTask_release, "f").call(this, template.input, template.output, template.renameOptions));
26
+ const tasks = input.map((template) => this.#release(template.input, template.output, template.renameOptions));
29
27
  return mergeStream(...tasks);
30
28
  }
31
29
  else {
32
- return __classPrivateFieldGet(this, _PublishTask_release, "f").call(this, input, output, renameOptions);
30
+ return this.#release(input, output, renameOptions);
33
31
  }
34
32
  }
35
33
  else {
@@ -43,5 +41,4 @@ class PublishTask extends BalmJS.BalmTask {
43
41
  callback();
44
42
  }
45
43
  }
46
- _PublishTask_release = new WeakMap();
47
44
  export default PublishTask;
@@ -1,23 +1,21 @@
1
- var _RemoveTask_getFiles;
2
- import { __classPrivateFieldGet } from "tslib";
3
1
  import { deleteAsync } from 'del';
4
2
  class RemoveTask extends BalmJS.BalmTask {
5
3
  constructor() {
6
4
  super('remove');
7
- _RemoveTask_getFiles.set(this, (input) => {
8
- let files = BalmJS.file.absPaths(input);
9
- files = BalmJS.utils.isArray(input)
10
- ? files.map((file) => file.replace(/\\/g, '/'))
11
- : files.replace(/\\/g, '/');
12
- return files;
13
- });
14
5
  }
6
+ #getFiles = (input) => {
7
+ let files = BalmJS.file.absPaths(input);
8
+ files = BalmJS.utils.isArray(input)
9
+ ? files.map((file) => file.replace(/\\/g, '/'))
10
+ : files.replace(/\\/g, '/');
11
+ return files;
12
+ };
15
13
  recipe(input) {
16
14
  const balmRemove = async (callback) => {
17
15
  const canDel = !!((BalmJS.utils.isString(input) && input.trim()) ||
18
16
  (BalmJS.utils.isArray(input) && input.length));
19
17
  if (canDel) {
20
- const files = __classPrivateFieldGet(this, _RemoveTask_getFiles, "f").call(this, input);
18
+ const files = this.#getFiles(input);
21
19
  BalmJS.logger.debug(`${this.name} task`, {
22
20
  files
23
21
  }, {
@@ -43,5 +41,4 @@ class RemoveTask extends BalmJS.BalmTask {
43
41
  callback();
44
42
  }
45
43
  }
46
- _RemoveTask_getFiles = new WeakMap();
47
44
  export default RemoveTask;
@@ -1,43 +1,8 @@
1
- var _ServerTask_watchTask, _ServerTask_onWatch;
2
- import { __classPrivateFieldGet } from "tslib";
3
1
  import detectPort from '../../utilities/detect-port.js';
4
2
  import getMiddlewares from '../../middlewares/index.js';
5
3
  class ServerTask extends BalmJS.BalmTask {
6
4
  constructor() {
7
5
  super('serve');
8
- _ServerTask_watchTask.set(this, (taskName, serverReload = false) => {
9
- const balmTask = BalmJS.tasks.get(taskName).fn;
10
- const reload = (done) => {
11
- server.reload();
12
- done();
13
- };
14
- return serverReload ? gulp.series(balmTask, reload) : balmTask;
15
- });
16
- _ServerTask_onWatch.set(this, () => {
17
- const { watch } = gulp;
18
- const watchOptions = {
19
- cwd: BalmJS.config.workspace
20
- };
21
- watch([
22
- `${BalmJS.config.src.img}/**/*`,
23
- `${BalmJS.config.dest.font}/**/*`,
24
- ...BalmJS.config.server.extraWatchFiles
25
- ], watchOptions).on('change', server.reload);
26
- watch(`${BalmJS.file.templateBasePath}/*.html`, watchOptions, __classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, 'html', true));
27
- watch(`${BalmJS.config.src.css}/**/*.${BalmJS.config.styles.extname}`, watchOptions, __classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, BalmJS.config.inFrontend ? this.styleName : 'style'));
28
- if (!BalmJS.config.server.useHMR) {
29
- watch(`${BalmJS.config.src.js}/**/*`, watchOptions, __classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, BalmJS.config.scripts.bundler, true));
30
- }
31
- watch(`${BalmJS.config.src.base}/modernizr.json`, watchOptions, __classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, 'modernizr'));
32
- watch(`${BalmJS.config.src.font}/**/*`, watchOptions, __classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, 'font'));
33
- if (BalmJS.config.ftp.watchFiles.length) {
34
- watch(BalmJS.config.ftp.watchFiles, watchOptions).on('change', (path) => {
35
- BalmJS.logger.debug(`${this.name} task`, `File ${path} was changed`);
36
- BalmJS.watchFtpFile = path;
37
- __classPrivateFieldGet(this, _ServerTask_watchTask, "f").call(this, 'ftp', true)();
38
- });
39
- }
40
- });
41
6
  if (BalmJS.config.env.isDev) {
42
7
  detectPort(BalmJS.config.server.port, BalmJS.config.server.host).then((port) => {
43
8
  if (BalmJS.config.server.port !== port) {
@@ -47,6 +12,39 @@ class ServerTask extends BalmJS.BalmTask {
47
12
  }, () => { });
48
13
  }
49
14
  }
15
+ #watchTask = (taskName, serverReload = false) => {
16
+ const balmTask = BalmJS.tasks.get(taskName).fn;
17
+ const reload = (done) => {
18
+ server.reload();
19
+ done();
20
+ };
21
+ return serverReload ? gulp.series(balmTask, reload) : balmTask;
22
+ };
23
+ #onWatch = () => {
24
+ const { watch } = gulp;
25
+ const watchOptions = {
26
+ cwd: BalmJS.config.workspace
27
+ };
28
+ watch([
29
+ `${BalmJS.config.src.img}/**/*`,
30
+ `${BalmJS.config.dest.font}/**/*`,
31
+ ...BalmJS.config.server.extraWatchFiles
32
+ ], watchOptions).on('change', server.reload);
33
+ watch(`${BalmJS.file.templateBasePath}/*.html`, watchOptions, this.#watchTask('html', true));
34
+ watch(`${BalmJS.config.src.css}/**/*.${BalmJS.config.styles.extname}`, watchOptions, this.#watchTask(BalmJS.config.inFrontend ? this.styleName : 'style'));
35
+ if (!BalmJS.config.server.useHMR) {
36
+ watch(`${BalmJS.config.src.js}/**/*`, watchOptions, this.#watchTask(BalmJS.config.scripts.bundler, true));
37
+ }
38
+ watch(`${BalmJS.config.src.base}/modernizr.json`, watchOptions, this.#watchTask('modernizr'));
39
+ watch(`${BalmJS.config.src.font}/**/*`, watchOptions, this.#watchTask('font'));
40
+ if (BalmJS.config.ftp.watchFiles.length) {
41
+ watch(BalmJS.config.ftp.watchFiles, watchOptions).on('change', (path) => {
42
+ BalmJS.logger.debug(`${this.name} task`, `File ${path} was changed`);
43
+ BalmJS.watchFtpFile = path;
44
+ this.#watchTask('ftp', true)();
45
+ });
46
+ }
47
+ };
50
48
  recipe(customHandler) {
51
49
  const balmServe = (callback) => {
52
50
  if (BalmJS.server) {
@@ -102,7 +100,7 @@ class ServerTask extends BalmJS.BalmTask {
102
100
  if (BalmJS.config.env.isDev) {
103
101
  BalmJS.server = server.init(bsOptions);
104
102
  if (BalmJS.config.useDefaults) {
105
- __classPrivateFieldGet(this, _ServerTask_onWatch, "f").call(this);
103
+ this.#onWatch();
106
104
  }
107
105
  else {
108
106
  BalmJS.watching = true;
@@ -128,5 +126,4 @@ class ServerTask extends BalmJS.BalmTask {
128
126
  return this.recipe();
129
127
  }
130
128
  }
131
- _ServerTask_watchTask = new WeakMap(), _ServerTask_onWatch = new WeakMap();
132
129
  export default ServerTask;
@@ -1,31 +1,29 @@
1
- var _UrlTask_urlProcessing;
2
- import { __classPrivateFieldGet } from "tslib";
3
1
  class UrlTask extends BalmJS.BalmTask {
4
2
  constructor() {
5
3
  super('url');
6
- _UrlTask_urlProcessing.set(this, (type) => {
7
- const pattern = BalmJS.config.paths.source[type]
8
- .split('/')
9
- .pop();
10
- const pathSrc = new RegExp(`\\.{2}/${pattern}/`, 'g');
11
- const pathDest = `../${BalmJS.config.paths.target[type]}/`;
12
- BalmJS.logger.debug(`${this.name} task`, {
13
- regex: pathSrc,
14
- replacement: pathDest
15
- }, {
16
- pre: true
17
- });
18
- return BalmJS.plugins.replace(pathSrc, pathDest);
19
- });
20
4
  this.defaultOutput = BalmJS.config.dest.css;
21
5
  this.defaultInput = BalmJS.file.matchAllFiles(this.defaultOutput, '*.css');
22
6
  }
7
+ #urlProcessing = (type) => {
8
+ const pattern = BalmJS.config.paths.source[type]
9
+ .split('/')
10
+ .pop();
11
+ const pathSrc = new RegExp(`\\.{2}/${pattern}/`, 'g');
12
+ const pathDest = `../${BalmJS.config.paths.target[type]}/`;
13
+ BalmJS.logger.debug(`${this.name} task`, {
14
+ regex: pathSrc,
15
+ replacement: pathDest
16
+ }, {
17
+ pre: true
18
+ });
19
+ return BalmJS.plugins.replace(pathSrc, pathDest);
20
+ };
23
21
  recipe(input, output) {
24
22
  const balmUrl = () => {
25
23
  this.init(input, output);
26
24
  return this.src
27
- .pipe(__classPrivateFieldGet(this, _UrlTask_urlProcessing, "f").call(this, 'img'))
28
- .pipe(__classPrivateFieldGet(this, _UrlTask_urlProcessing, "f").call(this, 'font'))
25
+ .pipe(this.#urlProcessing('img'))
26
+ .pipe(this.#urlProcessing('font'))
29
27
  .pipe(gulp.dest(this.output));
30
28
  };
31
29
  return balmUrl;
@@ -34,5 +32,4 @@ class UrlTask extends BalmJS.BalmTask {
34
32
  return this.recipe();
35
33
  }
36
34
  }
37
- _UrlTask_urlProcessing = new WeakMap();
38
35
  export default UrlTask;
@@ -1,21 +1,16 @@
1
- var _BalmCompiling_firstCompile;
2
- import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
3
1
  import loading from './loading.js';
4
2
  class BalmCompiling {
5
- constructor() {
6
- _BalmCompiling_firstCompile.set(this, true);
7
- }
3
+ #firstCompile = true;
8
4
  start() {
9
- if (!BalmJS.useCacache && __classPrivateFieldGet(this, _BalmCompiling_firstCompile, "f")) {
5
+ if (!BalmJS.useCacache && this.#firstCompile) {
10
6
  loading.render('Compiling to JS...');
11
7
  }
12
8
  }
13
9
  stop() {
14
- if (!BalmJS.useCacache && __classPrivateFieldGet(this, _BalmCompiling_firstCompile, "f")) {
15
- __classPrivateFieldSet(this, _BalmCompiling_firstCompile, false, "f");
10
+ if (!BalmJS.useCacache && this.#firstCompile) {
11
+ this.#firstCompile = false;
16
12
  loading.clear();
17
13
  }
18
14
  }
19
15
  }
20
- _BalmCompiling_firstCompile = new WeakMap();
21
16
  export default new BalmCompiling();
@@ -1,31 +1,25 @@
1
- var _BalmLoading_stream, _BalmLoading_frameIndex, _BalmLoading_frameCount;
2
- import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
3
1
  import readline from 'readline';
4
2
  import spinner from '../config/spinner.js';
5
3
  class BalmLoading {
6
- constructor() {
7
- _BalmLoading_stream.set(this, process.stderr);
8
- _BalmLoading_frameIndex.set(this, 0);
9
- _BalmLoading_frameCount.set(this, spinner.frames.length);
10
- }
4
+ #stream = process.stderr;
5
+ #frameIndex = 0;
6
+ #frameCount = spinner.frames.length;
11
7
  get frame() {
12
- var _a;
13
- const currentFrame = spinner.frames[__classPrivateFieldGet(this, _BalmLoading_frameIndex, "f")];
14
- __classPrivateFieldSet(this, _BalmLoading_frameIndex, __classPrivateFieldSet(this, _BalmLoading_frameIndex, (_a = __classPrivateFieldGet(this, _BalmLoading_frameIndex, "f"), ++_a), "f") % __classPrivateFieldGet(this, _BalmLoading_frameCount, "f"), "f");
8
+ const currentFrame = spinner.frames[this.#frameIndex];
9
+ this.#frameIndex = ++this.#frameIndex % this.#frameCount;
15
10
  return currentFrame;
16
11
  }
17
12
  clear() {
18
- readline.clearLine(__classPrivateFieldGet(this, _BalmLoading_stream, "f"), 0);
19
- readline.cursorTo(__classPrivateFieldGet(this, _BalmLoading_stream, "f"), 0);
13
+ readline.clearLine(this.#stream, 0);
14
+ readline.cursorTo(this.#stream, 0);
20
15
  }
21
16
  render(text = `${this.frame} BalmJS is initializing...`) {
22
17
  this.clear();
23
- __classPrivateFieldGet(this, _BalmLoading_stream, "f").write(text);
18
+ this.#stream.write(text);
24
19
  }
25
20
  succeed() {
26
21
  this.clear();
27
22
  console.log(`BalmJS core version: ${BalmJS.version}`);
28
23
  }
29
24
  }
30
- _BalmLoading_stream = new WeakMap(), _BalmLoading_frameIndex = new WeakMap(), _BalmLoading_frameCount = new WeakMap();
31
25
  export default new BalmLoading();
@@ -1,5 +1,3 @@
1
- var _Logger_log;
2
- import { __classPrivateFieldGet } from "tslib";
3
1
  import util from 'node:util';
4
2
  import fancyLog from 'fancy-log';
5
3
  import color from './color.js';
@@ -39,23 +37,21 @@ const LOG = {
39
37
  end: '^'.padEnd(36, '.')
40
38
  };
41
39
  class Logger {
42
- constructor() {
43
- _Logger_log.set(this, (obj, pre = false) => {
44
- const options = Object.assign({
45
- showHidden: false,
46
- depth: 2,
47
- colors: true
48
- }, BalmJS.config.logs.formatOptions);
49
- return pre ? util.inspect(obj, options) : obj;
50
- });
51
- }
40
+ #log = (obj, pre = false) => {
41
+ const options = Object.assign({
42
+ showHidden: false,
43
+ depth: 2,
44
+ colors: true
45
+ }, BalmJS.config.logs.formatOptions);
46
+ return pre ? util.inspect(obj, options) : obj;
47
+ };
52
48
  success(label, message, options = {}) {
53
49
  const logOptions = Object.assign({
54
50
  logLevel: BalmJS.LogLevel.Trace
55
51
  }, options);
56
52
  if (BalmJS.config.logs.level <= logOptions.logLevel) {
57
53
  console.log(LOG.beginning);
58
- fancyLog(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.OK), __classPrivateFieldGet(this, _Logger_log, "f").call(this, message, logOptions.pre));
54
+ fancyLog(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.OK), this.#log(message, logOptions.pre));
59
55
  console.log(LOG.end);
60
56
  }
61
57
  }
@@ -64,7 +60,7 @@ class Logger {
64
60
  logLevel: BalmJS.LogLevel.Debug
65
61
  }, options);
66
62
  if (BalmJS.config.logs.level <= logOptions.logLevel) {
67
- fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.DEBUG), __classPrivateFieldGet(this, _Logger_log, "f").call(this, message, logOptions.pre));
63
+ fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.DEBUG), this.#log(message, logOptions.pre));
68
64
  }
69
65
  }
70
66
  info(label, message, options = {}) {
@@ -72,7 +68,7 @@ class Logger {
72
68
  logLevel: BalmJS.LogLevel.Info
73
69
  }, options);
74
70
  if (BalmJS.config.logs.level <= logOptions.logLevel) {
75
- fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.INFO), __classPrivateFieldGet(this, _Logger_log, "f").call(this, message, logOptions.pre));
71
+ fancyLog.info(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.INFO), this.#log(message, logOptions.pre));
76
72
  }
77
73
  }
78
74
  warn(label, message, options = {}) {
@@ -80,7 +76,7 @@ class Logger {
80
76
  logLevel: BalmJS.LogLevel.Warn
81
77
  }, options);
82
78
  if (BalmJS.config.logs.level <= logOptions.logLevel) {
83
- fancyLog.warn(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.WARN), __classPrivateFieldGet(this, _Logger_log, "f").call(this, message, logOptions.pre));
79
+ fancyLog.warn(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.WARN), this.#log(message, logOptions.pre));
84
80
  }
85
81
  }
86
82
  error(label, message, options = {}) {
@@ -89,9 +85,8 @@ class Logger {
89
85
  pre: false
90
86
  }, options);
91
87
  if (BalmJS.config.logs.level <= logOptions.logLevel) {
92
- fancyLog.error(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.ERROR), __classPrivateFieldGet(this, _Logger_log, "f").call(this, message, logOptions.pre));
88
+ fancyLog.error(LOG.FORMAT, LOG.PREFIX, color(`<${label}>`, LOG.ERROR), this.#log(message, logOptions.pre));
93
89
  }
94
90
  }
95
91
  }
96
- _Logger_log = new WeakMap();
97
92
  export default new Logger();