balm-core 4.15.0 → 4.16.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.
@@ -1,3 +1,5 @@
1
+ import path from 'node:path';
2
+ import fs from 'node:fs';
1
3
  // Reference `gulp-sass@5.1.0`
2
4
  import { Transform } from 'node:stream';
3
5
  import sass from 'sass';
@@ -5,6 +7,11 @@ import replaceExtension from 'replace-ext';
5
7
  import stripAnsi from 'strip-ansi';
6
8
  import applySourceMap from 'vinyl-sourcemaps-apply';
7
9
  import ansiColors from 'ansi-colors';
10
+
11
+ // Just for `npm i -D sass@1.39.2`
12
+ process.env.BALM_CWD = process.env.INIT_CWD || process.cwd();
13
+ const localSassModule = path.join(process.env.BALM_ROOT || process.env.BALM_CWD, 'node_modules', 'sass', 'sass.dart.js');
14
+ const sassModule = fs.existsSync(localSassModule) ? requireModule(localSassModule) : sass;
8
15
  const PLUGIN_NAME = 'sass';
9
16
  const transformObj = transform => new Transform({
10
17
  transform,
@@ -119,5 +126,5 @@ const gulpSass = options => transformObj((file, encoding, callback) => {
119
126
  handleError(error, file, callback);
120
127
  }
121
128
  });
122
- gulpSass.compiler = sass;
129
+ gulpSass.compiler = sassModule;
123
130
  export default gulpSass;
@@ -1,13 +1,14 @@
1
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; }
2
2
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
3
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import revAll from 'gulp-rev-all';
4
5
  import { ASSETS_TYPES, CHUNK, ASSET } from '../../config/constants.js';
5
6
  class CacheTask extends BalmJS.BalmTask {
6
7
  constructor() {
7
8
  super('cache');
8
9
  _defineProperty(this, "fn", () => {
9
10
  this.init();
10
- return this.src.pipe($.revAll.revision(BalmJS.config.assets.options)).pipe($.if(/\.html$/, BalmJS.file.setPublicPath())).pipe(gulp.dest(this.output)).pipe($.revDeleteOriginal()).pipe($.revAll.manifestFile()).pipe(gulp.dest(this.output));
11
+ return this.src.pipe(revAll.revision(BalmJS.config.assets.options)).pipe($.if(/\.html$/, BalmJS.file.setPublicPath())).pipe(gulp.dest(this.output)).pipe($.revDeleteOriginal()).pipe(revAll.manifestFile()).pipe(gulp.dest(this.output));
11
12
  });
12
13
  const defaultIncludes = BalmJS.config.scripts.useCache ? ASSETS_TYPES.filter(assetType => assetType !== 'js').map(assetType => BalmJS.file.matchAllFiles(BalmJS.config.dest[assetType])) : ASSETS_TYPES.map(assetType => BalmJS.file.matchAllFiles(BalmJS.config.dest[assetType]));
13
14
  const defaultExcludes = [node.path.join(`!${BalmJS.config.dest.js}`, CHUNK.dir, '*'), node.path.join(`!${BalmJS.config.dest.js}`, ASSET.dir, '*'), node.path.join(`!${BalmJS.config.dest.base}`, BalmJS.config.pwa.manifest)];
@@ -1,3 +1,4 @@
1
+ import revAll from 'gulp-rev-all';
1
2
  class VersionTask extends BalmJS.BalmTask {
2
3
  constructor() {
3
4
  super('version');
@@ -11,7 +12,7 @@ class VersionTask extends BalmJS.BalmTask {
11
12
  this.init(input, output, {
12
13
  version: assetsOptions
13
14
  });
14
- return this.src.pipe($.revAll.revision(this.options)).pipe(gulp.dest(this.output)).pipe($.revAll.versionFile()).pipe(gulp.dest(this.output));
15
+ return this.src.pipe(revAll.revision(this.options)).pipe(gulp.dest(this.output)).pipe(revAll.versionFile()).pipe(gulp.dest(this.output));
15
16
  };
16
17
  return balmVersion;
17
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "balm-core",
3
- "version": "4.15.0",
3
+ "version": "4.16.0",
4
4
  "description": "BalmJS compiler core",
5
5
  "keywords": [
6
6
  "balm",
@@ -120,5 +120,5 @@
120
120
  "engines": {
121
121
  "node": ">=14.18.0"
122
122
  },
123
- "gitHead": "ab628f37a5519cd1c8b3fcf42828ca4bdfd2c503"
123
+ "gitHead": "fa3bd6dd7f008aa9a67cf3447c98ad5535083aa7"
124
124
  }
@@ -1,9 +1,16 @@
1
+ import path from 'node:path';
2
+ import fs from 'node:fs';
1
3
  import { Transform } from 'node:stream';
2
4
  import sass from 'sass';
3
5
  import replaceExtension from 'replace-ext';
4
6
  import stripAnsi from 'strip-ansi';
5
7
  import applySourceMap from 'vinyl-sourcemaps-apply';
6
8
  import ansiColors from 'ansi-colors';
9
+ process.env.BALM_CWD = process.env.INIT_CWD || process.cwd();
10
+ const localSassModule = path.join(process.env.BALM_ROOT || process.env.BALM_CWD, 'node_modules', 'sass', 'sass.dart.js');
11
+ const sassModule = fs.existsSync(localSassModule)
12
+ ? requireModule(localSassModule)
13
+ : sass;
7
14
  const PLUGIN_NAME = 'sass';
8
15
  const transformObj = (transform) => new Transform({ transform, objectMode: true });
9
16
  const filePush = (file, sassObject, callback) => {
@@ -86,5 +93,5 @@ const gulpSass = (options) => transformObj((file, encoding, callback) => {
86
93
  handleError(error, file, callback);
87
94
  }
88
95
  });
89
- gulpSass.compiler = sass;
96
+ gulpSass.compiler = sassModule;
90
97
  export default gulpSass;
@@ -1,3 +1,4 @@
1
+ import revAll from 'gulp-rev-all';
1
2
  import { ASSETS_TYPES, CHUNK, ASSET } from '../../config/constants.js';
2
3
  class CacheTask extends BalmJS.BalmTask {
3
4
  constructor() {
@@ -5,11 +6,11 @@ class CacheTask extends BalmJS.BalmTask {
5
6
  this.fn = () => {
6
7
  this.init();
7
8
  return this.src
8
- .pipe($.revAll.revision(BalmJS.config.assets.options))
9
+ .pipe(revAll.revision(BalmJS.config.assets.options))
9
10
  .pipe($.if(/\.html$/, BalmJS.file.setPublicPath()))
10
11
  .pipe(gulp.dest(this.output))
11
12
  .pipe($.revDeleteOriginal())
12
- .pipe($.revAll.manifestFile())
13
+ .pipe(revAll.manifestFile())
13
14
  .pipe(gulp.dest(this.output));
14
15
  };
15
16
  const defaultIncludes = BalmJS.config.scripts.useCache
@@ -1,3 +1,4 @@
1
+ import revAll from 'gulp-rev-all';
1
2
  class VersionTask extends BalmJS.BalmTask {
2
3
  constructor() {
3
4
  super('version');
@@ -12,9 +13,9 @@ class VersionTask extends BalmJS.BalmTask {
12
13
  version: assetsOptions
13
14
  });
14
15
  return this.src
15
- .pipe($.revAll.revision(this.options))
16
+ .pipe(revAll.revision(this.options))
16
17
  .pipe(gulp.dest(this.output))
17
- .pipe($.revAll.versionFile())
18
+ .pipe(revAll.versionFile())
18
19
  .pipe(gulp.dest(this.output));
19
20
  };
20
21
  return balmVersion;