@modern-js/plugin-tailwindcss 2.0.0-beta.3 → 2.0.0-beta.6
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 +197 -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 +156 -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 +31 -24
- package/dist/js/node/design-token/postcss-plugin/index.js +30 -13
- package/dist/js/node/design-token/runtime/index.js +33 -22
- package/dist/js/node/design-token/runtime/plugin.js +68 -40
- package/dist/js/node/index.js +29 -11
- package/dist/js/node/modern-app.env.d.js +0 -0
- package/dist/js/node/tailwind.js +51 -27
- package/dist/js/node/types.js +15 -0
- package/dist/js/node/utils.js +61 -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,33 +1,52 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
+
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
|
+
var __export = (target, all) => {
|
20
|
+
for (var name in all)
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
22
|
+
};
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
25
|
+
for (let key of __getOwnPropNames(from))
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
28
|
+
}
|
29
|
+
return to;
|
30
|
+
};
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
32
|
+
var cli_exports = {};
|
33
|
+
__export(cli_exports, {
|
34
|
+
default: () => cli_default
|
5
35
|
});
|
6
|
-
exports
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
11
|
-
var _default = ({
|
12
|
-
pluginName
|
13
|
-
} = {
|
14
|
-
pluginName: '@modern-js/plugin-tailwindcss'
|
15
|
-
}) => ({
|
16
|
-
name: '@modern-js/plugin-design-token',
|
36
|
+
module.exports = __toCommonJS(cli_exports);
|
37
|
+
var import_utils = require("@modern-js/utils");
|
38
|
+
var cli_default = ({ pluginName } = { pluginName: "@modern-js/plugin-tailwindcss" }) => ({
|
39
|
+
name: "@modern-js/plugin-design-token",
|
17
40
|
setup(api) {
|
18
41
|
let pluginsExportsUtils;
|
19
|
-
const resolveConfig = (0,
|
20
|
-
const PLUGIN_IDENTIFIER =
|
21
|
-
const getDesignTokens = designSystem => {
|
42
|
+
const resolveConfig = (0, import_utils.lazyImport)("tailwindcss/resolveConfig", require);
|
43
|
+
const PLUGIN_IDENTIFIER = "designToken";
|
44
|
+
const getDesignTokens = (designSystem) => {
|
22
45
|
const tailwindcssConfig = {};
|
23
|
-
tailwindcssConfig.theme = designSystem ?
|
24
|
-
|
25
|
-
// not use default design token when designToken.defaultTheme is false or theme is false
|
46
|
+
tailwindcssConfig.theme = designSystem ? __spreadValues({}, designSystem) : {};
|
26
47
|
if (!designSystem) {
|
27
48
|
tailwindcssConfig.presets = [];
|
28
49
|
}
|
29
|
-
|
30
|
-
// when only designSystem exist, need remove supportStyledComponents
|
31
50
|
if (designSystem) {
|
32
51
|
delete tailwindcssConfig.theme.supportStyledComponents;
|
33
52
|
}
|
@@ -36,35 +55,32 @@ var _default = ({
|
|
36
55
|
return {
|
37
56
|
config() {
|
38
57
|
const appContext = api.useAppContext();
|
39
|
-
pluginsExportsUtils = (0,
|
58
|
+
pluginsExportsUtils = (0, import_utils.createRuntimeExportsUtils)(
|
59
|
+
appContext.internalDirectory,
|
60
|
+
"plugins"
|
61
|
+
);
|
40
62
|
return {
|
41
63
|
source: {
|
42
64
|
alias: {
|
43
|
-
|
65
|
+
"@modern-js/runtime/plugins": pluginsExportsUtils.getPath()
|
44
66
|
}
|
45
67
|
},
|
46
|
-
tools: {
|
47
|
-
// TODO: support less、scss、css vars
|
48
|
-
// less: https://github.com/modern-js-dev/modern.js/pull/398/files#diff-f77c749e403fbf1fb676d5687bef3d7138a230331c849298d8afaff9b6afbc3dR166
|
49
|
-
// sass: https://github.com/modern-js-dev/modern.js/pull/398/files#diff-f77c749e403fbf1fb676d5687bef3d7138a230331c849298d8afaff9b6afbc3dR229
|
50
|
-
// postcss: https://github.com/modern-js-dev/modern.js/pull/398/files#diff-f77c749e403fbf1fb676d5687bef3d7138a230331c849298d8afaff9b6afbc3dR281
|
51
|
-
}
|
68
|
+
tools: {}
|
52
69
|
};
|
53
70
|
},
|
54
|
-
modifyEntryImports({
|
55
|
-
|
56
|
-
imports
|
57
|
-
}) {
|
58
|
-
var _userConfig$source$de, _userConfig$source;
|
71
|
+
modifyEntryImports({ entrypoint, imports }) {
|
72
|
+
var _a, _b;
|
59
73
|
const userConfig = api.useResolvedConfigContext();
|
60
|
-
const designSystem = (
|
61
|
-
if (typeof designSystem ===
|
74
|
+
const designSystem = (_b = (_a = userConfig.source) == null ? void 0 : _a.designSystem) != null ? _b : {};
|
75
|
+
if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
|
62
76
|
const designTokens = getDesignTokens(userConfig.source.designSystem);
|
63
77
|
imports.push({
|
64
|
-
value:
|
65
|
-
specifiers: [
|
66
|
-
|
67
|
-
|
78
|
+
value: "@modern-js/runtime/plugins",
|
79
|
+
specifiers: [
|
80
|
+
{
|
81
|
+
imported: PLUGIN_IDENTIFIER
|
82
|
+
}
|
83
|
+
],
|
68
84
|
initialize: `
|
69
85
|
const designTokens = ${JSON.stringify(designTokens)};
|
70
86
|
`
|
@@ -75,22 +91,18 @@ var _default = ({
|
|
75
91
|
imports
|
76
92
|
};
|
77
93
|
},
|
78
|
-
modifyEntryRuntimePlugins({
|
79
|
-
|
80
|
-
plugins
|
81
|
-
}) {
|
82
|
-
var _userConfig$source$de2, _userConfig$source2;
|
94
|
+
modifyEntryRuntimePlugins({ entrypoint, plugins }) {
|
95
|
+
var _a, _b;
|
83
96
|
const userConfig = api.useResolvedConfigContext();
|
84
|
-
const designSystem = (
|
97
|
+
const designSystem = (_b = (_a = userConfig.source) == null ? void 0 : _a.designSystem) != null ? _b : {};
|
85
98
|
let useSCThemeProvider = true;
|
86
99
|
if (designSystem) {
|
87
|
-
|
88
|
-
useSCThemeProvider = (designSystem === null || designSystem === void 0 ? void 0 : designSystem.supportStyledComponents) || false;
|
100
|
+
useSCThemeProvider = (designSystem == null ? void 0 : designSystem.supportStyledComponents) || false;
|
89
101
|
}
|
90
|
-
if (typeof designSystem ===
|
102
|
+
if (typeof designSystem === "object" && designSystem.supportStyledComponents) {
|
91
103
|
plugins.push({
|
92
104
|
name: PLUGIN_IDENTIFIER,
|
93
|
-
options: `{token: designTokens, useStyledComponentsThemeProvider: ${useSCThemeProvider ?
|
105
|
+
options: `{token: designTokens, useStyledComponentsThemeProvider: ${useSCThemeProvider ? "true" : "false"}, useDesignTokenContext: false}`
|
94
106
|
});
|
95
107
|
}
|
96
108
|
return {
|
@@ -99,13 +111,15 @@ var _default = ({
|
|
99
111
|
};
|
100
112
|
},
|
101
113
|
validateSchema() {
|
102
|
-
|
103
|
-
return _utils.PLUGIN_SCHEMAS['@modern-js/plugin-design-token'];
|
114
|
+
return import_utils.PLUGIN_SCHEMAS["@modern-js/plugin-design-token"];
|
104
115
|
},
|
105
116
|
addRuntimeExports() {
|
106
|
-
pluginsExportsUtils.addExport(
|
117
|
+
pluginsExportsUtils.addExport(
|
118
|
+
`export { default as designToken } from '${pluginName}/runtime-design-token'`
|
119
|
+
);
|
107
120
|
}
|
108
121
|
};
|
109
122
|
}
|
110
123
|
});
|
111
|
-
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
125
|
+
0 && (module.exports = {});
|
File without changes
|
@@ -1,26 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
5
|
-
|
6
|
-
var
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
11
16
|
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
|
+
mod
|
23
|
+
));
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
25
|
+
var design_token_exports = {};
|
26
|
+
__export(design_token_exports, {
|
27
|
+
default: () => import_runtime.default
|
12
28
|
});
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
Object.defineProperty(exports, key, {
|
19
|
-
enumerable: true,
|
20
|
-
get: function () {
|
21
|
-
return _runtime[key];
|
22
|
-
}
|
23
|
-
});
|
24
|
-
});
|
25
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
26
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
29
|
+
module.exports = __toCommonJS(design_token_exports);
|
30
|
+
var import_runtime = __toESM(require("./runtime"));
|
31
|
+
__reExport(design_token_exports, require("./runtime"), module.exports);
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
33
|
+
0 && (module.exports = {});
|
@@ -1,22 +1,39 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var postcss_plugin_exports = {};
|
19
|
+
__export(postcss_plugin_exports, {
|
20
|
+
default: () => postcss_plugin_default
|
5
21
|
});
|
6
|
-
exports
|
7
|
-
var
|
8
|
-
cssVarsHash
|
22
|
+
module.exports = __toCommonJS(postcss_plugin_exports);
|
23
|
+
var postcss_plugin_default = ({
|
24
|
+
cssVarsHash = {}
|
9
25
|
} = {}) => ({
|
10
|
-
postcssPlugin:
|
26
|
+
postcssPlugin: "postcss-replace-css-vars",
|
11
27
|
Declaration(decl) {
|
12
|
-
if (decl.value && typeof decl.value ===
|
13
|
-
decl.value = decl.value.replace(/--\S*/g, match => {
|
14
|
-
if (
|
15
|
-
return
|
28
|
+
if (decl.value && typeof decl.value === "string") {
|
29
|
+
decl.value = decl.value.replace(/--\S*/g, (match) => {
|
30
|
+
if (cssVarsHash[match]) {
|
31
|
+
return cssVarsHash[match];
|
16
32
|
}
|
17
33
|
return match;
|
18
34
|
});
|
19
35
|
}
|
20
36
|
}
|
21
37
|
});
|
22
|
-
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
39
|
+
0 && (module.exports = {});
|
@@ -1,23 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
|
+
mod
|
23
|
+
));
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
25
|
+
var runtime_exports = {};
|
26
|
+
__export(runtime_exports, {
|
27
|
+
default: () => runtime_default
|
5
28
|
});
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
if (key in exports && exports[key] === _plugin[key]) return;
|
13
|
-
Object.defineProperty(exports, key, {
|
14
|
-
enumerable: true,
|
15
|
-
get: function () {
|
16
|
-
return _plugin[key];
|
17
|
-
}
|
18
|
-
});
|
19
|
-
});
|
20
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
21
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
22
|
-
var _default = _plugin.default;
|
23
|
-
exports.default = _default;
|
29
|
+
module.exports = __toCommonJS(runtime_exports);
|
30
|
+
var import_plugin = __toESM(require("./plugin"));
|
31
|
+
__reExport(runtime_exports, require("./plugin"), module.exports);
|
32
|
+
var runtime_default = import_plugin.default;
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
34
|
+
0 && (module.exports = {});
|
@@ -1,66 +1,94 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
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
|
+
var __export = (target, all) => {
|
22
|
+
for (var name in all)
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
24
|
+
};
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
27
|
+
for (let key of __getOwnPropNames(from))
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
30
|
+
}
|
31
|
+
return to;
|
32
|
+
};
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
35
|
+
mod
|
36
|
+
));
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
38
|
+
var plugin_exports = {};
|
39
|
+
__export(plugin_exports, {
|
40
|
+
DesignTokenContext: () => DesignTokenContext,
|
41
|
+
default: () => plugin_default,
|
42
|
+
useDesignTokens: () => useDesignTokens
|
5
43
|
});
|
6
|
-
|
7
|
-
var
|
8
|
-
var
|
9
|
-
var
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
16
|
-
const DesignTokenContext = /*#__PURE__*/_react.default.createContext({});
|
17
|
-
exports.DesignTokenContext = DesignTokenContext;
|
18
|
-
const useDesignTokens = () => (0, _react.useContext)(DesignTokenContext);
|
19
|
-
exports.useDesignTokens = useDesignTokens;
|
20
|
-
var _default = (options = {}) => ({
|
21
|
-
name: '@modern-js/plugin-design-token',
|
44
|
+
module.exports = __toCommonJS(plugin_exports);
|
45
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
46
|
+
var import_hoist_non_react_statics = __toESM(require("hoist-non-react-statics"));
|
47
|
+
var import_react = __toESM(require("react"));
|
48
|
+
const DesignTokenContext = import_react.default.createContext({});
|
49
|
+
const useDesignTokens = () => (0, import_react.useContext)(DesignTokenContext);
|
50
|
+
var plugin_default = (options = {}) => ({
|
51
|
+
name: "@modern-js/plugin-design-token",
|
22
52
|
setup: () => ({
|
23
|
-
hoc({
|
24
|
-
|
25
|
-
}, next) {
|
26
|
-
const DesignTokenAppWrapper = props => {
|
53
|
+
hoc({ App }, next) {
|
54
|
+
const DesignTokenAppWrapper = (props) => {
|
27
55
|
const {
|
28
56
|
token = {},
|
29
57
|
useStyledComponentsThemeProvider = false,
|
30
58
|
useDesignTokenContext = false
|
31
59
|
} = options;
|
32
60
|
if (useStyledComponentsThemeProvider && useDesignTokenContext) {
|
33
|
-
const {
|
34
|
-
|
35
|
-
} = require('@modern-js/runtime/styled');
|
36
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeProvider, {
|
61
|
+
const { ThemeProvider } = require("@modern-js/runtime/styled");
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeProvider, {
|
37
63
|
theme: token,
|
38
|
-
children:
|
64
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DesignTokenContext.Provider, {
|
39
65
|
value: token,
|
40
|
-
children:
|
66
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, __spreadValues({}, props))
|
41
67
|
})
|
42
68
|
});
|
43
69
|
} else if (useStyledComponentsThemeProvider) {
|
44
|
-
const {
|
45
|
-
|
46
|
-
} = require('@modern-js/runtime/styled');
|
47
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeProvider, {
|
70
|
+
const { ThemeProvider } = require("@modern-js/runtime/styled");
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeProvider, {
|
48
72
|
theme: token,
|
49
|
-
children:
|
73
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, __spreadValues({}, props))
|
50
74
|
});
|
51
75
|
} else if (useDesignTokenContext) {
|
52
|
-
return
|
76
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DesignTokenContext.Provider, {
|
53
77
|
value: token,
|
54
|
-
children:
|
78
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, __spreadValues({}, props))
|
55
79
|
});
|
56
80
|
} else {
|
57
|
-
return
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, __spreadValues({}, props));
|
58
82
|
}
|
59
83
|
};
|
60
84
|
return next({
|
61
|
-
App: (0,
|
85
|
+
App: (0, import_hoist_non_react_statics.default)(DesignTokenAppWrapper, App)
|
62
86
|
});
|
63
87
|
}
|
64
88
|
})
|
65
89
|
});
|
66
|
-
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
91
|
+
0 && (module.exports = {
|
92
|
+
DesignTokenContext,
|
93
|
+
useDesignTokens
|
94
|
+
});
|
package/dist/js/node/index.js
CHANGED
@@ -1,13 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
5
|
-
|
6
|
-
Object.
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
10
16
|
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var src_exports = {};
|
25
|
+
__export(src_exports, {
|
26
|
+
default: () => import_cli.default
|
11
27
|
});
|
12
|
-
|
13
|
-
|
28
|
+
module.exports = __toCommonJS(src_exports);
|
29
|
+
var import_cli = __toESM(require("./cli"));
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
31
|
+
0 && (module.exports = {});
|
File without changes
|
package/dist/js/node/tailwind.js
CHANGED
@@ -1,44 +1,68 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.
|
4
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var tailwind_exports = {};
|
19
|
+
__export(tailwind_exports, {
|
20
|
+
getTailwindConfig: () => getTailwindConfig
|
5
21
|
});
|
6
|
-
exports
|
7
|
-
var
|
8
|
-
var
|
9
|
-
const checkIfExistNotAllowKeys = tailwindConfig => {
|
10
|
-
const notAllowExistKeys = [
|
11
|
-
let notAllowKey =
|
12
|
-
const ret = Object.keys(tailwindConfig).some(
|
22
|
+
module.exports = __toCommonJS(tailwind_exports);
|
23
|
+
var import_utils = require("@modern-js/utils");
|
24
|
+
var import_lodash = require("@modern-js/utils/lodash");
|
25
|
+
const checkIfExistNotAllowKeys = (tailwindConfig) => {
|
26
|
+
const notAllowExistKeys = ["theme"];
|
27
|
+
let notAllowKey = "";
|
28
|
+
const ret = Object.keys(tailwindConfig).some(
|
29
|
+
(key) => notAllowExistKeys.includes(key) && (notAllowKey = key)
|
30
|
+
);
|
13
31
|
return [ret, notAllowKey];
|
14
32
|
};
|
15
|
-
const getPureDesignSystemConfig = designSystemConfig => {
|
16
|
-
const pureDesignSystemConfig = (0,
|
33
|
+
const getPureDesignSystemConfig = (designSystemConfig) => {
|
34
|
+
const pureDesignSystemConfig = (0, import_lodash.cloneDeep)(designSystemConfig);
|
17
35
|
delete pureDesignSystemConfig.supportStyledComponents;
|
18
36
|
return pureDesignSystemConfig;
|
19
37
|
};
|
20
38
|
const getTailwindConfig = (tailwindcss, designSystem, option = {}) => {
|
21
|
-
const purgeConfig = (0,
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
39
|
+
const purgeConfig = (0, import_lodash.merge)(
|
40
|
+
{
|
41
|
+
enabled: process.env.NODE_ENV === "production",
|
42
|
+
layers: ["utilities"],
|
43
|
+
content: []
|
44
|
+
},
|
45
|
+
option.pureConfig || {}
|
46
|
+
);
|
28
47
|
const defaultTailwindConfig = {
|
29
48
|
purge: purgeConfig
|
30
49
|
};
|
31
|
-
const tailwindConfig = (0,
|
32
|
-
|
50
|
+
const tailwindConfig = (0, import_utils.applyOptionsChain)(
|
51
|
+
defaultTailwindConfig,
|
52
|
+
tailwindcss || {}
|
53
|
+
);
|
54
|
+
const designSystemConfig = getPureDesignSystemConfig(designSystem != null ? designSystem : {});
|
33
55
|
const [exist, key] = checkIfExistNotAllowKeys(tailwindConfig);
|
34
56
|
if (exist) {
|
35
|
-
|
36
|
-
|
57
|
+
import_utils.logger.error(
|
58
|
+
`should not exist '${key}' on tools.tailwindcss, please remove it`
|
59
|
+
);
|
37
60
|
process.exit(0);
|
38
61
|
}
|
39
|
-
|
40
|
-
// Because there is no default theme configuration
|
41
62
|
tailwindConfig.theme = designSystemConfig || {};
|
42
63
|
return tailwindConfig;
|
43
64
|
};
|
44
|
-
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
66
|
+
0 && (module.exports = {
|
67
|
+
getTailwindConfig
|
68
|
+
});
|