@modern-js/plugin-tailwindcss 0.0.0-next-20221130140620 → 0.0.0-next-20221202032240
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 +37 -35
- package/dist/js/modern/cli.js +32 -32
- package/dist/js/modern/design-token/cli/index.js +7 -11
- package/dist/js/modern/design-token/runtime/plugin.js +1 -3
- package/dist/js/modern/tailwind.js +4 -5
- package/dist/js/node/cli.js +32 -32
- package/dist/js/node/design-token/cli/index.js +7 -11
- package/dist/js/node/design-token/runtime/plugin.js +1 -3
- package/dist/js/node/tailwind.js +4 -5
- package/dist/js/treeshaking/cli.js +28 -29
- package/dist/js/treeshaking/design-token/cli/index.js +6 -8
- package/dist/js/treeshaking/tailwind.js +5 -6
- package/dist/types/cli.d.ts +3 -2
- package/dist/types/tailwind.d.ts +3 -3
- package/dist/types/types.d.ts +4 -10
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# @modern-js/plugin-tailwindcss
|
|
2
2
|
|
|
3
|
-
## 0.0.0-next-
|
|
3
|
+
## 0.0.0-next-20221202032240
|
|
4
4
|
|
|
5
5
|
### Major Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- dda38c9c3e: chore: v2
|
|
8
8
|
|
|
9
9
|
### Minor Changes
|
|
10
10
|
|
|
11
|
-
-
|
|
11
|
+
- 92f0eade39: feat:
|
|
12
12
|
|
|
13
13
|
1. add style config and add new hook
|
|
14
14
|
2. add dts alias logic
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
4. 添加日志逻辑
|
|
25
25
|
5. 添加 skipDeps 配置
|
|
26
26
|
|
|
27
|
-
-
|
|
27
|
+
- 92f0eade39: feat:
|
|
28
28
|
|
|
29
29
|
1. core: 增加 test 函数
|
|
30
30
|
2. module plugins: 增加 `babel`, `mainField`, `target` 插件
|
|
@@ -40,37 +40,39 @@
|
|
|
40
40
|
|
|
41
41
|
### Patch Changes
|
|
42
42
|
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
- Updated dependencies [
|
|
46
|
-
- Updated dependencies [
|
|
47
|
-
- Updated dependencies [
|
|
48
|
-
- Updated dependencies [
|
|
49
|
-
- Updated dependencies [
|
|
50
|
-
- Updated dependencies [
|
|
51
|
-
- Updated dependencies [
|
|
52
|
-
- Updated dependencies [
|
|
53
|
-
- Updated dependencies [
|
|
54
|
-
- Updated dependencies [
|
|
55
|
-
- Updated dependencies [
|
|
56
|
-
- Updated dependencies [
|
|
57
|
-
- Updated dependencies [
|
|
58
|
-
- Updated dependencies [
|
|
59
|
-
- Updated dependencies [
|
|
60
|
-
- Updated dependencies [
|
|
61
|
-
- Updated dependencies [
|
|
62
|
-
- Updated dependencies [
|
|
63
|
-
- Updated dependencies [
|
|
64
|
-
- Updated dependencies [
|
|
65
|
-
- Updated dependencies [
|
|
66
|
-
- Updated dependencies [
|
|
67
|
-
- Updated dependencies [
|
|
68
|
-
- Updated dependencies [
|
|
69
|
-
- Updated dependencies [
|
|
70
|
-
- Updated dependencies [
|
|
71
|
-
- Updated dependencies [
|
|
72
|
-
|
|
73
|
-
|
|
43
|
+
- d6546ad916: add buildConfig style in module-tools-v2 and remove tools
|
|
44
|
+
在 module-tools-v2 里新增 buildConfig style 并删除 tools
|
|
45
|
+
- Updated dependencies [2344eb26ed]
|
|
46
|
+
- Updated dependencies [a11fcf8b50]
|
|
47
|
+
- Updated dependencies [b18fa8f3ed]
|
|
48
|
+
- Updated dependencies [c9e800d39a]
|
|
49
|
+
- Updated dependencies [3e57f2bd58]
|
|
50
|
+
- Updated dependencies [fbf5eed5aa]
|
|
51
|
+
- Updated dependencies [a2509bfbdb]
|
|
52
|
+
- Updated dependencies [e4357f1856]
|
|
53
|
+
- Updated dependencies [4369648ae2]
|
|
54
|
+
- Updated dependencies [92f0eade39]
|
|
55
|
+
- Updated dependencies [92c0994468]
|
|
56
|
+
- Updated dependencies [edd1cfb1af]
|
|
57
|
+
- Updated dependencies [cc971eabfc]
|
|
58
|
+
- Updated dependencies [5b9049f2e9]
|
|
59
|
+
- Updated dependencies [6bda14ed71]
|
|
60
|
+
- Updated dependencies [92004d1906]
|
|
61
|
+
- Updated dependencies [b8bbe036c7]
|
|
62
|
+
- Updated dependencies [40ed5874c6]
|
|
63
|
+
- Updated dependencies [60d5378632]
|
|
64
|
+
- Updated dependencies [d5a31df781]
|
|
65
|
+
- Updated dependencies [dda38c9c3e]
|
|
66
|
+
- Updated dependencies [8b8e1bb571]
|
|
67
|
+
- Updated dependencies [3bbea92b2a]
|
|
68
|
+
- Updated dependencies [b710adb843]
|
|
69
|
+
- Updated dependencies [18aaf42249]
|
|
70
|
+
- Updated dependencies [fcace5b5b9]
|
|
71
|
+
- Updated dependencies [abf3421a75]
|
|
72
|
+
- Updated dependencies [543be9558e]
|
|
73
|
+
- Updated dependencies [14b712da84]
|
|
74
|
+
- @modern-js/runtime@0.0.0-next-20221202032240
|
|
75
|
+
- @modern-js/utils@0.0.0-next-20221202032240
|
|
74
76
|
|
|
75
77
|
## 2.0.0-beta.2
|
|
76
78
|
|
package/dist/js/modern/cli.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) {
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
4
|
import path from 'path';
|
|
7
5
|
import { PLUGIN_SCHEMAS, fs, CONFIG_CACHE_DIR, globby, nanoid, slash } from '@modern-js/utils';
|
|
8
6
|
import DesignTokenPlugin from "./design-token/cli";
|
|
@@ -53,38 +51,19 @@ export default (({
|
|
|
53
51
|
// TODO: Add interface about postcss config
|
|
54
52
|
// TODO: In module project, also is called, but should not be called.
|
|
55
53
|
postcss: config => {
|
|
54
|
+
var _modernConfig$tools, _modernConfig$source;
|
|
56
55
|
const modernConfig = api.useResolvedConfigContext();
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
pureConfig: {
|
|
63
|
-
content: ['./src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx', './src/**/*.less', './src/**/*.css', './src/**/*.sass', './src/**/*.scss', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
config.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
67
|
-
} else {
|
|
68
|
-
const tailwindConfig = getTailwindConfig(modernConfig, {
|
|
69
|
-
pureConfig: {
|
|
70
|
-
content: ['./src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx', './src/**/*.less', './src/**/*.css', './src/**/*.sass', './src/**/*.scss', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
config.plugins = [require('tailwindcss')(tailwindConfig)];
|
|
56
|
+
const tailwindConfig = getTailwindConfig(modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig$tools = modernConfig.tools) === null || _modernConfig$tools === void 0 ? void 0 : _modernConfig$tools.tailwindcss, modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig$source = modernConfig.source) === null || _modernConfig$source === void 0 ? void 0 : _modernConfig$source.designSystem, {
|
|
57
|
+
pureConfig: {
|
|
58
|
+
content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx',
|
|
59
|
+
// about storybook
|
|
60
|
+
'./storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
74
61
|
}
|
|
62
|
+
});
|
|
63
|
+
if (Array.isArray(config.postcssOptions.plugins)) {
|
|
64
|
+
config.postcssOptions.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
75
65
|
} else {
|
|
76
|
-
|
|
77
|
-
pureConfig: {
|
|
78
|
-
content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx',
|
|
79
|
-
// about storybook
|
|
80
|
-
'./storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
if (Array.isArray(config.postcssOptions.plugins)) {
|
|
84
|
-
config.postcssOptions.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
85
|
-
} else {
|
|
86
|
-
config.postcssOptions.plugins = [require('tailwindcss')(tailwindConfig)];
|
|
87
|
-
}
|
|
66
|
+
config.postcssOptions.plugins = [require('tailwindcss')(tailwindConfig)];
|
|
88
67
|
}
|
|
89
68
|
},
|
|
90
69
|
babel(config) {
|
|
@@ -118,6 +97,27 @@ export default (({
|
|
|
118
97
|
}
|
|
119
98
|
}
|
|
120
99
|
};
|
|
100
|
+
},
|
|
101
|
+
beforeBuildTask({
|
|
102
|
+
config
|
|
103
|
+
}) {
|
|
104
|
+
const modernConfig = api.useResolvedConfigContext();
|
|
105
|
+
const {
|
|
106
|
+
designSystem
|
|
107
|
+
} = modernConfig;
|
|
108
|
+
const tailwindConfig = getTailwindConfig(config.style.tailwindCss, designSystem, {
|
|
109
|
+
pureConfig: {
|
|
110
|
+
content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx',
|
|
111
|
+
// about storybook
|
|
112
|
+
'./storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
if (Array.isArray(config.style.postcss.plugins)) {
|
|
116
|
+
config.style.postcss.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
117
|
+
} else {
|
|
118
|
+
config.style.postcss.plugins = [require('tailwindcss')(tailwindConfig)];
|
|
119
|
+
}
|
|
120
|
+
return config;
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) {
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
4
|
import { lazyImport, PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
|
|
7
5
|
export default (({
|
|
8
6
|
pluginName
|
|
@@ -14,9 +12,7 @@ export default (({
|
|
|
14
12
|
let pluginsExportsUtils;
|
|
15
13
|
const resolveConfig = lazyImport('tailwindcss/resolveConfig', require);
|
|
16
14
|
const PLUGIN_IDENTIFIER = 'designToken';
|
|
17
|
-
const getDesignTokens =
|
|
18
|
-
var _userConfig$source;
|
|
19
|
-
const designSystem = (_userConfig$source = userConfig.source) === null || _userConfig$source === void 0 ? void 0 : _userConfig$source.designSystem;
|
|
15
|
+
const getDesignTokens = designSystem => {
|
|
20
16
|
const tailwindcssConfig = {};
|
|
21
17
|
tailwindcssConfig.theme = designSystem ? _objectSpread({}, designSystem) : {};
|
|
22
18
|
|
|
@@ -53,11 +49,11 @@ export default (({
|
|
|
53
49
|
entrypoint,
|
|
54
50
|
imports
|
|
55
51
|
}) {
|
|
56
|
-
var _userConfig$source$de, _userConfig$
|
|
52
|
+
var _userConfig$source$de, _userConfig$source;
|
|
57
53
|
const userConfig = api.useResolvedConfigContext();
|
|
58
|
-
const designSystem = (_userConfig$source$de = (_userConfig$
|
|
54
|
+
const designSystem = (_userConfig$source$de = (_userConfig$source = userConfig.source) === null || _userConfig$source === void 0 ? void 0 : _userConfig$source.designSystem) !== null && _userConfig$source$de !== void 0 ? _userConfig$source$de : {};
|
|
59
55
|
if (typeof designSystem === 'object' && designSystem.supportStyledComponents) {
|
|
60
|
-
const designTokens = getDesignTokens(userConfig);
|
|
56
|
+
const designTokens = getDesignTokens(userConfig.source.designSystem);
|
|
61
57
|
imports.push({
|
|
62
58
|
value: '@modern-js/runtime/plugins',
|
|
63
59
|
specifiers: [{
|
|
@@ -77,9 +73,9 @@ export default (({
|
|
|
77
73
|
entrypoint,
|
|
78
74
|
plugins
|
|
79
75
|
}) {
|
|
80
|
-
var _userConfig$source$de2, _userConfig$
|
|
76
|
+
var _userConfig$source$de2, _userConfig$source2;
|
|
81
77
|
const userConfig = api.useResolvedConfigContext();
|
|
82
|
-
const designSystem = (_userConfig$source$de2 = (_userConfig$
|
|
78
|
+
const designSystem = (_userConfig$source$de2 = (_userConfig$source2 = userConfig.source) === null || _userConfig$source2 === void 0 ? void 0 : _userConfig$source2.designSystem) !== null && _userConfig$source$de2 !== void 0 ? _userConfig$source$de2 : {};
|
|
83
79
|
let useSCThemeProvider = true;
|
|
84
80
|
if (designSystem) {
|
|
85
81
|
// when designSystem exist, designToken.styledComponents`s default value is false.
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) {
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
4
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
7
5
|
import React, { useContext } from 'react';
|
|
8
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -11,8 +11,7 @@ const getPureDesignSystemConfig = designSystemConfig => {
|
|
|
11
11
|
delete pureDesignSystemConfig.supportStyledComponents;
|
|
12
12
|
return pureDesignSystemConfig;
|
|
13
13
|
};
|
|
14
|
-
const getTailwindConfig = (
|
|
15
|
-
var _config$tools, _ref, _designSystem;
|
|
14
|
+
const getTailwindConfig = (tailwindcss, designSystem, option = {}) => {
|
|
16
15
|
const purgeConfig = merge({
|
|
17
16
|
// TODO: how the operating environment is determined
|
|
18
17
|
enabled: process.env.NODE_ENV === 'production',
|
|
@@ -23,8 +22,8 @@ const getTailwindConfig = (config, option = {}) => {
|
|
|
23
22
|
const defaultTailwindConfig = {
|
|
24
23
|
purge: purgeConfig
|
|
25
24
|
};
|
|
26
|
-
const tailwindConfig = applyOptionsChain(defaultTailwindConfig,
|
|
27
|
-
const
|
|
25
|
+
const tailwindConfig = applyOptionsChain(defaultTailwindConfig, tailwindcss || {});
|
|
26
|
+
const designSystemConfig = getPureDesignSystemConfig(designSystem !== null && designSystem !== void 0 ? designSystem : {});
|
|
28
27
|
const [exist, key] = checkIfExistNotAllowKeys(tailwindConfig);
|
|
29
28
|
if (exist) {
|
|
30
29
|
logger.error(`should not exist '${key}' on tools.tailwindcss, please remove it`);
|
|
@@ -33,7 +32,7 @@ const getTailwindConfig = (config, option = {}) => {
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
// Because there is no default theme configuration
|
|
36
|
-
tailwindConfig.theme =
|
|
35
|
+
tailwindConfig.theme = designSystemConfig || {};
|
|
37
36
|
return tailwindConfig;
|
|
38
37
|
};
|
|
39
38
|
export { getTailwindConfig };
|
package/dist/js/node/cli.js
CHANGED
|
@@ -12,9 +12,7 @@ var _utils2 = require("./utils");
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
function _defineProperty(obj, key, value) {
|
|
16
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
16
|
const supportCssInJsLibrary = 'styled-components';
|
|
19
17
|
const getRandomTwConfigFileName = internalDirectory => {
|
|
20
18
|
return (0, _utils.slash)(_path.default.join(internalDirectory, `tailwind.config.${Date.now()}.${(0, _utils.nanoid)()}.js`));
|
|
@@ -61,38 +59,19 @@ var _default = ({
|
|
|
61
59
|
// TODO: Add interface about postcss config
|
|
62
60
|
// TODO: In module project, also is called, but should not be called.
|
|
63
61
|
postcss: config => {
|
|
62
|
+
var _modernConfig$tools, _modernConfig$source;
|
|
64
63
|
const modernConfig = api.useResolvedConfigContext();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
pureConfig: {
|
|
71
|
-
content: ['./src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx', './src/**/*.less', './src/**/*.css', './src/**/*.sass', './src/**/*.scss', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
config.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
75
|
-
} else {
|
|
76
|
-
const tailwindConfig = (0, _tailwind.getTailwindConfig)(modernConfig, {
|
|
77
|
-
pureConfig: {
|
|
78
|
-
content: ['./src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx', './src/**/*.less', './src/**/*.css', './src/**/*.sass', './src/**/*.scss', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
config.plugins = [require('tailwindcss')(tailwindConfig)];
|
|
64
|
+
const tailwindConfig = (0, _tailwind.getTailwindConfig)(modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig$tools = modernConfig.tools) === null || _modernConfig$tools === void 0 ? void 0 : _modernConfig$tools.tailwindcss, modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig$source = modernConfig.source) === null || _modernConfig$source === void 0 ? void 0 : _modernConfig$source.designSystem, {
|
|
65
|
+
pureConfig: {
|
|
66
|
+
content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx',
|
|
67
|
+
// about storybook
|
|
68
|
+
'./storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
82
69
|
}
|
|
70
|
+
});
|
|
71
|
+
if (Array.isArray(config.postcssOptions.plugins)) {
|
|
72
|
+
config.postcssOptions.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
83
73
|
} else {
|
|
84
|
-
|
|
85
|
-
pureConfig: {
|
|
86
|
-
content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx',
|
|
87
|
-
// about storybook
|
|
88
|
-
'./storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
if (Array.isArray(config.postcssOptions.plugins)) {
|
|
92
|
-
config.postcssOptions.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
93
|
-
} else {
|
|
94
|
-
config.postcssOptions.plugins = [require('tailwindcss')(tailwindConfig)];
|
|
95
|
-
}
|
|
74
|
+
config.postcssOptions.plugins = [require('tailwindcss')(tailwindConfig)];
|
|
96
75
|
}
|
|
97
76
|
},
|
|
98
77
|
babel(config) {
|
|
@@ -126,6 +105,27 @@ var _default = ({
|
|
|
126
105
|
}
|
|
127
106
|
}
|
|
128
107
|
};
|
|
108
|
+
},
|
|
109
|
+
beforeBuildTask({
|
|
110
|
+
config
|
|
111
|
+
}) {
|
|
112
|
+
const modernConfig = api.useResolvedConfigContext();
|
|
113
|
+
const {
|
|
114
|
+
designSystem
|
|
115
|
+
} = modernConfig;
|
|
116
|
+
const tailwindConfig = (0, _tailwind.getTailwindConfig)(config.style.tailwindCss, designSystem, {
|
|
117
|
+
pureConfig: {
|
|
118
|
+
content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx',
|
|
119
|
+
// about storybook
|
|
120
|
+
'./storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
if (Array.isArray(config.style.postcss.plugins)) {
|
|
124
|
+
config.style.postcss.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
125
|
+
} else {
|
|
126
|
+
config.style.postcss.plugins = [require('tailwindcss')(tailwindConfig)];
|
|
127
|
+
}
|
|
128
|
+
return config;
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
}
|
|
@@ -7,9 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _utils = require("@modern-js/utils");
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) {
|
|
11
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
11
|
var _default = ({
|
|
14
12
|
pluginName
|
|
15
13
|
} = {
|
|
@@ -20,9 +18,7 @@ var _default = ({
|
|
|
20
18
|
let pluginsExportsUtils;
|
|
21
19
|
const resolveConfig = (0, _utils.lazyImport)('tailwindcss/resolveConfig', require);
|
|
22
20
|
const PLUGIN_IDENTIFIER = 'designToken';
|
|
23
|
-
const getDesignTokens =
|
|
24
|
-
var _userConfig$source;
|
|
25
|
-
const designSystem = (_userConfig$source = userConfig.source) === null || _userConfig$source === void 0 ? void 0 : _userConfig$source.designSystem;
|
|
21
|
+
const getDesignTokens = designSystem => {
|
|
26
22
|
const tailwindcssConfig = {};
|
|
27
23
|
tailwindcssConfig.theme = designSystem ? _objectSpread({}, designSystem) : {};
|
|
28
24
|
|
|
@@ -59,11 +55,11 @@ var _default = ({
|
|
|
59
55
|
entrypoint,
|
|
60
56
|
imports
|
|
61
57
|
}) {
|
|
62
|
-
var _userConfig$source$de, _userConfig$
|
|
58
|
+
var _userConfig$source$de, _userConfig$source;
|
|
63
59
|
const userConfig = api.useResolvedConfigContext();
|
|
64
|
-
const designSystem = (_userConfig$source$de = (_userConfig$
|
|
60
|
+
const designSystem = (_userConfig$source$de = (_userConfig$source = userConfig.source) === null || _userConfig$source === void 0 ? void 0 : _userConfig$source.designSystem) !== null && _userConfig$source$de !== void 0 ? _userConfig$source$de : {};
|
|
65
61
|
if (typeof designSystem === 'object' && designSystem.supportStyledComponents) {
|
|
66
|
-
const designTokens = getDesignTokens(userConfig);
|
|
62
|
+
const designTokens = getDesignTokens(userConfig.source.designSystem);
|
|
67
63
|
imports.push({
|
|
68
64
|
value: '@modern-js/runtime/plugins',
|
|
69
65
|
specifiers: [{
|
|
@@ -83,9 +79,9 @@ var _default = ({
|
|
|
83
79
|
entrypoint,
|
|
84
80
|
plugins
|
|
85
81
|
}) {
|
|
86
|
-
var _userConfig$source$de2, _userConfig$
|
|
82
|
+
var _userConfig$source$de2, _userConfig$source2;
|
|
87
83
|
const userConfig = api.useResolvedConfigContext();
|
|
88
|
-
const designSystem = (_userConfig$source$de2 = (_userConfig$
|
|
84
|
+
const designSystem = (_userConfig$source$de2 = (_userConfig$source2 = userConfig.source) === null || _userConfig$source2 === void 0 ? void 0 : _userConfig$source2.designSystem) !== null && _userConfig$source$de2 !== void 0 ? _userConfig$source$de2 : {};
|
|
89
85
|
let useSCThemeProvider = true;
|
|
90
86
|
if (designSystem) {
|
|
91
87
|
// when designSystem exist, designToken.styledComponents`s default value is false.
|
|
@@ -12,9 +12,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
function _defineProperty(obj, key, value) {
|
|
16
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
16
|
const DesignTokenContext = /*#__PURE__*/_react.default.createContext({});
|
|
19
17
|
exports.DesignTokenContext = DesignTokenContext;
|
|
20
18
|
const useDesignTokens = () => (0, _react.useContext)(DesignTokenContext);
|
package/dist/js/node/tailwind.js
CHANGED
|
@@ -17,8 +17,7 @@ const getPureDesignSystemConfig = designSystemConfig => {
|
|
|
17
17
|
delete pureDesignSystemConfig.supportStyledComponents;
|
|
18
18
|
return pureDesignSystemConfig;
|
|
19
19
|
};
|
|
20
|
-
const getTailwindConfig = (
|
|
21
|
-
var _config$tools, _ref, _designSystem;
|
|
20
|
+
const getTailwindConfig = (tailwindcss, designSystem, option = {}) => {
|
|
22
21
|
const purgeConfig = (0, _lodash.merge)({
|
|
23
22
|
// TODO: how the operating environment is determined
|
|
24
23
|
enabled: process.env.NODE_ENV === 'production',
|
|
@@ -29,8 +28,8 @@ const getTailwindConfig = (config, option = {}) => {
|
|
|
29
28
|
const defaultTailwindConfig = {
|
|
30
29
|
purge: purgeConfig
|
|
31
30
|
};
|
|
32
|
-
const tailwindConfig = (0, _utils.applyOptionsChain)(defaultTailwindConfig,
|
|
33
|
-
const
|
|
31
|
+
const tailwindConfig = (0, _utils.applyOptionsChain)(defaultTailwindConfig, tailwindcss || {});
|
|
32
|
+
const designSystemConfig = getPureDesignSystemConfig(designSystem !== null && designSystem !== void 0 ? designSystem : {});
|
|
34
33
|
const [exist, key] = checkIfExistNotAllowKeys(tailwindConfig);
|
|
35
34
|
if (exist) {
|
|
36
35
|
_utils.logger.error(`should not exist '${key}' on tools.tailwindcss, please remove it`);
|
|
@@ -39,7 +38,7 @@ const getTailwindConfig = (config, option = {}) => {
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
// Because there is no default theme configuration
|
|
42
|
-
tailwindConfig.theme =
|
|
41
|
+
tailwindConfig.theme = designSystemConfig || {};
|
|
43
42
|
return tailwindConfig;
|
|
44
43
|
};
|
|
45
44
|
exports.getTailwindConfig = getTailwindConfig;
|
|
@@ -57,38 +57,19 @@ export default (function () {
|
|
|
57
57
|
// TODO: Add interface about postcss config
|
|
58
58
|
// TODO: In module project, also is called, but should not be called.
|
|
59
59
|
postcss: function postcss(config) {
|
|
60
|
+
var _modernConfig$tools, _modernConfig$source;
|
|
60
61
|
var modernConfig = api.useResolvedConfigContext();
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
pureConfig: {
|
|
67
|
-
content: ['./src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx', './src/**/*.less', './src/**/*.css', './src/**/*.sass', './src/**/*.scss', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
config.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
71
|
-
} else {
|
|
72
|
-
var _tailwindConfig = getTailwindConfig(modernConfig, {
|
|
73
|
-
pureConfig: {
|
|
74
|
-
content: ['./src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx', './src/**/*.less', './src/**/*.css', './src/**/*.sass', './src/**/*.scss', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
config.plugins = [require('tailwindcss')(_tailwindConfig)];
|
|
62
|
+
var tailwindConfig = getTailwindConfig(modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig$tools = modernConfig.tools) === null || _modernConfig$tools === void 0 ? void 0 : _modernConfig$tools.tailwindcss, modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig$source = modernConfig.source) === null || _modernConfig$source === void 0 ? void 0 : _modernConfig$source.designSystem, {
|
|
63
|
+
pureConfig: {
|
|
64
|
+
content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx',
|
|
65
|
+
// about storybook
|
|
66
|
+
'./storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
78
67
|
}
|
|
68
|
+
});
|
|
69
|
+
if (Array.isArray(config.postcssOptions.plugins)) {
|
|
70
|
+
config.postcssOptions.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
79
71
|
} else {
|
|
80
|
-
|
|
81
|
-
pureConfig: {
|
|
82
|
-
content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx',
|
|
83
|
-
// about storybook
|
|
84
|
-
'./storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
if (Array.isArray(config.postcssOptions.plugins)) {
|
|
88
|
-
config.postcssOptions.plugins.push(require('tailwindcss')(_tailwindConfig2));
|
|
89
|
-
} else {
|
|
90
|
-
config.postcssOptions.plugins = [require('tailwindcss')(_tailwindConfig2)];
|
|
91
|
-
}
|
|
72
|
+
config.postcssOptions.plugins = [require('tailwindcss')(tailwindConfig)];
|
|
92
73
|
}
|
|
93
74
|
},
|
|
94
75
|
babel: function babel(config) {
|
|
@@ -122,6 +103,24 @@ export default (function () {
|
|
|
122
103
|
}
|
|
123
104
|
}
|
|
124
105
|
};
|
|
106
|
+
},
|
|
107
|
+
beforeBuildTask: function beforeBuildTask(_ref2) {
|
|
108
|
+
var config = _ref2.config;
|
|
109
|
+
var modernConfig = api.useResolvedConfigContext();
|
|
110
|
+
var designSystem = modernConfig.designSystem;
|
|
111
|
+
var tailwindConfig = getTailwindConfig(config.style.tailwindCss, designSystem, {
|
|
112
|
+
pureConfig: {
|
|
113
|
+
content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx',
|
|
114
|
+
// about storybook
|
|
115
|
+
'./storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
if (Array.isArray(config.style.postcss.plugins)) {
|
|
119
|
+
config.style.postcss.plugins.push(require('tailwindcss')(tailwindConfig));
|
|
120
|
+
} else {
|
|
121
|
+
config.style.postcss.plugins = [require('tailwindcss')(tailwindConfig)];
|
|
122
|
+
}
|
|
123
|
+
return config;
|
|
125
124
|
}
|
|
126
125
|
});
|
|
127
126
|
case 6:
|
|
@@ -12,9 +12,7 @@ export default (function () {
|
|
|
12
12
|
var pluginsExportsUtils;
|
|
13
13
|
var resolveConfig = lazyImport('tailwindcss/resolveConfig', require);
|
|
14
14
|
var PLUGIN_IDENTIFIER = 'designToken';
|
|
15
|
-
var getDesignTokens = function getDesignTokens(
|
|
16
|
-
var _userConfig$source;
|
|
17
|
-
var designSystem = (_userConfig$source = userConfig.source) === null || _userConfig$source === void 0 ? void 0 : _userConfig$source.designSystem;
|
|
15
|
+
var getDesignTokens = function getDesignTokens(designSystem) {
|
|
18
16
|
var tailwindcssConfig = {};
|
|
19
17
|
tailwindcssConfig.theme = designSystem ? _objectSpread({}, designSystem) : {};
|
|
20
18
|
|
|
@@ -48,13 +46,13 @@ export default (function () {
|
|
|
48
46
|
};
|
|
49
47
|
},
|
|
50
48
|
modifyEntryImports: function modifyEntryImports(_ref2) {
|
|
51
|
-
var _userConfig$source$de, _userConfig$
|
|
49
|
+
var _userConfig$source$de, _userConfig$source;
|
|
52
50
|
var entrypoint = _ref2.entrypoint,
|
|
53
51
|
imports = _ref2.imports;
|
|
54
52
|
var userConfig = api.useResolvedConfigContext();
|
|
55
|
-
var designSystem = (_userConfig$source$de = (_userConfig$
|
|
53
|
+
var designSystem = (_userConfig$source$de = (_userConfig$source = userConfig.source) === null || _userConfig$source === void 0 ? void 0 : _userConfig$source.designSystem) !== null && _userConfig$source$de !== void 0 ? _userConfig$source$de : {};
|
|
56
54
|
if (_typeof(designSystem) === 'object' && designSystem.supportStyledComponents) {
|
|
57
|
-
var designTokens = getDesignTokens(userConfig);
|
|
55
|
+
var designTokens = getDesignTokens(userConfig.source.designSystem);
|
|
58
56
|
imports.push({
|
|
59
57
|
value: '@modern-js/runtime/plugins',
|
|
60
58
|
specifiers: [{
|
|
@@ -69,11 +67,11 @@ export default (function () {
|
|
|
69
67
|
};
|
|
70
68
|
},
|
|
71
69
|
modifyEntryRuntimePlugins: function modifyEntryRuntimePlugins(_ref3) {
|
|
72
|
-
var _userConfig$source$de2, _userConfig$
|
|
70
|
+
var _userConfig$source$de2, _userConfig$source2;
|
|
73
71
|
var entrypoint = _ref3.entrypoint,
|
|
74
72
|
plugins = _ref3.plugins;
|
|
75
73
|
var userConfig = api.useResolvedConfigContext();
|
|
76
|
-
var designSystem = (_userConfig$source$de2 = (_userConfig$
|
|
74
|
+
var designSystem = (_userConfig$source$de2 = (_userConfig$source2 = userConfig.source) === null || _userConfig$source2 === void 0 ? void 0 : _userConfig$source2.designSystem) !== null && _userConfig$source$de2 !== void 0 ? _userConfig$source$de2 : {};
|
|
77
75
|
var useSCThemeProvider = true;
|
|
78
76
|
if (designSystem) {
|
|
79
77
|
// when designSystem exist, designToken.styledComponents`s default value is false.
|
|
@@ -14,9 +14,8 @@ var getPureDesignSystemConfig = function getPureDesignSystemConfig(designSystemC
|
|
|
14
14
|
delete pureDesignSystemConfig.supportStyledComponents;
|
|
15
15
|
return pureDesignSystemConfig;
|
|
16
16
|
};
|
|
17
|
-
var getTailwindConfig = function getTailwindConfig(
|
|
18
|
-
var
|
|
19
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
17
|
+
var getTailwindConfig = function getTailwindConfig(tailwindcss, designSystem) {
|
|
18
|
+
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
20
19
|
var purgeConfig = merge({
|
|
21
20
|
// TODO: how the operating environment is determined
|
|
22
21
|
enabled: process.env.NODE_ENV === 'production',
|
|
@@ -27,8 +26,8 @@ var getTailwindConfig = function getTailwindConfig(config) {
|
|
|
27
26
|
var defaultTailwindConfig = {
|
|
28
27
|
purge: purgeConfig
|
|
29
28
|
};
|
|
30
|
-
var tailwindConfig = applyOptionsChain(defaultTailwindConfig,
|
|
31
|
-
var
|
|
29
|
+
var tailwindConfig = applyOptionsChain(defaultTailwindConfig, tailwindcss || {});
|
|
30
|
+
var designSystemConfig = getPureDesignSystemConfig(designSystem !== null && designSystem !== void 0 ? designSystem : {});
|
|
32
31
|
var _checkIfExistNotAllow = checkIfExistNotAllowKeys(tailwindConfig),
|
|
33
32
|
_checkIfExistNotAllow2 = _slicedToArray(_checkIfExistNotAllow, 2),
|
|
34
33
|
exist = _checkIfExistNotAllow2[0],
|
|
@@ -40,7 +39,7 @@ var getTailwindConfig = function getTailwindConfig(config) {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
// Because there is no default theme configuration
|
|
43
|
-
tailwindConfig.theme =
|
|
42
|
+
tailwindConfig.theme = designSystemConfig || {};
|
|
44
43
|
return tailwindConfig;
|
|
45
44
|
};
|
|
46
45
|
export { getTailwindConfig };
|
package/dist/types/cli.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { LegacyAppTools
|
|
1
|
+
import type { LegacyAppTools } from '@modern-js/app-tools';
|
|
2
|
+
import type { CliPlugin, ModuleTools } from '@modern-js/module-tools-v2';
|
|
2
3
|
export declare const getRandomTwConfigFileName: (internalDirectory: string) => string;
|
|
3
4
|
declare const _default: ({
|
|
4
5
|
pluginName
|
|
5
6
|
}?: {
|
|
6
7
|
pluginName: string;
|
|
7
|
-
}) => CliPlugin<LegacyAppTools>;
|
|
8
|
+
}) => CliPlugin<LegacyAppTools & ModuleTools>;
|
|
8
9
|
export default _default;
|
package/dist/types/tailwind.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const getTailwindConfig: (
|
|
1
|
+
import { DesignSystem, Tailwind } from './types';
|
|
2
|
+
declare const getTailwindConfig: (tailwindcss?: Tailwind, designSystem?: DesignSystem, option?: {
|
|
3
3
|
pureConfig?: Record<string, any>;
|
|
4
|
-
}) => any
|
|
4
|
+
}) => Record<string, any>;
|
|
5
5
|
export { getTailwindConfig };
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
export type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
source?: {
|
|
6
|
-
designSystem?: Record<string, any> & {
|
|
7
|
-
supportStyledComponents?: boolean;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
1
|
+
export declare type DesignSystem = Record<string, any> & {
|
|
2
|
+
supportStyledComponents?: boolean;
|
|
3
|
+
};
|
|
4
|
+
export declare type Tailwind = Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.0-next-
|
|
14
|
+
"version": "0.0.0-next-20221202032240",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.18.0",
|
|
47
47
|
"hoist-non-react-statics": "^3.3.2",
|
|
48
|
-
"@modern-js/utils": "0.0.0-next-
|
|
48
|
+
"@modern-js/utils": "0.0.0-next-20221202032240"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/jest": "^27",
|
|
@@ -56,16 +56,17 @@
|
|
|
56
56
|
"jest": "^27",
|
|
57
57
|
"react": "^18",
|
|
58
58
|
"postcss": "^8.4.14",
|
|
59
|
-
"@modern-js/core": "0.0.0-next-
|
|
60
|
-
"@modern-js/
|
|
61
|
-
"@modern-js/
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
59
|
+
"@modern-js/core": "0.0.0-next-20221202032240",
|
|
60
|
+
"@modern-js/module-tools-v2": "0.0.0-next-20221202032240",
|
|
61
|
+
"@modern-js/runtime": "0.0.0-next-20221202032240",
|
|
62
|
+
"@modern-js/types": "0.0.0-next-20221202032240",
|
|
63
|
+
"@scripts/build": "0.0.0-next-20221202032240",
|
|
64
|
+
"@modern-js/app-tools": "0.0.0-next-20221202032240",
|
|
65
|
+
"@scripts/jest-config": "0.0.0-next-20221202032240"
|
|
65
66
|
},
|
|
66
67
|
"peerDependencies": {
|
|
67
68
|
"tailwindcss": "^2.0.4",
|
|
68
|
-
"@modern-js/runtime": "0.0.0-next-
|
|
69
|
+
"@modern-js/runtime": "^0.0.0-next-20221202032240"
|
|
69
70
|
},
|
|
70
71
|
"peerDependenciesMeta": {
|
|
71
72
|
"@modern-js/runtime": {
|