balm-core 4.15.1 → 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "balm-core",
3
- "version": "4.15.1",
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": "5a935bd962498ce7d64e4bca2f8ef1dc970d71ff"
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;