@modern-js/plugin-tailwindcss 2.0.0-beta.2 → 2.0.0-beta.4
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 +181 -0
- package/dist/js/modern/cli.js +139 -84
- package/dist/js/modern/design-token/cli/index.js +58 -54
- package/dist/js/modern/design-token/global.d.js +0 -0
- package/dist/js/modern/design-token/index.js +5 -2
- package/dist/js/modern/design-token/postcss-plugin/index.js +11 -8
- package/dist/js/modern/design-token/runtime/index.js +4 -1
- package/dist/js/modern/design-token/runtime/plugin.js +41 -29
- package/dist/js/modern/index.js +4 -1
- package/dist/js/modern/modern-app.env.d.js +0 -0
- package/dist/js/modern/tailwind.js +30 -24
- package/dist/js/modern/utils.js +32 -8
- package/dist/js/node/cli.js +159 -95
- package/dist/js/node/design-token/cli/index.js +71 -59
- package/dist/js/node/design-token/global.d.js +0 -0
- package/dist/js/node/design-token/index.js +29 -24
- package/dist/js/node/design-token/postcss-plugin/index.js +28 -13
- package/dist/js/node/design-token/runtime/index.js +31 -22
- package/dist/js/node/design-token/runtime/plugin.js +65 -40
- package/dist/js/node/index.js +27 -11
- package/dist/js/node/modern-app.env.d.js +0 -0
- package/dist/js/node/tailwind.js +49 -30
- package/dist/js/node/utils.js +56 -16
- package/dist/js/treeshaking/cli.js +266 -134
- package/dist/js/treeshaking/design-token/cli/index.js +116 -101
- package/dist/js/treeshaking/design-token/global.d.js +1 -0
- package/dist/js/treeshaking/design-token/index.js +3 -2
- package/dist/js/treeshaking/design-token/postcss-plugin/index.js +17 -26
- package/dist/js/treeshaking/design-token/runtime/index.js +2 -1
- package/dist/js/treeshaking/design-token/runtime/plugin.js +76 -55
- package/dist/js/treeshaking/index.js +2 -1
- package/dist/js/treeshaking/modern-app.env.d.js +1 -0
- package/dist/js/treeshaking/tailwind.js +86 -43
- package/dist/js/treeshaking/types.js +1 -0
- package/dist/js/treeshaking/utils.js +159 -44
- package/dist/types/cli.d.ts +5 -2
- package/dist/types/design-token/cli/index.d.ts +2 -0
- package/dist/types/design-token/postcss-plugin/index.d.ts +2 -0
- package/dist/types/design-token/runtime/plugin.d.ts +2 -0
- package/dist/types/tailwind.d.ts +3 -3
- package/dist/types/types.d.ts +4 -10
- package/package.json +11 -9
@@ -1,49 +1,56 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
+
var __spreadValues = (a, b) => {
|
7
|
+
for (var prop in b || (b = {}))
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
10
|
+
if (__getOwnPropSymbols)
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
+
if (__propIsEnum.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
}
|
15
|
+
return a;
|
16
|
+
};
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
18
|
+
import hoistNonReactStatics from "hoist-non-react-statics";
|
19
|
+
import React, { useContext } from "react";
|
20
|
+
const DesignTokenContext = React.createContext({});
|
21
|
+
const useDesignTokens = () => useContext(DesignTokenContext);
|
22
|
+
var plugin_default = (options = {}) => ({
|
23
|
+
name: "@modern-js/plugin-design-token",
|
11
24
|
setup: () => ({
|
12
|
-
hoc({
|
13
|
-
|
14
|
-
}, next) {
|
15
|
-
const DesignTokenAppWrapper = props => {
|
25
|
+
hoc({ App }, next) {
|
26
|
+
const DesignTokenAppWrapper = (props) => {
|
16
27
|
const {
|
17
28
|
token = {},
|
18
29
|
useStyledComponentsThemeProvider = false,
|
19
30
|
useDesignTokenContext = false
|
20
31
|
} = options;
|
21
32
|
if (useStyledComponentsThemeProvider && useDesignTokenContext) {
|
22
|
-
const {
|
23
|
-
|
24
|
-
} = require('@modern-js/runtime/styled');
|
25
|
-
return /*#__PURE__*/_jsx(ThemeProvider, {
|
33
|
+
const { ThemeProvider } = require("@modern-js/runtime/styled");
|
34
|
+
return /* @__PURE__ */ jsx(ThemeProvider, {
|
26
35
|
theme: token,
|
27
|
-
children:
|
36
|
+
children: /* @__PURE__ */ jsx(DesignTokenContext.Provider, {
|
28
37
|
value: token,
|
29
|
-
children:
|
38
|
+
children: /* @__PURE__ */ jsx(App, __spreadValues({}, props))
|
30
39
|
})
|
31
40
|
});
|
32
41
|
} else if (useStyledComponentsThemeProvider) {
|
33
|
-
const {
|
34
|
-
|
35
|
-
} = require('@modern-js/runtime/styled');
|
36
|
-
return /*#__PURE__*/_jsx(ThemeProvider, {
|
42
|
+
const { ThemeProvider } = require("@modern-js/runtime/styled");
|
43
|
+
return /* @__PURE__ */ jsx(ThemeProvider, {
|
37
44
|
theme: token,
|
38
|
-
children:
|
45
|
+
children: /* @__PURE__ */ jsx(App, __spreadValues({}, props))
|
39
46
|
});
|
40
47
|
} else if (useDesignTokenContext) {
|
41
|
-
return
|
48
|
+
return /* @__PURE__ */ jsx(DesignTokenContext.Provider, {
|
42
49
|
value: token,
|
43
|
-
children:
|
50
|
+
children: /* @__PURE__ */ jsx(App, __spreadValues({}, props))
|
44
51
|
});
|
45
52
|
} else {
|
46
|
-
return
|
53
|
+
return /* @__PURE__ */ jsx(App, __spreadValues({}, props));
|
47
54
|
}
|
48
55
|
};
|
49
56
|
return next({
|
@@ -51,4 +58,9 @@ export default ((options = {}) => ({
|
|
51
58
|
});
|
52
59
|
}
|
53
60
|
})
|
54
|
-
})
|
61
|
+
});
|
62
|
+
export {
|
63
|
+
DesignTokenContext,
|
64
|
+
plugin_default as default,
|
65
|
+
useDesignTokens
|
66
|
+
};
|
package/dist/js/modern/index.js
CHANGED
File without changes
|
@@ -1,39 +1,45 @@
|
|
1
|
-
import { applyOptionsChain, logger } from
|
2
|
-
import { merge, cloneDeep } from
|
3
|
-
const checkIfExistNotAllowKeys = tailwindConfig => {
|
4
|
-
const notAllowExistKeys = [
|
5
|
-
let notAllowKey =
|
6
|
-
const ret = Object.keys(tailwindConfig).some(
|
1
|
+
import { applyOptionsChain, logger } from "@modern-js/utils";
|
2
|
+
import { merge, cloneDeep } from "@modern-js/utils/lodash";
|
3
|
+
const checkIfExistNotAllowKeys = (tailwindConfig) => {
|
4
|
+
const notAllowExistKeys = ["theme"];
|
5
|
+
let notAllowKey = "";
|
6
|
+
const ret = Object.keys(tailwindConfig).some(
|
7
|
+
(key) => notAllowExistKeys.includes(key) && (notAllowKey = key)
|
8
|
+
);
|
7
9
|
return [ret, notAllowKey];
|
8
10
|
};
|
9
|
-
const getPureDesignSystemConfig = designSystemConfig => {
|
11
|
+
const getPureDesignSystemConfig = (designSystemConfig) => {
|
10
12
|
const pureDesignSystemConfig = cloneDeep(designSystemConfig);
|
11
13
|
delete pureDesignSystemConfig.supportStyledComponents;
|
12
14
|
return pureDesignSystemConfig;
|
13
15
|
};
|
14
|
-
const getTailwindConfig = (
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
const getTailwindConfig = (tailwindcss, designSystem, option = {}) => {
|
17
|
+
const purgeConfig = merge(
|
18
|
+
{
|
19
|
+
enabled: process.env.NODE_ENV === "production",
|
20
|
+
layers: ["utilities"],
|
21
|
+
content: []
|
22
|
+
},
|
23
|
+
option.pureConfig || {}
|
24
|
+
);
|
23
25
|
const defaultTailwindConfig = {
|
24
26
|
purge: purgeConfig
|
25
27
|
};
|
26
|
-
const tailwindConfig = applyOptionsChain(
|
27
|
-
|
28
|
+
const tailwindConfig = applyOptionsChain(
|
29
|
+
defaultTailwindConfig,
|
30
|
+
tailwindcss || {}
|
31
|
+
);
|
32
|
+
const designSystemConfig = getPureDesignSystemConfig(designSystem != null ? designSystem : {});
|
28
33
|
const [exist, key] = checkIfExistNotAllowKeys(tailwindConfig);
|
29
34
|
if (exist) {
|
30
|
-
logger.error(
|
31
|
-
|
35
|
+
logger.error(
|
36
|
+
`should not exist '${key}' on tools.tailwindcss, please remove it`
|
37
|
+
);
|
32
38
|
process.exit(0);
|
33
39
|
}
|
34
|
-
|
35
|
-
// Because there is no default theme configuration
|
36
|
-
tailwindConfig.theme = designSystem || {};
|
40
|
+
tailwindConfig.theme = designSystemConfig || {};
|
37
41
|
return tailwindConfig;
|
38
42
|
};
|
39
|
-
export {
|
43
|
+
export {
|
44
|
+
getTailwindConfig
|
45
|
+
};
|
package/dist/js/modern/utils.js
CHANGED
@@ -1,6 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
2
|
+
return new Promise((resolve, reject) => {
|
3
|
+
var fulfilled = (value) => {
|
4
|
+
try {
|
5
|
+
step(generator.next(value));
|
6
|
+
} catch (e) {
|
7
|
+
reject(e);
|
8
|
+
}
|
9
|
+
};
|
10
|
+
var rejected = (value) => {
|
11
|
+
try {
|
12
|
+
step(generator.throw(value));
|
13
|
+
} catch (e) {
|
14
|
+
reject(e);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
19
|
+
});
|
20
|
+
};
|
21
|
+
import path from "path";
|
22
|
+
import { fs } from "@modern-js/utils";
|
23
|
+
const template = (configPath) => `
|
4
24
|
function _interopRequireDefault(obj) {
|
5
25
|
return obj && obj.__esModule ? obj : { default: obj };
|
6
26
|
}
|
@@ -20,13 +40,17 @@ module.exports = {
|
|
20
40
|
...tailwindcss,
|
21
41
|
};
|
22
42
|
`;
|
23
|
-
|
24
|
-
const depName =
|
25
|
-
const packageJson = (
|
43
|
+
const checkTwinMacroNotExist = (appDirectory) => __async(void 0, null, function* () {
|
44
|
+
const depName = "twin.macro";
|
45
|
+
const packageJson = (yield fs.readJSON(path.join(appDirectory, "package.json"), {
|
26
46
|
throws: false
|
27
47
|
})) || {};
|
28
|
-
if (typeof packageJson.dependencies ===
|
48
|
+
if (typeof packageJson.dependencies === "object" && packageJson.dependencies[depName] || typeof packageJson.devDependencies === "object" && packageJson.devDependencies[depName]) {
|
29
49
|
return false;
|
30
50
|
}
|
31
51
|
return true;
|
32
|
-
};
|
52
|
+
});
|
53
|
+
export {
|
54
|
+
checkTwinMacroNotExist,
|
55
|
+
template
|
56
|
+
};
|
package/dist/js/node/cli.js
CHANGED
@@ -1,131 +1,195 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var stdin_exports = {};
|
25
|
+
__export(stdin_exports, {
|
26
|
+
default: () => cli_default,
|
27
|
+
getRandomTwConfigFileName: () => getRandomTwConfigFileName
|
5
28
|
});
|
6
|
-
|
7
|
-
var
|
8
|
-
var
|
9
|
-
var
|
10
|
-
var
|
11
|
-
var
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
29
|
+
module.exports = __toCommonJS(stdin_exports);
|
30
|
+
var import_path = __toESM(require("path"));
|
31
|
+
var import_utils = require("@modern-js/utils");
|
32
|
+
var import_cli = __toESM(require("./design-token/cli"));
|
33
|
+
var import_tailwind = require("./tailwind");
|
34
|
+
var import_utils2 = require("./utils");
|
35
|
+
var __async = (__this, __arguments, generator) => {
|
36
|
+
return new Promise((resolve, reject) => {
|
37
|
+
var fulfilled = (value) => {
|
38
|
+
try {
|
39
|
+
step(generator.next(value));
|
40
|
+
} catch (e) {
|
41
|
+
reject(e);
|
42
|
+
}
|
43
|
+
};
|
44
|
+
var rejected = (value) => {
|
45
|
+
try {
|
46
|
+
step(generator.throw(value));
|
47
|
+
} catch (e) {
|
48
|
+
reject(e);
|
49
|
+
}
|
50
|
+
};
|
51
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
52
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
53
|
+
});
|
54
|
+
};
|
55
|
+
const supportCssInJsLibrary = "styled-components";
|
56
|
+
const getRandomTwConfigFileName = (internalDirectory) => {
|
57
|
+
return (0, import_utils.slash)(
|
58
|
+
import_path.default.join(
|
59
|
+
internalDirectory,
|
60
|
+
`tailwind.config.${Date.now()}.${(0, import_utils.nanoid)()}.js`
|
61
|
+
)
|
62
|
+
);
|
19
63
|
};
|
20
|
-
|
21
|
-
|
22
|
-
pluginName
|
23
|
-
} = {
|
24
|
-
pluginName: '@modern-js/plugin-tailwindcss'
|
64
|
+
var cli_default = ({ pluginName } = {
|
65
|
+
pluginName: "@modern-js/plugin-tailwindcss"
|
25
66
|
}) => ({
|
26
|
-
name:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
let internalTwConfigPath = '';
|
37
|
-
// When reinstalling dependencies, most of the time the project will be restarted
|
38
|
-
const notHaveTwinMacro = await (0, _utils2.checkTwinMacroNotExist)(appDirectory);
|
67
|
+
name: "@modern-js/plugin-tailwindcss",
|
68
|
+
usePlugins: [
|
69
|
+
(0, import_cli.default)({
|
70
|
+
pluginName
|
71
|
+
})
|
72
|
+
],
|
73
|
+
setup: (api) => __async(void 0, null, function* () {
|
74
|
+
const { appDirectory, internalDirectory } = api.useAppContext();
|
75
|
+
let internalTwConfigPath = "";
|
76
|
+
const notHaveTwinMacro = yield (0, import_utils2.checkTwinMacroNotExist)(appDirectory);
|
39
77
|
return {
|
40
78
|
prepare() {
|
41
79
|
if (notHaveTwinMacro) {
|
42
80
|
return;
|
43
81
|
}
|
44
82
|
internalTwConfigPath = getRandomTwConfigFileName(internalDirectory);
|
45
|
-
const globPattern = (0,
|
46
|
-
|
83
|
+
const globPattern = (0, import_utils.slash)(
|
84
|
+
import_path.default.join(appDirectory, import_utils.CONFIG_CACHE_DIR, "*.cjs")
|
85
|
+
);
|
86
|
+
const files = import_utils.globby.sync(globPattern, {
|
47
87
|
absolute: true
|
48
88
|
});
|
49
89
|
if (files.length > 0) {
|
50
|
-
|
90
|
+
import_utils.fs.writeFileSync(
|
91
|
+
internalTwConfigPath,
|
92
|
+
(0, import_utils2.template)(files[files.length - 1]),
|
93
|
+
"utf-8"
|
94
|
+
);
|
51
95
|
}
|
52
96
|
},
|
53
97
|
validateSchema() {
|
54
|
-
return
|
98
|
+
return import_utils.PLUGIN_SCHEMAS["@modern-js/plugin-tailwindcss"];
|
55
99
|
},
|
56
100
|
config() {
|
57
101
|
return {
|
58
102
|
tools: {
|
59
|
-
|
60
|
-
|
61
|
-
postcss: config => {
|
103
|
+
postcss: (config) => {
|
104
|
+
var _a, _b;
|
62
105
|
const modernConfig = api.useResolvedConfigContext();
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
const tailwindConfig = (0, _tailwind.getTailwindConfig)(modernConfig, {
|
68
|
-
pureConfig: {
|
69
|
-
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']
|
70
|
-
}
|
71
|
-
});
|
72
|
-
config.plugins.push(require('tailwindcss')(tailwindConfig));
|
73
|
-
} else {
|
74
|
-
const tailwindConfig = (0, _tailwind.getTailwindConfig)(modernConfig, {
|
75
|
-
pureConfig: {
|
76
|
-
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']
|
77
|
-
}
|
78
|
-
});
|
79
|
-
config.plugins = [require('tailwindcss')(tailwindConfig)];
|
80
|
-
}
|
81
|
-
} else {
|
82
|
-
const tailwindConfig = (0, _tailwind.getTailwindConfig)(modernConfig, {
|
106
|
+
const tailwindConfig = (0, import_tailwind.getTailwindConfig)(
|
107
|
+
(_a = modernConfig == null ? void 0 : modernConfig.tools) == null ? void 0 : _a.tailwindcss,
|
108
|
+
(_b = modernConfig == null ? void 0 : modernConfig.source) == null ? void 0 : _b.designSystem,
|
109
|
+
{
|
83
110
|
pureConfig: {
|
84
|
-
content: [
|
85
|
-
|
86
|
-
|
111
|
+
content: [
|
112
|
+
"./config/html/**/*.html",
|
113
|
+
"./config/html/**/*.ejs",
|
114
|
+
"./config/html/**/*.hbs",
|
115
|
+
"./src/**/*.js",
|
116
|
+
"./src/**/*.jsx",
|
117
|
+
"./src/**/*.ts",
|
118
|
+
"./src/**/*.tsx",
|
119
|
+
"./storybook/**/*",
|
120
|
+
"./styles/**/*.less",
|
121
|
+
"./styles/**/*.css",
|
122
|
+
"./styles/**/*.sass",
|
123
|
+
"./styles/**/*.scss"
|
124
|
+
]
|
87
125
|
}
|
88
|
-
});
|
89
|
-
if (Array.isArray(config.postcssOptions.plugins)) {
|
90
|
-
config.postcssOptions.plugins.push(require('tailwindcss')(tailwindConfig));
|
91
|
-
} else {
|
92
|
-
config.postcssOptions.plugins = [require('tailwindcss')(tailwindConfig)];
|
93
126
|
}
|
127
|
+
);
|
128
|
+
if (Array.isArray(config.postcssOptions.plugins)) {
|
129
|
+
config.postcssOptions.plugins.push(
|
130
|
+
require("tailwindcss")(tailwindConfig)
|
131
|
+
);
|
132
|
+
} else {
|
133
|
+
config.postcssOptions.plugins = [
|
134
|
+
require("tailwindcss")(tailwindConfig)
|
135
|
+
];
|
94
136
|
}
|
95
137
|
},
|
96
|
-
babel(
|
97
|
-
var _config$plugins;
|
138
|
+
babel(_, { addPlugins }) {
|
98
139
|
if (notHaveTwinMacro) {
|
99
140
|
return;
|
100
141
|
}
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
if (Array.isArray(plugin) && plugin[0]) {
|
109
|
-
const pluginTarget = plugin[0];
|
110
|
-
let pluginOptions = plugin[1];
|
111
|
-
if (typeof pluginTarget === 'string' &&
|
112
|
-
// TODO: use babel chain
|
113
|
-
(0, _utils.slash)(pluginTarget).includes('compiled/babel-plugin-macros')) {
|
114
|
-
if (pluginOptions) {
|
115
|
-
pluginOptions = _objectSpread(_objectSpread({}, pluginOptions), twinConfig);
|
116
|
-
} else {
|
117
|
-
plugin.push(twinConfig);
|
142
|
+
addPlugins([
|
143
|
+
[
|
144
|
+
require.resolve("babel-plugin-macros"),
|
145
|
+
{
|
146
|
+
twin: {
|
147
|
+
preset: supportCssInJsLibrary,
|
148
|
+
config: internalTwConfigPath
|
118
149
|
}
|
119
|
-
return true;
|
120
150
|
}
|
121
|
-
|
122
|
-
|
123
|
-
});
|
151
|
+
]
|
152
|
+
]);
|
124
153
|
}
|
125
154
|
}
|
126
155
|
};
|
156
|
+
},
|
157
|
+
beforeBuildTask({ config }) {
|
158
|
+
const modernConfig = api.useResolvedConfigContext();
|
159
|
+
const { designSystem } = modernConfig;
|
160
|
+
const tailwindConfig = (0, import_tailwind.getTailwindConfig)(
|
161
|
+
config.style.tailwindCss,
|
162
|
+
designSystem,
|
163
|
+
{
|
164
|
+
pureConfig: {
|
165
|
+
content: [
|
166
|
+
"./config/html/**/*.html",
|
167
|
+
"./config/html/**/*.ejs",
|
168
|
+
"./config/html/**/*.hbs",
|
169
|
+
"./src/**/*.js",
|
170
|
+
"./src/**/*.jsx",
|
171
|
+
"./src/**/*.ts",
|
172
|
+
"./src/**/*.tsx",
|
173
|
+
"./storybook/**/*",
|
174
|
+
"./styles/**/*.less",
|
175
|
+
"./styles/**/*.css",
|
176
|
+
"./styles/**/*.sass",
|
177
|
+
"./styles/**/*.scss"
|
178
|
+
]
|
179
|
+
}
|
180
|
+
}
|
181
|
+
);
|
182
|
+
if (Array.isArray(config.style.postcss.plugins)) {
|
183
|
+
config.style.postcss.plugins.push(
|
184
|
+
require("tailwindcss")(tailwindConfig)
|
185
|
+
);
|
186
|
+
} else {
|
187
|
+
config.style.postcss.plugins = [
|
188
|
+
require("tailwindcss")(tailwindConfig)
|
189
|
+
];
|
190
|
+
}
|
191
|
+
return config;
|
127
192
|
}
|
128
193
|
};
|
129
|
-
}
|
194
|
+
})
|
130
195
|
});
|
131
|
-
exports.default = _default;
|