@modern-js/plugin-tailwindcss 1.5.0 → 1.5.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @modern-js/plugin-tailwindcss
2
2
 
3
+ ## 1.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3c874ca16: fix: `@modern-js/plugin-tailwindcss` support `pluginName` params
8
+
9
+ fix: `@modern-js/plugin-tailwindcss` 支持 `pluginName` 参数
10
+
3
11
  ## 1.5.0
4
12
 
5
13
  ### Minor Changes
@@ -13,10 +13,16 @@ const supportCssInJsLibrary = 'styled-components';
13
13
  export const getRandomTwConfigFileName = internalDirectory => {
14
14
  return slash(path.join(internalDirectory, `tailwind.config.${Date.now()}.${nanoid()}.js`));
15
15
  };
16
- export default (() => ({
16
+ export default (({
17
+ pluginName
18
+ } = {
19
+ pluginName: '@modern-js/plugin-tailwindcss'
20
+ }) => ({
17
21
  name: '@modern-js/plugin-tailwindcss',
18
22
  // support designSystem.supportStyledComponents
19
- usePlugins: [DesignTokenPlugin()],
23
+ usePlugins: [DesignTokenPlugin({
24
+ pluginName
25
+ })],
20
26
  setup: async api => {
21
27
  const {
22
28
  appDirectory,
@@ -5,7 +5,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  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; }
6
6
 
7
7
  import { lazyImport, PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
8
- export default (() => ({
8
+ export default (({
9
+ pluginName
10
+ }) => ({
9
11
  name: '@modern-js/plugin-design-token',
10
12
 
11
13
  setup(api) {
@@ -118,7 +120,7 @@ export default (() => ({
118
120
  },
119
121
 
120
122
  addRuntimeExports() {
121
- pluginsExportsUtils.addExport(`export { default as designToken } from '@modern-js/plugin-tailwindcss/runtime-design-token'`);
123
+ pluginsExportsUtils.addExport(`export { default as designToken } from '${pluginName}/runtime-design-token'`);
122
124
  }
123
125
 
124
126
  };
@@ -31,10 +31,16 @@ const getRandomTwConfigFileName = internalDirectory => {
31
31
 
32
32
  exports.getRandomTwConfigFileName = getRandomTwConfigFileName;
33
33
 
34
- var _default = () => ({
34
+ var _default = ({
35
+ pluginName
36
+ } = {
37
+ pluginName: '@modern-js/plugin-tailwindcss'
38
+ }) => ({
35
39
  name: '@modern-js/plugin-tailwindcss',
36
40
  // support designSystem.supportStyledComponents
37
- usePlugins: [(0, _cli.default)()],
41
+ usePlugins: [(0, _cli.default)({
42
+ pluginName
43
+ })],
38
44
  setup: async api => {
39
45
  const {
40
46
  appDirectory,
@@ -13,7 +13,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
13
13
 
14
14
  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; }
15
15
 
16
- var _default = () => ({
16
+ var _default = ({
17
+ pluginName
18
+ }) => ({
17
19
  name: '@modern-js/plugin-design-token',
18
20
 
19
21
  setup(api) {
@@ -126,7 +128,7 @@ var _default = () => ({
126
128
  },
127
129
 
128
130
  addRuntimeExports() {
129
- pluginsExportsUtils.addExport(`export { default as designToken } from '@modern-js/plugin-tailwindcss/runtime-design-token'`);
131
+ pluginsExportsUtils.addExport(`export { default as designToken } from '${pluginName}/runtime-design-token'`);
130
132
  }
131
133
 
132
134
  };
@@ -11,10 +11,17 @@ export var getRandomTwConfigFileName = function getRandomTwConfigFileName(intern
11
11
  return slash(path.join(internalDirectory, "tailwind.config.".concat(Date.now(), ".").concat(nanoid(), ".js")));
12
12
  };
13
13
  export default (function () {
14
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
15
+ pluginName: '@modern-js/plugin-tailwindcss'
16
+ },
17
+ pluginName = _ref.pluginName;
18
+
14
19
  return {
15
20
  name: '@modern-js/plugin-tailwindcss',
16
21
  // support designSystem.supportStyledComponents
17
- usePlugins: [DesignTokenPlugin()],
22
+ usePlugins: [DesignTokenPlugin({
23
+ pluginName: pluginName
24
+ })],
18
25
  setup: function () {
19
26
  var _setup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(api) {
20
27
  var _api$useAppContext, appDirectory, internalDirectory, internalTwConfigPath, notHaveTwinMacro;
@@ -1,7 +1,8 @@
1
1
  import _typeof from "@babel/runtime/helpers/esm/typeof";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import { lazyImport, PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
4
- export default (function () {
4
+ export default (function (_ref) {
5
+ var pluginName = _ref.pluginName;
5
6
  return {
6
7
  name: '@modern-js/plugin-design-token',
7
8
  setup: function setup(api) {
@@ -10,8 +11,8 @@ export default (function () {
10
11
  var PLUGIN_IDENTIFIER = 'designToken';
11
12
 
12
13
  var getDesignTokens = function getDesignTokens(userConfig) {
13
- var _ref = userConfig,
14
- designSystem = _ref.source.designSystem; // TODO: Type to be filled
14
+ var _ref2 = userConfig,
15
+ designSystem = _ref2.source.designSystem; // TODO: Type to be filled
15
16
 
16
17
  var tailwindcssConfig = {};
17
18
  tailwindcssConfig.theme = designSystem ? _objectSpread({}, designSystem) : {}; // not use default design token when designToken.defaultTheme is false or theme is false
@@ -45,9 +46,9 @@ export default (function () {
45
46
  }
46
47
  };
47
48
  },
48
- modifyEntryImports: function modifyEntryImports(_ref2) {
49
- var entrypoint = _ref2.entrypoint,
50
- imports = _ref2.imports;
49
+ modifyEntryImports: function modifyEntryImports(_ref3) {
50
+ var entrypoint = _ref3.entrypoint,
51
+ imports = _ref3.imports;
51
52
  var userConfig = api.useResolvedConfigContext();
52
53
  var designSystem = userConfig.source.designSystem;
53
54
 
@@ -67,12 +68,12 @@ export default (function () {
67
68
  imports: imports
68
69
  };
69
70
  },
70
- modifyEntryRuntimePlugins: function modifyEntryRuntimePlugins(_ref3) {
71
- var entrypoint = _ref3.entrypoint,
72
- plugins = _ref3.plugins;
71
+ modifyEntryRuntimePlugins: function modifyEntryRuntimePlugins(_ref4) {
72
+ var entrypoint = _ref4.entrypoint,
73
+ plugins = _ref4.plugins;
73
74
 
74
- var _ref4 = api.useResolvedConfigContext(),
75
- designSystem = _ref4.source.designSystem;
75
+ var _ref5 = api.useResolvedConfigContext(),
76
+ designSystem = _ref5.source.designSystem;
76
77
 
77
78
  var useSCThemeProvider = true;
78
79
 
@@ -98,7 +99,7 @@ export default (function () {
98
99
  return PLUGIN_SCHEMAS['@modern-js/plugin-design-token'];
99
100
  },
100
101
  addRuntimeExports: function addRuntimeExports() {
101
- pluginsExportsUtils.addExport("export { default as designToken } from '@modern-js/plugin-tailwindcss/runtime-design-token'");
102
+ pluginsExportsUtils.addExport("export { default as designToken } from '".concat(pluginName, "/runtime-design-token'"));
102
103
  }
103
104
  };
104
105
  }
@@ -1,6 +1,10 @@
1
1
  import type { CliPlugin } from '@modern-js/core';
2
2
  export declare const getRandomTwConfigFileName: (internalDirectory: string) => string;
3
3
 
4
- declare const _default: () => CliPlugin;
4
+ declare const _default: ({
5
+ pluginName
6
+ }?: {
7
+ pluginName: string;
8
+ }) => CliPlugin;
5
9
 
6
10
  export default _default;
@@ -1,5 +1,9 @@
1
1
  import type { CliPlugin } from '@modern-js/core';
2
2
 
3
- declare const _default: () => CliPlugin;
3
+ declare const _default: ({
4
+ pluginName
5
+ }: {
6
+ pluginName: string;
7
+ }) => CliPlugin;
4
8
 
5
9
  export default _default;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.5.0",
14
+ "version": "1.5.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",