balm-core 3.30.1 → 3.31.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,10 +1,14 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports["default"] = void 0;
8
+ var _fs = _interopRequireDefault(require("fs"));
7
9
  var _regex = require("../config/regex");
10
+ // Check if Tailwind config exists
11
+ var useTailwind = _fs["default"].existsSync(path.join(BalmJS.config.workspace, 'tailwind.config.js'));
8
12
  function cssLoader() {
9
13
  var styleLoader = {
10
14
  loader: require.resolve('style-loader'),
@@ -52,7 +56,7 @@ function cssLoader() {
52
56
  loader: require.resolve('postcss-loader'),
53
57
  options: Object.assign({
54
58
  postcssOptions: {
55
- plugins: BalmJS.plugins.postcssPlugins(true)
59
+ plugins: BalmJS.plugins.postcssPlugins(true, useTailwind)
56
60
  },
57
61
  sourceMap: sourceMap
58
62
  }, BalmJS.config.scripts.postcssLoaderOptions)
@@ -36,10 +36,10 @@ var lessOptions = {};
36
36
  * @reference https://github.com/csstools/postcss-preset-env#options
37
37
  */
38
38
  var postcssEnvOptions = {
39
- stage: 0,
40
39
  autoprefixer: {
41
40
  flexbox: 'no-2009'
42
- }
41
+ },
42
+ stage: 3
43
43
  };
44
44
  /**
45
45
  * PostCSS plugins
@@ -8,13 +8,15 @@ exports["default"] = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  function getDefaultPostcssPlugins() {
10
10
  var isPostCSS = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
11
- var postcssPresetEnv = require('postcss-preset-env');
11
+ var useTailwind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12
12
  var atImport = require('postcss-import');
13
+ var postcssFlexbugsFixes = require('postcss-flexbugs-fixes');
14
+ var postcssPresetEnv = require('postcss-preset-env');
13
15
  var autoprefixer = require('autoprefixer');
14
16
  var cssnano = require('cssnano');
15
- var defaultPostcssPlugins = isPostCSS || BalmJS.config.styles.extname === 'css' ? [postcssPresetEnv(BalmJS.config.styles.postcssEnvOptions), atImport({
17
+ var defaultPostcssPlugins = isPostCSS || BalmJS.config.styles.extname === 'css' ? [].concat((0, _toConsumableArray2["default"])(useTailwind ? ['tailwindcss'] : []), [atImport({
16
18
  path: BalmJS.file.stylePaths
17
- })] : [];
19
+ }), postcssFlexbugsFixes(), postcssPresetEnv(BalmJS.config.styles.postcssEnvOptions)]) : [];
18
20
  var cssnanoPlugin = BalmJS.config.env.isProd || BalmJS.config.styles.minify ? [cssnano(Object.assign(BalmJS.config.styles.options, {
19
21
  autoprefixer: false
20
22
  }))] : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "balm-core",
3
- "version": "3.30.1",
3
+ "version": "3.31.0",
4
4
  "description": "BalmJS compiler core",
5
5
  "keywords": [
6
6
  "balm",
@@ -74,6 +74,7 @@
74
74
  "parents": "^1.0.1",
75
75
  "plugin-error": "^2.0.1",
76
76
  "postcss": "7",
77
+ "postcss-flexbugs-fixes": "4",
77
78
  "postcss-import": "12",
78
79
  "postcss-load-config": "2",
79
80
  "postcss-loader": "4",
@@ -89,6 +90,7 @@
89
90
  "ssh2": "0.8.9",
90
91
  "strip-ansi": "6",
91
92
  "style-loader": "2",
93
+ "tailwindcss": "npm:@tailwindcss/postcss7-compat",
92
94
  "terser": "^5.16.6",
93
95
  "terser-webpack-plugin": "4",
94
96
  "through2": "^4.0.2",
@@ -117,5 +119,5 @@
117
119
  "engines": {
118
120
  "node": ">=10.13.0"
119
121
  },
120
- "gitHead": "fd25a9b3407f40c3ca76d56b0f58c2b6f1b18b7b"
122
+ "gitHead": "c8dba4cdbc84c9ea0f7e2912fb3f3b4b04b01caa"
121
123
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const fs_1 = tslib_1.__importDefault(require("fs"));
3
5
  const regex_1 = require("../config/regex");
6
+ const useTailwind = fs_1.default.existsSync(path.join(BalmJS.config.workspace, 'tailwind.config.js'));
4
7
  function cssLoader() {
5
8
  let styleLoader = {
6
9
  loader: require.resolve('style-loader'),
@@ -48,7 +51,7 @@ function cssLoader() {
48
51
  loader: require.resolve('postcss-loader'),
49
52
  options: Object.assign({
50
53
  postcssOptions: {
51
- plugins: BalmJS.plugins.postcssPlugins(true)
54
+ plugins: BalmJS.plugins.postcssPlugins(true, useTailwind)
52
55
  },
53
56
  sourceMap
54
57
  }, BalmJS.config.scripts.postcssLoaderOptions)
@@ -12,10 +12,10 @@ const options = {
12
12
  const sassOptions = {};
13
13
  const lessOptions = {};
14
14
  const postcssEnvOptions = {
15
- stage: 0,
16
15
  autoprefixer: {
17
16
  flexbox: 'no-2009'
18
- }
17
+ },
18
+ stage: 3
19
19
  };
20
20
  const postcssPlugins = [];
21
21
  const imageBasePath = '../';
@@ -1,14 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- function getDefaultPostcssPlugins(isPostCSS = false) {
4
- const postcssPresetEnv = require('postcss-preset-env');
3
+ function getDefaultPostcssPlugins(isPostCSS = false, useTailwind = false) {
5
4
  const atImport = require('postcss-import');
5
+ const postcssFlexbugsFixes = require('postcss-flexbugs-fixes');
6
+ const postcssPresetEnv = require('postcss-preset-env');
6
7
  const autoprefixer = require('autoprefixer');
7
8
  const cssnano = require('cssnano');
8
9
  const defaultPostcssPlugins = isPostCSS || BalmJS.config.styles.extname === 'css'
9
10
  ? [
10
- postcssPresetEnv(BalmJS.config.styles.postcssEnvOptions),
11
- atImport({ path: BalmJS.file.stylePaths })
11
+ ...(useTailwind ? ['tailwindcss'] : []),
12
+ atImport({ path: BalmJS.file.stylePaths }),
13
+ postcssFlexbugsFixes(),
14
+ postcssPresetEnv(BalmJS.config.styles.postcssEnvOptions)
12
15
  ]
13
16
  : [];
14
17
  const cssnanoPlugin = BalmJS.config.env.isProd || BalmJS.config.styles.minify