@modern-js/plugin-tailwindcss 2.4.1-beta.0 → 2.5.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 (32) hide show
  1. package/CHANGELOG.md +15 -3
  2. package/dist/{js/node → cjs}/cli.js +3 -23
  3. package/dist/{js/node → cjs}/design-token/cli/index.js +1 -15
  4. package/dist/{js/node → cjs}/design-token/index.js +0 -0
  5. package/dist/{js/node → cjs}/design-token/postcss-plugin/index.js +0 -0
  6. package/dist/{js/node → cjs}/design-token/runtime/index.js +0 -0
  7. package/dist/{js/node → cjs}/design-token/runtime/plugin.js +12 -18
  8. package/dist/{js/node → cjs}/index.js +0 -0
  9. package/dist/{js/node → cjs}/tailwind.js +0 -0
  10. package/dist/{js/node → cjs}/types.js +0 -0
  11. package/dist/{js/node → cjs}/utils.js +4 -24
  12. package/dist/{js/treeshaking → esm}/cli.js +0 -0
  13. package/dist/{js/treeshaking → esm}/design-token/cli/index.js +0 -0
  14. package/dist/{js/treeshaking → esm}/design-token/index.js +0 -0
  15. package/dist/{js/treeshaking → esm}/design-token/postcss-plugin/index.js +0 -0
  16. package/dist/{js/treeshaking → esm}/design-token/runtime/index.js +0 -0
  17. package/dist/{js/treeshaking → esm}/design-token/runtime/plugin.js +0 -0
  18. package/dist/{js/treeshaking → esm}/index.js +0 -0
  19. package/dist/{js/treeshaking → esm}/tailwind.js +0 -0
  20. package/dist/{js/treeshaking → esm}/types.js +0 -0
  21. package/dist/{js/treeshaking → esm}/utils.js +0 -0
  22. package/dist/{js/modern → esm-node}/cli.js +3 -23
  23. package/dist/{js/modern → esm-node}/design-token/cli/index.js +1 -17
  24. package/dist/{js/modern → esm-node}/design-token/index.js +0 -0
  25. package/dist/{js/modern → esm-node}/design-token/postcss-plugin/index.js +0 -0
  26. package/dist/{js/modern → esm-node}/design-token/runtime/index.js +0 -0
  27. package/dist/{js/modern → esm-node}/design-token/runtime/plugin.js +12 -20
  28. package/dist/{js/modern → esm-node}/index.js +0 -0
  29. package/dist/{js/modern → esm-node}/tailwind.js +0 -0
  30. package/dist/{js/modern → esm-node}/types.js +0 -0
  31. package/dist/{js/modern → esm-node}/utils.js +4 -24
  32. package/package.json +17 -18
package/CHANGELOG.md CHANGED
@@ -1,14 +1,26 @@
1
1
  # @modern-js/plugin-tailwindcss
2
2
 
3
- ## 2.4.1-beta.0
3
+ ## 2.5.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 89ca6cc: refactor: merge build-config into scripts/build
8
+
9
+ refactor: 把 build-config 合并进 scripts/build
10
+
11
+ - 30614fa: chore: modify package.json entry fields and build config
12
+ chore: 更改 package.json entry 字段以及构建配置
13
+ - Updated dependencies [89ca6cc]
14
+ - Updated dependencies [7cb8bb4]
15
+ - Updated dependencies [30614fa]
7
16
  - Updated dependencies [7a25271]
17
+ - Updated dependencies [8871bb8]
18
+ - Updated dependencies [1b0ce87]
19
+ - Updated dependencies [0d75c27]
8
20
  - Updated dependencies [11c053b]
9
21
  - Updated dependencies [a0f2ab1]
10
- - @modern-js/runtime@2.4.1-beta.0
11
- - @modern-js/utils@2.4.1-beta.0
22
+ - @modern-js/runtime@2.5.0
23
+ - @modern-js/utils@2.5.0
12
24
 
13
25
  ## 2.4.0
14
26
 
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  mod
22
22
  ));
23
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
- var __async = (__this, __arguments, generator) => {
25
- return new Promise((resolve, reject) => {
26
- var fulfilled = (value) => {
27
- try {
28
- step(generator.next(value));
29
- } catch (e) {
30
- reject(e);
31
- }
32
- };
33
- var rejected = (value) => {
34
- try {
35
- step(generator.throw(value));
36
- } catch (e) {
37
- reject(e);
38
- }
39
- };
40
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
41
- step((generator = generator.apply(__this, __arguments)).next());
42
- });
43
- };
44
24
  var cli_exports = {};
45
25
  __export(cli_exports, {
46
26
  default: () => cli_default,
@@ -70,10 +50,10 @@ var cli_default = ({ pluginName } = {
70
50
  pluginName
71
51
  })
72
52
  ],
73
- setup: (api) => __async(void 0, null, function* () {
53
+ setup: async (api) => {
74
54
  const { appDirectory, internalDirectory } = api.useAppContext();
75
55
  let internalTwConfigPath = "";
76
- const haveTwinMacro = yield (0, import_utils2.checkTwinMacroExist)(appDirectory);
56
+ const haveTwinMacro = await (0, import_utils2.checkTwinMacroExist)(appDirectory);
77
57
  const tailwindPath = (0, import_utils2.getTailwindPath)(appDirectory);
78
58
  const tailwindVersion = (0, import_utils2.getTailwindVersion)(appDirectory);
79
59
  const defaultContent = [
@@ -182,7 +162,7 @@ var cli_default = ({ pluginName } = {
182
162
  return config;
183
163
  }
184
164
  };
185
- })
165
+ }
186
166
  });
187
167
  // Annotate the CommonJS export names for ESM import in node:
188
168
  0 && (module.exports = {
@@ -1,21 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
4
  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
5
  var __export = (target, all) => {
20
6
  for (var name in all)
21
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -43,7 +29,7 @@ var cli_default = ({ pluginName } = { pluginName: "@modern-js/plugin-tailwindcss
43
29
  const PLUGIN_IDENTIFIER = "designToken";
44
30
  const getDesignTokens = (designSystem) => {
45
31
  const tailwindcssConfig = {};
46
- tailwindcssConfig.theme = designSystem ? __spreadValues({}, designSystem) : {};
32
+ tailwindcssConfig.theme = designSystem ? { ...designSystem } : {};
47
33
  if (!designSystem) {
48
34
  tailwindcssConfig.presets = [];
49
35
  }
File without changes
@@ -2,22 +2,8 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  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
7
  var __export = (target, all) => {
22
8
  for (var name in all)
23
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -63,22 +49,30 @@ var plugin_default = (options = {}) => ({
63
49
  theme: token,
64
50
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DesignTokenContext.Provider, {
65
51
  value: token,
66
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, __spreadValues({}, props))
52
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
53
+ ...props
54
+ })
67
55
  })
68
56
  });
69
57
  } else if (useStyledComponentsThemeProvider) {
70
58
  const { ThemeProvider } = require("@modern-js/runtime/styled");
71
59
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeProvider, {
72
60
  theme: token,
73
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, __spreadValues({}, props))
61
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
62
+ ...props
63
+ })
74
64
  });
75
65
  } else if (useDesignTokenContext) {
76
66
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DesignTokenContext.Provider, {
77
67
  value: token,
78
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, __spreadValues({}, props))
68
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
69
+ ...props
70
+ })
79
71
  });
80
72
  } else {
81
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, __spreadValues({}, props));
73
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
74
+ ...props
75
+ });
82
76
  }
83
77
  };
84
78
  return next({
File without changes
File without changes
File without changes
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  mod
22
22
  ));
23
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
- var __async = (__this, __arguments, generator) => {
25
- return new Promise((resolve, reject) => {
26
- var fulfilled = (value) => {
27
- try {
28
- step(generator.next(value));
29
- } catch (e) {
30
- reject(e);
31
- }
32
- };
33
- var rejected = (value) => {
34
- try {
35
- step(generator.throw(value));
36
- } catch (e) {
37
- reject(e);
38
- }
39
- };
40
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
41
- step((generator = generator.apply(__this, __arguments)).next());
42
- });
43
- };
44
24
  var utils_exports = {};
45
25
  __export(utils_exports, {
46
26
  checkTwinMacroExist: () => checkTwinMacroExist,
@@ -73,14 +53,14 @@ module.exports = {
73
53
  };
74
54
  `;
75
55
  const TWIN_MACRO_NAME = "twin.macro";
76
- const checkTwinMacroExist = (appDirectory) => __async(void 0, null, function* () {
77
- const packageJson = (yield import_utils.fs.readJSON(import_path.default.join(appDirectory, "package.json"), {
56
+ const checkTwinMacroExist = async (appDirectory) => {
57
+ const packageJson = await import_utils.fs.readJSON(import_path.default.join(appDirectory, "package.json"), {
78
58
  throws: false
79
- })) || {};
59
+ }) || {};
80
60
  return Boolean(
81
61
  typeof packageJson.dependencies === "object" && packageJson.dependencies[TWIN_MACRO_NAME] || typeof packageJson.devDependencies === "object" && packageJson.devDependencies[TWIN_MACRO_NAME]
82
62
  );
83
- });
63
+ };
84
64
  const getTwinMacroMajorVersion = (appDirectory) => {
85
65
  try {
86
66
  const pkgJsonPath = require.resolve(`${TWIN_MACRO_NAME}/package.json`, {
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,23 +1,3 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
1
  import path from "path";
22
2
  import {
23
3
  PLUGIN_SCHEMAS,
@@ -54,10 +34,10 @@ var cli_default = ({ pluginName } = {
54
34
  pluginName
55
35
  })
56
36
  ],
57
- setup: (api) => __async(void 0, null, function* () {
37
+ setup: async (api) => {
58
38
  const { appDirectory, internalDirectory } = api.useAppContext();
59
39
  let internalTwConfigPath = "";
60
- const haveTwinMacro = yield checkTwinMacroExist(appDirectory);
40
+ const haveTwinMacro = await checkTwinMacroExist(appDirectory);
61
41
  const tailwindPath = getTailwindPath(appDirectory);
62
42
  const tailwindVersion = getTailwindVersion(appDirectory);
63
43
  const defaultContent = [
@@ -166,7 +146,7 @@ var cli_default = ({ pluginName } = {
166
146
  return config;
167
147
  }
168
148
  };
169
- })
149
+ }
170
150
  });
171
151
  export {
172
152
  cli_default as default,
@@ -1,19 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
1
  import {
18
2
  lazyImport,
19
3
  PLUGIN_SCHEMAS,
@@ -27,7 +11,7 @@ var cli_default = ({ pluginName } = { pluginName: "@modern-js/plugin-tailwindcss
27
11
  const PLUGIN_IDENTIFIER = "designToken";
28
12
  const getDesignTokens = (designSystem) => {
29
13
  const tailwindcssConfig = {};
30
- tailwindcssConfig.theme = designSystem ? __spreadValues({}, designSystem) : {};
14
+ tailwindcssConfig.theme = designSystem ? { ...designSystem } : {};
31
15
  if (!designSystem) {
32
16
  tailwindcssConfig.presets = [];
33
17
  }
@@ -1,19 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
1
  import { jsx } from "react/jsx-runtime";
18
2
  import hoistNonReactStatics from "hoist-non-react-statics";
19
3
  import React, { useContext } from "react";
@@ -35,22 +19,30 @@ var plugin_default = (options = {}) => ({
35
19
  theme: token,
36
20
  children: /* @__PURE__ */ jsx(DesignTokenContext.Provider, {
37
21
  value: token,
38
- children: /* @__PURE__ */ jsx(App, __spreadValues({}, props))
22
+ children: /* @__PURE__ */ jsx(App, {
23
+ ...props
24
+ })
39
25
  })
40
26
  });
41
27
  } else if (useStyledComponentsThemeProvider) {
42
28
  const { ThemeProvider } = require("@modern-js/runtime/styled");
43
29
  return /* @__PURE__ */ jsx(ThemeProvider, {
44
30
  theme: token,
45
- children: /* @__PURE__ */ jsx(App, __spreadValues({}, props))
31
+ children: /* @__PURE__ */ jsx(App, {
32
+ ...props
33
+ })
46
34
  });
47
35
  } else if (useDesignTokenContext) {
48
36
  return /* @__PURE__ */ jsx(DesignTokenContext.Provider, {
49
37
  value: token,
50
- children: /* @__PURE__ */ jsx(App, __spreadValues({}, props))
38
+ children: /* @__PURE__ */ jsx(App, {
39
+ ...props
40
+ })
51
41
  });
52
42
  } else {
53
- return /* @__PURE__ */ jsx(App, __spreadValues({}, props));
43
+ return /* @__PURE__ */ jsx(App, {
44
+ ...props
45
+ });
54
46
  }
55
47
  };
56
48
  return next({
File without changes
File without changes
File without changes
@@ -1,23 +1,3 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
1
  import path from "path";
22
2
  import { fs } from "@modern-js/utils";
23
3
  const template = (configPath) => `
@@ -41,14 +21,14 @@ module.exports = {
41
21
  };
42
22
  `;
43
23
  const TWIN_MACRO_NAME = "twin.macro";
44
- const checkTwinMacroExist = (appDirectory) => __async(void 0, null, function* () {
45
- const packageJson = (yield fs.readJSON(path.join(appDirectory, "package.json"), {
24
+ const checkTwinMacroExist = async (appDirectory) => {
25
+ const packageJson = await fs.readJSON(path.join(appDirectory, "package.json"), {
46
26
  throws: false
47
- })) || {};
27
+ }) || {};
48
28
  return Boolean(
49
29
  typeof packageJson.dependencies === "object" && packageJson.dependencies[TWIN_MACRO_NAME] || typeof packageJson.devDependencies === "object" && packageJson.devDependencies[TWIN_MACRO_NAME]
50
30
  );
51
- });
31
+ };
52
32
  const getTwinMacroMajorVersion = (appDirectory) => {
53
33
  try {
54
34
  const pkgJsonPath = require.resolve(`${TWIN_MACRO_NAME}/package.json`, {
package/package.json CHANGED
@@ -11,28 +11,27 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.4.1-beta.0",
14
+ "version": "2.5.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
- "main": "./dist/js/node/index.js",
18
- "module": "./dist/js/treeshaking/index.js",
19
- "jsnext:modern": "./dist/js/modern/index.js",
17
+ "main": "./dist/cjs/index.js",
18
+ "module": "./dist/esm/index.js",
20
19
  "exports": {
21
20
  ".": {
22
21
  "node": {
23
22
  "jsnext:source": "./src/index.ts",
24
- "require": "./dist/js/node/index.js"
23
+ "require": "./dist/cjs/index.js"
25
24
  },
26
- "default": "./dist/js/node/index.js"
25
+ "default": "./dist/cjs/index.js"
27
26
  },
28
27
  "./cli": {
29
28
  "jsnext:source": "./src/cli.ts",
30
- "default": "./dist/js/node/cli.js"
29
+ "default": "./dist/cjs/cli.js"
31
30
  },
32
31
  "./runtime-design-token": {
33
32
  "jsnext:source": "./src/design-token/index.js",
34
- "node": "./dist/js/node/design-token/index.js",
35
- "default": "./dist/js/treeshaking/design-token/index.js"
33
+ "node": "./dist/cjs/design-token/index.js",
34
+ "default": "./dist/esm/design-token/index.js"
36
35
  }
37
36
  },
38
37
  "typesVersions": {
@@ -46,7 +45,7 @@
46
45
  "@babel/runtime": "^7.18.0",
47
46
  "babel-plugin-macros": "3.1.0",
48
47
  "hoist-non-react-statics": "^3.3.2",
49
- "@modern-js/utils": "2.4.1-beta.0"
48
+ "@modern-js/utils": "2.5.0"
50
49
  },
51
50
  "devDependencies": {
52
51
  "@types/jest": "^27",
@@ -56,17 +55,17 @@
56
55
  "jest": "^27",
57
56
  "react": "^18",
58
57
  "postcss": "8.4.21",
59
- "@modern-js/core": "2.4.1-beta.0",
60
- "@modern-js/module-tools": "2.5.0-beta.0",
61
- "@modern-js/runtime": "2.4.1-beta.0",
62
- "@modern-js/types": "2.4.0",
63
- "@scripts/build": "2.4.0",
64
- "@modern-js/app-tools": "3.0.0-beta.0",
65
- "@scripts/jest-config": "2.4.0"
58
+ "@modern-js/core": "2.5.0",
59
+ "@modern-js/runtime": "2.5.0",
60
+ "@modern-js/module-tools": "2.5.0",
61
+ "@modern-js/types": "2.5.0",
62
+ "@scripts/build": "2.5.0",
63
+ "@modern-js/app-tools": "2.5.0",
64
+ "@scripts/jest-config": "2.5.0"
66
65
  },
67
66
  "peerDependencies": {
68
67
  "tailwindcss": ">= 2.0.0 || >= 3.0.0",
69
- "@modern-js/runtime": "^2.4.1-beta.0"
68
+ "@modern-js/runtime": "^2.5.0"
70
69
  },
71
70
  "peerDependenciesMeta": {
72
71
  "@modern-js/runtime": {