@modern-js/plugin-tailwindcss 2.31.2 → 2.32.1

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,5 +1,38 @@
1
1
  # @modern-js/plugin-tailwindcss
2
2
 
3
+ ## 2.32.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5e04e3e: refactor(tailwindcss): allow to use tailwind theme config
8
+
9
+ refactor(tailwindcss): 支持使用 tailwind theme 配置
10
+
11
+ - Updated dependencies [90e053a]
12
+ - @modern-js/runtime@2.32.1
13
+ - @modern-js/utils@2.32.1
14
+
15
+ ## 2.32.0
16
+
17
+ ### Patch Changes
18
+
19
+ - 6076166: fix: packaging errors found by publint
20
+
21
+ fix: 修复 publint 检测到的 packaging 问题
22
+
23
+ - b31e9dd: chore(plugin-tailwindcss): use glob shorthand in the default config
24
+
25
+ chore(plugin-tailwindcss): 在默认配置中使用 glob 缩写
26
+
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
35
+
3
36
  ## 2.31.2
4
37
 
5
38
  ### Patch Changes
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Modern.js
3
+ Copyright (c) 2021-present Modern.js
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/cjs/cli.js CHANGED
@@ -32,16 +32,13 @@ const getRandomTwConfigFileName = (internalDirectory) => {
32
32
  };
33
33
  function getDefaultContent(appDirectory) {
34
34
  const defaultContent = [
35
- "./src/**/*.js",
36
- "./src/**/*.jsx",
37
- "./src/**/*.ts",
38
- "./src/**/*.tsx"
35
+ "./src/**/*.{js,jsx,ts,tsx}"
39
36
  ];
40
37
  if (_utils.fs.existsSync(_path.default.join(appDirectory, "storybook"))) {
41
38
  defaultContent.push("./storybook/**/*");
42
39
  }
43
40
  if (_utils.fs.existsSync(_path.default.join(appDirectory, "config/html"))) {
44
- defaultContent.push("./config/html/**/*.html", "./config/html/**/*.ejs", "./config/html/**/*.hbs");
41
+ defaultContent.push("./config/html/**/*.{html,ejs,hbs}");
45
42
  }
46
43
  return defaultContent;
47
44
  }
@@ -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
  };
package/dist/esm/cli.js CHANGED
@@ -11,16 +11,13 @@ export var getRandomTwConfigFileName = function(internalDirectory) {
11
11
  };
12
12
  function getDefaultContent(appDirectory) {
13
13
  var defaultContent = [
14
- "./src/**/*.js",
15
- "./src/**/*.jsx",
16
- "./src/**/*.ts",
17
- "./src/**/*.tsx"
14
+ "./src/**/*.{js,jsx,ts,tsx}"
18
15
  ];
19
16
  if (fs.existsSync(path.join(appDirectory, "storybook"))) {
20
17
  defaultContent.push("./storybook/**/*");
21
18
  }
22
19
  if (fs.existsSync(path.join(appDirectory, "config/html"))) {
23
- defaultContent.push("./config/html/**/*.html", "./config/html/**/*.ejs", "./config/html/**/*.hbs");
20
+ defaultContent.push("./config/html/**/*.{html,ejs,hbs}");
24
21
  }
25
22
  return defaultContent;
26
23
  }
@@ -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 };
@@ -9,16 +9,13 @@ export const getRandomTwConfigFileName = (internalDirectory) => {
9
9
  };
10
10
  function getDefaultContent(appDirectory) {
11
11
  const defaultContent = [
12
- "./src/**/*.js",
13
- "./src/**/*.jsx",
14
- "./src/**/*.ts",
15
- "./src/**/*.tsx"
12
+ "./src/**/*.{js,jsx,ts,tsx}"
16
13
  ];
17
14
  if (fs.existsSync(path.join(appDirectory, "storybook"))) {
18
15
  defaultContent.push("./storybook/**/*");
19
16
  }
20
17
  if (fs.existsSync(path.join(appDirectory, "config/html"))) {
21
- defaultContent.push("./config/html/**/*.html", "./config/html/**/*.ejs", "./config/html/**/*.hbs");
18
+ defaultContent.push("./config/html/**/*.{html,ejs,hbs}");
22
19
  }
23
20
  return defaultContent;
24
21
  }
@@ -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": "2.31.2",
18
+ "version": "2.32.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -33,7 +33,7 @@
33
33
  "default": "./dist/cjs/cli.js"
34
34
  },
35
35
  "./runtime-design-token": {
36
- "jsnext:source": "./src/design-token/index.js",
36
+ "jsnext:source": "./src/design-token/index.ts",
37
37
  "node": "./dist/cjs/design-token/index.js",
38
38
  "default": "./dist/esm/design-token/index.js"
39
39
  }
@@ -49,27 +49,27 @@
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": "2.31.2"
52
+ "@modern-js/utils": "2.32.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/jest": "^29",
56
56
  "@types/node": "^14",
57
57
  "typescript": "^5",
58
- "tailwindcss": "^3.2.4",
58
+ "tailwindcss": "^3.3.3",
59
59
  "jest": "^29",
60
60
  "react": "^18",
61
61
  "postcss": "8.4.27",
62
- "@modern-js/core": "2.31.2",
63
- "@modern-js/module-tools": "2.31.2",
64
- "@modern-js/runtime": "2.31.2",
65
- "@modern-js/types": "2.31.2",
66
- "@scripts/build": "2.31.1",
67
- "@modern-js/app-tools": "2.31.2",
68
- "@scripts/jest-config": "2.31.1"
62
+ "@modern-js/core": "2.32.1",
63
+ "@modern-js/module-tools": "2.32.1",
64
+ "@modern-js/runtime": "2.32.1",
65
+ "@modern-js/types": "2.32.1",
66
+ "@modern-js/app-tools": "2.32.1",
67
+ "@scripts/build": "2.32.1",
68
+ "@scripts/jest-config": "2.32.1"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "tailwindcss": ">= 2.0.0 || >= 3.0.0",
72
- "@modern-js/runtime": "^2.31.2"
72
+ "@modern-js/runtime": "^2.32.1"
73
73
  },
74
74
  "peerDependenciesMeta": {
75
75
  "@modern-js/runtime": {