@modern-js/plugin-tailwindcss 2.13.5-beta.0 → 2.14.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/cli.js +0 -4
  3. package/dist/esm/cli.js +0 -4
  4. package/dist/esm-node/cli.js +0 -4
  5. package/package.json +10 -10
  6. package/dist/js/modern/cli.js +0 -174
  7. package/dist/js/modern/design-token/cli/index.js +0 -110
  8. package/dist/js/modern/design-token/index.js +0 -5
  9. package/dist/js/modern/design-token/postcss-plugin/index.js +0 -18
  10. package/dist/js/modern/design-token/runtime/index.js +0 -6
  11. package/dist/js/modern/design-token/runtime/plugin.js +0 -66
  12. package/dist/js/modern/index.js +0 -4
  13. package/dist/js/modern/tailwind.js +0 -45
  14. package/dist/js/modern/types.js +0 -0
  15. package/dist/js/modern/utils.js +0 -86
  16. package/dist/js/node/cli.js +0 -190
  17. package/dist/js/node/design-token/cli/index.js +0 -125
  18. package/dist/js/node/design-token/index.js +0 -33
  19. package/dist/js/node/design-token/postcss-plugin/index.js +0 -39
  20. package/dist/js/node/design-token/runtime/index.js +0 -34
  21. package/dist/js/node/design-token/runtime/plugin.js +0 -94
  22. package/dist/js/node/index.js +0 -31
  23. package/dist/js/node/tailwind.js +0 -68
  24. package/dist/js/node/types.js +0 -15
  25. package/dist/js/node/utils.js +0 -119
  26. package/dist/js/treeshaking/cli.js +0 -268
  27. package/dist/js/treeshaking/design-token/cli/index.js +0 -118
  28. package/dist/js/treeshaking/design-token/index.js +0 -3
  29. package/dist/js/treeshaking/design-token/postcss-plugin/index.js +0 -17
  30. package/dist/js/treeshaking/design-token/runtime/index.js +0 -4
  31. package/dist/js/treeshaking/design-token/runtime/plugin.js +0 -78
  32. package/dist/js/treeshaking/index.js +0 -2
  33. package/dist/js/treeshaking/tailwind.js +0 -91
  34. package/dist/js/treeshaking/types.js +0 -1
  35. package/dist/js/treeshaking/utils.js +0 -194
@@ -1,91 +0,0 @@
1
- function _arrayLikeToArray(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _arrayWithHoles(arr) {
7
- if (Array.isArray(arr)) return arr;
8
- }
9
- function _iterableToArrayLimit(arr, i) {
10
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
- if (_i == null) return;
12
- var _arr = [];
13
- var _n = true;
14
- var _d = false;
15
- var _s, _e;
16
- try {
17
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
- _arr.push(_s.value);
19
- if (i && _arr.length === i) break;
20
- }
21
- } catch (err) {
22
- _d = true;
23
- _e = err;
24
- } finally{
25
- try {
26
- if (!_n && _i["return"] != null) _i["return"]();
27
- } finally{
28
- if (_d) throw _e;
29
- }
30
- }
31
- return _arr;
32
- }
33
- function _nonIterableRest() {
34
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
- }
36
- function _slicedToArray(arr, i) {
37
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
38
- }
39
- function _unsupportedIterableToArray(o, minLen) {
40
- if (!o) return;
41
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
42
- var n = Object.prototype.toString.call(o).slice(8, -1);
43
- if (n === "Object" && o.constructor) n = o.constructor.name;
44
- if (n === "Map" || n === "Set") return Array.from(n);
45
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
46
- }
47
- import { applyOptionsChain, logger } from "@modern-js/utils";
48
- import { merge, cloneDeep } from "@modern-js/utils/lodash";
49
- var checkIfExistNotAllowKeys = function(tailwindConfig) {
50
- var notAllowExistKeys = [
51
- "theme"
52
- ];
53
- var notAllowKey = "";
54
- var ret = Object.keys(tailwindConfig).some(function(key) {
55
- return notAllowExistKeys.includes(key) && (notAllowKey = key);
56
- });
57
- return [
58
- ret,
59
- notAllowKey
60
- ];
61
- };
62
- var getPureDesignSystemConfig = function(designSystemConfig) {
63
- var pureDesignSystemConfig = cloneDeep(designSystemConfig);
64
- delete pureDesignSystemConfig.supportStyledComponents;
65
- return pureDesignSystemConfig;
66
- };
67
- var getTailwindConfig = function(tailwindVersion, tailwindcss, designSystem) {
68
- var option = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
69
- var purgeConfig = merge({
70
- enabled: process.env.NODE_ENV === "production",
71
- layers: [
72
- "utilities"
73
- ],
74
- content: []
75
- }, option.pureConfig || {});
76
- var defaultTailwindConfig = tailwindVersion === "3" ? {
77
- content: purgeConfig.content
78
- } : {
79
- purge: purgeConfig
80
- };
81
- var tailwindConfig = applyOptionsChain(defaultTailwindConfig, tailwindcss || {});
82
- var designSystemConfig = getPureDesignSystemConfig(designSystem !== null && designSystem !== void 0 ? designSystem : {});
83
- var _checkIfExistNotAllowKeys = _slicedToArray(checkIfExistNotAllowKeys(tailwindConfig), 2), exist = _checkIfExistNotAllowKeys[0], key = _checkIfExistNotAllowKeys[1];
84
- if (exist) {
85
- logger.error("should not exist '".concat(key, "' on tools.tailwindcss, please remove it"));
86
- process.exit(0);
87
- }
88
- tailwindConfig.theme = designSystemConfig || {};
89
- return tailwindConfig;
90
- };
91
- export { getTailwindConfig };
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,194 +0,0 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
14
- }
15
- function _asyncToGenerator(fn) {
16
- return function() {
17
- var self = this, args = arguments;
18
- return new Promise(function(resolve, reject) {
19
- var gen = fn.apply(self, args);
20
- function _next(value) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
- }
23
- function _throw(err) {
24
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
- }
26
- _next(undefined);
27
- });
28
- };
29
- }
30
- var __generator = this && this.__generator || function(thisArg, body) {
31
- var f, y, t, g, _ = {
32
- label: 0,
33
- sent: function() {
34
- if (t[0] & 1) throw t[1];
35
- return t[1];
36
- },
37
- trys: [],
38
- ops: []
39
- };
40
- return(g = {
41
- next: verb(0),
42
- "throw": verb(1),
43
- "return": verb(2)
44
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
45
- return this;
46
- }), g);
47
- function verb(n) {
48
- return function(v) {
49
- return step([
50
- n,
51
- v
52
- ]);
53
- };
54
- }
55
- function step(op) {
56
- if (f) throw new TypeError("Generator is already executing.");
57
- while(_)try {
58
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
59
- if (y = 0, t) op = [
60
- op[0] & 2,
61
- t.value
62
- ];
63
- switch(op[0]){
64
- case 0:
65
- case 1:
66
- t = op;
67
- break;
68
- case 4:
69
- _.label++;
70
- return {
71
- value: op[1],
72
- done: false
73
- };
74
- case 5:
75
- _.label++;
76
- y = op[1];
77
- op = [
78
- 0
79
- ];
80
- continue;
81
- case 7:
82
- op = _.ops.pop();
83
- _.trys.pop();
84
- continue;
85
- default:
86
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
87
- _ = 0;
88
- continue;
89
- }
90
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
91
- _.label = op[1];
92
- break;
93
- }
94
- if (op[0] === 6 && _.label < t[1]) {
95
- _.label = t[1];
96
- t = op;
97
- break;
98
- }
99
- if (t && _.label < t[2]) {
100
- _.label = t[2];
101
- _.ops.push(op);
102
- break;
103
- }
104
- if (t[2]) _.ops.pop();
105
- _.trys.pop();
106
- continue;
107
- }
108
- op = body.call(thisArg, _);
109
- } catch (e) {
110
- op = [
111
- 6,
112
- e
113
- ];
114
- y = 0;
115
- } finally{
116
- f = t = 0;
117
- }
118
- if (op[0] & 5) throw op[1];
119
- return {
120
- value: op[0] ? op[1] : void 0,
121
- done: true
122
- };
123
- }
124
- };
125
- import path from "path";
126
- import { fs } from "@modern-js/utils";
127
- var template = function(configPath) {
128
- 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");
129
- };
130
- var TWIN_MACRO_NAME = "twin.macro";
131
- var checkTwinMacroExist = function() {
132
- var _ref = _asyncToGenerator(function(appDirectory) {
133
- var packageJson;
134
- return __generator(this, function(_state) {
135
- switch(_state.label){
136
- case 0:
137
- return [
138
- 4,
139
- fs.readJSON(path.join(appDirectory, "package.json"), {
140
- throws: false
141
- })
142
- ];
143
- case 1:
144
- packageJson = _state.sent() || {};
145
- return [
146
- 2,
147
- Boolean(typeof packageJson.dependencies === "object" && packageJson.dependencies[TWIN_MACRO_NAME] || typeof packageJson.devDependencies === "object" && packageJson.devDependencies[TWIN_MACRO_NAME])
148
- ];
149
- }
150
- });
151
- });
152
- return function checkTwinMacroExist(appDirectory) {
153
- return _ref.apply(this, arguments);
154
- };
155
- }();
156
- var getTwinMacroMajorVersion = function(appDirectory) {
157
- try {
158
- var pkgJsonPath = require.resolve("".concat(TWIN_MACRO_NAME, "/package.json"), {
159
- paths: [
160
- appDirectory
161
- ]
162
- });
163
- var version = require(pkgJsonPath).version;
164
- return Number(version.split(".")[0]);
165
- } catch (err) {
166
- return null;
167
- }
168
- };
169
- function getTailwindPath(appDirectory) {
170
- try {
171
- return require.resolve("tailwindcss", {
172
- paths: [
173
- appDirectory,
174
- __dirname
175
- ]
176
- });
177
- } catch (err) {
178
- return "tailwindcss";
179
- }
180
- }
181
- function getTailwindVersion(appDirectory) {
182
- try {
183
- var packageJsonPath = require.resolve("tailwindcss/package.json", {
184
- paths: [
185
- appDirectory,
186
- __dirname
187
- ]
188
- });
189
- return require(packageJsonPath).version.split(".")[0];
190
- } catch (err) {
191
- return "3";
192
- }
193
- }
194
- export { checkTwinMacroExist, getTailwindPath, getTailwindVersion, getTwinMacroMajorVersion, template };