@modern-js/plugin-tailwindcss 2.4.0 → 2.5.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 +22 -0
- package/dist/{js/node → cjs}/cli.js +3 -23
- package/dist/{js/node → cjs}/design-token/cli/index.js +1 -15
- package/dist/{js/node → cjs}/design-token/index.js +0 -0
- package/dist/{js/node → cjs}/design-token/postcss-plugin/index.js +0 -0
- package/dist/{js/node → cjs}/design-token/runtime/index.js +0 -0
- package/dist/{js/node → cjs}/design-token/runtime/plugin.js +12 -18
- package/dist/{js/node → cjs}/index.js +0 -0
- package/dist/{js/node → cjs}/tailwind.js +0 -0
- package/dist/{js/node → cjs}/types.js +0 -0
- package/dist/{js/node → cjs}/utils.js +4 -24
- package/dist/{js/treeshaking → esm}/cli.js +4 -4
- package/dist/{js/treeshaking → esm}/design-token/cli/index.js +6 -6
- package/dist/{js/treeshaking → esm}/design-token/index.js +0 -0
- package/dist/{js/treeshaking → esm}/design-token/postcss-plugin/index.js +1 -1
- package/dist/{js/treeshaking → esm}/design-token/runtime/index.js +0 -0
- package/dist/{js/treeshaking → esm}/design-token/runtime/plugin.js +1 -1
- package/dist/{js/treeshaking → esm}/index.js +0 -0
- package/dist/{js/treeshaking → esm}/tailwind.js +1 -1
- package/dist/{js/treeshaking → esm}/types.js +0 -0
- package/dist/{js/treeshaking → esm}/utils.js +0 -0
- package/dist/{js/modern → esm-node}/cli.js +3 -23
- package/dist/{js/modern → esm-node}/design-token/cli/index.js +1 -17
- package/dist/{js/modern → esm-node}/design-token/index.js +0 -0
- package/dist/{js/modern → esm-node}/design-token/postcss-plugin/index.js +0 -0
- package/dist/{js/modern → esm-node}/design-token/runtime/index.js +0 -0
- package/dist/{js/modern → esm-node}/design-token/runtime/plugin.js +12 -20
- package/dist/{js/modern → esm-node}/index.js +0 -0
- package/dist/{js/modern → esm-node}/tailwind.js +0 -0
- package/dist/{js/modern → esm-node}/types.js +0 -0
- package/dist/{js/modern → esm-node}/utils.js +4 -24
- package/package.json +17 -18
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# @modern-js/plugin-tailwindcss
|
2
2
|
|
3
|
+
## 2.5.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 89ca6cc: refactor: merge build-config into scripts/build
|
8
|
+
|
9
|
+
refactor: 把 build-config 合并进 scripts/build
|
10
|
+
|
11
|
+
- 30614fa: chore: modify package.json entry fields and build config
|
12
|
+
chore: 更改 package.json entry 字段以及构建配置
|
13
|
+
- Updated dependencies [89ca6cc]
|
14
|
+
- Updated dependencies [7cb8bb4]
|
15
|
+
- Updated dependencies [30614fa]
|
16
|
+
- Updated dependencies [7a25271]
|
17
|
+
- Updated dependencies [8871bb8]
|
18
|
+
- Updated dependencies [1b0ce87]
|
19
|
+
- Updated dependencies [0d75c27]
|
20
|
+
- Updated dependencies [11c053b]
|
21
|
+
- Updated dependencies [a0f2ab1]
|
22
|
+
- @modern-js/runtime@2.5.0
|
23
|
+
- @modern-js/utils@2.5.0
|
24
|
+
|
3
25
|
## 2.4.0
|
4
26
|
|
5
27
|
### Patch Changes
|
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
21
21
|
mod
|
22
22
|
));
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
25
|
-
return new Promise((resolve, reject) => {
|
26
|
-
var fulfilled = (value) => {
|
27
|
-
try {
|
28
|
-
step(generator.next(value));
|
29
|
-
} catch (e) {
|
30
|
-
reject(e);
|
31
|
-
}
|
32
|
-
};
|
33
|
-
var rejected = (value) => {
|
34
|
-
try {
|
35
|
-
step(generator.throw(value));
|
36
|
-
} catch (e) {
|
37
|
-
reject(e);
|
38
|
-
}
|
39
|
-
};
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
42
|
-
});
|
43
|
-
};
|
44
24
|
var cli_exports = {};
|
45
25
|
__export(cli_exports, {
|
46
26
|
default: () => cli_default,
|
@@ -70,10 +50,10 @@ var cli_default = ({ pluginName } = {
|
|
70
50
|
pluginName
|
71
51
|
})
|
72
52
|
],
|
73
|
-
setup: (api) =>
|
53
|
+
setup: async (api) => {
|
74
54
|
const { appDirectory, internalDirectory } = api.useAppContext();
|
75
55
|
let internalTwConfigPath = "";
|
76
|
-
const haveTwinMacro =
|
56
|
+
const haveTwinMacro = await (0, import_utils2.checkTwinMacroExist)(appDirectory);
|
77
57
|
const tailwindPath = (0, import_utils2.getTailwindPath)(appDirectory);
|
78
58
|
const tailwindVersion = (0, import_utils2.getTailwindVersion)(appDirectory);
|
79
59
|
const defaultContent = [
|
@@ -182,7 +162,7 @@ var cli_default = ({ pluginName } = {
|
|
182
162
|
return config;
|
183
163
|
}
|
184
164
|
};
|
185
|
-
}
|
165
|
+
}
|
186
166
|
});
|
187
167
|
// Annotate the CommonJS export names for ESM import in node:
|
188
168
|
0 && (module.exports = {
|
@@ -1,21 +1,7 @@
|
|
1
1
|
var __defProp = Object.defineProperty;
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
-
var __spreadValues = (a, b) => {
|
9
|
-
for (var prop in b || (b = {}))
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
12
|
-
if (__getOwnPropSymbols)
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
14
|
-
if (__propIsEnum.call(b, prop))
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
16
|
-
}
|
17
|
-
return a;
|
18
|
-
};
|
19
5
|
var __export = (target, all) => {
|
20
6
|
for (var name in all)
|
21
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
@@ -43,7 +29,7 @@ var cli_default = ({ pluginName } = { pluginName: "@modern-js/plugin-tailwindcss
|
|
43
29
|
const PLUGIN_IDENTIFIER = "designToken";
|
44
30
|
const getDesignTokens = (designSystem) => {
|
45
31
|
const tailwindcssConfig = {};
|
46
|
-
tailwindcssConfig.theme = designSystem ?
|
32
|
+
tailwindcssConfig.theme = designSystem ? { ...designSystem } : {};
|
47
33
|
if (!designSystem) {
|
48
34
|
tailwindcssConfig.presets = [];
|
49
35
|
}
|
File without changes
|
File without changes
|
File without changes
|
@@ -2,22 +2,8 @@ var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
6
5
|
var __getProtoOf = Object.getPrototypeOf;
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
10
|
-
var __spreadValues = (a, b) => {
|
11
|
-
for (var prop in b || (b = {}))
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
14
|
-
if (__getOwnPropSymbols)
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
16
|
-
if (__propIsEnum.call(b, prop))
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
18
|
-
}
|
19
|
-
return a;
|
20
|
-
};
|
21
7
|
var __export = (target, all) => {
|
22
8
|
for (var name in all)
|
23
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
@@ -63,22 +49,30 @@ var plugin_default = (options = {}) => ({
|
|
63
49
|
theme: token,
|
64
50
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DesignTokenContext.Provider, {
|
65
51
|
value: token,
|
66
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App,
|
52
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
53
|
+
...props
|
54
|
+
})
|
67
55
|
})
|
68
56
|
});
|
69
57
|
} else if (useStyledComponentsThemeProvider) {
|
70
58
|
const { ThemeProvider } = require("@modern-js/runtime/styled");
|
71
59
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeProvider, {
|
72
60
|
theme: token,
|
73
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App,
|
61
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
62
|
+
...props
|
63
|
+
})
|
74
64
|
});
|
75
65
|
} else if (useDesignTokenContext) {
|
76
66
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DesignTokenContext.Provider, {
|
77
67
|
value: token,
|
78
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App,
|
68
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
69
|
+
...props
|
70
|
+
})
|
79
71
|
});
|
80
72
|
} else {
|
81
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App,
|
73
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
74
|
+
...props
|
75
|
+
});
|
82
76
|
}
|
83
77
|
};
|
84
78
|
return next({
|
File without changes
|
File without changes
|
File without changes
|
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
21
21
|
mod
|
22
22
|
));
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
25
|
-
return new Promise((resolve, reject) => {
|
26
|
-
var fulfilled = (value) => {
|
27
|
-
try {
|
28
|
-
step(generator.next(value));
|
29
|
-
} catch (e) {
|
30
|
-
reject(e);
|
31
|
-
}
|
32
|
-
};
|
33
|
-
var rejected = (value) => {
|
34
|
-
try {
|
35
|
-
step(generator.throw(value));
|
36
|
-
} catch (e) {
|
37
|
-
reject(e);
|
38
|
-
}
|
39
|
-
};
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
42
|
-
});
|
43
|
-
};
|
44
24
|
var utils_exports = {};
|
45
25
|
__export(utils_exports, {
|
46
26
|
checkTwinMacroExist: () => checkTwinMacroExist,
|
@@ -73,14 +53,14 @@ module.exports = {
|
|
73
53
|
};
|
74
54
|
`;
|
75
55
|
const TWIN_MACRO_NAME = "twin.macro";
|
76
|
-
const checkTwinMacroExist = (appDirectory) =>
|
77
|
-
const packageJson =
|
56
|
+
const checkTwinMacroExist = async (appDirectory) => {
|
57
|
+
const packageJson = await import_utils.fs.readJSON(import_path.default.join(appDirectory, "package.json"), {
|
78
58
|
throws: false
|
79
|
-
})
|
59
|
+
}) || {};
|
80
60
|
return Boolean(
|
81
61
|
typeof packageJson.dependencies === "object" && packageJson.dependencies[TWIN_MACRO_NAME] || typeof packageJson.devDependencies === "object" && packageJson.devDependencies[TWIN_MACRO_NAME]
|
82
62
|
);
|
83
|
-
}
|
63
|
+
};
|
84
64
|
const getTwinMacroMajorVersion = (appDirectory) => {
|
85
65
|
try {
|
86
66
|
const pkgJsonPath = require.resolve(`${TWIN_MACRO_NAME}/package.json`, {
|
@@ -144,11 +144,11 @@ var cli_default = function() {
|
|
144
144
|
],
|
145
145
|
setup: function() {
|
146
146
|
var _ref = _asyncToGenerator(function(api) {
|
147
|
-
var
|
147
|
+
var _api_useAppContext, appDirectory, internalDirectory, internalTwConfigPath, haveTwinMacro, tailwindPath, tailwindVersion, defaultContent;
|
148
148
|
return __generator(this, function(_state) {
|
149
149
|
switch(_state.label){
|
150
150
|
case 0:
|
151
|
-
|
151
|
+
_api_useAppContext = api.useAppContext(), appDirectory = _api_useAppContext.appDirectory, internalDirectory = _api_useAppContext.internalDirectory;
|
152
152
|
internalTwConfigPath = "";
|
153
153
|
return [
|
154
154
|
4,
|
@@ -194,9 +194,9 @@ var cli_default = function() {
|
|
194
194
|
var tailwindConfig;
|
195
195
|
var initTailwindConfig = function() {
|
196
196
|
if (!tailwindConfig) {
|
197
|
-
var
|
197
|
+
var _modernConfig_tools, _modernConfig_source;
|
198
198
|
var modernConfig = api.useResolvedConfigContext();
|
199
|
-
tailwindConfig = getTailwindConfig(tailwindVersion, modernConfig === null || modernConfig === void 0 ? void 0 : (
|
199
|
+
tailwindConfig = 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, {
|
200
200
|
pureConfig: {
|
201
201
|
content: defaultContent
|
202
202
|
}
|
@@ -63,10 +63,10 @@ var cli_default = function() {
|
|
63
63
|
},
|
64
64
|
modifyEntryImports: function modifyEntryImports(param) {
|
65
65
|
var entrypoint = param.entrypoint, imports = param.imports;
|
66
|
-
var
|
66
|
+
var _userConfig_source;
|
67
67
|
var userConfig = api.useResolvedConfigContext();
|
68
|
-
var
|
69
|
-
var designSystem = (
|
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
70
|
if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
|
71
71
|
var designTokens = getDesignTokens(userConfig.source.designSystem);
|
72
72
|
imports.push({
|
@@ -86,10 +86,10 @@ var cli_default = function() {
|
|
86
86
|
},
|
87
87
|
modifyEntryRuntimePlugins: function modifyEntryRuntimePlugins(param) {
|
88
88
|
var entrypoint = param.entrypoint, plugins = param.plugins;
|
89
|
-
var
|
89
|
+
var _userConfig_source;
|
90
90
|
var userConfig = api.useResolvedConfigContext();
|
91
|
-
var
|
92
|
-
var designSystem = (
|
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
93
|
var useSCThemeProvider = true;
|
94
94
|
if (designSystem) {
|
95
95
|
useSCThemeProvider = (designSystem === null || designSystem === void 0 ? void 0 : designSystem.supportStyledComponents) || false;
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
var postcss_plugin_default = function() {
|
2
|
-
var
|
2
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref_cssVarsHash = _ref.cssVarsHash, cssVarsHash = _ref_cssVarsHash === void 0 ? {} : _ref_cssVarsHash;
|
3
3
|
return {
|
4
4
|
postcssPlugin: "postcss-replace-css-vars",
|
5
5
|
Declaration: function Declaration(decl) {
|
File without changes
|
@@ -42,7 +42,7 @@ var plugin_default = function() {
|
|
42
42
|
hoc: function hoc(param, next) {
|
43
43
|
var App = param.App;
|
44
44
|
var DesignTokenAppWrapper = function(props) {
|
45
|
-
var
|
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
46
|
if (useStyledComponentsThemeProvider && useDesignTokenContext) {
|
47
47
|
var ThemeProvider = require("@modern-js/runtime/styled").ThemeProvider;
|
48
48
|
return /* @__PURE__ */ jsx(ThemeProvider, {
|
File without changes
|
@@ -80,7 +80,7 @@ var getTailwindConfig = function(tailwindVersion, tailwindcss, designSystem) {
|
|
80
80
|
};
|
81
81
|
var tailwindConfig = applyOptionsChain(defaultTailwindConfig, tailwindcss || {});
|
82
82
|
var designSystemConfig = getPureDesignSystemConfig(designSystem !== null && designSystem !== void 0 ? designSystem : {});
|
83
|
-
var
|
83
|
+
var _checkIfExistNotAllowKeys = _slicedToArray(checkIfExistNotAllowKeys(tailwindConfig), 2), exist = _checkIfExistNotAllowKeys[0], key = _checkIfExistNotAllowKeys[1];
|
84
84
|
if (exist) {
|
85
85
|
logger.error("should not exist '".concat(key, "' on tools.tailwindcss, please remove it"));
|
86
86
|
process.exit(0);
|
File without changes
|
File without changes
|
@@ -1,23 +1,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
1
|
import path from "path";
|
22
2
|
import {
|
23
3
|
PLUGIN_SCHEMAS,
|
@@ -54,10 +34,10 @@ var cli_default = ({ pluginName } = {
|
|
54
34
|
pluginName
|
55
35
|
})
|
56
36
|
],
|
57
|
-
setup: (api) =>
|
37
|
+
setup: async (api) => {
|
58
38
|
const { appDirectory, internalDirectory } = api.useAppContext();
|
59
39
|
let internalTwConfigPath = "";
|
60
|
-
const haveTwinMacro =
|
40
|
+
const haveTwinMacro = await checkTwinMacroExist(appDirectory);
|
61
41
|
const tailwindPath = getTailwindPath(appDirectory);
|
62
42
|
const tailwindVersion = getTailwindVersion(appDirectory);
|
63
43
|
const defaultContent = [
|
@@ -166,7 +146,7 @@ var cli_default = ({ pluginName } = {
|
|
166
146
|
return config;
|
167
147
|
}
|
168
148
|
};
|
169
|
-
}
|
149
|
+
}
|
170
150
|
});
|
171
151
|
export {
|
172
152
|
cli_default as default,
|
@@ -1,19 +1,3 @@
|
|
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
1
|
import {
|
18
2
|
lazyImport,
|
19
3
|
PLUGIN_SCHEMAS,
|
@@ -27,7 +11,7 @@ var cli_default = ({ pluginName } = { pluginName: "@modern-js/plugin-tailwindcss
|
|
27
11
|
const PLUGIN_IDENTIFIER = "designToken";
|
28
12
|
const getDesignTokens = (designSystem) => {
|
29
13
|
const tailwindcssConfig = {};
|
30
|
-
tailwindcssConfig.theme = designSystem ?
|
14
|
+
tailwindcssConfig.theme = designSystem ? { ...designSystem } : {};
|
31
15
|
if (!designSystem) {
|
32
16
|
tailwindcssConfig.presets = [];
|
33
17
|
}
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,19 +1,3 @@
|
|
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
1
|
import { jsx } from "react/jsx-runtime";
|
18
2
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
19
3
|
import React, { useContext } from "react";
|
@@ -35,22 +19,30 @@ var plugin_default = (options = {}) => ({
|
|
35
19
|
theme: token,
|
36
20
|
children: /* @__PURE__ */ jsx(DesignTokenContext.Provider, {
|
37
21
|
value: token,
|
38
|
-
children: /* @__PURE__ */ jsx(App,
|
22
|
+
children: /* @__PURE__ */ jsx(App, {
|
23
|
+
...props
|
24
|
+
})
|
39
25
|
})
|
40
26
|
});
|
41
27
|
} else if (useStyledComponentsThemeProvider) {
|
42
28
|
const { ThemeProvider } = require("@modern-js/runtime/styled");
|
43
29
|
return /* @__PURE__ */ jsx(ThemeProvider, {
|
44
30
|
theme: token,
|
45
|
-
children: /* @__PURE__ */ jsx(App,
|
31
|
+
children: /* @__PURE__ */ jsx(App, {
|
32
|
+
...props
|
33
|
+
})
|
46
34
|
});
|
47
35
|
} else if (useDesignTokenContext) {
|
48
36
|
return /* @__PURE__ */ jsx(DesignTokenContext.Provider, {
|
49
37
|
value: token,
|
50
|
-
children: /* @__PURE__ */ jsx(App,
|
38
|
+
children: /* @__PURE__ */ jsx(App, {
|
39
|
+
...props
|
40
|
+
})
|
51
41
|
});
|
52
42
|
} else {
|
53
|
-
return /* @__PURE__ */ jsx(App,
|
43
|
+
return /* @__PURE__ */ jsx(App, {
|
44
|
+
...props
|
45
|
+
});
|
54
46
|
}
|
55
47
|
};
|
56
48
|
return next({
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,23 +1,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
1
|
import path from "path";
|
22
2
|
import { fs } from "@modern-js/utils";
|
23
3
|
const template = (configPath) => `
|
@@ -41,14 +21,14 @@ module.exports = {
|
|
41
21
|
};
|
42
22
|
`;
|
43
23
|
const TWIN_MACRO_NAME = "twin.macro";
|
44
|
-
const checkTwinMacroExist = (appDirectory) =>
|
45
|
-
const packageJson =
|
24
|
+
const checkTwinMacroExist = async (appDirectory) => {
|
25
|
+
const packageJson = await fs.readJSON(path.join(appDirectory, "package.json"), {
|
46
26
|
throws: false
|
47
|
-
})
|
27
|
+
}) || {};
|
48
28
|
return Boolean(
|
49
29
|
typeof packageJson.dependencies === "object" && packageJson.dependencies[TWIN_MACRO_NAME] || typeof packageJson.devDependencies === "object" && packageJson.devDependencies[TWIN_MACRO_NAME]
|
50
30
|
);
|
51
|
-
}
|
31
|
+
};
|
52
32
|
const getTwinMacroMajorVersion = (appDirectory) => {
|
53
33
|
try {
|
54
34
|
const pkgJsonPath = require.resolve(`${TWIN_MACRO_NAME}/package.json`, {
|
package/package.json
CHANGED
@@ -11,28 +11,27 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "2.
|
14
|
+
"version": "2.5.0",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
|
-
"main": "./dist/
|
18
|
-
"module": "./dist/
|
19
|
-
"jsnext:modern": "./dist/js/modern/index.js",
|
17
|
+
"main": "./dist/cjs/index.js",
|
18
|
+
"module": "./dist/esm/index.js",
|
20
19
|
"exports": {
|
21
20
|
".": {
|
22
21
|
"node": {
|
23
22
|
"jsnext:source": "./src/index.ts",
|
24
|
-
"require": "./dist/
|
23
|
+
"require": "./dist/cjs/index.js"
|
25
24
|
},
|
26
|
-
"default": "./dist/
|
25
|
+
"default": "./dist/cjs/index.js"
|
27
26
|
},
|
28
27
|
"./cli": {
|
29
28
|
"jsnext:source": "./src/cli.ts",
|
30
|
-
"default": "./dist/
|
29
|
+
"default": "./dist/cjs/cli.js"
|
31
30
|
},
|
32
31
|
"./runtime-design-token": {
|
33
32
|
"jsnext:source": "./src/design-token/index.js",
|
34
|
-
"node": "./dist/
|
35
|
-
"default": "./dist/
|
33
|
+
"node": "./dist/cjs/design-token/index.js",
|
34
|
+
"default": "./dist/esm/design-token/index.js"
|
36
35
|
}
|
37
36
|
},
|
38
37
|
"typesVersions": {
|
@@ -46,7 +45,7 @@
|
|
46
45
|
"@babel/runtime": "^7.18.0",
|
47
46
|
"babel-plugin-macros": "3.1.0",
|
48
47
|
"hoist-non-react-statics": "^3.3.2",
|
49
|
-
"@modern-js/utils": "2.
|
48
|
+
"@modern-js/utils": "2.5.0"
|
50
49
|
},
|
51
50
|
"devDependencies": {
|
52
51
|
"@types/jest": "^27",
|
@@ -56,17 +55,17 @@
|
|
56
55
|
"jest": "^27",
|
57
56
|
"react": "^18",
|
58
57
|
"postcss": "8.4.21",
|
59
|
-
"@modern-js/core": "2.
|
60
|
-
"@modern-js/
|
61
|
-
"@modern-js/
|
62
|
-
"@modern-js/types": "2.
|
63
|
-
"@scripts/build": "2.
|
64
|
-
"@modern-js/app-tools": "2.
|
65
|
-
"@scripts/jest-config": "2.
|
58
|
+
"@modern-js/core": "2.5.0",
|
59
|
+
"@modern-js/runtime": "2.5.0",
|
60
|
+
"@modern-js/module-tools": "2.5.0",
|
61
|
+
"@modern-js/types": "2.5.0",
|
62
|
+
"@scripts/build": "2.5.0",
|
63
|
+
"@modern-js/app-tools": "2.5.0",
|
64
|
+
"@scripts/jest-config": "2.5.0"
|
66
65
|
},
|
67
66
|
"peerDependencies": {
|
68
67
|
"tailwindcss": ">= 2.0.0 || >= 3.0.0",
|
69
|
-
"@modern-js/runtime": "^2.
|
68
|
+
"@modern-js/runtime": "^2.5.0"
|
70
69
|
},
|
71
70
|
"peerDependenciesMeta": {
|
72
71
|
"@modern-js/runtime": {
|