@modern-js/plugin-tailwindcss 2.35.1 → 2.37.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/dist/cjs/cli.js +54 -39
- package/dist/cjs/config.js +46 -27
- package/dist/cjs/design-token/cli/index.js +27 -10
- package/dist/cjs/design-token/index.js +37 -10
- package/dist/cjs/design-token/postcss-plugin/index.js +21 -8
- package/dist/cjs/design-token/runtime/index.js +38 -11
- package/dist/cjs/design-token/runtime/plugin.js +51 -35
- package/dist/cjs/index.js +26 -17
- package/dist/cjs/macro.js +43 -26
- package/dist/cjs/types.js +15 -3
- package/dist/cjs/utils.js +25 -15
- package/dist/esm/cli.js +12 -11
- package/dist/esm/config.js +7 -4
- package/dist/esm/design-token/cli/index.js +8 -5
- package/dist/esm/design-token/index.js +4 -1
- package/dist/esm/design-token/postcss-plugin/index.js +4 -1
- package/dist/esm/design-token/runtime/index.js +4 -1
- package/dist/esm/design-token/runtime/plugin.js +8 -3
- package/dist/esm/index.js +5 -2
- package/dist/esm/macro.js +10 -4
- package/dist/esm/types.js +0 -1
- package/dist/esm/utils.js +6 -2
- package/dist/esm-node/cli.js +7 -6
- package/dist/esm-node/config.js +5 -2
- package/dist/esm-node/design-token/cli/index.js +4 -1
- package/dist/esm-node/design-token/index.js +4 -1
- package/dist/esm-node/design-token/postcss-plugin/index.js +4 -1
- package/dist/esm-node/design-token/runtime/index.js +4 -1
- package/dist/esm-node/design-token/runtime/plugin.js +8 -3
- package/dist/esm-node/index.js +5 -2
- package/dist/esm-node/macro.js +10 -4
- package/dist/esm-node/types.js +0 -1
- package/dist/esm-node/utils.js +6 -2
- package/package.json +12 -12
package/dist/cjs/macro.js
CHANGED
@@ -1,31 +1,41 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
6
9
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return template;
|
15
|
-
},
|
16
|
-
checkTwinMacroExist: function() {
|
17
|
-
return checkTwinMacroExist;
|
18
|
-
},
|
19
|
-
getTwinMacroMajorVersion: function() {
|
20
|
-
return getTwinMacroMajorVersion;
|
21
|
-
},
|
22
|
-
getRandomTwConfigFileName: function() {
|
23
|
-
return getRandomTwConfigFileName;
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
24
17
|
}
|
18
|
+
return to;
|
19
|
+
};
|
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 macro_exports = {};
|
30
|
+
__export(macro_exports, {
|
31
|
+
checkTwinMacroExist: () => checkTwinMacroExist,
|
32
|
+
getRandomTwConfigFileName: () => getRandomTwConfigFileName,
|
33
|
+
getTwinMacroMajorVersion: () => getTwinMacroMajorVersion,
|
34
|
+
template: () => template
|
25
35
|
});
|
26
|
-
|
27
|
-
|
28
|
-
|
36
|
+
module.exports = __toCommonJS(macro_exports);
|
37
|
+
var import_path = __toESM(require("path"));
|
38
|
+
var import_utils = require("@modern-js/utils");
|
29
39
|
const template = (configPath) => `
|
30
40
|
function _interopRequireDefault(obj) {
|
31
41
|
return obj && obj.__esModule ? obj : { default: obj };
|
@@ -48,7 +58,7 @@ module.exports = {
|
|
48
58
|
`;
|
49
59
|
const TWIN_MACRO_NAME = "twin.macro";
|
50
60
|
const checkTwinMacroExist = async (appDirectory) => {
|
51
|
-
const packageJson = await
|
61
|
+
const packageJson = await import_utils.fs.readJSON(import_path.default.join(appDirectory, "package.json"), {
|
52
62
|
throws: false
|
53
63
|
}) || {};
|
54
64
|
return Boolean(typeof packageJson.dependencies === "object" && packageJson.dependencies[TWIN_MACRO_NAME] || typeof packageJson.devDependencies === "object" && packageJson.devDependencies[TWIN_MACRO_NAME]);
|
@@ -67,5 +77,12 @@ const getTwinMacroMajorVersion = (appDirectory) => {
|
|
67
77
|
}
|
68
78
|
};
|
69
79
|
const getRandomTwConfigFileName = (internalDirectory) => {
|
70
|
-
return (0,
|
80
|
+
return (0, import_utils.slash)(import_path.default.join(internalDirectory, `tailwind.config.${Date.now()}.${(0, import_utils.nanoid)()}.js`));
|
71
81
|
};
|
82
|
+
// Annotate the CommonJS export names for ESM import in node:
|
83
|
+
0 && (module.exports = {
|
84
|
+
checkTwinMacroExist,
|
85
|
+
getRandomTwConfigFileName,
|
86
|
+
getTwinMacroMajorVersion,
|
87
|
+
template
|
88
|
+
});
|
package/dist/cjs/types.js
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
8
|
+
for (let key of __getOwnPropNames(from))
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
11
|
+
}
|
12
|
+
return to;
|
13
|
+
};
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
+
var types_exports = {};
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
package/dist/cjs/utils.js
CHANGED
@@ -1,22 +1,27 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
6
7
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return getTailwindPath;
|
15
|
-
},
|
16
|
-
getTailwindVersion: function() {
|
17
|
-
return getTailwindVersion;
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
18
15
|
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var utils_exports = {};
|
20
|
+
__export(utils_exports, {
|
21
|
+
getTailwindPath: () => getTailwindPath,
|
22
|
+
getTailwindVersion: () => getTailwindVersion
|
19
23
|
});
|
24
|
+
module.exports = __toCommonJS(utils_exports);
|
20
25
|
function getTailwindPath(appDirectory) {
|
21
26
|
try {
|
22
27
|
return require.resolve("tailwindcss", {
|
@@ -42,3 +47,8 @@ function getTailwindVersion(appDirectory) {
|
|
42
47
|
return "3";
|
43
48
|
}
|
44
49
|
}
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
51
|
+
0 && (module.exports = {
|
52
|
+
getTailwindPath,
|
53
|
+
getTailwindVersion
|
54
|
+
});
|
package/dist/esm/cli.js
CHANGED
@@ -6,7 +6,7 @@ import { designTokenPlugin } from "./design-token/cli";
|
|
6
6
|
import { getTailwindConfig, loadConfigFile } from "./config";
|
7
7
|
import { getTailwindPath, getTailwindVersion } from "./utils";
|
8
8
|
import { template, checkTwinMacroExist, getTwinMacroMajorVersion, getRandomTwConfigFileName } from "./macro";
|
9
|
-
|
9
|
+
var tailwindcssPlugin = function() {
|
10
10
|
var pluginName = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
11
11
|
pluginName: "@modern-js/plugin-tailwindcss"
|
12
12
|
}).pluginName;
|
@@ -15,7 +15,7 @@ export var tailwindcssPlugin = function() {
|
|
15
15
|
// support designSystem.supportStyledComponents
|
16
16
|
usePlugins: [
|
17
17
|
designTokenPlugin({
|
18
|
-
pluginName
|
18
|
+
pluginName
|
19
19
|
})
|
20
20
|
],
|
21
21
|
setup: function() {
|
@@ -79,8 +79,8 @@ export var tailwindcssPlugin = function() {
|
|
79
79
|
var _modernConfig_tools, _modernConfig_source;
|
80
80
|
var modernConfig = api.useResolvedConfigContext();
|
81
81
|
tailwindConfig = getTailwindConfig({
|
82
|
-
appDirectory
|
83
|
-
tailwindVersion
|
82
|
+
appDirectory,
|
83
|
+
tailwindVersion,
|
84
84
|
userConfig: userTailwindConfig,
|
85
85
|
extraConfig: modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_tools = modernConfig.tools) === null || _modernConfig_tools === void 0 ? void 0 : _modernConfig_tools.tailwindcss,
|
86
86
|
designSystem: modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_source = modernConfig.source) === null || _modernConfig_source === void 0 ? void 0 : _modernConfig_source.designSystem
|
@@ -124,8 +124,8 @@ export var tailwindcssPlugin = function() {
|
|
124
124
|
beforeBuildTask: function beforeBuildTask(config) {
|
125
125
|
var modernConfig = api.useResolvedConfigContext();
|
126
126
|
var tailwindConfig = getTailwindConfig({
|
127
|
-
appDirectory
|
128
|
-
tailwindVersion
|
127
|
+
appDirectory,
|
128
|
+
tailwindVersion,
|
129
129
|
userConfig: userTailwindConfig,
|
130
130
|
extraConfig: config.style.tailwindcss,
|
131
131
|
designSystem: modernConfig.designSystem
|
@@ -138,11 +138,8 @@ export var tailwindcssPlugin = function() {
|
|
138
138
|
tailwindPlugin
|
139
139
|
];
|
140
140
|
}
|
141
|
-
return config;
|
142
|
-
},
|
143
|
-
modifyLibuild: function modifyLibuild(config, next) {
|
144
141
|
config.transformCache = false;
|
145
|
-
return
|
142
|
+
return config;
|
146
143
|
}
|
147
144
|
}
|
148
145
|
];
|
@@ -155,4 +152,8 @@ export var tailwindcssPlugin = function() {
|
|
155
152
|
}()
|
156
153
|
};
|
157
154
|
};
|
158
|
-
|
155
|
+
var cli_default = tailwindcssPlugin;
|
156
|
+
export {
|
157
|
+
cli_default as default,
|
158
|
+
tailwindcssPlugin
|
159
|
+
};
|
package/dist/esm/config.js
CHANGED
@@ -27,10 +27,10 @@ var getV2PurgeConfig = function(content) {
|
|
27
27
|
layers: [
|
28
28
|
"utilities"
|
29
29
|
],
|
30
|
-
content
|
30
|
+
content
|
31
31
|
};
|
32
32
|
};
|
33
|
-
|
33
|
+
function loadConfigFile(appDirectory) {
|
34
34
|
return _loadConfigFile.apply(this, arguments);
|
35
35
|
}
|
36
36
|
function _loadConfigFile() {
|
@@ -78,7 +78,7 @@ var getTailwindConfig = function(param) {
|
|
78
78
|
var tailwindVersion = param.tailwindVersion, appDirectory = param.appDirectory, userConfig = param.userConfig, extraConfig = param.extraConfig, designSystem = param.designSystem;
|
79
79
|
var content = getDefaultContent(appDirectory);
|
80
80
|
var tailwindConfig = tailwindVersion === "3" ? {
|
81
|
-
content
|
81
|
+
content
|
82
82
|
} : {
|
83
83
|
purge: getV2PurgeConfig(content)
|
84
84
|
};
|
@@ -90,4 +90,7 @@ var getTailwindConfig = function(param) {
|
|
90
90
|
}
|
91
91
|
return tailwindConfig;
|
92
92
|
};
|
93
|
-
export {
|
93
|
+
export {
|
94
|
+
getTailwindConfig,
|
95
|
+
loadConfigFile
|
96
|
+
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
2
2
|
import { lazyImport, createRuntimeExportsUtils } from "@modern-js/utils";
|
3
|
-
|
3
|
+
var designTokenPlugin = function() {
|
4
4
|
var pluginName = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
5
5
|
pluginName: "@modern-js/plugin-tailwindcss"
|
6
6
|
}).pluginName;
|
@@ -52,8 +52,8 @@ export var designTokenPlugin = function() {
|
|
52
52
|
});
|
53
53
|
}
|
54
54
|
return {
|
55
|
-
entrypoint
|
56
|
-
imports
|
55
|
+
entrypoint,
|
56
|
+
imports
|
57
57
|
};
|
58
58
|
},
|
59
59
|
modifyEntryRuntimePlugins: function modifyEntryRuntimePlugins(param) {
|
@@ -73,8 +73,8 @@ export var designTokenPlugin = function() {
|
|
73
73
|
});
|
74
74
|
}
|
75
75
|
return {
|
76
|
-
entrypoint
|
77
|
-
plugins
|
76
|
+
entrypoint,
|
77
|
+
plugins
|
78
78
|
};
|
79
79
|
},
|
80
80
|
validateSchema: function validateSchema() {
|
@@ -113,3 +113,6 @@ export var designTokenPlugin = function() {
|
|
113
113
|
}
|
114
114
|
};
|
115
115
|
};
|
116
|
+
export {
|
117
|
+
designTokenPlugin
|
118
|
+
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
function postcss_plugin_default() {
|
2
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",
|
@@ -15,3 +15,6 @@ export default function() {
|
|
15
15
|
};
|
16
16
|
}
|
17
17
|
;
|
18
|
+
export {
|
19
|
+
postcss_plugin_default as default
|
20
|
+
};
|
@@ -2,11 +2,11 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
3
3
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
4
4
|
import React, { useContext } from "react";
|
5
|
-
|
6
|
-
|
5
|
+
var DesignTokenContext = /* @__PURE__ */ React.createContext({});
|
6
|
+
var useDesignTokens = function() {
|
7
7
|
return useContext(DesignTokenContext);
|
8
8
|
};
|
9
|
-
|
9
|
+
function plugin_default() {
|
10
10
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
11
11
|
return {
|
12
12
|
name: "@modern-js/plugin-design-token",
|
@@ -49,3 +49,8 @@ export default function() {
|
|
49
49
|
};
|
50
50
|
}
|
51
51
|
;
|
52
|
+
export {
|
53
|
+
DesignTokenContext,
|
54
|
+
plugin_default as default,
|
55
|
+
useDesignTokens
|
56
|
+
};
|
package/dist/esm/index.js
CHANGED
package/dist/esm/macro.js
CHANGED
@@ -2,11 +2,11 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
3
|
import path from "path";
|
4
4
|
import { fs, nanoid, slash } from "@modern-js/utils";
|
5
|
-
|
5
|
+
var template = function(configPath) {
|
6
6
|
return "\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n}\nconst modernConfig = _interopRequireDefault(require('".concat(configPath, "')).default;\n\nconst theme =\n modernConfig && modernConfig.source && modernConfig.source.designSystem\n ? modernConfig.source.designSystem\n : {};\nconst tailwindcss =\n modernConfig && modernConfig.tools && modernConfig.tools.tailwindcss\n ? modernConfig.tools.tailwindcss\n : {};\n\nmodule.exports = {\n theme,\n ...tailwindcss,\n};\n");
|
7
7
|
};
|
8
8
|
var TWIN_MACRO_NAME = "twin.macro";
|
9
|
-
|
9
|
+
var checkTwinMacroExist = function() {
|
10
10
|
var _ref = _async_to_generator(function(appDirectory) {
|
11
11
|
var packageJson;
|
12
12
|
return _ts_generator(this, function(_state) {
|
@@ -31,7 +31,7 @@ export var checkTwinMacroExist = function() {
|
|
31
31
|
return _ref.apply(this, arguments);
|
32
32
|
};
|
33
33
|
}();
|
34
|
-
|
34
|
+
var getTwinMacroMajorVersion = function(appDirectory) {
|
35
35
|
try {
|
36
36
|
var pkgJsonPath = require.resolve("".concat(TWIN_MACRO_NAME, "/package.json"), {
|
37
37
|
paths: [
|
@@ -44,6 +44,12 @@ export var getTwinMacroMajorVersion = function(appDirectory) {
|
|
44
44
|
return null;
|
45
45
|
}
|
46
46
|
};
|
47
|
-
|
47
|
+
var getRandomTwConfigFileName = function(internalDirectory) {
|
48
48
|
return slash(path.join(internalDirectory, "tailwind.config.".concat(Date.now(), ".").concat(nanoid(), ".js")));
|
49
49
|
};
|
50
|
+
export {
|
51
|
+
checkTwinMacroExist,
|
52
|
+
getRandomTwConfigFileName,
|
53
|
+
getTwinMacroMajorVersion,
|
54
|
+
template
|
55
|
+
};
|
package/dist/esm/types.js
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
package/dist/esm/utils.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
function getTailwindPath(appDirectory) {
|
2
2
|
try {
|
3
3
|
return require.resolve("tailwindcss", {
|
4
4
|
paths: [
|
@@ -10,7 +10,7 @@ export function getTailwindPath(appDirectory) {
|
|
10
10
|
return "tailwindcss";
|
11
11
|
}
|
12
12
|
}
|
13
|
-
|
13
|
+
function getTailwindVersion(appDirectory) {
|
14
14
|
try {
|
15
15
|
var packageJsonPath = require.resolve("tailwindcss/package.json", {
|
16
16
|
paths: [
|
@@ -23,3 +23,7 @@ export function getTailwindVersion(appDirectory) {
|
|
23
23
|
return "3";
|
24
24
|
}
|
25
25
|
}
|
26
|
+
export {
|
27
|
+
getTailwindPath,
|
28
|
+
getTailwindVersion
|
29
|
+
};
|
package/dist/esm-node/cli.js
CHANGED
@@ -4,7 +4,7 @@ import { designTokenPlugin } from "./design-token/cli";
|
|
4
4
|
import { getTailwindConfig, loadConfigFile } from "./config";
|
5
5
|
import { getTailwindPath, getTailwindVersion } from "./utils";
|
6
6
|
import { template, checkTwinMacroExist, getTwinMacroMajorVersion, getRandomTwConfigFileName } from "./macro";
|
7
|
-
|
7
|
+
const tailwindcssPlugin = ({ pluginName } = {
|
8
8
|
pluginName: "@modern-js/plugin-tailwindcss"
|
9
9
|
}) => ({
|
10
10
|
name: "@modern-js/plugin-tailwindcss",
|
@@ -116,13 +116,14 @@ export const tailwindcssPlugin = ({ pluginName } = {
|
|
116
116
|
tailwindPlugin
|
117
117
|
];
|
118
118
|
}
|
119
|
-
return config;
|
120
|
-
},
|
121
|
-
modifyLibuild(config, next) {
|
122
119
|
config.transformCache = false;
|
123
|
-
return
|
120
|
+
return config;
|
124
121
|
}
|
125
122
|
};
|
126
123
|
}
|
127
124
|
});
|
128
|
-
|
125
|
+
var cli_default = tailwindcssPlugin;
|
126
|
+
export {
|
127
|
+
cli_default as default,
|
128
|
+
tailwindcssPlugin
|
129
|
+
};
|
package/dist/esm-node/config.js
CHANGED
@@ -26,7 +26,7 @@ const getV2PurgeConfig = (content) => ({
|
|
26
26
|
],
|
27
27
|
content
|
28
28
|
});
|
29
|
-
|
29
|
+
async function loadConfigFile(appDirectory) {
|
30
30
|
const extensions = [
|
31
31
|
"ts",
|
32
32
|
"js",
|
@@ -56,4 +56,7 @@ const getTailwindConfig = ({ tailwindVersion, appDirectory, userConfig, extraCon
|
|
56
56
|
}
|
57
57
|
return tailwindConfig;
|
58
58
|
};
|
59
|
-
export {
|
59
|
+
export {
|
60
|
+
getTailwindConfig,
|
61
|
+
loadConfigFile
|
62
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { lazyImport, createRuntimeExportsUtils } from "@modern-js/utils";
|
2
|
-
|
2
|
+
const designTokenPlugin = ({ pluginName } = {
|
3
3
|
pluginName: "@modern-js/plugin-tailwindcss"
|
4
4
|
}) => ({
|
5
5
|
name: "@modern-js/plugin-design-token",
|
@@ -111,3 +111,6 @@ export const designTokenPlugin = ({ pluginName } = {
|
|
111
111
|
};
|
112
112
|
}
|
113
113
|
});
|
114
|
+
export {
|
115
|
+
designTokenPlugin
|
116
|
+
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
var postcss_plugin_default = ({ cssVarsHash = {} } = {}) => ({
|
2
2
|
postcssPlugin: "postcss-replace-css-vars",
|
3
3
|
Declaration(decl) {
|
4
4
|
if (decl.value && typeof decl.value === "string") {
|
@@ -11,3 +11,6 @@ export default ({ cssVarsHash = {} } = {}) => ({
|
|
11
11
|
}
|
12
12
|
}
|
13
13
|
});
|
14
|
+
export {
|
15
|
+
postcss_plugin_default as default
|
16
|
+
};
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
3
3
|
import React, { useContext } from "react";
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
const DesignTokenContext = /* @__PURE__ */ React.createContext({});
|
5
|
+
const useDesignTokens = () => useContext(DesignTokenContext);
|
6
|
+
var plugin_default = (options = {}) => ({
|
7
7
|
name: "@modern-js/plugin-design-token",
|
8
8
|
setup: () => ({
|
9
9
|
hoc({ App }, next) {
|
@@ -47,3 +47,8 @@ export default (options = {}) => ({
|
|
47
47
|
}
|
48
48
|
})
|
49
49
|
});
|
50
|
+
export {
|
51
|
+
DesignTokenContext,
|
52
|
+
plugin_default as default,
|
53
|
+
useDesignTokens
|
54
|
+
};
|
package/dist/esm-node/index.js
CHANGED
package/dist/esm-node/macro.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import path from "path";
|
2
2
|
import { fs, nanoid, slash } from "@modern-js/utils";
|
3
|
-
|
3
|
+
const template = (configPath) => `
|
4
4
|
function _interopRequireDefault(obj) {
|
5
5
|
return obj && obj.__esModule ? obj : { default: obj };
|
6
6
|
}
|
@@ -21,13 +21,13 @@ module.exports = {
|
|
21
21
|
};
|
22
22
|
`;
|
23
23
|
const TWIN_MACRO_NAME = "twin.macro";
|
24
|
-
|
24
|
+
const checkTwinMacroExist = async (appDirectory) => {
|
25
25
|
const packageJson = await fs.readJSON(path.join(appDirectory, "package.json"), {
|
26
26
|
throws: false
|
27
27
|
}) || {};
|
28
28
|
return Boolean(typeof packageJson.dependencies === "object" && packageJson.dependencies[TWIN_MACRO_NAME] || typeof packageJson.devDependencies === "object" && packageJson.devDependencies[TWIN_MACRO_NAME]);
|
29
29
|
};
|
30
|
-
|
30
|
+
const getTwinMacroMajorVersion = (appDirectory) => {
|
31
31
|
try {
|
32
32
|
const pkgJsonPath = require.resolve(`${TWIN_MACRO_NAME}/package.json`, {
|
33
33
|
paths: [
|
@@ -40,6 +40,12 @@ export const getTwinMacroMajorVersion = (appDirectory) => {
|
|
40
40
|
return null;
|
41
41
|
}
|
42
42
|
};
|
43
|
-
|
43
|
+
const getRandomTwConfigFileName = (internalDirectory) => {
|
44
44
|
return slash(path.join(internalDirectory, `tailwind.config.${Date.now()}.${nanoid()}.js`));
|
45
45
|
};
|
46
|
+
export {
|
47
|
+
checkTwinMacroExist,
|
48
|
+
getRandomTwConfigFileName,
|
49
|
+
getTwinMacroMajorVersion,
|
50
|
+
template
|
51
|
+
};
|
package/dist/esm-node/types.js
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
package/dist/esm-node/utils.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
function getTailwindPath(appDirectory) {
|
2
2
|
try {
|
3
3
|
return require.resolve("tailwindcss", {
|
4
4
|
paths: [
|
@@ -10,7 +10,7 @@ export function getTailwindPath(appDirectory) {
|
|
10
10
|
return "tailwindcss";
|
11
11
|
}
|
12
12
|
}
|
13
|
-
|
13
|
+
function getTailwindVersion(appDirectory) {
|
14
14
|
try {
|
15
15
|
const packageJsonPath = require.resolve("tailwindcss/package.json", {
|
16
16
|
paths: [
|
@@ -23,3 +23,7 @@ export function getTailwindVersion(appDirectory) {
|
|
23
23
|
return "3";
|
24
24
|
}
|
25
25
|
}
|
26
|
+
export {
|
27
|
+
getTailwindPath,
|
28
|
+
getTailwindVersion
|
29
|
+
};
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.37.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -49,8 +49,8 @@
|
|
49
49
|
"babel-plugin-macros": "3.1.0",
|
50
50
|
"hoist-non-react-statics": "^3.3.2",
|
51
51
|
"@swc/helpers": "0.5.1",
|
52
|
-
"@modern-js/utils": "2.
|
53
|
-
"@modern-js/node-bundle-require": "2.
|
52
|
+
"@modern-js/utils": "2.37.0",
|
53
|
+
"@modern-js/node-bundle-require": "2.37.0"
|
54
54
|
},
|
55
55
|
"devDependencies": {
|
56
56
|
"@types/jest": "^29",
|
@@ -59,18 +59,18 @@
|
|
59
59
|
"tailwindcss": "^3.3.3",
|
60
60
|
"jest": "^29",
|
61
61
|
"react": "^18",
|
62
|
-
"postcss": "8.4.
|
63
|
-
"@modern-js/
|
64
|
-
"@modern-js/
|
65
|
-
"@modern-js/
|
66
|
-
"@modern-js/
|
67
|
-
"@
|
68
|
-
"@
|
69
|
-
"@scripts/jest-config": "2.
|
62
|
+
"postcss": "8.4.31",
|
63
|
+
"@modern-js/core": "2.37.0",
|
64
|
+
"@modern-js/module-tools": "2.37.0",
|
65
|
+
"@modern-js/runtime": "2.37.0",
|
66
|
+
"@modern-js/types": "2.37.0",
|
67
|
+
"@scripts/build": "2.37.0",
|
68
|
+
"@modern-js/app-tools": "2.37.0",
|
69
|
+
"@scripts/jest-config": "2.37.0"
|
70
70
|
},
|
71
71
|
"peerDependencies": {
|
72
72
|
"tailwindcss": ">= 2.0.0 || >= 3.0.0",
|
73
|
-
"@modern-js/runtime": "^2.
|
73
|
+
"@modern-js/runtime": "^2.37.0"
|
74
74
|
},
|
75
75
|
"peerDependenciesMeta": {
|
76
76
|
"@modern-js/runtime": {
|