@modern-js/plugin-tailwindcss 2.15.0 → 2.16.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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/cli.js +130 -158
- package/dist/cjs/design-token/cli/index.js +93 -111
- package/dist/cjs/design-token/index.js +26 -36
- package/dist/cjs/design-token/postcss-plugin/index.js +8 -26
- package/dist/cjs/design-token/runtime/index.js +27 -37
- package/dist/cjs/design-token/runtime/plugin.js +90 -52
- package/dist/cjs/index.js +13 -34
- package/dist/cjs/tailwind.js +33 -52
- package/dist/cjs/types.js +4 -15
- package/dist/cjs/utils.js +36 -49
- package/dist/esm/cli.js +264 -253
- package/dist/esm/design-token/cli/index.js +112 -113
- package/dist/esm/design-token/index.js +1 -2
- package/dist/esm/design-token/postcss-plugin/index.js +17 -17
- package/dist/esm/design-token/runtime/index.js +1 -2
- package/dist/esm/design-token/runtime/plugin.js +71 -71
- package/dist/esm/index.js +1 -2
- package/dist/esm/tailwind.js +88 -76
- package/dist/esm/types.js +1 -1
- package/dist/esm/utils.js +183 -177
- package/dist/esm-node/cli.js +109 -137
- package/dist/esm-node/design-token/cli/index.js +85 -94
- package/dist/esm-node/design-token/index.js +1 -4
- package/dist/esm-node/design-token/postcss-plugin/index.js +1 -6
- package/dist/esm-node/design-token/runtime/index.js +1 -4
- package/dist/esm-node/design-token/runtime/plugin.js +29 -18
- package/dist/esm-node/index.js +1 -4
- package/dist/esm-node/tailwind.js +24 -27
- package/dist/esm-node/types.js +1 -0
- package/dist/esm-node/utils.js +19 -18
- package/package.json +15 -11
@@ -1,119 +1,118 @@
|
|
1
|
-
function
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
function _define_property(obj, key, value) {
|
2
|
+
if (key in obj) {
|
3
|
+
Object.defineProperty(obj, key, {
|
4
|
+
value,
|
5
|
+
enumerable: true,
|
6
|
+
configurable: true,
|
7
|
+
writable: true
|
8
|
+
});
|
9
|
+
} else {
|
10
|
+
obj[key] = value;
|
11
|
+
}
|
12
|
+
return obj;
|
13
13
|
}
|
14
|
-
function
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
ownKeys.forEach(function(key) {
|
24
|
-
_defineProperty(target, key, source[key]);
|
25
|
-
});
|
14
|
+
function _object_spread(target) {
|
15
|
+
for (var i = 1; i < arguments.length; i++) {
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
17
|
+
var ownKeys = Object.keys(source);
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
21
|
+
}));
|
26
22
|
}
|
27
|
-
|
23
|
+
ownKeys.forEach(function(key) {
|
24
|
+
_define_property(target, key, source[key]);
|
25
|
+
});
|
26
|
+
}
|
27
|
+
return target;
|
28
28
|
}
|
29
29
|
import { lazyImport, PLUGIN_SCHEMAS, createRuntimeExportsUtils } from "@modern-js/utils";
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
imported: PLUGIN_IDENTIFIER
|
78
|
-
}
|
79
|
-
],
|
80
|
-
initialize: "\n const designTokens = ".concat(JSON.stringify(designTokens), ";\n ")
|
81
|
-
});
|
82
|
-
}
|
83
|
-
return {
|
84
|
-
entrypoint: entrypoint,
|
85
|
-
imports: imports
|
86
|
-
};
|
87
|
-
},
|
88
|
-
modifyEntryRuntimePlugins: function modifyEntryRuntimePlugins(param) {
|
89
|
-
var entrypoint = param.entrypoint, plugins = param.plugins;
|
90
|
-
var _userConfig_source;
|
91
|
-
var userConfig = api.useResolvedConfigContext();
|
92
|
-
var _userConfig_source_designSystem;
|
93
|
-
var designSystem = (_userConfig_source_designSystem = (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.designSystem) !== null && _userConfig_source_designSystem !== void 0 ? _userConfig_source_designSystem : {};
|
94
|
-
var useSCThemeProvider = true;
|
95
|
-
if (designSystem) {
|
96
|
-
useSCThemeProvider = (designSystem === null || designSystem === void 0 ? void 0 : designSystem.supportStyledComponents) || false;
|
97
|
-
}
|
98
|
-
if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
|
99
|
-
plugins.push({
|
100
|
-
name: PLUGIN_IDENTIFIER,
|
101
|
-
options: "{token: designTokens, useStyledComponentsThemeProvider: ".concat(useSCThemeProvider ? "true" : "false", ", useDesignTokenContext: false}")
|
102
|
-
});
|
103
|
-
}
|
104
|
-
return {
|
105
|
-
entrypoint: entrypoint,
|
106
|
-
plugins: plugins
|
107
|
-
};
|
108
|
-
},
|
109
|
-
validateSchema: function validateSchema() {
|
110
|
-
return PLUGIN_SCHEMAS["@modern-js/plugin-design-token"];
|
111
|
-
},
|
112
|
-
addRuntimeExports: function addRuntimeExports() {
|
113
|
-
pluginsExportsUtils.addExport("export { default as designToken } from '".concat(pluginName, "/runtime-design-token'"));
|
30
|
+
export default function() {
|
31
|
+
var pluginName = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
32
|
+
pluginName: "@modern-js/plugin-tailwindcss"
|
33
|
+
}).pluginName;
|
34
|
+
return {
|
35
|
+
name: "@modern-js/plugin-design-token",
|
36
|
+
setup: function setup(api) {
|
37
|
+
var pluginsExportsUtils;
|
38
|
+
var resolveConfig = lazyImport("tailwindcss/resolveConfig", require);
|
39
|
+
var PLUGIN_IDENTIFIER = "designToken";
|
40
|
+
var getDesignTokens = function(designSystem) {
|
41
|
+
var tailwindcssConfig = {};
|
42
|
+
tailwindcssConfig.theme = designSystem ? _object_spread({}, designSystem) : {};
|
43
|
+
if (!designSystem) {
|
44
|
+
tailwindcssConfig.presets = [];
|
45
|
+
}
|
46
|
+
if (designSystem) {
|
47
|
+
delete tailwindcssConfig.theme.supportStyledComponents;
|
48
|
+
}
|
49
|
+
return resolveConfig(tailwindcssConfig).theme || {};
|
50
|
+
};
|
51
|
+
return {
|
52
|
+
config: function config() {
|
53
|
+
var appContext = api.useAppContext();
|
54
|
+
pluginsExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, "plugins");
|
55
|
+
return {
|
56
|
+
source: {
|
57
|
+
alias: {
|
58
|
+
"@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
|
59
|
+
}
|
60
|
+
},
|
61
|
+
tools: {}
|
62
|
+
};
|
63
|
+
},
|
64
|
+
modifyEntryImports: function modifyEntryImports(param) {
|
65
|
+
var entrypoint = param.entrypoint, imports = param.imports;
|
66
|
+
var _userConfig_source;
|
67
|
+
var userConfig = api.useResolvedConfigContext();
|
68
|
+
var _userConfig_source_designSystem;
|
69
|
+
var designSystem = (_userConfig_source_designSystem = (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.designSystem) !== null && _userConfig_source_designSystem !== void 0 ? _userConfig_source_designSystem : {};
|
70
|
+
if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
|
71
|
+
var designTokens = getDesignTokens(userConfig.source.designSystem);
|
72
|
+
imports.push({
|
73
|
+
value: "@modern-js/runtime/plugins",
|
74
|
+
specifiers: [
|
75
|
+
{
|
76
|
+
imported: PLUGIN_IDENTIFIER
|
114
77
|
}
|
115
|
-
|
78
|
+
],
|
79
|
+
initialize: "\n const designTokens = ".concat(JSON.stringify(designTokens), ";\n ")
|
80
|
+
});
|
81
|
+
}
|
82
|
+
return {
|
83
|
+
entrypoint,
|
84
|
+
imports
|
85
|
+
};
|
86
|
+
},
|
87
|
+
modifyEntryRuntimePlugins: function modifyEntryRuntimePlugins(param) {
|
88
|
+
var entrypoint = param.entrypoint, plugins = param.plugins;
|
89
|
+
var _userConfig_source;
|
90
|
+
var userConfig = api.useResolvedConfigContext();
|
91
|
+
var _userConfig_source_designSystem;
|
92
|
+
var designSystem = (_userConfig_source_designSystem = (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.designSystem) !== null && _userConfig_source_designSystem !== void 0 ? _userConfig_source_designSystem : {};
|
93
|
+
var useSCThemeProvider = true;
|
94
|
+
if (designSystem) {
|
95
|
+
useSCThemeProvider = (designSystem === null || designSystem === void 0 ? void 0 : designSystem.supportStyledComponents) || false;
|
96
|
+
}
|
97
|
+
if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
|
98
|
+
plugins.push({
|
99
|
+
name: PLUGIN_IDENTIFIER,
|
100
|
+
options: "{token: designTokens, useStyledComponentsThemeProvider: ".concat(useSCThemeProvider ? "true" : "false", ", useDesignTokenContext: false}")
|
101
|
+
});
|
102
|
+
}
|
103
|
+
return {
|
104
|
+
entrypoint,
|
105
|
+
plugins
|
106
|
+
};
|
107
|
+
},
|
108
|
+
validateSchema: function validateSchema() {
|
109
|
+
return PLUGIN_SCHEMAS["@modern-js/plugin-design-token"];
|
110
|
+
},
|
111
|
+
addRuntimeExports: function addRuntimeExports() {
|
112
|
+
pluginsExportsUtils.addExport("export { default as designToken } from '".concat(pluginName, "/runtime-design-token'"));
|
116
113
|
}
|
117
|
-
|
118
|
-
}
|
119
|
-
|
114
|
+
};
|
115
|
+
}
|
116
|
+
};
|
117
|
+
}
|
118
|
+
;
|
@@ -1,17 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
}
|
17
|
-
|
1
|
+
export default function() {
|
2
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref_cssVarsHash = _ref.cssVarsHash, cssVarsHash = _ref_cssVarsHash === void 0 ? {} : _ref_cssVarsHash;
|
3
|
+
return {
|
4
|
+
postcssPlugin: "postcss-replace-css-vars",
|
5
|
+
Declaration: function Declaration(decl) {
|
6
|
+
if (decl.value && typeof decl.value === "string") {
|
7
|
+
decl.value = decl.value.replace(/--\S*/g, function(match) {
|
8
|
+
if (cssVarsHash[match]) {
|
9
|
+
return cssVarsHash[match];
|
10
|
+
}
|
11
|
+
return match;
|
12
|
+
});
|
13
|
+
}
|
14
|
+
}
|
15
|
+
};
|
16
|
+
}
|
17
|
+
;
|
@@ -1,78 +1,78 @@
|
|
1
|
-
function
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
function _define_property(obj, key, value) {
|
2
|
+
if (key in obj) {
|
3
|
+
Object.defineProperty(obj, key, {
|
4
|
+
value,
|
5
|
+
enumerable: true,
|
6
|
+
configurable: true,
|
7
|
+
writable: true
|
8
|
+
});
|
9
|
+
} else {
|
10
|
+
obj[key] = value;
|
11
|
+
}
|
12
|
+
return obj;
|
13
13
|
}
|
14
|
-
function
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
ownKeys.forEach(function(key) {
|
24
|
-
_defineProperty(target, key, source[key]);
|
25
|
-
});
|
14
|
+
function _object_spread(target) {
|
15
|
+
for (var i = 1; i < arguments.length; i++) {
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
17
|
+
var ownKeys = Object.keys(source);
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
21
|
+
}));
|
26
22
|
}
|
27
|
-
|
23
|
+
ownKeys.forEach(function(key) {
|
24
|
+
_define_property(target, key, source[key]);
|
25
|
+
});
|
26
|
+
}
|
27
|
+
return target;
|
28
28
|
}
|
29
|
-
import { jsx } from "react/jsx-runtime";
|
29
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
30
30
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
31
31
|
import React, { useContext } from "react";
|
32
|
-
var DesignTokenContext = React.createContext({});
|
33
|
-
var useDesignTokens = function() {
|
34
|
-
|
32
|
+
export var DesignTokenContext = /* @__PURE__ */ React.createContext({});
|
33
|
+
export var useDesignTokens = function() {
|
34
|
+
return useContext(DesignTokenContext);
|
35
35
|
};
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
}
|
74
|
-
};
|
36
|
+
export default function() {
|
37
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
38
|
+
return {
|
39
|
+
name: "@modern-js/plugin-design-token",
|
40
|
+
setup: function() {
|
41
|
+
return {
|
42
|
+
hoc: function hoc(param, next) {
|
43
|
+
var App = param.App;
|
44
|
+
var DesignTokenAppWrapper = function(props) {
|
45
|
+
var _options_token = options.token, token = _options_token === void 0 ? {} : _options_token, _options_useStyledComponentsThemeProvider = options.useStyledComponentsThemeProvider, useStyledComponentsThemeProvider = _options_useStyledComponentsThemeProvider === void 0 ? false : _options_useStyledComponentsThemeProvider, _options_useDesignTokenContext = options.useDesignTokenContext, useDesignTokenContext = _options_useDesignTokenContext === void 0 ? false : _options_useDesignTokenContext;
|
46
|
+
if (useStyledComponentsThemeProvider && useDesignTokenContext) {
|
47
|
+
var ThemeProvider = require("@modern-js/runtime/styled").ThemeProvider;
|
48
|
+
return /* @__PURE__ */ _jsx(ThemeProvider, {
|
49
|
+
theme: token,
|
50
|
+
children: /* @__PURE__ */ _jsx(DesignTokenContext.Provider, {
|
51
|
+
value: token,
|
52
|
+
children: /* @__PURE__ */ _jsx(App, _object_spread({}, props))
|
53
|
+
})
|
54
|
+
});
|
55
|
+
} else if (useStyledComponentsThemeProvider) {
|
56
|
+
var ThemeProvider1 = require("@modern-js/runtime/styled").ThemeProvider;
|
57
|
+
return /* @__PURE__ */ _jsx(ThemeProvider1, {
|
58
|
+
theme: token,
|
59
|
+
children: /* @__PURE__ */ _jsx(App, _object_spread({}, props))
|
60
|
+
});
|
61
|
+
} else if (useDesignTokenContext) {
|
62
|
+
return /* @__PURE__ */ _jsx(DesignTokenContext.Provider, {
|
63
|
+
value: token,
|
64
|
+
children: /* @__PURE__ */ _jsx(App, _object_spread({}, props))
|
65
|
+
});
|
66
|
+
} else {
|
67
|
+
return /* @__PURE__ */ _jsx(App, _object_spread({}, props));
|
68
|
+
}
|
69
|
+
};
|
70
|
+
return next({
|
71
|
+
App: hoistNonReactStatics(DesignTokenAppWrapper, App)
|
72
|
+
});
|
75
73
|
}
|
76
|
-
|
77
|
-
}
|
78
|
-
|
74
|
+
};
|
75
|
+
}
|
76
|
+
};
|
77
|
+
}
|
78
|
+
;
|
package/dist/esm/index.js
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
export { default2 as default };
|
1
|
+
export { default } from "./cli";
|
package/dist/esm/tailwind.js
CHANGED
@@ -1,93 +1,105 @@
|
|
1
|
-
function
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
function _array_like_to_array(arr, len) {
|
2
|
+
if (len == null || len > arr.length)
|
3
|
+
len = arr.length;
|
4
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
5
|
+
arr2[i] = arr[i];
|
6
|
+
return arr2;
|
5
7
|
}
|
6
|
-
function
|
7
|
-
|
8
|
+
function _array_with_holes(arr) {
|
9
|
+
if (Array.isArray(arr))
|
10
|
+
return arr;
|
8
11
|
}
|
9
|
-
function
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
function _iterable_to_array_limit(arr, i) {
|
13
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
14
|
+
if (_i == null)
|
15
|
+
return;
|
16
|
+
var _arr = [];
|
17
|
+
var _n = true;
|
18
|
+
var _d = false;
|
19
|
+
var _s, _e;
|
20
|
+
try {
|
21
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
22
|
+
_arr.push(_s.value);
|
23
|
+
if (i && _arr.length === i)
|
24
|
+
break;
|
25
|
+
}
|
26
|
+
} catch (err) {
|
27
|
+
_d = true;
|
28
|
+
_e = err;
|
29
|
+
} finally {
|
16
30
|
try {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
_d = true;
|
23
|
-
_e = err;
|
24
|
-
} finally{
|
25
|
-
try {
|
26
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
27
|
-
} finally{
|
28
|
-
if (_d) throw _e;
|
29
|
-
}
|
31
|
+
if (!_n && _i["return"] != null)
|
32
|
+
_i["return"]();
|
33
|
+
} finally {
|
34
|
+
if (_d)
|
35
|
+
throw _e;
|
30
36
|
}
|
31
|
-
|
37
|
+
}
|
38
|
+
return _arr;
|
32
39
|
}
|
33
|
-
function
|
34
|
-
|
40
|
+
function _non_iterable_rest() {
|
41
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
35
42
|
}
|
36
|
-
function
|
37
|
-
|
43
|
+
function _sliced_to_array(arr, i) {
|
44
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
38
45
|
}
|
39
|
-
function
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
47
|
+
if (!o)
|
48
|
+
return;
|
49
|
+
if (typeof o === "string")
|
50
|
+
return _array_like_to_array(o, minLen);
|
51
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
52
|
+
if (n === "Object" && o.constructor)
|
53
|
+
n = o.constructor.name;
|
54
|
+
if (n === "Map" || n === "Set")
|
55
|
+
return Array.from(n);
|
56
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
57
|
+
return _array_like_to_array(o, minLen);
|
46
58
|
}
|
47
59
|
import { applyOptionsChain, logger } from "@modern-js/utils";
|
48
60
|
import { merge, cloneDeep } from "@modern-js/utils/lodash";
|
49
61
|
var checkIfExistNotAllowKeys = function(tailwindConfig) {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
62
|
+
var notAllowExistKeys = [
|
63
|
+
"theme"
|
64
|
+
];
|
65
|
+
var notAllowKey = "";
|
66
|
+
var ret = Object.keys(tailwindConfig).some(function(key) {
|
67
|
+
return notAllowExistKeys.includes(key) && (notAllowKey = key);
|
68
|
+
});
|
69
|
+
return [
|
70
|
+
ret,
|
71
|
+
notAllowKey
|
72
|
+
];
|
61
73
|
};
|
62
74
|
var getPureDesignSystemConfig = function(designSystemConfig) {
|
63
|
-
|
64
|
-
|
65
|
-
|
75
|
+
var pureDesignSystemConfig = cloneDeep(designSystemConfig);
|
76
|
+
delete pureDesignSystemConfig.supportStyledComponents;
|
77
|
+
return pureDesignSystemConfig;
|
66
78
|
};
|
67
79
|
var getTailwindConfig = function(tailwindVersion, tailwindcss, designSystem) {
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
80
|
+
var option = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
81
|
+
var purgeConfig = merge({
|
82
|
+
// TODO: how the operating environment is determined
|
83
|
+
enabled: process.env.NODE_ENV === "production",
|
84
|
+
// TODO: Remove or not
|
85
|
+
layers: [
|
86
|
+
"utilities"
|
87
|
+
],
|
88
|
+
content: []
|
89
|
+
}, option.pureConfig || {});
|
90
|
+
var defaultTailwindConfig = tailwindVersion === "3" ? {
|
91
|
+
content: purgeConfig.content
|
92
|
+
} : {
|
93
|
+
purge: purgeConfig
|
94
|
+
};
|
95
|
+
var tailwindConfig = applyOptionsChain(defaultTailwindConfig, tailwindcss || {});
|
96
|
+
var designSystemConfig = getPureDesignSystemConfig(designSystem !== null && designSystem !== void 0 ? designSystem : {});
|
97
|
+
var _checkIfExistNotAllowKeys = _sliced_to_array(checkIfExistNotAllowKeys(tailwindConfig), 2), exist = _checkIfExistNotAllowKeys[0], key = _checkIfExistNotAllowKeys[1];
|
98
|
+
if (exist) {
|
99
|
+
logger.error("should not exist '".concat(key, "' on tools.tailwindcss, please remove it"));
|
100
|
+
process.exit(0);
|
101
|
+
}
|
102
|
+
tailwindConfig.theme = designSystemConfig || {};
|
103
|
+
return tailwindConfig;
|
92
104
|
};
|
93
105
|
export { getTailwindConfig };
|
package/dist/esm/types.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
export {};
|