balm-core 4.22.1 → 4.23.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.
- package/index.d.ts +4 -0
- package/lib/config/scripts.js +1 -9
- package/lib/plugins/sass.js +16 -0
- package/package.json +13 -13
- package/tslib/config/scripts.js +1 -4
- package/tslib/plugins/sass.js +16 -0
package/index.d.ts
CHANGED
|
@@ -41,6 +41,10 @@ interface BalmStyles {
|
|
|
41
41
|
spriteParams: object;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// Sass
|
|
45
|
+
export type SassOptions = import('sass').Options<'sync'>;
|
|
46
|
+
export type SassImporter = import('sass').FileImporter<'sync'>;
|
|
47
|
+
|
|
44
48
|
// Webpack
|
|
45
49
|
export type WebpackEntry = import('webpack').Entry;
|
|
46
50
|
export type Configuration = import('webpack').Configuration;
|
package/lib/config/scripts.js
CHANGED
|
@@ -8,14 +8,6 @@ const minify = false;
|
|
|
8
8
|
*/
|
|
9
9
|
const minifyOptions = {
|
|
10
10
|
ecma: 5,
|
|
11
|
-
parse: {
|
|
12
|
-
// We want terser to parse ecma 8 code. However, we don't want it
|
|
13
|
-
// to apply any minification steps that turns valid ecma 5 code
|
|
14
|
-
// into invalid ecma 5 code. This is why the 'compress' and 'output'
|
|
15
|
-
// sections only apply transformations that are ecma 5 safe
|
|
16
|
-
// https://github.com/facebook/create-react-app/pull/4234
|
|
17
|
-
ecma: 2017
|
|
18
|
-
},
|
|
19
11
|
compress: {
|
|
20
12
|
// Disabled because of an issue with Uglify breaking seemingly valid code:
|
|
21
13
|
// https://github.com/facebook/create-react-app/issues/2376
|
|
@@ -31,7 +23,7 @@ const minifyOptions = {
|
|
|
31
23
|
mangle: {
|
|
32
24
|
safari10: true
|
|
33
25
|
},
|
|
34
|
-
|
|
26
|
+
format: {
|
|
35
27
|
comments: false,
|
|
36
28
|
// Turned on because emoji and regex is not minified properly using default
|
|
37
29
|
// https://github.com/facebook/create-react-app/issues/2488
|
package/lib/plugins/sass.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
3
4
|
// Reference `gulp-sass@5.1.0`
|
|
4
5
|
import { Transform } from 'node:stream';
|
|
5
6
|
import * as sass from 'sass';
|
|
@@ -67,6 +68,21 @@ const gulpSass = options => transformObj((file, encoding, callback) => {
|
|
|
67
68
|
return callback(null, file);
|
|
68
69
|
}
|
|
69
70
|
const path = file.path;
|
|
71
|
+
|
|
72
|
+
// Create alias
|
|
73
|
+
if (!options.importers && Object.keys(BalmJS.config.scripts.alias).length) {
|
|
74
|
+
options.importers = [];
|
|
75
|
+
for (const [key, value] of Object.entries(BalmJS.config.scripts.alias)) {
|
|
76
|
+
options.importers.push({
|
|
77
|
+
findFileUrl(url) {
|
|
78
|
+
if (!url.startsWith(key)) return null;
|
|
79
|
+
const newUrl = url.replace(new RegExp(`^${key}`), value);
|
|
80
|
+
BalmJS.logger.debug(`${PLUGIN_NAME} alias`, `${url} -> ${newUrl}`);
|
|
81
|
+
return pathToFileURL(newUrl);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
70
86
|
try {
|
|
71
87
|
filePush(file, sassModule.compile(path, options), callback);
|
|
72
88
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "balm-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.23.0",
|
|
4
4
|
"description": "BalmJS compiler core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"balm",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"@rollup/plugin-terser": "^0.4.3",
|
|
45
45
|
"ansi-colors": "^4.1.3",
|
|
46
46
|
"async": "^3.2.4",
|
|
47
|
-
"autoprefixer": "^10.4.
|
|
47
|
+
"autoprefixer": "^10.4.16",
|
|
48
48
|
"babel-loader": "^9.1.3",
|
|
49
49
|
"browser-sync": "^2.29.3",
|
|
50
50
|
"connect-history-api-fallback": "^2.0.0",
|
|
51
51
|
"css-loader": "^6.8.1",
|
|
52
52
|
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
53
53
|
"cssnano": "^6.0.1",
|
|
54
|
-
"del": "^7.
|
|
54
|
+
"del": "^7.1.0",
|
|
55
55
|
"dotenv": "^16.3.1",
|
|
56
56
|
"dotenv-expand": "^10.0.0",
|
|
57
57
|
"esbuild": "^0.19.0",
|
|
@@ -73,33 +73,33 @@
|
|
|
73
73
|
"istextorbinary": "^6.0.0",
|
|
74
74
|
"less": "^4.2.0",
|
|
75
75
|
"mini-css-extract-plugin": "^2.7.6",
|
|
76
|
-
"modernizr": "^3.
|
|
76
|
+
"modernizr": "^3.13.0",
|
|
77
77
|
"parents": "^1.0.1",
|
|
78
78
|
"plugin-error": "^2.0.1",
|
|
79
|
-
"postcss": "^8.4.
|
|
79
|
+
"postcss": "^8.4.30",
|
|
80
80
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
81
81
|
"postcss-import": "^15.1.0",
|
|
82
82
|
"postcss-load-config": "^4.0.1",
|
|
83
83
|
"postcss-loader": "7.3.3",
|
|
84
|
-
"postcss-preset-env": "^9.1.
|
|
84
|
+
"postcss-preset-env": "^9.1.4",
|
|
85
85
|
"pretty-bytes": "^6.1.1",
|
|
86
86
|
"readable-stream": "^4.4.2",
|
|
87
87
|
"replace-ext": "^2.0.0",
|
|
88
|
-
"rollup": "^3.
|
|
89
|
-
"sass": "^1.
|
|
88
|
+
"rollup": "^3.29.3",
|
|
89
|
+
"sass": "^1.68.0",
|
|
90
90
|
"sass-loader": "^13.3.2",
|
|
91
91
|
"ssh2": "^1.14.0",
|
|
92
92
|
"strip-ansi": "^7.1.0",
|
|
93
93
|
"style-loader": "^3.3.3",
|
|
94
94
|
"tailwindcss": "^3.3.3",
|
|
95
|
-
"terser": "^5.
|
|
95
|
+
"terser": "^5.20.0",
|
|
96
96
|
"terser-webpack-plugin": "^5.3.9",
|
|
97
97
|
"through2": "^4.0.2",
|
|
98
98
|
"through2-concurrent": "^2.0.0",
|
|
99
|
-
"tslib": "^2.6.
|
|
99
|
+
"tslib": "^2.6.2",
|
|
100
100
|
"vinyl-sourcemaps-apply": "^0.2.1",
|
|
101
|
-
"webpack": "^5.88.
|
|
102
|
-
"webpack-bundle-analyzer": "^4.9.
|
|
101
|
+
"webpack": "^5.88.2",
|
|
102
|
+
"webpack-bundle-analyzer": "^4.9.1",
|
|
103
103
|
"webpack-dev-middleware": "^6.1.1",
|
|
104
104
|
"webpack-hot-middleware": "^2.25.4",
|
|
105
105
|
"webpack-merge": "^5.9.0",
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
"engines": {
|
|
122
122
|
"node": ">=16"
|
|
123
123
|
},
|
|
124
|
-
"gitHead": "
|
|
124
|
+
"gitHead": "dd622fb3dd42f96992bf73fc238ebe8e725785b4"
|
|
125
125
|
}
|
package/tslib/config/scripts.js
CHANGED
|
@@ -2,9 +2,6 @@ const bundler = 'webpack';
|
|
|
2
2
|
const minify = false;
|
|
3
3
|
const minifyOptions = {
|
|
4
4
|
ecma: 5,
|
|
5
|
-
parse: {
|
|
6
|
-
ecma: 2017
|
|
7
|
-
},
|
|
8
5
|
compress: {
|
|
9
6
|
comparisons: false,
|
|
10
7
|
inline: 2
|
|
@@ -12,7 +9,7 @@ const minifyOptions = {
|
|
|
12
9
|
mangle: {
|
|
13
10
|
safari10: true
|
|
14
11
|
},
|
|
15
|
-
|
|
12
|
+
format: {
|
|
16
13
|
comments: false,
|
|
17
14
|
ascii_only: true
|
|
18
15
|
}
|
package/tslib/plugins/sass.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
3
4
|
import { Transform } from 'node:stream';
|
|
4
5
|
import * as sass from 'sass';
|
|
5
6
|
import replaceExtension from 'replace-ext';
|
|
@@ -54,6 +55,21 @@ const gulpSass = (options) => transformObj((file, encoding, callback) => {
|
|
|
54
55
|
return callback(null, file);
|
|
55
56
|
}
|
|
56
57
|
const path = file.path;
|
|
58
|
+
if (!options.importers &&
|
|
59
|
+
Object.keys(BalmJS.config.scripts.alias).length) {
|
|
60
|
+
options.importers = [];
|
|
61
|
+
for (const [key, value] of Object.entries(BalmJS.config.scripts.alias)) {
|
|
62
|
+
options.importers.push({
|
|
63
|
+
findFileUrl(url) {
|
|
64
|
+
if (!url.startsWith(key))
|
|
65
|
+
return null;
|
|
66
|
+
const newUrl = url.replace(new RegExp(`^${key}`), value);
|
|
67
|
+
BalmJS.logger.debug(`${PLUGIN_NAME} alias`, `${url} -> ${newUrl}`);
|
|
68
|
+
return pathToFileURL(newUrl);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
57
73
|
try {
|
|
58
74
|
filePush(file, sassModule.compile(path, options), callback);
|
|
59
75
|
}
|