balm-core 4.30.0 → 4.32.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 (43) hide show
  1. package/README.md +1 -1
  2. package/lib/balm.js +2 -2
  3. package/lib/bundler/webpack/config/env.js +1 -1
  4. package/lib/config/globals.js +14 -1
  5. package/lib/plugins/imagemin.js +2 -2
  6. package/lib/plugins/index.js +2 -0
  7. package/lib/plugins/postcss.js +2 -2
  8. package/lib/plugins/replace.js +1 -1
  9. package/lib/plugins/sass-legacy.js +131 -0
  10. package/lib/plugins/sass.js +66 -125
  11. package/lib/tasks/foundation/balm.js +1 -1
  12. package/lib/tasks/foundation/balm_style.js +1 -1
  13. package/lib/tasks/private/build.js +1 -1
  14. package/lib/tasks/private/cache.js +1 -1
  15. package/lib/tasks/private/clean.js +3 -3
  16. package/lib/tasks/private/end.js +1 -1
  17. package/lib/tasks/private/extra.js +1 -1
  18. package/lib/tasks/private/font.js +1 -1
  19. package/lib/tasks/private/image.js +1 -1
  20. package/lib/tasks/private/lint.js +1 -1
  21. package/lib/tasks/private/media.js +1 -1
  22. package/lib/tasks/private/modernizr.js +3 -3
  23. package/lib/tasks/private/pwa-cache.js +1 -1
  24. package/lib/tasks/private/sprite.js +2 -2
  25. package/lib/tasks/private/start.js +1 -1
  26. package/lib/tasks/private/workbox-sw.js +1 -1
  27. package/lib/tasks/public/html.js +2 -2
  28. package/lib/tasks/public/publish.js +2 -2
  29. package/lib/tasks/public/remove.js +2 -2
  30. package/lib/tasks/public/sass.js +1 -2
  31. package/lib/tasks/public/server.js +2 -2
  32. package/lib/tasks/public/url.js +2 -2
  33. package/lib/utilities/compiling.js +2 -2
  34. package/lib/utilities/loading.js +2 -2
  35. package/lib/utilities/logger.js +2 -2
  36. package/package.json +44 -43
  37. package/tslib/config/globals.js +21 -1
  38. package/tslib/plugins/imagemin.js +1 -1
  39. package/tslib/plugins/index.js +2 -0
  40. package/tslib/plugins/sass-legacy.js +95 -0
  41. package/tslib/plugins/sass.js +62 -124
  42. package/tslib/tasks/foundation/balm_style.js +3 -1
  43. package/tslib/tasks/public/sass.js +1 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
2
  <a href="https://balm.js.org/">
3
- <img width="128" heigth="128" src="https://balm.js.org/logo.png" alt="BalmJS">
3
+ <img width="128" height="128" src="https://balm.js.org/logo.png" alt="BalmJS">
4
4
  </a>
5
5
  <br>
6
6
  <br>
package/lib/balm.js CHANGED
@@ -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 _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
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,6 +1,6 @@
1
1
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
2
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
- 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; }
3
+ 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; }
4
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
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
  import dotenv from 'dotenv';
@@ -4,10 +4,21 @@ 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
 
8
9
  // Set env var for ORIGINAL cwd before anything touches it
9
10
  process.env.BALM_CWD = process.env.INIT_CWD || process.cwd();
10
11
  const gulpModule = path.join(process.env.BALM_ROOT || process.env.BALM_CWD, 'node_modules', 'gulp', 'index.js');
12
+ const localSassModule = path.join(process.env.BALM_CWD, 'node_modules', 'sass');
13
+ let isLegacySass = false;
14
+ try {
15
+ const sassPkg = requireModule(path.join(localSassModule, 'package.json'));
16
+ isLegacySass = semver.lt(sassPkg.version, '1.40.0');
17
+ } catch (_) {}
18
+ const nodeLocalSassModule = path.join(localSassModule, 'sass.node.js');
19
+ const defaultLocalSassModule = path.join(localSassModule, 'sass.default.js'); // For `npm i -D sass <= 1.62.1`
20
+ const dartLocalSassModule = path.join(localSassModule, 'sass.dart.js'); // For `npm i -D sass <= 1.39.2`
21
+ const getSassModule = sass => fs.existsSync(nodeLocalSassModule) ? requireModule(nodeLocalSassModule) : fs.existsSync(defaultLocalSassModule) ? requireModule(defaultLocalSassModule) : fs.existsSync(dartLocalSassModule) ? requireModule(dartLocalSassModule) : sass;
11
22
  if (fs.existsSync(gulpModule)) {
12
23
  // Chdir before requiring balm config to make sure
13
24
  // we let them chdir as needed
@@ -22,7 +33,9 @@ if (fs.existsSync(gulpModule)) {
22
33
  }
23
34
  global.node = {
24
35
  path,
25
- fs
36
+ fs,
37
+ isLegacySass,
38
+ getSassModule
26
39
  };
27
40
  global.server = create();
28
41
  global.through2 = through2;
@@ -1,4 +1,4 @@
1
- // Reference `gulp-imagemin@9.0.0`
1
+ // Reference `gulp-imagemin@9.1.0`
2
2
 
3
3
  import imagemin from 'imagemin';
4
4
  import prettyBytes from 'pretty-bytes';
@@ -54,7 +54,7 @@ function gulpImagemin(customPlugins) {
54
54
  totalFiles++;
55
55
  }
56
56
  BalmJS.logger.debug(PLUGIN_NAME, `${file.relative} (${message})`);
57
- file.contents = data;
57
+ file.contents = Buffer.from(data);
58
58
  callback(null, file);
59
59
  } catch (error) {
60
60
  callback(new PluginError(PLUGIN_NAME, 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;
@@ -1,4 +1,4 @@
1
- // Reference `gulp-postcss@9.0.1`
1
+ // Reference `gulp-postcss@10.0.0`
2
2
  import { Transform } from 'node:stream';
3
3
  import postcss from 'postcss';
4
4
  import postcssLoadConfig from 'postcss-load-config';
@@ -28,7 +28,7 @@ function gulpPostcss(cb) {
28
28
  }
29
29
  const ctx = {
30
30
  file,
31
- options: contextOptions
31
+ options: contextOptions // @TODO: The options property is deprecated and should be removed
32
32
  };
33
33
  return postcssLoadConfig(ctx, configPath);
34
34
  });
@@ -1,6 +1,6 @@
1
1
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
2
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
- 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; }
3
+ 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; }
4
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
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`
@@ -0,0 +1,131 @@
1
+ // Reference `gulp-sass@5.1.0`
2
+ import { Transform } from 'node:stream';
3
+ import * as sass from 'sass';
4
+ import replaceExtension from 'replace-ext';
5
+ import stripAnsi from 'strip-ansi';
6
+ import applySourceMap from 'vinyl-sourcemaps-apply';
7
+ import ansiColors from 'ansi-colors';
8
+ const sassModule = node.getSassModule(sass);
9
+ const PLUGIN_NAME = 'sass-legacy';
10
+ const transformObj = transform => new Transform({
11
+ transform,
12
+ objectMode: true
13
+ });
14
+
15
+ /**
16
+ * Handles returning the file to the stream
17
+ */
18
+ function filePush(file, sassObject, callback) {
19
+ // Build Source Maps!
20
+ if (sassObject.map) {
21
+ // Transform map into JSON
22
+ const sassMap = JSON.parse(sassObject.map.toString());
23
+ // Grab the stdout and transform it into stdin
24
+ const sassMapFile = sassMap.file.replace(/^stdout$/, 'stdin');
25
+ // Grab the base filename that's being worked on
26
+ const sassFileSrc = file.relative;
27
+ // Grab the path portion of the file that's being worked on
28
+ const sassFileSrcPath = node.path.dirname(sassFileSrc);
29
+ if (sassFileSrcPath) {
30
+ const sourceFileIndex = sassMap.sources.indexOf(sassMapFile);
31
+ // Prepend the path to all files in the sources array except the file that's being worked on
32
+ sassMap.sources = sassMap.sources.map((source, index) => index === sourceFileIndex ? source : node.path.join(sassFileSrcPath, source));
33
+ }
34
+
35
+ // Remove 'stdin' from sources and replace with filenames!
36
+ sassMap.sources = sassMap.sources.filter(src => src !== 'stdin' && src);
37
+
38
+ // Replace the map file with the original filename (but new extension)
39
+ sassMap.file = replaceExtension(sassFileSrc, '.css');
40
+ // Apply the map
41
+ applySourceMap(file, sassMap);
42
+ }
43
+ file.contents = sassObject.css;
44
+ file.path = replaceExtension(file.path, '.css');
45
+ if (file.stat) {
46
+ file.stat.atime = file.stat.mtime = file.stat.ctime = new Date();
47
+ }
48
+ callback(null, file);
49
+ }
50
+
51
+ /**
52
+ * Handles error message
53
+ */
54
+ function handleError(error, file, callback) {
55
+ const filePath = (error.file === 'stdin' ? file.path : error.file) || file.path;
56
+ const relativePath = node.path.relative(process.cwd(), filePath);
57
+ const message = `${ansiColors.underline(relativePath)}\n${error.formatted}`;
58
+ error.messageFormatted = message;
59
+ error.messageOriginal = error.message;
60
+ error.message = stripAnsi(message);
61
+ error.relativePath = relativePath;
62
+ return callback(new PluginError(PLUGIN_NAME, error));
63
+ }
64
+
65
+ //////////////////////////////
66
+ // Main Gulp Sass function
67
+ //////////////////////////////
68
+ const gulpSass = (options, sync = false) => transformObj((file, encoding, callback) => {
69
+ if (file.isNull()) {
70
+ return callback(null, file);
71
+ }
72
+ if (file.isStream()) {
73
+ return callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
74
+ }
75
+ if (node.path.basename(file.path).startsWith('_')) {
76
+ return callback();
77
+ }
78
+ if (!file.contents.length) {
79
+ file.path = replaceExtension(file.path, '.css');
80
+ return callback(null, file);
81
+ }
82
+ const opts = options || {};
83
+ opts.data = file.contents.toString();
84
+
85
+ // We set the file path here so that libsass can correctly resolve import paths
86
+ opts.file = file.path;
87
+
88
+ // Ensure `indentedSyntax` is true if a `.sass` file
89
+ if (node.path.extname(file.path) === '.sass') {
90
+ opts.indentedSyntax = true;
91
+ }
92
+
93
+ // Ensure file's parent directory in the include path
94
+ if (opts.includePaths) {
95
+ if (typeof opts.includePaths === 'string') {
96
+ opts.includePaths = [opts.includePaths];
97
+ }
98
+ } else {
99
+ opts.includePaths = [];
100
+ }
101
+ opts.includePaths.unshift(node.path.dirname(file.path));
102
+
103
+ // Generate Source Maps if the source-map plugin is present
104
+ if (file.sourceMap) {
105
+ opts.sourceMap = file.path;
106
+ opts.omitSourceMapUrl = true;
107
+ opts.sourceMapContents = true;
108
+ }
109
+ if (sync !== true) {
110
+ /**
111
+ * Async Sass render
112
+ */
113
+ sassModule.render(opts, (error, obj) => {
114
+ if (error) {
115
+ handleError(error, file, callback);
116
+ return;
117
+ }
118
+ filePush(file, obj, callback);
119
+ });
120
+ } else {
121
+ /**
122
+ * Sync Sass render
123
+ */
124
+ try {
125
+ filePush(file, sassModule.renderSync(opts), callback);
126
+ } catch (error) {
127
+ handleError(error, file, callback);
128
+ }
129
+ }
130
+ });
131
+ export default gulpSass;
@@ -1,24 +1,11 @@
1
- import fs from 'node:fs';
2
- import { pathToFileURL } from 'node:url';
3
- // Reference `gulp-sass@5.1.0`
1
+ // Reference `gulp-sass@6.0.1`
4
2
  import { Transform } from 'node:stream';
5
- import semver from 'semver';
6
3
  import * as sass from 'sass';
7
4
  import replaceExtension from 'replace-ext';
8
5
  import stripAnsi from 'strip-ansi';
9
6
  import applySourceMap from 'vinyl-sourcemaps-apply';
10
7
  import ansiColors from 'ansi-colors';
11
- process.env.BALM_CWD = process.env.INIT_CWD || process.cwd();
12
- const localSassModule = node.path.join(process.env.BALM_CWD, 'node_modules', 'sass');
13
- let isLegacy = false;
14
- try {
15
- const sassPkg = requireModule(node.path.join(localSassModule, 'package.json'));
16
- isLegacy = semver.lt(sassPkg.version, '1.40.0');
17
- } catch (_) {}
18
- const nodeLocalSassModule = node.path.join(localSassModule, 'sass.node.js');
19
- const defaultLocalSassModule = node.path.join(localSassModule, 'sass.default.js'); // For `npm i -D sass <= 1.62.1`
20
- const dartLocalSassModule = node.path.join(localSassModule, 'sass.dart.js'); // For `npm i -D sass <= 1.39.2`
21
- const sassModule = fs.existsSync(nodeLocalSassModule) ? requireModule(nodeLocalSassModule) : fs.existsSync(defaultLocalSassModule) ? requireModule(defaultLocalSassModule) : fs.existsSync(dartLocalSassModule) ? requireModule(dartLocalSassModule) : sass;
8
+ const sassModule = node.getSassModule(sass);
22
9
  const PLUGIN_NAME = 'sass';
23
10
  const transformObj = transform => new Transform({
24
11
  transform,
@@ -29,48 +16,44 @@ const transformObj = transform => new Transform({
29
16
  * Handles returning the file to the stream
30
17
  */
31
18
  function filePush(file, result, callback) {
32
- // Build Source Maps!
33
- if (result.sourceMap) {
34
- const sassMap = result.sourceMap;
35
- // Replace the map file with the original filename (but new extension)
36
- sassMap.file = replaceExtension(file.relative, '.css');
37
- // Apply the map
38
- applySourceMap(file, sassMap);
39
- }
40
19
  file.contents = Buffer.from(result.css);
41
20
  file.path = replaceExtension(file.path, '.css');
42
- if (file.stat) {
43
- file.stat.atime = file.stat.mtime = file.stat.ctime = new Date();
44
- }
45
- callback(null, file);
46
- }
47
- function legacyFilePush(file, sassObject, callback) {
21
+
48
22
  // Build Source Maps!
49
- if (sassObject.map) {
50
- // Transform map into JSON
51
- const sassMap = JSON.parse(sassObject.map.toString());
52
- // Grab the stdout and transform it into stdin
53
- const sassMapFile = sassMap.file.replace(/^stdout$/, 'stdin');
54
- // Grab the base filename that's being worked on
55
- const sassFileSrc = file.relative;
56
- // Grab the path portion of the file that's being worked on
57
- const sassFileSrcPath = node.path.dirname(sassFileSrc);
58
- if (sassFileSrcPath) {
59
- const sourceFileIndex = sassMap.sources.indexOf(sassMapFile);
60
- // Prepend the path to all files in the sources array except the file that's being worked on
61
- sassMap.sources = sassMap.sources.map((source, index) => index === sourceFileIndex ? source : node.path.join(sassFileSrcPath, source));
23
+ if (result.sourceMap) {
24
+ const proto = /^file:\/\/?/;
25
+ const leadingSlash = /^\//;
26
+ const sassMap = result.sourceMap;
27
+ const base = node.path.resolve(file.cwd, file.base);
28
+ if (!sassMap.file) {
29
+ // Convert from absolute path to relative as in gulp-sass 5.0.0
30
+ sassMap.file = file.history[0].replace(base + node.path.sep, '').replace(proto, '');
62
31
  }
63
32
 
64
- // Remove 'stdin' from sources and replace with filenames!
65
- sassMap.sources = sassMap.sources.filter(src => src !== 'stdin' && src);
33
+ // Transform to relative file paths as in gulp-sass 5.0.0
34
+ sassMap.sources = sassMap.sources.map(src => {
35
+ // file uses Windows-style path separators, source is a URL.
36
+ const baseUri = base.replace(/\\/g, '/');
37
+ // The current file and its content is included
38
+ // as data:<encoded file contents> in the new Sass JS API.
39
+ // Map it to the original file name (first history entry).
40
+ if (src.startsWith('data:')) {
41
+ return file.history[0].replace(/\\/g, '/').replace(`${baseUri}/`, '').replace(proto, '').replace(leadingSlash, '');
42
+ }
43
+ return src.replace(proto, '').replace(`${baseUri}/`, '').replace(leadingSlash, '');
44
+ });
66
45
 
46
+ // Grab the base filename that's being worked on
47
+ const sassFileSrc = file.relative;
67
48
  // Replace the map file with the original filename (but new extension)
68
49
  sassMap.file = replaceExtension(sassFileSrc, '.css');
50
+ if (file.sourceMap && file.sourceMap.sourcesContent && !sassMap.sourcesContent) {
51
+ sassMap.sourcesContent = file.sourceMap.sourcesContent;
52
+ }
53
+
69
54
  // Apply the map
70
55
  applySourceMap(file, sassMap);
71
56
  }
72
- file.contents = sassObject.css;
73
- file.path = replaceExtension(file.path, '.css');
74
57
  if (file.stat) {
75
58
  file.stat.atime = file.stat.mtime = file.stat.ctime = new Date();
76
59
  }
@@ -81,26 +64,17 @@ function legacyFilePush(file, sassObject, callback) {
81
64
  * Handles error message
82
65
  */
83
66
  function handleError(error, file, callback) {
84
- const relativePath = node.path.relative(process.cwd(), file.path);
85
- const message = `${ansiColors.underline(relativePath)}\n${error.message}`;
86
- error.message = stripAnsi(message);
87
- return callback(new PluginError(PLUGIN_NAME, error));
88
- }
89
- function legacyHandleError(error, file, callback) {
90
67
  const filePath = (error.file === 'stdin' ? file.path : error.file) || file.path;
91
68
  const relativePath = node.path.relative(process.cwd(), filePath);
92
- const message = `${ansiColors.underline(relativePath)}\n${error.formatted}`;
93
- error.messageFormatted = message;
94
- error.messageOriginal = error.message;
69
+ const message = `${ansiColors.underline(relativePath)}\n${error.message}`;
95
70
  error.message = stripAnsi(message);
96
- error.relativePath = relativePath;
97
71
  return callback(new PluginError(PLUGIN_NAME, error));
98
72
  }
99
73
 
100
74
  //////////////////////////////
101
75
  // Main Gulp Sass function
102
76
  //////////////////////////////
103
- const gulpSass = options => transformObj((file, encoding, callback) => {
77
+ const gulpSass = (options, sync = false) => transformObj((file, encoding, callback) => {
104
78
  if (file.isNull()) {
105
79
  return callback(null, file);
106
80
  }
@@ -115,79 +89,46 @@ const gulpSass = options => transformObj((file, encoding, callback) => {
115
89
  return callback(null, file);
116
90
  }
117
91
  const opts = options || {};
118
- if (isLegacy) {
119
- opts.data = file.contents.toString();
120
-
121
- // We set the file path here so that libsass can correctly resolve import paths
122
- opts.file = file.path;
123
-
124
- // Ensure `indentedSyntax` is true if a `.sass` file
125
- if (node.path.extname(file.path) === '.sass') {
126
- opts.indentedSyntax = true;
127
- }
128
92
 
129
- // Ensure file's parent directory in the include path
130
- if (opts.includePaths) {
131
- if (typeof opts.includePaths === 'string') {
132
- opts.includePaths = [opts.includePaths];
133
- }
134
- } else {
135
- opts.includePaths = [];
136
- }
137
- opts.includePaths.unshift(node.path.dirname(file.path));
93
+ // Ensure `indented` if a `.sass` file
94
+ if (node.path.extname(file.path) === '.sass') {
95
+ opts.syntax = 'indented';
96
+ }
138
97
 
139
- // Generate Source Maps if the source-map plugin is present
140
- if (file.sourceMap) {
141
- opts.sourceMap = file.path;
142
- opts.omitSourceMapUrl = true;
143
- opts.sourceMapContents = true;
98
+ // Ensure file's parent directory in the include path
99
+ if (opts.loadPaths) {
100
+ if (typeof opts.loadPaths === 'string') {
101
+ opts.loadPaths = [opts.loadPaths];
144
102
  }
103
+ } else {
104
+ opts.loadPaths = [];
105
+ }
106
+ opts.loadPaths.unshift(node.path.dirname(file.path));
145
107
 
146
- // Create alias
147
- if (!opts.importer) {
148
- const aliasKeys = Object.keys(BalmJS.config.scripts.alias).filter(key => /^@[a-z0-9-]{1,213}/.test(key));
149
- if (aliasKeys.length) {
150
- const aliasKeyRegex = new RegExp(`^(${aliasKeys.join('|')})/`);
151
- opts.importer = [function (url) {
152
- let file = url;
153
- const result = url.match(aliasKeyRegex);
154
- const key = result ? result[1] : null;
155
- if (key) {
156
- file = url.replace(key, BalmJS.config.scripts.alias[key]);
157
- BalmJS.logger.debug(`${PLUGIN_NAME} alias`, `${key} -> ${url} => ${file}`);
158
- }
159
- return {
160
- file
161
- };
162
- }];
163
- }
164
- }
108
+ // Generate Source Maps if the source-map plugin is present
109
+ if (file.sourceMap) {
110
+ opts.sourceMap = true;
111
+ opts.sourceMapIncludeSources = true;
112
+ }
113
+ const fileContents = file.contents.toString();
114
+ if (sync !== true) {
115
+ /**
116
+ * Async Sass compile
117
+ */
118
+ sassModule.compileStringAsync(fileContents, opts).then(compileResult => {
119
+ filePush(file, compileResult, callback);
120
+ }).catch(error => {
121
+ handleError(error, file, callback);
122
+ });
165
123
  } else {
166
- // Create alias
167
- if (!options.importers) {
168
- const aliasKeys = Object.keys(BalmJS.config.scripts.alias).filter(key => /^@[a-z0-9-]{1,213}/.test(key));
169
- if (aliasKeys.length) {
170
- const aliasKeyRegex = new RegExp(`^(${aliasKeys.join('|')})/`);
171
- options.importers = [{
172
- findFileUrl(url) {
173
- let file = url;
174
- const result = url.match(aliasKeyRegex);
175
- const key = result ? result[1] : null;
176
- if (key) {
177
- file = url.replace(key, BalmJS.config.scripts.alias[key]);
178
- BalmJS.logger.debug(`${PLUGIN_NAME} alias`, `${key} -> ${url} => ${file}`);
179
- }
180
- return pathToFileURL(file);
181
- }
182
- }];
183
- }
124
+ /**
125
+ * Sync Sass compile
126
+ */
127
+ try {
128
+ filePush(file, sassModule.compileString(fileContents, opts), callback);
129
+ } catch (error) {
130
+ handleError(error, file, callback);
184
131
  }
185
132
  }
186
- try {
187
- isLegacy ? legacyFilePush(file, sassModule.renderSync(opts), callback) : filePush(file, sassModule.compile(file.path, options), callback);
188
- } catch (error) {
189
- isLegacy ? legacyHandleError(error, file, callback) : handleError(error, file, callback);
190
- }
191
133
  });
192
- export default gulpSass;
193
- export { isLegacy };
134
+ export default gulpSass;
@@ -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 BalmTask {
@@ -46,7 +46,7 @@ class BalmStyleTask extends BalmTask {
46
46
  }));
47
47
  switch (style) {
48
48
  case 'sass':
49
- stream = stream.pipe(BalmJS.plugins.sass(options));
49
+ stream = stream.pipe(node.isLegacySass ? BalmJS.plugins.legacySass(options) : BalmJS.plugins.sass(options));
50
50
  break;
51
51
  case 'less':
52
52
  stream = stream.pipe(BalmJS.plugins.less(options));
@@ -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 gulpSize from 'gulp-size';
@@ -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 revAll from 'gulp-rev-all';
@@ -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 { deleteAsync } from 'del';
@@ -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 EndTask 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 ExtraTask 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 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';
@@ -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';