@modern-js/plugin-tailwindcss 2.0.0-beta.0 → 2.0.0-beta.1
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 +70 -0
- package/dist/js/modern/cli.js +33 -37
- package/dist/js/modern/design-token/cli/index.js +13 -38
- package/dist/js/modern/design-token/postcss-plugin/index.js +0 -3
- package/dist/js/modern/design-token/runtime/plugin.js +0 -8
- package/dist/js/modern/tailwind.js +6 -10
- package/dist/js/modern/types.js +0 -0
- package/dist/js/modern/utils.js +0 -2
- package/dist/js/node/cli.js +33 -49
- package/dist/js/node/design-token/cli/index.js +13 -41
- package/dist/js/node/design-token/index.js +0 -4
- package/dist/js/node/design-token/postcss-plugin/index.js +0 -5
- package/dist/js/node/design-token/runtime/index.js +0 -5
- package/dist/js/node/design-token/runtime/plugin.js +0 -20
- package/dist/js/node/index.js +0 -2
- package/dist/js/node/tailwind.js +6 -13
- package/dist/js/node/types.js +0 -0
- package/dist/js/node/utils.js +0 -9
- package/dist/js/treeshaking/cli.js +34 -36
- package/dist/js/treeshaking/design-token/cli/index.js +22 -30
- package/dist/js/treeshaking/design-token/postcss-plugin/index.js +2 -6
- package/dist/js/treeshaking/design-token/runtime/plugin.js +7 -12
- package/dist/js/treeshaking/tailwind.js +9 -14
- package/dist/js/treeshaking/types.js +0 -0
- package/dist/js/treeshaking/utils.js +0 -9
- package/dist/types/cli.d.ts +0 -2
- package/dist/types/design-token/cli/index.d.ts +0 -2
- package/dist/types/design-token/postcss-plugin/index.d.ts +0 -2
- package/dist/types/design-token/runtime/plugin.d.ts +0 -2
- package/dist/types/types.d.ts +10 -0
- package/package.json +9 -9
@@ -1,19 +1,16 @@
|
|
1
1
|
export default (function () {
|
2
2
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
_ref$cssVarsHash = _ref.cssVarsHash,
|
4
|
+
cssVarsHash = _ref$cssVarsHash === void 0 ? {} : _ref$cssVarsHash;
|
6
5
|
return {
|
7
6
|
postcssPlugin: 'postcss-replace-css-vars',
|
8
7
|
Declaration: function (_Declaration) {
|
9
8
|
function Declaration(_x) {
|
10
9
|
return _Declaration.apply(this, arguments);
|
11
10
|
}
|
12
|
-
|
13
11
|
Declaration.toString = function () {
|
14
12
|
return _Declaration.toString();
|
15
13
|
};
|
16
|
-
|
17
14
|
return Declaration;
|
18
15
|
}(function (decl) {
|
19
16
|
if (decl.value && typeof decl.value === 'string') {
|
@@ -21,7 +18,6 @@ export default (function () {
|
|
21
18
|
if (cssVarsHash[match]) {
|
22
19
|
return cssVarsHash[match];
|
23
20
|
}
|
24
|
-
|
25
21
|
return match;
|
26
22
|
});
|
27
23
|
}
|
@@ -14,19 +14,16 @@ export default (function () {
|
|
14
14
|
return {
|
15
15
|
hoc: function hoc(_ref, next) {
|
16
16
|
var App = _ref.App;
|
17
|
-
|
18
17
|
var DesignTokenAppWrapper = function DesignTokenAppWrapper(props) {
|
19
18
|
var _options$token = options.token,
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
token = _options$token === void 0 ? {} : _options$token,
|
20
|
+
_options$useStyledCom = options.useStyledComponentsThemeProvider,
|
21
|
+
useStyledComponentsThemeProvider = _options$useStyledCom === void 0 ? false : _options$useStyledCom,
|
22
|
+
_options$useDesignTok = options.useDesignTokenContext,
|
23
|
+
useDesignTokenContext = _options$useDesignTok === void 0 ? false : _options$useDesignTok;
|
26
24
|
if (useStyledComponentsThemeProvider && useDesignTokenContext) {
|
27
25
|
var _require = require('@modern-js/runtime/styled'),
|
28
|
-
|
29
|
-
|
26
|
+
ThemeProvider = _require.ThemeProvider;
|
30
27
|
return /*#__PURE__*/_jsx(ThemeProvider, {
|
31
28
|
theme: token,
|
32
29
|
children: /*#__PURE__*/_jsx(DesignTokenContext.Provider, {
|
@@ -36,8 +33,7 @@ export default (function () {
|
|
36
33
|
});
|
37
34
|
} else if (useStyledComponentsThemeProvider) {
|
38
35
|
var _require2 = require('@modern-js/runtime/styled'),
|
39
|
-
|
40
|
-
|
36
|
+
_ThemeProvider = _require2.ThemeProvider;
|
41
37
|
return /*#__PURE__*/_jsx(_ThemeProvider, {
|
42
38
|
theme: token,
|
43
39
|
children: /*#__PURE__*/_jsx(App, _objectSpread({}, props))
|
@@ -51,7 +47,6 @@ export default (function () {
|
|
51
47
|
return /*#__PURE__*/_jsx(App, _objectSpread({}, props));
|
52
48
|
}
|
53
49
|
};
|
54
|
-
|
55
50
|
return next({
|
56
51
|
App: hoistNonReactStatics(DesignTokenAppWrapper, App)
|
57
52
|
});
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
2
|
import { applyOptionsChain, logger } from '@modern-js/utils';
|
3
3
|
import { merge, cloneDeep } from '@modern-js/utils/lodash';
|
4
|
-
|
5
4
|
var checkIfExistNotAllowKeys = function checkIfExistNotAllowKeys(tailwindConfig) {
|
6
5
|
var notAllowExistKeys = ['theme'];
|
7
6
|
var notAllowKey = '';
|
@@ -10,14 +9,13 @@ var checkIfExistNotAllowKeys = function checkIfExistNotAllowKeys(tailwindConfig)
|
|
10
9
|
});
|
11
10
|
return [ret, notAllowKey];
|
12
11
|
};
|
13
|
-
|
14
12
|
var getPureDesignSystemConfig = function getPureDesignSystemConfig(designSystemConfig) {
|
15
13
|
var pureDesignSystemConfig = cloneDeep(designSystemConfig);
|
16
14
|
delete pureDesignSystemConfig.supportStyledComponents;
|
17
15
|
return pureDesignSystemConfig;
|
18
16
|
};
|
19
|
-
|
20
17
|
var getTailwindConfig = function getTailwindConfig(config) {
|
18
|
+
var _ref, _designSystem;
|
21
19
|
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
22
20
|
var purgeConfig = merge({
|
23
21
|
// TODO: how the operating environment is determined
|
@@ -30,22 +28,19 @@ var getTailwindConfig = function getTailwindConfig(config) {
|
|
30
28
|
purge: purgeConfig
|
31
29
|
};
|
32
30
|
var tailwindConfig = applyOptionsChain(defaultTailwindConfig, config.tools.tailwindcss || {});
|
33
|
-
var designSystem = getPureDesignSystemConfig(config.source.designSystem
|
34
|
-
|
31
|
+
var designSystem = getPureDesignSystemConfig((_ref = (_designSystem = config.designSystem) !== null && _designSystem !== void 0 ? _designSystem : config.source.designSystem) !== null && _ref !== void 0 ? _ref : {});
|
35
32
|
var _checkIfExistNotAllow = checkIfExistNotAllowKeys(tailwindConfig),
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
_checkIfExistNotAllow2 = _slicedToArray(_checkIfExistNotAllow, 2),
|
34
|
+
exist = _checkIfExistNotAllow2[0],
|
35
|
+
key = _checkIfExistNotAllow2[1];
|
40
36
|
if (exist) {
|
41
|
-
logger.error("should not exist '".concat(key, "' on tools.tailwindcss, please remove it"));
|
42
|
-
|
37
|
+
logger.error("should not exist '".concat(key, "' on tools.tailwindcss, please remove it"));
|
38
|
+
// eslint-disable-next-line no-process-exit
|
43
39
|
process.exit(0);
|
44
|
-
}
|
45
|
-
|
40
|
+
}
|
46
41
|
|
42
|
+
// Because there is no default theme configuration
|
47
43
|
tailwindConfig.theme = designSystem || {};
|
48
44
|
return tailwindConfig;
|
49
45
|
};
|
50
|
-
|
51
46
|
export { getTailwindConfig };
|
File without changes
|
@@ -18,30 +18,22 @@ export var checkTwinMacroNotExist = /*#__PURE__*/function () {
|
|
18
18
|
return fs.readJSON(path.join(appDirectory, 'package.json'), {
|
19
19
|
"throws": false
|
20
20
|
});
|
21
|
-
|
22
21
|
case 3:
|
23
22
|
_context.t0 = _context.sent;
|
24
|
-
|
25
23
|
if (_context.t0) {
|
26
24
|
_context.next = 6;
|
27
25
|
break;
|
28
26
|
}
|
29
|
-
|
30
27
|
_context.t0 = {};
|
31
|
-
|
32
28
|
case 6:
|
33
29
|
packageJson = _context.t0;
|
34
|
-
|
35
30
|
if (!(_typeof(packageJson.dependencies) === 'object' && packageJson.dependencies[depName] || _typeof(packageJson.devDependencies) === 'object' && packageJson.devDependencies[depName])) {
|
36
31
|
_context.next = 9;
|
37
32
|
break;
|
38
33
|
}
|
39
|
-
|
40
34
|
return _context.abrupt("return", false);
|
41
|
-
|
42
35
|
case 9:
|
43
36
|
return _context.abrupt("return", true);
|
44
|
-
|
45
37
|
case 10:
|
46
38
|
case "end":
|
47
39
|
return _context.stop();
|
@@ -49,7 +41,6 @@ export var checkTwinMacroNotExist = /*#__PURE__*/function () {
|
|
49
41
|
}
|
50
42
|
}, _callee);
|
51
43
|
}));
|
52
|
-
|
53
44
|
return function checkTwinMacroNotExist(_x) {
|
54
45
|
return _ref.apply(this, arguments);
|
55
46
|
};
|
package/dist/types/cli.d.ts
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
import type { CliPlugin } from '@modern-js/core';
|
2
2
|
export declare const getRandomTwConfigFileName: (internalDirectory: string) => string;
|
3
|
-
|
4
3
|
declare const _default: ({
|
5
4
|
pluginName
|
6
5
|
}?: {
|
7
6
|
pluginName: string;
|
8
7
|
}) => CliPlugin;
|
9
|
-
|
10
8
|
export default _default;
|
@@ -2,11 +2,9 @@ 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
|
-
|
6
5
|
declare const _default: (options?: {
|
7
6
|
token?: Record<string, any>;
|
8
7
|
useStyledComponentsThemeProvider?: boolean;
|
9
8
|
useDesignTokenContext?: boolean;
|
10
9
|
}) => Plugin;
|
11
|
-
|
12
10
|
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.1",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -44,14 +44,10 @@
|
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
46
|
"@babel/runtime": "^7.18.0",
|
47
|
-
"
|
48
|
-
"
|
47
|
+
"hoist-non-react-statics": "^3.3.2",
|
48
|
+
"@modern-js/utils": "2.0.0-beta.1"
|
49
49
|
},
|
50
50
|
"devDependencies": {
|
51
|
-
"@modern-js/core": "2.0.0-beta.0",
|
52
|
-
"@modern-js/runtime": "2.0.0-beta.0",
|
53
|
-
"@modern-js/types": "2.0.0-beta.0",
|
54
|
-
"@scripts/build": "2.0.0-beta.0",
|
55
51
|
"@types/jest": "^27",
|
56
52
|
"@types/node": "^14",
|
57
53
|
"@types/tailwindcss": "^2.2.1",
|
@@ -60,11 +56,15 @@
|
|
60
56
|
"jest": "^27",
|
61
57
|
"react": "^18",
|
62
58
|
"postcss": "^8.4.14",
|
63
|
-
"@
|
59
|
+
"@modern-js/core": "2.0.0-beta.1",
|
60
|
+
"@modern-js/runtime": "2.0.0-beta.1",
|
61
|
+
"@modern-js/types": "2.0.0-beta.1",
|
62
|
+
"@scripts/build": "2.0.0-beta.1",
|
63
|
+
"@scripts/jest-config": "2.0.0-beta.1"
|
64
64
|
},
|
65
65
|
"peerDependencies": {
|
66
66
|
"tailwindcss": "^2.0.4",
|
67
|
-
"@modern-js/runtime": "^2.0.0-beta.
|
67
|
+
"@modern-js/runtime": "^2.0.0-beta.1"
|
68
68
|
},
|
69
69
|
"peerDependenciesMeta": {
|
70
70
|
"@modern-js/runtime": {
|