@modern-js/plugin-tailwindcss 0.0.0-next-1692814759279 → 0.0.0-next-1692886027894

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/CHANGELOG.md CHANGED
@@ -1,25 +1,37 @@
1
1
  # @modern-js/plugin-tailwindcss
2
2
 
3
- ## 0.0.0-next-1692814759279
3
+ ## 0.0.0-next-1692886027894
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 607616660: fix: packaging errors found by publint
7
+ - 5e04e3e5a: refactor(tailwindcss): allow to use tailwind theme config
8
+
9
+ refactor(tailwindcss): 支持使用 tailwind theme 配置
10
+
11
+ - Updated dependencies [90e053a65]
12
+ - @modern-js/runtime@0.0.0-next-1692886027894
13
+ - @modern-js/utils@0.0.0-next-1692886027894
14
+
15
+ ## 2.32.0
16
+
17
+ ### Patch Changes
18
+
19
+ - 6076166: fix: packaging errors found by publint
8
20
 
9
21
  fix: 修复 publint 检测到的 packaging 问题
10
22
 
11
- - b31e9dd8e: chore(plugin-tailwindcss): use glob shorthand in the default config
23
+ - b31e9dd: chore(plugin-tailwindcss): use glob shorthand in the default config
12
24
 
13
25
  chore(plugin-tailwindcss): 在默认配置中使用 glob 缩写
14
26
 
15
- - Updated dependencies [e5a3fb4ca]
16
- - Updated dependencies [607616660]
17
- - Updated dependencies [a030aff28]
18
- - Updated dependencies [92591c6a0]
19
- - Updated dependencies [3c911009a]
20
- - Updated dependencies [5255eba1f]
21
- - @modern-js/runtime@0.0.0-next-1692814759279
22
- - @modern-js/utils@0.0.0-next-1692814759279
27
+ - Updated dependencies [e5a3fb4]
28
+ - Updated dependencies [6076166]
29
+ - Updated dependencies [a030aff]
30
+ - Updated dependencies [92591c6]
31
+ - Updated dependencies [3c91100]
32
+ - Updated dependencies [5255eba]
33
+ - @modern-js/runtime@2.32.0
34
+ - @modern-js/utils@2.32.0
23
35
 
24
36
  ## 2.31.2
25
37
 
@@ -39,8 +39,7 @@ const _default = ({ pluginName } = {
39
39
  alias: {
40
40
  "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
41
41
  }
42
- },
43
- tools: {}
42
+ }
44
43
  };
45
44
  },
46
45
  modifyEntryImports({ entrypoint, imports }) {
@@ -10,21 +10,10 @@ Object.defineProperty(exports, "getTailwindConfig", {
10
10
  });
11
11
  const _utils = require("@modern-js/utils");
12
12
  const _lodash = require("@modern-js/utils/lodash");
13
- const checkIfExistNotAllowKeys = (tailwindConfig) => {
14
- const notAllowExistKeys = [
15
- "theme"
16
- ];
17
- let notAllowKey = "";
18
- const ret = Object.keys(tailwindConfig).some((key) => notAllowExistKeys.includes(key) && (notAllowKey = key));
19
- return [
20
- ret,
21
- notAllowKey
22
- ];
23
- };
24
- const getPureDesignSystemConfig = (designSystemConfig) => {
25
- const pureDesignSystemConfig = (0, _lodash.cloneDeep)(designSystemConfig);
26
- delete pureDesignSystemConfig.supportStyledComponents;
27
- return pureDesignSystemConfig;
13
+ const getPureDesignSystemConfig = (config) => {
14
+ const pureConfig = (0, _lodash.cloneDeep)(config);
15
+ delete pureConfig.supportStyledComponents;
16
+ return pureConfig;
28
17
  };
29
18
  const getTailwindConfig = (tailwindVersion, tailwindcss, designSystem, option = {}) => {
30
19
  const purgeConfig = (0, _lodash.merge)({
@@ -43,11 +32,8 @@ const getTailwindConfig = (tailwindVersion, tailwindcss, designSystem, option =
43
32
  };
44
33
  const tailwindConfig = (0, _utils.applyOptionsChain)(defaultTailwindConfig, tailwindcss || {});
45
34
  const designSystemConfig = getPureDesignSystemConfig(designSystem !== null && designSystem !== void 0 ? designSystem : {});
46
- const [exist, key] = checkIfExistNotAllowKeys(tailwindConfig);
47
- if (exist) {
48
- _utils.logger.error(`should not exist '${key}' on tools.tailwindcss, please remove it`);
49
- process.exit(0);
35
+ if (designSystemConfig && Object.keys(designSystemConfig).length > 0) {
36
+ tailwindConfig.theme = designSystemConfig;
50
37
  }
51
- tailwindConfig.theme = designSystemConfig || {};
52
38
  return tailwindConfig;
53
39
  };
@@ -30,8 +30,7 @@ export default function() {
30
30
  alias: {
31
31
  "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
32
32
  }
33
- },
34
- tools: {}
33
+ }
35
34
  };
36
35
  },
37
36
  modifyEntryImports: function modifyEntryImports(param) {
@@ -1,23 +1,9 @@
1
- import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
2
- import { applyOptionsChain, logger } from "@modern-js/utils";
1
+ import { applyOptionsChain } from "@modern-js/utils";
3
2
  import { merge, cloneDeep } from "@modern-js/utils/lodash";
4
- var checkIfExistNotAllowKeys = function(tailwindConfig) {
5
- var notAllowExistKeys = [
6
- "theme"
7
- ];
8
- var notAllowKey = "";
9
- var ret = Object.keys(tailwindConfig).some(function(key) {
10
- return notAllowExistKeys.includes(key) && (notAllowKey = key);
11
- });
12
- return [
13
- ret,
14
- notAllowKey
15
- ];
16
- };
17
- var getPureDesignSystemConfig = function(designSystemConfig) {
18
- var pureDesignSystemConfig = cloneDeep(designSystemConfig);
19
- delete pureDesignSystemConfig.supportStyledComponents;
20
- return pureDesignSystemConfig;
3
+ var getPureDesignSystemConfig = function(config) {
4
+ var pureConfig = cloneDeep(config);
5
+ delete pureConfig.supportStyledComponents;
6
+ return pureConfig;
21
7
  };
22
8
  var getTailwindConfig = function(tailwindVersion, tailwindcss, designSystem) {
23
9
  var option = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
@@ -37,12 +23,9 @@ var getTailwindConfig = function(tailwindVersion, tailwindcss, designSystem) {
37
23
  };
38
24
  var tailwindConfig = applyOptionsChain(defaultTailwindConfig, tailwindcss || {});
39
25
  var designSystemConfig = getPureDesignSystemConfig(designSystem !== null && designSystem !== void 0 ? designSystem : {});
40
- var _checkIfExistNotAllowKeys = _sliced_to_array(checkIfExistNotAllowKeys(tailwindConfig), 2), exist = _checkIfExistNotAllowKeys[0], key = _checkIfExistNotAllowKeys[1];
41
- if (exist) {
42
- logger.error("should not exist '".concat(key, "' on tools.tailwindcss, please remove it"));
43
- process.exit(0);
26
+ if (designSystemConfig && Object.keys(designSystemConfig).length > 0) {
27
+ tailwindConfig.theme = designSystemConfig;
44
28
  }
45
- tailwindConfig.theme = designSystemConfig || {};
46
29
  return tailwindConfig;
47
30
  };
48
31
  export { getTailwindConfig };
@@ -29,8 +29,7 @@ export default ({ pluginName } = {
29
29
  alias: {
30
30
  "@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
31
31
  }
32
- },
33
- tools: {}
32
+ }
34
33
  };
35
34
  },
36
35
  modifyEntryImports({ entrypoint, imports }) {
@@ -1,20 +1,9 @@
1
- import { applyOptionsChain, logger } from "@modern-js/utils";
1
+ import { applyOptionsChain } from "@modern-js/utils";
2
2
  import { merge, cloneDeep } from "@modern-js/utils/lodash";
3
- const checkIfExistNotAllowKeys = (tailwindConfig) => {
4
- const notAllowExistKeys = [
5
- "theme"
6
- ];
7
- let notAllowKey = "";
8
- const ret = Object.keys(tailwindConfig).some((key) => notAllowExistKeys.includes(key) && (notAllowKey = key));
9
- return [
10
- ret,
11
- notAllowKey
12
- ];
13
- };
14
- const getPureDesignSystemConfig = (designSystemConfig) => {
15
- const pureDesignSystemConfig = cloneDeep(designSystemConfig);
16
- delete pureDesignSystemConfig.supportStyledComponents;
17
- return pureDesignSystemConfig;
3
+ const getPureDesignSystemConfig = (config) => {
4
+ const pureConfig = cloneDeep(config);
5
+ delete pureConfig.supportStyledComponents;
6
+ return pureConfig;
18
7
  };
19
8
  const getTailwindConfig = (tailwindVersion, tailwindcss, designSystem, option = {}) => {
20
9
  const purgeConfig = merge({
@@ -33,12 +22,9 @@ const getTailwindConfig = (tailwindVersion, tailwindcss, designSystem, option =
33
22
  };
34
23
  const tailwindConfig = applyOptionsChain(defaultTailwindConfig, tailwindcss || {});
35
24
  const designSystemConfig = getPureDesignSystemConfig(designSystem !== null && designSystem !== void 0 ? designSystem : {});
36
- const [exist, key] = checkIfExistNotAllowKeys(tailwindConfig);
37
- if (exist) {
38
- logger.error(`should not exist '${key}' on tools.tailwindcss, please remove it`);
39
- process.exit(0);
25
+ if (designSystemConfig && Object.keys(designSystemConfig).length > 0) {
26
+ tailwindConfig.theme = designSystemConfig;
40
27
  }
41
- tailwindConfig.theme = designSystemConfig || {};
42
28
  return tailwindConfig;
43
29
  };
44
30
  export { getTailwindConfig };
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-next-1692814759279",
18
+ "version": "0.0.0-next-1692886027894",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -49,7 +49,7 @@
49
49
  "babel-plugin-macros": "3.1.0",
50
50
  "hoist-non-react-statics": "^3.3.2",
51
51
  "@swc/helpers": "0.5.1",
52
- "@modern-js/utils": "0.0.0-next-1692814759279"
52
+ "@modern-js/utils": "0.0.0-next-1692886027894"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/jest": "^29",
@@ -59,17 +59,17 @@
59
59
  "jest": "^29",
60
60
  "react": "^18",
61
61
  "postcss": "8.4.27",
62
- "@modern-js/core": "0.0.0-next-1692814759279",
63
- "@modern-js/module-tools": "0.0.0-next-1692814759279",
64
- "@modern-js/runtime": "0.0.0-next-1692814759279",
65
- "@modern-js/types": "0.0.0-next-1692814759279",
66
- "@scripts/build": "0.0.0-next-1692814759279",
67
- "@modern-js/app-tools": "0.0.0-next-1692814759279",
68
- "@scripts/jest-config": "0.0.0-next-1692814759279"
62
+ "@modern-js/core": "0.0.0-next-1692886027894",
63
+ "@modern-js/runtime": "0.0.0-next-1692886027894",
64
+ "@modern-js/module-tools": "0.0.0-next-1692886027894",
65
+ "@modern-js/types": "0.0.0-next-1692886027894",
66
+ "@scripts/build": "0.0.0-next-1692886027894",
67
+ "@scripts/jest-config": "0.0.0-next-1692886027894",
68
+ "@modern-js/app-tools": "0.0.0-next-1692886027894"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "tailwindcss": ">= 2.0.0 || >= 3.0.0",
72
- "@modern-js/runtime": "0.0.0-next-1692814759279"
72
+ "@modern-js/runtime": "0.0.0-next-1692886027894"
73
73
  },
74
74
  "peerDependenciesMeta": {
75
75
  "@modern-js/runtime": {