@douyinfe/semi-rspack-plugin 2.54.1 → 2.55.0-beta.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.
@@ -0,0 +1,2 @@
1
+ declare const componentVariablePathList: string[];
2
+ export default componentVariablePathList;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const componentVariablePathList = [
4
+ '@douyinfe/semi-foundation/tooltip/variables.scss',
5
+ '@douyinfe/semi-foundation/anchor/variables.scss',
6
+ '@douyinfe/semi-foundation/autoComplete/variables.scss',
7
+ '@douyinfe/semi-foundation/avatar/variables.scss',
8
+ '@douyinfe/semi-foundation/backtop/variables.scss',
9
+ '@douyinfe/semi-foundation/badge/variables.scss',
10
+ '@douyinfe/semi-foundation/banner/variables.scss',
11
+ '@douyinfe/semi-foundation/breadcrumb/variables.scss',
12
+ '@douyinfe/semi-foundation/button/variables.scss',
13
+ '@douyinfe/semi-foundation/calendar/variables.scss',
14
+ '@douyinfe/semi-foundation/card/variables.scss',
15
+ '@douyinfe/semi-foundation/carousel/variables.scss',
16
+ '@douyinfe/semi-foundation/cascader/variables.scss',
17
+ '@douyinfe/semi-foundation/checkbox/variables.scss',
18
+ '@douyinfe/semi-foundation/collapse/variables.scss',
19
+ '@douyinfe/semi-foundation/collapsible/variables.scss',
20
+ '@douyinfe/semi-foundation/datePicker/variables.scss',
21
+ '@douyinfe/semi-foundation/descriptions/variables.scss',
22
+ '@douyinfe/semi-foundation/divider/variables.scss',
23
+ '@douyinfe/semi-foundation/dropdown/variables.scss',
24
+ '@douyinfe/semi-foundation/empty/variables.scss',
25
+ '@douyinfe/semi-foundation/form/variables.scss',
26
+ '@douyinfe/semi-foundation/grid/variables.scss',
27
+ '@douyinfe/semi-foundation/highlight/variables.scss',
28
+ '@douyinfe/semi-foundation/image/variables.scss',
29
+ '@douyinfe/semi-foundation/input/variables.scss',
30
+ '@douyinfe/semi-foundation/inputNumber/variables.scss',
31
+ '@douyinfe/semi-foundation/list/variables.scss',
32
+ '@douyinfe/semi-foundation/modal/variables.scss',
33
+ '@douyinfe/semi-foundation/navigation/variables.scss',
34
+ '@douyinfe/semi-foundation/notification/variables.scss',
35
+ '@douyinfe/semi-foundation/pagination/variables.scss',
36
+ '@douyinfe/semi-foundation/popconfirm/variables.scss',
37
+ '@douyinfe/semi-foundation/popover/variables.scss',
38
+ '@douyinfe/semi-foundation/progress/variables.scss',
39
+ '@douyinfe/semi-foundation/radio/variables.scss',
40
+ '@douyinfe/semi-foundation/rating/variables.scss',
41
+ '@douyinfe/semi-foundation/scrollList/variables.scss',
42
+ '@douyinfe/semi-foundation/select/variables.scss',
43
+ '@douyinfe/semi-foundation/sideSheet/variables.scss',
44
+ '@douyinfe/semi-foundation/skeleton/variables.scss',
45
+ '@douyinfe/semi-foundation/slider/variables.scss',
46
+ '@douyinfe/semi-foundation/space/variables.scss',
47
+ '@douyinfe/semi-foundation/spin/variables.scss',
48
+ '@douyinfe/semi-foundation/steps/variables.scss',
49
+ '@douyinfe/semi-foundation/switch/variables.scss',
50
+ '@douyinfe/semi-foundation/table/variables.scss',
51
+ '@douyinfe/semi-foundation/tabs/variables.scss',
52
+ '@douyinfe/semi-foundation/tag/variables.scss',
53
+ '@douyinfe/semi-foundation/tagInput/variables.scss',
54
+ '@douyinfe/semi-foundation/timePicker/variables.scss',
55
+ '@douyinfe/semi-foundation/timeline/variables.scss',
56
+ '@douyinfe/semi-foundation/toast/variables.scss',
57
+ '@douyinfe/semi-foundation/transfer/variables.scss',
58
+ '@douyinfe/semi-foundation/tree/variables.scss',
59
+ '@douyinfe/semi-foundation/treeSelect/variables.scss',
60
+ '@douyinfe/semi-foundation/typography/variables.scss',
61
+ '@douyinfe/semi-foundation/upload/variables.scss'
62
+ ];
63
+ exports.default = componentVariablePathList;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const enhanced_resolve_1 = __importDefault(require("enhanced-resolve"));
7
+ const componentName_1 = __importDefault(require("../componentName"));
7
8
  function SemiThemeLoader(source) {
8
9
  const query = this.getOptions();
9
10
  const theme = query.name || '@douyinfe/semi-theme-default';
@@ -50,7 +51,29 @@ function SemiThemeLoader(source) {
50
51
  const prefixCls = query.prefixCls || 'semi';
51
52
  const prefixClsStr = `$prefix: '${prefixCls}';\n`;
52
53
  if (shouldInject) {
53
- return `${animationStr}${cssVarStr}${scssVarStr}${prefixClsStr}${fileStr}`;
54
+ const customStr = (() => {
55
+ let customStr = '';
56
+ try {
57
+ if (!enhanced_resolve_1.default.sync(this.context, `${theme}/scss/custom.scss`)) {
58
+ return '';
59
+ }
60
+ const collectAllVariablesPath = [
61
+ ...componentName_1.default,
62
+ ];
63
+ if (componentVariables) {
64
+ collectAllVariablesPath.push(`${theme}/scss/local.scss`);
65
+ }
66
+ collectAllVariablesPath.push(`${theme}/scss/custom.scss`);
67
+ customStr = collectAllVariablesPath.map(p => {
68
+ return `@import "~${p}";`;
69
+ }).join('\n') + '\n' + customStr;
70
+ }
71
+ catch (e) {
72
+ customStr = ''; // fallback to empty string
73
+ }
74
+ return `body:not(:not(body)){${customStr}};`;
75
+ })();
76
+ return `${animationStr}${cssVarStr}${scssVarStr}${prefixClsStr}${fileStr}${customStr}`;
54
77
  }
55
78
  else {
56
79
  return `${scssVarStr}${prefixClsStr}${fileStr}`;
package/lib/rule.js CHANGED
@@ -18,7 +18,12 @@ function createThemeLoaderRule(opts) {
18
18
  else {
19
19
  themeOptions.name = opts.theme;
20
20
  }
21
- const options = Object.assign(Object.assign({}, themeOptions), { prefixCls: opts.prefixCls, variables: (0, utils_1.stringifyVariableRecord)(opts.variables), include: opts.include });
21
+ const options = {
22
+ ...themeOptions,
23
+ prefixCls: opts.prefixCls,
24
+ variables: (0, utils_1.stringifyVariableRecord)(opts.variables),
25
+ include: opts.include,
26
+ };
22
27
  return {
23
28
  test: /@douyinfe\/semi-(ui|icons|foundation)\/lib\/.+\.scss$/,
24
29
  use: [{ loader: constants_1.THEME_LOADER, options }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-rspack-plugin",
3
- "version": "2.54.1",
3
+ "version": "2.55.0-beta.0",
4
4
  "description": "",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -30,5 +30,5 @@
30
30
  "typescript": "^4",
31
31
  "webpack": "^5.77.0"
32
32
  },
33
- "gitHead": "29a9d7e115640dd1e9d8559609d9e4ee44dcfd12"
33
+ "gitHead": "1b20ba60f41785e247a71987235b5f3bbd577ff0"
34
34
  }