balm-core 4.19.0 → 4.21.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,5 +1,9 @@
1
+ import fs from 'node:fs';
1
2
  import MiniCssExtractPlugin from 'mini-css-extract-plugin';
2
3
  import { cssRegex, cssModuleRegex, sassRegex, sassModuleRegex } from '../config/regex.js';
4
+ // Check if Tailwind config exists
5
+ const useTailwind = fs.existsSync(node.path.join(BalmJS.config.workspace, 'tailwind.config.js'));
6
+
3
7
  // common function to get style loaders
4
8
  function getStyleLoaders(styleLoader, cssOptions, preProcessor = '', sassOptions = {}) {
5
9
  const {
@@ -17,7 +21,7 @@ function getStyleLoaders(styleLoader, cssOptions, preProcessor = '', sassOptions
17
21
  loader: requireModule.resolve('postcss-loader'),
18
22
  options: Object.assign({
19
23
  postcssOptions: {
20
- plugins: BalmJS.plugins.postcssPlugins(true)
24
+ plugins: BalmJS.plugins.postcssPlugins(true, useTailwind)
21
25
  },
22
26
  sourceMap
23
27
  }, BalmJS.config.scripts.postcssLoaderOptions)
@@ -30,10 +30,10 @@ const lessOptions = {};
30
30
  * @reference https://github.com/csstools/postcss-preset-env#options
31
31
  */
32
32
  const postcssEnvOptions = {
33
- stage: 0,
34
33
  autoprefixer: {
35
34
  flexbox: 'no-2009'
36
- }
35
+ },
36
+ stage: 3
37
37
  };
38
38
  /**
39
39
  * PostCSS plugins
@@ -3,8 +3,8 @@ import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
3
3
  import postcssPresetEnv from 'postcss-preset-env';
4
4
  import autoprefixer from 'autoprefixer';
5
5
  import cssnano from 'cssnano';
6
- function getDefaultPostcssPlugins(isPostCSS = false) {
7
- const defaultPostcssPlugins = isPostCSS || BalmJS.config.styles.extname === 'css' ? [atImport({
6
+ function getDefaultPostcssPlugins(isPostCSS = false, useTailwind = false) {
7
+ const defaultPostcssPlugins = isPostCSS || BalmJS.config.styles.extname === 'css' ? [...(useTailwind ? ['tailwindcss'] : []), atImport({
8
8
  path: BalmJS.file.stylePaths
9
9
  }), postcssFlexbugsFixes(), postcssPresetEnv(BalmJS.config.styles.postcssEnvOptions)] : [];
10
10
  const cssnanoPlugin = BalmJS.config.env.isProd || BalmJS.config.styles.minify ? [cssnano(BalmJS.config.styles.options)] : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "balm-core",
3
- "version": "4.19.0",
3
+ "version": "4.21.0",
4
4
  "description": "BalmJS compiler core",
5
5
  "keywords": [
6
6
  "balm",
@@ -41,18 +41,18 @@
41
41
  "directory": "packages/balm-core"
42
42
  },
43
43
  "dependencies": {
44
- "@rollup/plugin-terser": "^0.4.1",
44
+ "@rollup/plugin-terser": "^0.4.3",
45
45
  "ansi-colors": "^4.1.3",
46
46
  "async": "^3.2.4",
47
47
  "autoprefixer": "^10.4.14",
48
48
  "babel-loader": "^9.1.2",
49
- "browser-sync": "^2.29.1",
49
+ "browser-sync": "^2.29.3",
50
50
  "connect-history-api-fallback": "^2.0.0",
51
- "css-loader": "^6.7.3",
51
+ "css-loader": "^6.8.1",
52
52
  "css-minimizer-webpack-plugin": "^5.0.0",
53
- "cssnano": "^6.0.0",
53
+ "cssnano": "^6.0.1",
54
54
  "del": "^7.0.0",
55
- "dotenv": "^16.0.3",
55
+ "dotenv": "^16.1.4",
56
56
  "dotenv-expand": "^10.0.0",
57
57
  "esbuild": "^0.17.0",
58
58
  "fancy-log": "^2.0.0",
@@ -72,42 +72,43 @@
72
72
  "imagemin": "^8.0.1",
73
73
  "istextorbinary": "^6.0.0",
74
74
  "less": "^4.1.3",
75
- "mini-css-extract-plugin": "^2.7.5",
75
+ "mini-css-extract-plugin": "^2.7.6",
76
76
  "modernizr": "^3.12.0",
77
77
  "parents": "^1.0.1",
78
78
  "plugin-error": "^2.0.1",
79
- "postcss": "^8.4.23",
79
+ "postcss": "^8.4.24",
80
80
  "postcss-flexbugs-fixes": "^5.0.2",
81
81
  "postcss-import": "^15.1.0",
82
82
  "postcss-load-config": "^4.0.1",
83
- "postcss-loader": "7.2.4",
84
- "postcss-preset-env": "^8.3.2",
83
+ "postcss-loader": "7.3.2",
84
+ "postcss-preset-env": "^8.4.2",
85
85
  "pretty-bytes": "^6.1.0",
86
- "readable-stream": "^4.3.0",
86
+ "readable-stream": "^4.4.0",
87
87
  "replace-ext": "^2.0.0",
88
- "rollup": "^3.20.7",
89
- "sass": "^1.62.0",
90
- "sass-loader": "^13.2.2",
91
- "ssh2": "^1.11.0",
92
- "strip-ansi": "^7.0.1",
93
- "style-loader": "^3.3.2",
94
- "terser": "^5.17.1",
95
- "terser-webpack-plugin": "^5.3.7",
88
+ "rollup": "^3.24.0",
89
+ "sass": "1.62.1",
90
+ "sass-loader": "^13.3.1",
91
+ "ssh2": "^1.13.0",
92
+ "strip-ansi": "^7.1.0",
93
+ "style-loader": "^3.3.3",
94
+ "tailwindcss": "^3.3.2",
95
+ "terser": "^5.17.7",
96
+ "terser-webpack-plugin": "^5.3.9",
96
97
  "through2": "^4.0.2",
97
98
  "through2-concurrent": "^2.0.0",
98
- "tslib": "^2.5.0",
99
+ "tslib": "^2.5.3",
99
100
  "vinyl-sourcemaps-apply": "^0.2.1",
100
- "webpack": "^5.80.0",
101
- "webpack-bundle-analyzer": "^4.8.0",
102
- "webpack-dev-middleware": "^6.0.2",
101
+ "webpack": "^5.86.0",
102
+ "webpack-bundle-analyzer": "^4.9.0",
103
+ "webpack-dev-middleware": "^6.1.1",
103
104
  "webpack-hot-middleware": "^2.25.3",
104
- "webpack-merge": "^5.8.0",
105
- "workbox-build": "^6.5.4"
105
+ "webpack-merge": "^5.9.0",
106
+ "workbox-build": "^7.0.0"
106
107
  },
107
108
  "devDependencies": {
108
109
  "@swc/core": "1",
109
110
  "@types/express": "4",
110
- "@types/node": "18",
111
+ "@types/node": "20",
111
112
  "@types/uglify-js": "3",
112
113
  "@types/webpack": "5"
113
114
  },
@@ -120,5 +121,5 @@
120
121
  "engines": {
121
122
  "node": ">=16"
122
123
  },
123
- "gitHead": "8d41ece29df451e09e54cdc86b18ba8a37a491b2"
124
+ "gitHead": "e3e150f85429c7def79c2d466b058d26ed0b02e7"
124
125
  }
@@ -1,5 +1,7 @@
1
+ import fs from 'node:fs';
1
2
  import MiniCssExtractPlugin from 'mini-css-extract-plugin';
2
3
  import { cssRegex, cssModuleRegex, sassRegex, sassModuleRegex } from '../config/regex.js';
4
+ const useTailwind = fs.existsSync(node.path.join(BalmJS.config.workspace, 'tailwind.config.js'));
3
5
  function getStyleLoaders(styleLoader, cssOptions, preProcessor = '', sassOptions = {}) {
4
6
  const { sourceMap } = cssOptions;
5
7
  const loaders = [
@@ -19,7 +21,7 @@ function getStyleLoaders(styleLoader, cssOptions, preProcessor = '', sassOptions
19
21
  loader: requireModule.resolve('postcss-loader'),
20
22
  options: Object.assign({
21
23
  postcssOptions: {
22
- plugins: BalmJS.plugins.postcssPlugins(true)
24
+ plugins: BalmJS.plugins.postcssPlugins(true, useTailwind)
23
25
  },
24
26
  sourceMap
25
27
  }, BalmJS.config.scripts.postcssLoaderOptions)
@@ -10,10 +10,10 @@ const options = {
10
10
  const sassOptions = {};
11
11
  const lessOptions = {};
12
12
  const postcssEnvOptions = {
13
- stage: 0,
14
13
  autoprefixer: {
15
14
  flexbox: 'no-2009'
16
- }
15
+ },
16
+ stage: 3
17
17
  };
18
18
  const postcssPlugins = [];
19
19
  const imageBasePath = '../';
@@ -3,9 +3,10 @@ import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
3
3
  import postcssPresetEnv from 'postcss-preset-env';
4
4
  import autoprefixer from 'autoprefixer';
5
5
  import cssnano from 'cssnano';
6
- function getDefaultPostcssPlugins(isPostCSS = false) {
6
+ function getDefaultPostcssPlugins(isPostCSS = false, useTailwind = false) {
7
7
  const defaultPostcssPlugins = isPostCSS || BalmJS.config.styles.extname === 'css'
8
8
  ? [
9
+ ...(useTailwind ? ['tailwindcss'] : []),
9
10
  atImport({ path: BalmJS.file.stylePaths }),
10
11
  postcssFlexbugsFixes(),
11
12
  postcssPresetEnv(BalmJS.config.styles.postcssEnvOptions)