@douyinfe/semi-rspack-plugin 2.88.3 → 2.89.0-alpha.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.
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const enhanced_resolve_1 = __importDefault(require("enhanced-resolve"));
7
7
  const componentName_1 = __importDefault(require("../componentName"));
8
+ const fs_1 = __importDefault(require("fs"));
8
9
  function SemiThemeLoader(source) {
9
10
  const query = this.getOptions();
10
11
  const theme = query.name || '@douyinfe/semi-theme-default';
@@ -55,10 +56,16 @@ function SemiThemeLoader(source) {
55
56
  if (shouldInject) {
56
57
  const customStr = (() => {
57
58
  let customStr = '';
59
+ let addBodySelector = true;
58
60
  try {
59
61
  if (!enhanced_resolve_1.default.sync(this.context, `${theme}/scss/custom.scss`)) {
60
62
  return '';
61
63
  }
64
+ const resolved = require.resolve(`${theme}/scss/custom.scss`);
65
+ const customFileContent = fs_1.default.readFileSync(resolved, 'utf-8');
66
+ if (customFileContent.includes('body {')) {
67
+ addBodySelector = false;
68
+ }
62
69
  const collectAllVariablesPath = [
63
70
  ...componentName_1.default,
64
71
  ];
@@ -73,7 +80,7 @@ function SemiThemeLoader(source) {
73
80
  catch (e) {
74
81
  customStr = ''; // fallback to empty string
75
82
  }
76
- return `body:not(:not(body)){${customStr}};`;
83
+ return addBodySelector ? `body:not(:not(body)){${customStr}};` : customStr;
77
84
  })();
78
85
  finalCSS = `${animationStr}${cssVarStr}${scssVarStr}${prefixClsStr}${fileStr}${customStr}`;
79
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-rspack-plugin",
3
- "version": "2.88.3",
3
+ "version": "2.89.0-alpha.0",
4
4
  "description": "",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -33,5 +33,5 @@
33
33
  "typescript": "^4",
34
34
  "webpack": "^5.77.0"
35
35
  },
36
- "gitHead": "5f79a271fdeb8e6980a3a833785105dd68030a8c"
36
+ "gitHead": "5760245f1cacac2e9ecdeb3d53d723a76d0e25be"
37
37
  }