@modern-js/plugin-tailwindcss 2.0.0-beta.3 → 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 +97 -0
- package/dist/js/modern/cli.js +132 -79
- package/dist/js/modern/design-token/cli/index.js +57 -51
- 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 +28 -21
- package/dist/js/modern/utils.js +32 -8
- package/dist/js/node/cli.js +152 -90
- package/dist/js/node/design-token/cli/index.js +70 -56
- 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 +47 -27
- package/dist/js/node/utils.js +56 -16
- package/dist/js/treeshaking/cli.js +265 -132
- package/dist/js/treeshaking/design-token/cli/index.js +116 -99
- 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 -42
- package/dist/js/treeshaking/types.js +1 -0
- package/dist/js/treeshaking/utils.js +159 -44
- package/dist/types/cli.d.ts +3 -1
- 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/package.json +11 -10
@@ -1,47 +1,162 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
}
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
break;
|
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);
|
26
25
|
}
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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;
|
33
107
|
}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
108
|
+
op = body.call(thisArg, _);
|
109
|
+
} catch (e) {
|
110
|
+
op = [
|
111
|
+
6,
|
112
|
+
e
|
113
|
+
];
|
114
|
+
y = 0;
|
115
|
+
} finally{
|
116
|
+
f = t = 0;
|
40
117
|
}
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}
|
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 checkTwinMacroNotExist = function() {
|
131
|
+
var _ref = _asyncToGenerator(function(appDirectory) {
|
132
|
+
var depName, packageJson;
|
133
|
+
return __generator(this, function(_state) {
|
134
|
+
switch(_state.label){
|
135
|
+
case 0:
|
136
|
+
depName = "twin.macro";
|
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
|
+
if (typeof packageJson.dependencies === "object" && packageJson.dependencies[depName] || typeof packageJson.devDependencies === "object" && packageJson.devDependencies[depName]) {
|
146
|
+
return [
|
147
|
+
2,
|
148
|
+
false
|
149
|
+
];
|
150
|
+
}
|
151
|
+
return [
|
152
|
+
2,
|
153
|
+
true
|
154
|
+
];
|
155
|
+
}
|
156
|
+
});
|
157
|
+
});
|
158
|
+
return function checkTwinMacroNotExist(appDirectory) {
|
159
|
+
return _ref.apply(this, arguments);
|
160
|
+
};
|
161
|
+
}();
|
162
|
+
export { checkTwinMacroNotExist, template };
|
package/dist/types/cli.d.ts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
import type { LegacyAppTools } from '@modern-js/app-tools';
|
2
|
-
import type { CliPlugin, ModuleTools } from '@modern-js/module-tools
|
2
|
+
import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';
|
3
3
|
export declare const getRandomTwConfigFileName: (internalDirectory: string) => string;
|
4
|
+
|
4
5
|
declare const _default: ({
|
5
6
|
pluginName
|
6
7
|
}?: {
|
7
8
|
pluginName: string;
|
8
9
|
}) => CliPlugin<LegacyAppTools & ModuleTools>;
|
10
|
+
|
9
11
|
export default _default;
|
@@ -2,9 +2,11 @@ import type { Plugin } from '@modern-js/runtime';
|
|
2
2
|
import React from 'react';
|
3
3
|
export declare const DesignTokenContext: React.Context<any>;
|
4
4
|
export declare const useDesignTokens: () => IDesignTokens;
|
5
|
+
|
5
6
|
declare const _default: (options?: {
|
6
7
|
token?: Record<string, any>;
|
7
8
|
useStyledComponentsThemeProvider?: boolean;
|
8
9
|
useDesignTokenContext?: boolean;
|
9
10
|
}) => Plugin;
|
11
|
+
|
10
12
|
export default _default;
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "2.0.0-beta.
|
14
|
+
"version": "2.0.0-beta.4",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -44,8 +44,9 @@
|
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
46
|
"@babel/runtime": "^7.18.0",
|
47
|
+
"babel-plugin-macros": "3.1.0",
|
47
48
|
"hoist-non-react-statics": "^3.3.2",
|
48
|
-
"@modern-js/utils": "2.0.0-beta.
|
49
|
+
"@modern-js/utils": "2.0.0-beta.4"
|
49
50
|
},
|
50
51
|
"devDependencies": {
|
51
52
|
"@types/jest": "^27",
|
@@ -56,17 +57,17 @@
|
|
56
57
|
"jest": "^27",
|
57
58
|
"react": "^18",
|
58
59
|
"postcss": "^8.4.14",
|
59
|
-
"@modern-js/core": "2.0.0-beta.
|
60
|
-
"@modern-js/module-tools
|
61
|
-
"@modern-js/runtime": "2.0.0-beta.
|
62
|
-
"@modern-js/types": "2.0.0-beta.
|
63
|
-
"@scripts/build": "2.0.0-beta.
|
64
|
-
"@modern-js/app-tools": "2.0.0-beta.
|
65
|
-
"@scripts/jest-config": "2.0.0-beta.
|
60
|
+
"@modern-js/core": "2.0.0-beta.4",
|
61
|
+
"@modern-js/module-tools": "2.0.0-beta.4",
|
62
|
+
"@modern-js/runtime": "2.0.0-beta.4",
|
63
|
+
"@modern-js/types": "2.0.0-beta.4",
|
64
|
+
"@scripts/build": "2.0.0-beta.4",
|
65
|
+
"@modern-js/app-tools": "2.0.0-beta.4",
|
66
|
+
"@scripts/jest-config": "2.0.0-beta.4"
|
66
67
|
},
|
67
68
|
"peerDependencies": {
|
68
69
|
"tailwindcss": "^2.0.4",
|
69
|
-
"@modern-js/runtime": "^2.0.0-beta.
|
70
|
+
"@modern-js/runtime": "^2.0.0-beta.4"
|
70
71
|
},
|
71
72
|
"peerDependenciesMeta": {
|
72
73
|
"@modern-js/runtime": {
|