@modern-js/plugin-tailwindcss 2.14.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 +25 -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
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
# @modern-js/plugin-tailwindcss
|
2
2
|
|
3
|
+
## 2.16.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- acc0a00: fix: upgrade libuild version to support tailwind in watch mode
|
8
|
+
fix: 更新 libuild 版本以支持 tailwindcss 在 watch 模式下生效
|
9
|
+
- 4e876ab: chore: package.json include the monorepo-relative directory
|
10
|
+
|
11
|
+
chore: 在 package.json 中声明 monorepo 的子路径
|
12
|
+
|
13
|
+
- Updated dependencies [02e9c5d]
|
14
|
+
- Updated dependencies [5954330]
|
15
|
+
- Updated dependencies [7596520]
|
16
|
+
- Updated dependencies [4e876ab]
|
17
|
+
- @modern-js/runtime@2.16.0
|
18
|
+
- @modern-js/utils@2.16.0
|
19
|
+
|
20
|
+
## 2.15.0
|
21
|
+
|
22
|
+
### Patch Changes
|
23
|
+
|
24
|
+
- Updated dependencies [09a3e57]
|
25
|
+
- @modern-js/runtime@2.15.0
|
26
|
+
- @modern-js/utils@2.15.0
|
27
|
+
|
3
28
|
## 2.14.0
|
4
29
|
|
5
30
|
### Patch Changes
|
package/dist/cjs/cli.js
CHANGED
@@ -1,178 +1,150 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __export = (target, all) => {
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
8
6
|
for (var name in all)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
return to;
|
18
|
-
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
-
mod
|
26
|
-
));
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
-
var cli_exports = {};
|
29
|
-
__export(cli_exports, {
|
30
|
-
default: () => cli_default,
|
31
|
-
getRandomTwConfigFileName: () => getRandomTwConfigFileName
|
7
|
+
Object.defineProperty(target, name, {
|
8
|
+
enumerable: true,
|
9
|
+
get: all[name]
|
10
|
+
});
|
11
|
+
}
|
12
|
+
_export(exports, {
|
13
|
+
getRandomTwConfigFileName: () => getRandomTwConfigFileName,
|
14
|
+
default: () => _default
|
32
15
|
});
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
16
|
+
const _path = /* @__PURE__ */ _interop_require_default(require("path"));
|
17
|
+
const _utils = require("@modern-js/utils");
|
18
|
+
const _cli = /* @__PURE__ */ _interop_require_default(require("./design-token/cli"));
|
19
|
+
const _tailwind = require("./tailwind");
|
20
|
+
const _utils1 = require("./utils");
|
21
|
+
function _interop_require_default(obj) {
|
22
|
+
return obj && obj.__esModule ? obj : {
|
23
|
+
default: obj
|
24
|
+
};
|
25
|
+
}
|
39
26
|
const supportCssInJsLibrary = "styled-components";
|
40
27
|
const getRandomTwConfigFileName = (internalDirectory) => {
|
41
|
-
return (0,
|
42
|
-
import_path.default.join(
|
43
|
-
internalDirectory,
|
44
|
-
`tailwind.config.${Date.now()}.${(0, import_utils.nanoid)()}.js`
|
45
|
-
)
|
46
|
-
);
|
28
|
+
return (0, _utils.slash)(_path.default.join(internalDirectory, `tailwind.config.${Date.now()}.${(0, _utils.nanoid)()}.js`));
|
47
29
|
};
|
48
|
-
|
30
|
+
const _default = ({ pluginName } = {
|
49
31
|
pluginName: "@modern-js/plugin-tailwindcss"
|
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
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
internalTwConfigPath,
|
91
|
-
(0, import_utils2.template)(files[files.length - 1]),
|
92
|
-
"utf-8"
|
93
|
-
);
|
32
|
+
}) => {
|
33
|
+
return {
|
34
|
+
name: "@modern-js/plugin-tailwindcss",
|
35
|
+
// support designSystem.supportStyledComponents
|
36
|
+
usePlugins: [
|
37
|
+
(0, _cli.default)({
|
38
|
+
pluginName
|
39
|
+
})
|
40
|
+
],
|
41
|
+
setup: async (api) => {
|
42
|
+
const { appDirectory, internalDirectory } = api.useAppContext();
|
43
|
+
let internalTwConfigPath = "";
|
44
|
+
const haveTwinMacro = await (0, _utils1.checkTwinMacroExist)(appDirectory);
|
45
|
+
const tailwindPath = (0, _utils1.getTailwindPath)(appDirectory);
|
46
|
+
const tailwindVersion = (0, _utils1.getTailwindVersion)(appDirectory);
|
47
|
+
const defaultContent = [
|
48
|
+
"./config/html/**/*.html",
|
49
|
+
"./config/html/**/*.ejs",
|
50
|
+
"./config/html/**/*.hbs",
|
51
|
+
"./src/**/*.js",
|
52
|
+
"./src/**/*.jsx",
|
53
|
+
"./src/**/*.ts",
|
54
|
+
"./src/**/*.tsx",
|
55
|
+
// about storybook
|
56
|
+
"./storybook/**/*"
|
57
|
+
];
|
58
|
+
return {
|
59
|
+
prepare() {
|
60
|
+
if (haveTwinMacro) {
|
61
|
+
const twinMajorVersion = (0, _utils1.getTwinMacroMajorVersion)(appDirectory);
|
62
|
+
const useConfigPath = twinMajorVersion && twinMajorVersion < 3;
|
63
|
+
if (useConfigPath) {
|
64
|
+
internalTwConfigPath = getRandomTwConfigFileName(internalDirectory);
|
65
|
+
const globPattern = (0, _utils.slash)(_path.default.join(appDirectory, _utils.CONFIG_CACHE_DIR, "*.cjs"));
|
66
|
+
const files = _utils.globby.sync(globPattern, {
|
67
|
+
absolute: true
|
68
|
+
});
|
69
|
+
if (files.length > 0) {
|
70
|
+
_utils.fs.writeFileSync(internalTwConfigPath, (0, _utils1.template)(files[files.length - 1]), "utf-8");
|
71
|
+
}
|
94
72
|
}
|
95
73
|
}
|
96
|
-
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
tailwindConfig = (0, import_tailwind.getTailwindConfig)(
|
108
|
-
tailwindVersion,
|
109
|
-
(_a = modernConfig == null ? void 0 : modernConfig.tools) == null ? void 0 : _a.tailwindcss,
|
110
|
-
(_b = modernConfig == null ? void 0 : modernConfig.source) == null ? void 0 : _b.designSystem,
|
111
|
-
{
|
74
|
+
},
|
75
|
+
validateSchema() {
|
76
|
+
return _utils.PLUGIN_SCHEMAS["@modern-js/plugin-tailwindcss"];
|
77
|
+
},
|
78
|
+
config() {
|
79
|
+
let tailwindConfig;
|
80
|
+
const initTailwindConfig = () => {
|
81
|
+
if (!tailwindConfig) {
|
82
|
+
var _modernConfig_tools, _modernConfig_source;
|
83
|
+
const modernConfig = api.useResolvedConfigContext();
|
84
|
+
tailwindConfig = (0, _tailwind.getTailwindConfig)(tailwindVersion, 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, {
|
112
85
|
pureConfig: {
|
113
86
|
content: defaultContent
|
114
87
|
}
|
115
|
-
}
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
postcss: (config) => {
|
124
|
-
initTailwindConfig();
|
125
|
-
const tailwindPlugin = require(tailwindPath)(tailwindConfig);
|
126
|
-
if (Array.isArray(config.postcssOptions.plugins)) {
|
127
|
-
config.postcssOptions.plugins.push(tailwindPlugin);
|
128
|
-
} else {
|
129
|
-
config.postcssOptions.plugins = [tailwindPlugin];
|
130
|
-
}
|
131
|
-
},
|
132
|
-
babel(_, { addPlugins }) {
|
133
|
-
if (haveTwinMacro) {
|
88
|
+
});
|
89
|
+
}
|
90
|
+
};
|
91
|
+
return {
|
92
|
+
tools: {
|
93
|
+
// TODO: Add interface about postcss config
|
94
|
+
// TODO: In module project, also is called, but should not be called.
|
95
|
+
postcss: (config) => {
|
134
96
|
initTailwindConfig();
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
97
|
+
const tailwindPlugin = require(tailwindPath)(tailwindConfig);
|
98
|
+
if (Array.isArray(config.postcssOptions.plugins)) {
|
99
|
+
config.postcssOptions.plugins.push(tailwindPlugin);
|
100
|
+
} else {
|
101
|
+
config.postcssOptions.plugins = [
|
102
|
+
tailwindPlugin
|
103
|
+
];
|
104
|
+
}
|
105
|
+
},
|
106
|
+
babel(_, { addPlugins }) {
|
107
|
+
if (haveTwinMacro) {
|
108
|
+
initTailwindConfig();
|
109
|
+
addPlugins([
|
110
|
+
[
|
111
|
+
require.resolve("babel-plugin-macros"),
|
112
|
+
{
|
113
|
+
twin: {
|
114
|
+
preset: supportCssInJsLibrary,
|
115
|
+
config: internalTwConfigPath || tailwindConfig
|
116
|
+
}
|
142
117
|
}
|
143
|
-
|
144
|
-
]
|
145
|
-
|
118
|
+
]
|
119
|
+
]);
|
120
|
+
}
|
146
121
|
}
|
147
122
|
}
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
const tailwindConfig = (0, import_tailwind.getTailwindConfig)(
|
155
|
-
tailwindVersion,
|
156
|
-
config.style.tailwindCss,
|
157
|
-
designSystem,
|
158
|
-
{
|
123
|
+
};
|
124
|
+
},
|
125
|
+
beforeBuildTask(config) {
|
126
|
+
const modernConfig = api.useResolvedConfigContext();
|
127
|
+
const { designSystem } = modernConfig;
|
128
|
+
const tailwindConfig = (0, _tailwind.getTailwindConfig)(tailwindVersion, config.style.tailwindCss, designSystem, {
|
159
129
|
pureConfig: {
|
160
130
|
content: defaultContent
|
161
131
|
}
|
132
|
+
});
|
133
|
+
const tailwindPlugin = require(tailwindPath)(tailwindConfig);
|
134
|
+
if (Array.isArray(config.style.postcss.plugins)) {
|
135
|
+
config.style.postcss.plugins.push(tailwindPlugin);
|
136
|
+
} else {
|
137
|
+
config.style.postcss.plugins = [
|
138
|
+
tailwindPlugin
|
139
|
+
];
|
162
140
|
}
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
config.
|
167
|
-
|
168
|
-
config.style.postcss.plugins = [tailwindPlugin];
|
141
|
+
return config;
|
142
|
+
},
|
143
|
+
modifyLibuild(config, next) {
|
144
|
+
config.transformCache = false;
|
145
|
+
return next(config);
|
169
146
|
}
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
});
|
175
|
-
// Annotate the CommonJS export names for ESM import in node:
|
176
|
-
0 && (module.exports = {
|
177
|
-
getRandomTwConfigFileName
|
178
|
-
});
|
147
|
+
};
|
148
|
+
}
|
149
|
+
};
|
150
|
+
};
|
@@ -1,116 +1,98 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
-
var __export = (target, all) => {
|
6
|
-
for (var name in all)
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
-
};
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
-
for (let key of __getOwnPropNames(from))
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
-
}
|
15
|
-
return to;
|
16
|
-
};
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
-
var cli_exports = {};
|
19
|
-
__export(cli_exports, {
|
20
|
-
default: () => cli_default
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
21
4
|
});
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
const appContext = api.useAppContext();
|
44
|
-
pluginsExportsUtils = (0, import_utils.createRuntimeExportsUtils)(
|
45
|
-
appContext.internalDirectory,
|
46
|
-
"plugins"
|
47
|
-
);
|
48
|
-
return {
|
49
|
-
source: {
|
50
|
-
alias: {
|
51
|
-
"@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
|
52
|
-
}
|
53
|
-
},
|
54
|
-
tools: {
|
55
|
-
// TODO: support less、scss、css vars
|
56
|
-
// less: https://github.com/web-infra-dev/modern.js/pull/398/files#diff-f77c749e403fbf1fb676d5687bef3d7138a230331c849298d8afaff9b6afbc3dR166
|
57
|
-
// sass: https://github.com/web-infra-dev/modern.js/pull/398/files#diff-f77c749e403fbf1fb676d5687bef3d7138a230331c849298d8afaff9b6afbc3dR229
|
58
|
-
// postcss: https://github.com/web-infra-dev/modern.js/pull/398/files#diff-f77c749e403fbf1fb676d5687bef3d7138a230331c849298d8afaff9b6afbc3dR281
|
59
|
-
}
|
60
|
-
};
|
61
|
-
},
|
62
|
-
modifyEntryImports({ entrypoint, imports }) {
|
63
|
-
var _a, _b;
|
64
|
-
const userConfig = api.useResolvedConfigContext();
|
65
|
-
const designSystem = (_b = (_a = userConfig.source) == null ? void 0 : _a.designSystem) != null ? _b : {};
|
66
|
-
if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
|
67
|
-
const designTokens = getDesignTokens(userConfig.source.designSystem);
|
68
|
-
imports.push({
|
69
|
-
value: "@modern-js/runtime/plugins",
|
70
|
-
specifiers: [
|
71
|
-
{
|
72
|
-
imported: PLUGIN_IDENTIFIER
|
73
|
-
}
|
74
|
-
],
|
75
|
-
initialize: `
|
76
|
-
const designTokens = ${JSON.stringify(designTokens)};
|
77
|
-
`
|
78
|
-
});
|
5
|
+
Object.defineProperty(exports, "default", {
|
6
|
+
enumerable: true,
|
7
|
+
get: () => _default
|
8
|
+
});
|
9
|
+
const _utils = require("@modern-js/utils");
|
10
|
+
const _default = ({ pluginName } = {
|
11
|
+
pluginName: "@modern-js/plugin-tailwindcss"
|
12
|
+
}) => {
|
13
|
+
return {
|
14
|
+
name: "@modern-js/plugin-design-token",
|
15
|
+
setup(api) {
|
16
|
+
let pluginsExportsUtils;
|
17
|
+
const resolveConfig = (0, _utils.lazyImport)("tailwindcss/resolveConfig", require);
|
18
|
+
const PLUGIN_IDENTIFIER = "designToken";
|
19
|
+
const getDesignTokens = (designSystem) => {
|
20
|
+
const tailwindcssConfig = {};
|
21
|
+
tailwindcssConfig.theme = designSystem ? {
|
22
|
+
...designSystem
|
23
|
+
} : {};
|
24
|
+
if (!designSystem) {
|
25
|
+
tailwindcssConfig.presets = [];
|
79
26
|
}
|
80
|
-
return {
|
81
|
-
entrypoint,
|
82
|
-
imports
|
83
|
-
};
|
84
|
-
},
|
85
|
-
modifyEntryRuntimePlugins({ entrypoint, plugins }) {
|
86
|
-
var _a, _b;
|
87
|
-
const userConfig = api.useResolvedConfigContext();
|
88
|
-
const designSystem = (_b = (_a = userConfig.source) == null ? void 0 : _a.designSystem) != null ? _b : {};
|
89
|
-
let useSCThemeProvider = true;
|
90
27
|
if (designSystem) {
|
91
|
-
|
28
|
+
delete tailwindcssConfig.theme.supportStyledComponents;
|
92
29
|
}
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
30
|
+
return resolveConfig(tailwindcssConfig).theme || {};
|
31
|
+
};
|
32
|
+
return {
|
33
|
+
config() {
|
34
|
+
const appContext = api.useAppContext();
|
35
|
+
pluginsExportsUtils = (0, _utils.createRuntimeExportsUtils)(appContext.internalDirectory, "plugins");
|
36
|
+
return {
|
37
|
+
source: {
|
38
|
+
alias: {
|
39
|
+
"@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
|
40
|
+
}
|
41
|
+
},
|
42
|
+
tools: {}
|
43
|
+
};
|
44
|
+
},
|
45
|
+
modifyEntryImports({ entrypoint, imports }) {
|
46
|
+
var _userConfig_source;
|
47
|
+
const userConfig = api.useResolvedConfigContext();
|
48
|
+
var _userConfig_source_designSystem;
|
49
|
+
const 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 : {};
|
50
|
+
if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
|
51
|
+
const designTokens = getDesignTokens(userConfig.source.designSystem);
|
52
|
+
imports.push({
|
53
|
+
value: "@modern-js/runtime/plugins",
|
54
|
+
specifiers: [
|
55
|
+
{
|
56
|
+
imported: PLUGIN_IDENTIFIER
|
57
|
+
}
|
58
|
+
],
|
59
|
+
initialize: `
|
60
|
+
const designTokens = ${JSON.stringify(designTokens)};
|
61
|
+
`
|
62
|
+
});
|
63
|
+
}
|
64
|
+
return {
|
65
|
+
entrypoint,
|
66
|
+
imports
|
67
|
+
};
|
68
|
+
},
|
69
|
+
modifyEntryRuntimePlugins({ entrypoint, plugins }) {
|
70
|
+
var _userConfig_source;
|
71
|
+
const userConfig = api.useResolvedConfigContext();
|
72
|
+
var _userConfig_source_designSystem;
|
73
|
+
const 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 : {};
|
74
|
+
let useSCThemeProvider = true;
|
75
|
+
if (designSystem) {
|
76
|
+
useSCThemeProvider = (designSystem === null || designSystem === void 0 ? void 0 : designSystem.supportStyledComponents) || false;
|
77
|
+
}
|
78
|
+
if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
|
79
|
+
plugins.push({
|
80
|
+
name: PLUGIN_IDENTIFIER,
|
81
|
+
options: `{token: designTokens, useStyledComponentsThemeProvider: ${useSCThemeProvider ? "true" : "false"}, useDesignTokenContext: false}`
|
82
|
+
});
|
83
|
+
}
|
84
|
+
return {
|
85
|
+
entrypoint,
|
86
|
+
plugins
|
87
|
+
};
|
88
|
+
},
|
89
|
+
validateSchema() {
|
90
|
+
return _utils.PLUGIN_SCHEMAS["@modern-js/plugin-design-token"];
|
91
|
+
},
|
92
|
+
addRuntimeExports() {
|
93
|
+
pluginsExportsUtils.addExport(`export { default as designToken } from '${pluginName}/runtime-design-token'`);
|
98
94
|
}
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
},
|
104
|
-
validateSchema() {
|
105
|
-
return import_utils.PLUGIN_SCHEMAS["@modern-js/plugin-design-token"];
|
106
|
-
},
|
107
|
-
addRuntimeExports() {
|
108
|
-
pluginsExportsUtils.addExport(
|
109
|
-
`export { default as designToken } from '${pluginName}/runtime-design-token'`
|
110
|
-
);
|
111
|
-
}
|
112
|
-
};
|
113
|
-
}
|
114
|
-
});
|
115
|
-
// Annotate the CommonJS export names for ESM import in node:
|
116
|
-
0 && (module.exports = {});
|
95
|
+
};
|
96
|
+
}
|
97
|
+
};
|
98
|
+
};
|
@@ -1,37 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
-
mod
|
27
|
-
));
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var design_token_exports = {};
|
30
|
-
__export(design_token_exports, {
|
31
|
-
default: () => import_runtime.default
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
32
4
|
});
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
5
|
+
Object.defineProperty(exports, "default", {
|
6
|
+
enumerable: true,
|
7
|
+
get: () => _runtime.default
|
8
|
+
});
|
9
|
+
const _runtime = /* @__PURE__ */ _interop_require_default(_export_star(require("./runtime"), exports));
|
10
|
+
function _export_star(from, to) {
|
11
|
+
Object.keys(from).forEach(function(k) {
|
12
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
13
|
+
Object.defineProperty(to, k, {
|
14
|
+
enumerable: true,
|
15
|
+
get: function() {
|
16
|
+
return from[k];
|
17
|
+
}
|
18
|
+
});
|
19
|
+
}
|
20
|
+
});
|
21
|
+
return from;
|
22
|
+
}
|
23
|
+
function _interop_require_default(obj) {
|
24
|
+
return obj && obj.__esModule ? obj : {
|
25
|
+
default: obj
|
26
|
+
};
|
27
|
+
}
|
@@ -1,28 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
};
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
-
for (let key of __getOwnPropNames(from))
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
-
}
|
15
|
-
return to;
|
16
|
-
};
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
-
var postcss_plugin_exports = {};
|
19
|
-
__export(postcss_plugin_exports, {
|
20
|
-
default: () => postcss_plugin_default
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "default", {
|
6
|
+
enumerable: true,
|
7
|
+
get: () => _default
|
21
8
|
});
|
22
|
-
|
23
|
-
var postcss_plugin_default = ({
|
24
|
-
cssVarsHash = {}
|
25
|
-
} = {}) => ({
|
9
|
+
const _default = ({ cssVarsHash = {} } = {}) => ({
|
26
10
|
postcssPlugin: "postcss-replace-css-vars",
|
27
11
|
Declaration(decl) {
|
28
12
|
if (decl.value && typeof decl.value === "string") {
|
@@ -35,5 +19,3 @@ var postcss_plugin_default = ({
|
|
35
19
|
}
|
36
20
|
}
|
37
21
|
});
|
38
|
-
// Annotate the CommonJS export names for ESM import in node:
|
39
|
-
0 && (module.exports = {});
|