balm-core 5.0.1 → 5.1.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 (71) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +7 -0
  3. package/lib/balm.js +2 -2
  4. package/lib/bundler/webpack/config/env.js +1 -1
  5. package/lib/config/globals.js +14 -1
  6. package/lib/plugins/imagemin.js +13 -8
  7. package/lib/plugins/index.js +2 -0
  8. package/lib/plugins/postcss.js +2 -2
  9. package/lib/plugins/rename.js +1 -3
  10. package/lib/plugins/replace.js +4 -2
  11. package/lib/plugins/sass-legacy.js +131 -0
  12. package/lib/plugins/sass.js +66 -125
  13. package/lib/tasks/foundation/balm.js +3 -2
  14. package/lib/tasks/foundation/balm_style.js +1 -1
  15. package/lib/tasks/private/build.js +1 -1
  16. package/lib/tasks/private/cache.js +1 -1
  17. package/lib/tasks/private/clean.js +3 -3
  18. package/lib/tasks/private/end.js +1 -1
  19. package/lib/tasks/private/extra.js +1 -1
  20. package/lib/tasks/private/font.js +1 -1
  21. package/lib/tasks/private/image.js +3 -2
  22. package/lib/tasks/private/lint.js +1 -1
  23. package/lib/tasks/private/media.js +1 -1
  24. package/lib/tasks/private/modernizr.js +3 -3
  25. package/lib/tasks/private/pwa-cache.js +1 -1
  26. package/lib/tasks/private/sprite.js +5 -3
  27. package/lib/tasks/private/start.js +1 -1
  28. package/lib/tasks/private/workbox-sw.js +1 -1
  29. package/lib/tasks/public/html.js +2 -2
  30. package/lib/tasks/public/publish.js +2 -2
  31. package/lib/tasks/public/remove.js +2 -2
  32. package/lib/tasks/public/sass.js +1 -2
  33. package/lib/tasks/public/server.js +2 -2
  34. package/lib/tasks/public/url.js +2 -2
  35. package/lib/utilities/compiling.js +2 -2
  36. package/lib/utilities/loading.js +2 -2
  37. package/lib/utilities/logger.js +2 -2
  38. package/package.json +53 -52
  39. package/tslib/balm.js +5 -8
  40. package/tslib/config/globals.js +21 -1
  41. package/tslib/plugins/imagemin.js +13 -8
  42. package/tslib/plugins/index.js +2 -0
  43. package/tslib/plugins/rename.js +1 -1
  44. package/tslib/plugins/replace.js +2 -1
  45. package/tslib/plugins/sass-legacy.js +95 -0
  46. package/tslib/plugins/sass.js +62 -124
  47. package/tslib/tasks/foundation/balm.js +10 -7
  48. package/tslib/tasks/foundation/balm_style.js +3 -1
  49. package/tslib/tasks/private/build.js +7 -7
  50. package/tslib/tasks/private/cache.js +10 -10
  51. package/tslib/tasks/private/clean.js +28 -31
  52. package/tslib/tasks/private/end.js +8 -8
  53. package/tslib/tasks/private/extra.js +7 -7
  54. package/tslib/tasks/private/font.js +4 -4
  55. package/tslib/tasks/private/image.js +16 -15
  56. package/tslib/tasks/private/lint.js +9 -9
  57. package/tslib/tasks/private/media.js +4 -4
  58. package/tslib/tasks/private/modernizr.js +40 -43
  59. package/tslib/tasks/private/pwa-cache.js +11 -11
  60. package/tslib/tasks/private/sprite.js +37 -40
  61. package/tslib/tasks/private/start.js +7 -7
  62. package/tslib/tasks/private/workbox-sw.js +4 -4
  63. package/tslib/tasks/public/html.js +23 -26
  64. package/tslib/tasks/public/publish.js +13 -16
  65. package/tslib/tasks/public/remove.js +8 -11
  66. package/tslib/tasks/public/sass.js +1 -2
  67. package/tslib/tasks/public/server.js +34 -37
  68. package/tslib/tasks/public/url.js +16 -19
  69. package/tslib/utilities/compiling.js +4 -9
  70. package/tslib/utilities/loading.js +8 -14
  71. package/tslib/utilities/logger.js +13 -18
@@ -1,4 +1,4 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  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); }
4
4
  class FontTask extends BalmJS.BalmTask {
@@ -1,4 +1,4 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  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); }
4
4
  import { getDefaultImagePlugins } from '../../plugins/imagemin.js';
@@ -9,7 +9,8 @@ class ImageTask extends BalmJS.BalmTask {
9
9
  this.init();
10
10
  const balmImage = () => {
11
11
  return gulp.src(BalmJS.file.absPaths(this.input), {
12
- since: gulp.lastRun(balmImage)
12
+ since: gulp.lastRun(balmImage),
13
+ encoding: false
13
14
  }).pipe(BalmJS.plugins.plumber(error => {
14
15
  BalmJS.logger.error(`${this.name} task`, error);
15
16
  })).pipe(BalmJS.plugins.imagemin(this.plugins)).pipe(gulp.dest(this.output));
@@ -1,4 +1,4 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  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); }
4
4
  class LintTask extends BalmJS.BalmTask {
@@ -1,4 +1,4 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  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); }
4
4
  class MediaTask extends BalmJS.BalmTask {
@@ -1,8 +1,8 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  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); }
4
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
5
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
4
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
5
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
6
6
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
7
7
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
8
8
  import { build } from 'modernizr';
@@ -1,4 +1,4 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  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); }
4
4
  import { deleteAsync } from 'del';
@@ -1,5 +1,5 @@
1
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
2
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
1
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
2
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
3
3
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
4
4
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
5
5
  import mergeStream from '../../utilities/merge-stream.js';
@@ -77,7 +77,9 @@ class SpriteTask extends BalmJS.BalmTask {
77
77
  });
78
78
  spriteConfig.params = _classPrivateFieldGet(_getParams, this).call(this, spriteItem, spriteOptions);
79
79
  gulp.task(BalmJS.toNamespace(spriteTaskName), () => {
80
- const spriteData = gulp.src(spriteConfig.input).pipe(BalmJS.plugins.plumber(error => {
80
+ const spriteData = gulp.src(spriteConfig.input, {
81
+ encoding: false
82
+ }).pipe(BalmJS.plugins.plumber(error => {
81
83
  BalmJS.logger.error(`${this.name} task`, error.message);
82
84
  })).pipe($.spritesmith(spriteConfig.params));
83
85
  const imgStream = spriteData.img.pipe(gulp.dest(spriteConfig.imgOutput));
@@ -1,4 +1,4 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  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); }
4
4
  class StartTask extends BalmJS.BalmTask {
@@ -1,4 +1,4 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  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); }
4
4
  class WorkboxSwTask extends BalmJS.BalmTask {
@@ -1,5 +1,5 @@
1
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
2
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
1
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
2
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
3
3
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
4
4
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
5
5
  import { PUBLIC_URL } from '../../config/constants.js';
@@ -1,5 +1,5 @@
1
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
2
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
1
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
2
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
3
3
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
4
4
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
5
5
  import mergeStream from '../../utilities/merge-stream.js';
@@ -1,5 +1,5 @@
1
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
2
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
1
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
2
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
3
3
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
4
4
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
5
5
  import { deleteAsync } from 'del';
@@ -1,10 +1,9 @@
1
- import { isLegacy } from '../../plugins/sass.js';
2
1
  class SassTask extends BalmJS.BalmStyleTask {
3
2
  constructor() {
4
3
  super('sass');
5
4
  }
6
5
  get options() {
7
- return Object.assign(isLegacy ? {
6
+ return Object.assign(node.isLegacySass ? {
8
7
  includePaths: BalmJS.file.stylePaths,
9
8
  outputStyle: 'expanded'
10
9
  } : {
@@ -1,5 +1,5 @@
1
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
2
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
1
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
2
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
3
3
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
4
4
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
5
5
  import detectPort from '../../utilities/detect-port.js';
@@ -1,5 +1,5 @@
1
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
2
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
1
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
2
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
3
3
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
4
4
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
5
5
  var _urlProcessing = /*#__PURE__*/new WeakMap();
@@ -1,5 +1,5 @@
1
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
2
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
1
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
2
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
3
3
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
4
4
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
5
5
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
@@ -1,5 +1,5 @@
1
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
2
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
1
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
2
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
3
3
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
4
4
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
5
5
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
@@ -1,5 +1,5 @@
1
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
2
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
1
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
2
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
3
3
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
4
4
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
5
5
  import util from 'node:util';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "balm-core",
3
- "version": "5.0.1",
3
+ "version": "5.1.0",
4
4
  "description": "BalmJS compiler core",
5
5
  "keywords": [
6
6
  "balm",
@@ -41,94 +41,95 @@
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
- "async": "^3.2.5",
47
- "autoprefixer": "^10.4.19",
48
- "babel-loader": "^9.1.3",
49
- "browser-sync": "^3.0.2",
46
+ "async": "^3.2.6",
47
+ "autoprefixer": "^10.5.0",
48
+ "babel-loader": "^10.1.1",
49
+ "browser-sync": "^3.0.4",
50
50
  "connect-history-api-fallback": "^2.0.0",
51
- "css-loader": "^7.1.1",
52
- "css-minimizer-webpack-plugin": "^6.0.0",
53
- "cssnano": "^7.0.1",
54
- "del": "^7.1.0",
55
- "dotenv": "^16.4.5",
56
- "dotenv-expand": "^11.0.6",
57
- "esbuild": "^0.20.0",
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",
66
- "gulp-zip": "^6.0.0",
67
- "gulp.spritesmith": "^6.13.0",
68
- "html-loader": "^5.0.0",
66
+ "gulp-zip": "^6.1.0",
67
+ "gulp.spritesmith": "^6.13.1",
68
+ "html-loader": "^5.1.0",
69
69
  "html-minifier": "^4.0.0",
70
- "html-webpack-plugin": "^5.6.0",
71
- "http-proxy-middleware": "^3.0.0",
72
- "imagemin": "^8.0.1",
70
+ "html-webpack-plugin": "^5.6.7",
71
+ "http-proxy-middleware": "3",
72
+ "imagemin": "^9.0.1",
73
73
  "istextorbinary": "^9.5.0",
74
- "less": "^4.2.0",
75
- "mini-css-extract-plugin": "^2.9.0",
76
- "modernizr": "^3.13.0",
74
+ "less": "^4.6.4",
75
+ "mini-css-extract-plugin": "^2.10.2",
76
+ "modernizr": "^3.13.1",
77
77
  "parents": "^1.0.1",
78
78
  "plugin-error": "^2.0.1",
79
- "postcss": "^8.4.38",
79
+ "postcss": "^8.5.14",
80
80
  "postcss-flexbugs-fixes": "^5.0.2",
81
- "postcss-import": "^16.1.0",
82
- "postcss-load-config": "^5.1.0",
83
- "postcss-loader": "^8.1.1",
84
- "postcss-preset-env": "^9.5.11",
85
- "pretty-bytes": "^6.1.1",
86
- "readable-stream": "^4.5.2",
81
+ "postcss-import": "^16.1.1",
82
+ "postcss-load-config": "^6.0.1",
83
+ "postcss-loader": "^8.2.1",
84
+ "postcss-preset-env": "^11.2.1",
85
+ "pretty-bytes": "^7.1.0",
86
+ "readable-stream": "^4.7.0",
87
87
  "replace-ext": "^2.0.0",
88
- "rollup": "^4.17.2",
89
- "sass": "^1.76.0",
90
- "sass-loader": "^14.2.1",
91
- "semver": "^7.6.0",
92
- "ssh2": "^1.15.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": "^3.4.3",
96
- "terser": "^5.30.4",
97
- "terser-webpack-plugin": "^5.3.10",
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
- "tslib": "^2.6.2",
100
+ "tslib": "^2.8.1",
101
101
  "vinyl-sourcemaps-apply": "^0.2.1",
102
- "webpack": "^5.91.0",
103
- "webpack-bundle-analyzer": "^4.10.2",
104
- "webpack-dev-middleware": "^7.2.1",
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
- "webpack-merge": "^5.10.0",
107
- "workbox-build": "^7.1.0"
106
+ "webpack-merge": "^6.0.1",
107
+ "workbox-build": "^7.4.1"
108
108
  },
109
109
  "devDependencies": {
110
110
  "@types/async": "3",
111
111
  "@types/browser-sync": "2",
112
- "@types/express": "4",
112
+ "@types/express": "5",
113
113
  "@types/fancy-log": "2",
114
114
  "@types/html-minifier": "4",
115
- "@types/imagemin": "8",
115
+ "@types/imagemin": "9",
116
116
  "@types/parents": "1",
117
117
  "@types/postcss-flexbugs-fixes": "5",
118
118
  "@types/readable-stream": "4",
119
119
  "@types/replace-ext": "2",
120
+ "@types/semver": "7",
120
121
  "@types/through2-concurrent": "2",
121
122
  "@types/webpack-bundle-analyzer": "4",
122
123
  "@types/webpack-hot-middleware": "2"
123
124
  },
124
125
  "optionalDependencies": {
125
126
  "imagemin-gifsicle": "^7.0.0",
126
- "imagemin-mozjpeg": "^9.0.0",
127
+ "imagemin-mozjpeg": "^10.0.0",
127
128
  "imagemin-optipng": "^8.0.0",
128
- "imagemin-svgo": "^9.0.0"
129
+ "imagemin-svgo": "^12.0.0"
129
130
  },
130
131
  "engines": {
131
- "node": ">=18.12.0"
132
+ "node": "^20.19.0 || >=22.0.0"
132
133
  },
133
- "gitHead": "619d0e68949929109878b5237814761d987af55a"
134
+ "gitHead": "561aaa5e4a9ad75b5b047ada2d8a66900e1d5431"
134
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;
@@ -4,8 +4,26 @@ import colors from 'ansi-colors';
4
4
  import { create } from 'browser-sync';
5
5
  import through2 from 'through2';
6
6
  import PluginError from 'plugin-error';
7
+ import semver from 'semver';
7
8
  process.env.BALM_CWD = process.env.INIT_CWD || process.cwd();
8
9
  const gulpModule = path.join(process.env.BALM_ROOT || process.env.BALM_CWD, 'node_modules', 'gulp', 'index.js');
10
+ const localSassModule = path.join(process.env.BALM_CWD, 'node_modules', 'sass');
11
+ let isLegacySass = false;
12
+ try {
13
+ const sassPkg = requireModule(path.join(localSassModule, 'package.json'));
14
+ isLegacySass = semver.lt(sassPkg.version, '1.40.0');
15
+ }
16
+ catch (_) { }
17
+ const nodeLocalSassModule = path.join(localSassModule, 'sass.node.js');
18
+ const defaultLocalSassModule = path.join(localSassModule, 'sass.default.js');
19
+ const dartLocalSassModule = path.join(localSassModule, 'sass.dart.js');
20
+ const getSassModule = (sass) => fs.existsSync(nodeLocalSassModule)
21
+ ? requireModule(nodeLocalSassModule)
22
+ : fs.existsSync(defaultLocalSassModule)
23
+ ? requireModule(defaultLocalSassModule)
24
+ : fs.existsSync(dartLocalSassModule)
25
+ ? requireModule(dartLocalSassModule)
26
+ : sass;
9
27
  if (fs.existsSync(gulpModule)) {
10
28
  if (process.cwd() !== process.env.BALM_CWD) {
11
29
  process.chdir(process.env.BALM_CWD);
@@ -19,7 +37,9 @@ else {
19
37
  }
20
38
  global.node = {
21
39
  path,
22
- fs
40
+ fs,
41
+ isLegacySass,
42
+ getSassModule
23
43
  };
24
44
  global.server = create();
25
45
  global.through2 = through2;
@@ -4,12 +4,17 @@ import through2Concurrent from 'through2-concurrent';
4
4
  const PLUGIN_NAME = 'imagemin';
5
5
  const defaultPlugins = ['gifsicle', 'mozjpeg', 'optipng', 'svgo'];
6
6
  const loadPlugin = (plugin, ...args) => {
7
- try {
8
- return requireModule(`imagemin-${plugin}`)(...args);
9
- }
10
- catch (_) {
11
- BalmJS.logger.error(PLUGIN_NAME, `Could not load default plugin \`${plugin}\``);
12
- }
7
+ return async (input) => {
8
+ try {
9
+ const m = await import(`imagemin-${plugin}`);
10
+ const pluginFn = m.default(...args);
11
+ return pluginFn(input);
12
+ }
13
+ catch (_) {
14
+ BalmJS.logger.error(PLUGIN_NAME, `Could not load default plugin \`${plugin}\``);
15
+ return input;
16
+ }
17
+ };
13
18
  };
14
19
  const exposePlugin = (plugin) => (...args) => loadPlugin(plugin, ...args);
15
20
  const getDefaultPlugins = () => defaultPlugins.flatMap((plugin) => loadPlugin(plugin));
@@ -39,7 +44,7 @@ function gulpImagemin(customPlugins) {
39
44
  (async () => {
40
45
  try {
41
46
  const data = await imagemin.buffer(file.contents, {
42
- plugins
47
+ plugins: plugins
43
48
  });
44
49
  const originalSize = file.contents.length;
45
50
  const optimizedSize = data.length;
@@ -55,7 +60,7 @@ function gulpImagemin(customPlugins) {
55
60
  totalFiles++;
56
61
  }
57
62
  BalmJS.logger.debug(PLUGIN_NAME, `${file.relative} (${message})`);
58
- file.contents = data;
63
+ file.contents = Buffer.from(data);
59
64
  callback(null, file);
60
65
  }
61
66
  catch (error) {
@@ -8,6 +8,7 @@ import postcssPlugins from './postcss-plugins.js';
8
8
  import rename from './rename.js';
9
9
  import replace from './replace.js';
10
10
  import sass from './sass.js';
11
+ import legacySass from './sass-legacy.js';
11
12
  import sftp from './sftp.js';
12
13
  const plugins = {
13
14
  htmlmin,
@@ -20,6 +21,7 @@ const plugins = {
20
21
  rename,
21
22
  replace,
22
23
  sass,
24
+ legacySass,
23
25
  sftp
24
26
  };
25
27
  BalmJS.plugins = plugins;
@@ -12,7 +12,7 @@ function gulpRename(obj, options = {}) {
12
12
  };
13
13
  };
14
14
  stream._transform = (chunk, unused, callback) => {
15
- const file = chunk.clone({ contents: false });
15
+ const file = chunk.clone();
16
16
  let parsedPath = parsePath(file.relative);
17
17
  let _path;
18
18
  const type = typeof obj;
@@ -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
  };
@@ -0,0 +1,95 @@
1
+ import { Transform } from 'node:stream';
2
+ import * as sass from 'sass';
3
+ import replaceExtension from 'replace-ext';
4
+ import stripAnsi from 'strip-ansi';
5
+ import applySourceMap from 'vinyl-sourcemaps-apply';
6
+ import ansiColors from 'ansi-colors';
7
+ const sassModule = node.getSassModule(sass);
8
+ const PLUGIN_NAME = 'sass-legacy';
9
+ const transformObj = (transform) => new Transform({ transform, objectMode: true });
10
+ function filePush(file, sassObject, callback) {
11
+ if (sassObject.map) {
12
+ const sassMap = JSON.parse(sassObject.map.toString());
13
+ const sassMapFile = sassMap.file.replace(/^stdout$/, 'stdin');
14
+ const sassFileSrc = file.relative;
15
+ const sassFileSrcPath = node.path.dirname(sassFileSrc);
16
+ if (sassFileSrcPath) {
17
+ const sourceFileIndex = sassMap.sources.indexOf(sassMapFile);
18
+ sassMap.sources = sassMap.sources.map((source, index) => index === sourceFileIndex
19
+ ? source
20
+ : node.path.join(sassFileSrcPath, source));
21
+ }
22
+ sassMap.sources = sassMap.sources.filter((src) => src !== 'stdin' && src);
23
+ sassMap.file = replaceExtension(sassFileSrc, '.css');
24
+ applySourceMap(file, sassMap);
25
+ }
26
+ file.contents = sassObject.css;
27
+ file.path = replaceExtension(file.path, '.css');
28
+ if (file.stat) {
29
+ file.stat.atime = file.stat.mtime = file.stat.ctime = new Date();
30
+ }
31
+ callback(null, file);
32
+ }
33
+ function handleError(error, file, callback) {
34
+ const filePath = (error.file === 'stdin' ? file.path : error.file) || file.path;
35
+ const relativePath = node.path.relative(process.cwd(), filePath);
36
+ const message = `${ansiColors.underline(relativePath)}\n${error.formatted}`;
37
+ error.messageFormatted = message;
38
+ error.messageOriginal = error.message;
39
+ error.message = stripAnsi(message);
40
+ error.relativePath = relativePath;
41
+ return callback(new PluginError(PLUGIN_NAME, error));
42
+ }
43
+ const gulpSass = (options, sync = false) => transformObj((file, encoding, callback) => {
44
+ if (file.isNull()) {
45
+ return callback(null, file);
46
+ }
47
+ if (file.isStream()) {
48
+ return callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
49
+ }
50
+ if (node.path.basename(file.path).startsWith('_')) {
51
+ return callback();
52
+ }
53
+ if (!file.contents.length) {
54
+ file.path = replaceExtension(file.path, '.css');
55
+ return callback(null, file);
56
+ }
57
+ const opts = (options || {});
58
+ opts.data = file.contents.toString();
59
+ opts.file = file.path;
60
+ if (node.path.extname(file.path) === '.sass') {
61
+ opts.indentedSyntax = true;
62
+ }
63
+ if (opts.includePaths) {
64
+ if (typeof opts.includePaths === 'string') {
65
+ opts.includePaths = [opts.includePaths];
66
+ }
67
+ }
68
+ else {
69
+ opts.includePaths = [];
70
+ }
71
+ opts.includePaths.unshift(node.path.dirname(file.path));
72
+ if (file.sourceMap) {
73
+ opts.sourceMap = file.path;
74
+ opts.omitSourceMapUrl = true;
75
+ opts.sourceMapContents = true;
76
+ }
77
+ if (sync !== true) {
78
+ sassModule.render(opts, (error, obj) => {
79
+ if (error) {
80
+ handleError(error, file, callback);
81
+ return;
82
+ }
83
+ filePush(file, obj, callback);
84
+ });
85
+ }
86
+ else {
87
+ try {
88
+ filePush(file, sassModule.renderSync(opts), callback);
89
+ }
90
+ catch (error) {
91
+ handleError(error, file, callback);
92
+ }
93
+ }
94
+ });
95
+ export default gulpSass;