balm-core 4.23.1 → 4.23.2
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/lib/plugins/sass.js +13 -11
- package/package.json +2 -2
- package/tslib/plugins/sass.js +16 -14
package/lib/plugins/sass.js
CHANGED
|
@@ -70,20 +70,22 @@ const gulpSass = options => transformObj((file, encoding, callback) => {
|
|
|
70
70
|
const path = file.path;
|
|
71
71
|
|
|
72
72
|
// Create alias
|
|
73
|
-
if (!options.importers
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
if (!options.importers) {
|
|
74
|
+
const aliasKeys = Object.keys(BalmJS.config.scripts.alias).filter(key => /^@\w+/.test(key));
|
|
75
|
+
if (aliasKeys.length) {
|
|
76
|
+
const aliasKeyRegex = new RegExp(`^${aliasKeys.join('|')}`);
|
|
77
|
+
options.importers = [{
|
|
77
78
|
findFileUrl(url) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
let file = url;
|
|
80
|
+
const result = url.match(aliasKeyRegex);
|
|
81
|
+
const key = result ? result[0] : null;
|
|
82
|
+
if (key) {
|
|
83
|
+
file = url.replace(aliasKeyRegex, BalmJS.config.scripts.alias[key]);
|
|
84
|
+
BalmJS.logger.debug(`${PLUGIN_NAME} alias`, `${url} -> ${file}`);
|
|
84
85
|
}
|
|
86
|
+
return pathToFileURL(file);
|
|
85
87
|
}
|
|
86
|
-
}
|
|
88
|
+
}];
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "balm-core",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.2",
|
|
4
4
|
"description": "BalmJS compiler core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"balm",
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
"engines": {
|
|
122
122
|
"node": ">=16"
|
|
123
123
|
},
|
|
124
|
-
"gitHead": "
|
|
124
|
+
"gitHead": "f0776661b321ddeab4abc03c62cc3ccf336c4a06"
|
|
125
125
|
}
|
package/tslib/plugins/sass.js
CHANGED
|
@@ -55,22 +55,24 @@ const gulpSass = (options) => transformObj((file, encoding, callback) => {
|
|
|
55
55
|
return callback(null, file);
|
|
56
56
|
}
|
|
57
57
|
const path = file.path;
|
|
58
|
-
if (!options.importers
|
|
59
|
-
Object.keys(BalmJS.config.scripts.alias).
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
options.importers
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
if (!options.importers) {
|
|
59
|
+
const aliasKeys = Object.keys(BalmJS.config.scripts.alias).filter((key) => /^@\w+/.test(key));
|
|
60
|
+
if (aliasKeys.length) {
|
|
61
|
+
const aliasKeyRegex = new RegExp(`^${aliasKeys.join('|')}`);
|
|
62
|
+
options.importers = [
|
|
63
|
+
{
|
|
64
|
+
findFileUrl(url) {
|
|
65
|
+
let file = url;
|
|
66
|
+
const result = url.match(aliasKeyRegex);
|
|
67
|
+
const key = result ? result[0] : null;
|
|
68
|
+
if (key) {
|
|
69
|
+
file = url.replace(aliasKeyRegex, BalmJS.config.scripts.alias[key]);
|
|
70
|
+
BalmJS.logger.debug(`${PLUGIN_NAME} alias`, `${url} -> ${file}`);
|
|
71
|
+
}
|
|
72
|
+
return pathToFileURL(file);
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
|
-
|
|
75
|
+
];
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
try {
|