balm-core 4.23.2 → 4.23.4

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.
@@ -71,17 +71,17 @@ const gulpSass = options => transformObj((file, encoding, callback) => {
71
71
 
72
72
  // Create alias
73
73
  if (!options.importers) {
74
- const aliasKeys = Object.keys(BalmJS.config.scripts.alias).filter(key => /^@\w+/.test(key));
74
+ const aliasKeys = Object.keys(BalmJS.config.scripts.alias).filter(key => /^@[a-z0-9-]{1,213}/.test(key));
75
75
  if (aliasKeys.length) {
76
- const aliasKeyRegex = new RegExp(`^${aliasKeys.join('|')}`);
76
+ const aliasKeyRegex = new RegExp(`^(${aliasKeys.join('|')})/`);
77
77
  options.importers = [{
78
78
  findFileUrl(url) {
79
79
  let file = url;
80
80
  const result = url.match(aliasKeyRegex);
81
- const key = result ? result[0] : null;
81
+ const key = result ? result[1] : null;
82
82
  if (key) {
83
- file = url.replace(aliasKeyRegex, BalmJS.config.scripts.alias[key]);
84
- BalmJS.logger.debug(`${PLUGIN_NAME} alias`, `${url} -> ${file}`);
83
+ file = url.replace(key, BalmJS.config.scripts.alias[key]);
84
+ BalmJS.logger.debug(`${PLUGIN_NAME} alias`, `${key} -> ${url} => ${file}`);
85
85
  }
86
86
  return pathToFileURL(file);
87
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "balm-core",
3
- "version": "4.23.2",
3
+ "version": "4.23.4",
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": "f0776661b321ddeab4abc03c62cc3ccf336c4a06"
124
+ "gitHead": "e0804cb73144575327351c9a48cb6bb0af240899"
125
125
  }
@@ -56,18 +56,18 @@ const gulpSass = (options) => transformObj((file, encoding, callback) => {
56
56
  }
57
57
  const path = file.path;
58
58
  if (!options.importers) {
59
- const aliasKeys = Object.keys(BalmJS.config.scripts.alias).filter((key) => /^@\w+/.test(key));
59
+ const aliasKeys = Object.keys(BalmJS.config.scripts.alias).filter((key) => /^@[a-z0-9-]{1,213}/.test(key));
60
60
  if (aliasKeys.length) {
61
- const aliasKeyRegex = new RegExp(`^${aliasKeys.join('|')}`);
61
+ const aliasKeyRegex = new RegExp(`^(${aliasKeys.join('|')})/`);
62
62
  options.importers = [
63
63
  {
64
64
  findFileUrl(url) {
65
65
  let file = url;
66
66
  const result = url.match(aliasKeyRegex);
67
- const key = result ? result[0] : null;
67
+ const key = result ? result[1] : null;
68
68
  if (key) {
69
- file = url.replace(aliasKeyRegex, BalmJS.config.scripts.alias[key]);
70
- BalmJS.logger.debug(`${PLUGIN_NAME} alias`, `${url} -> ${file}`);
69
+ file = url.replace(key, BalmJS.config.scripts.alias[key]);
70
+ BalmJS.logger.debug(`${PLUGIN_NAME} alias`, `${key} -> ${url} => ${file}`);
71
71
  }
72
72
  return pathToFileURL(file);
73
73
  }