@modern-js/plugin-tailwindcss 1.2.4 → 1.2.7

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/.eslintrc.js ADDED
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['@modern-js'],
4
+ parserOptions: {
5
+ // the base path used to search for `tsconfig.json`
6
+ tsconfigRootDir: __dirname,
7
+ // the relative path to sub-package's `tsconfig.json`
8
+ project: ['./tsconfig.json'],
9
+ },
10
+ };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @modern-js/plugin-tailwindcss
2
2
 
3
+ ## 1.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 17d0cc46: feat: prebundle lodash to @modern-js/utils/lodash
8
+ - Updated dependencies [77ff9754]
9
+ - Updated dependencies [d2d1d6b2]
10
+ - Updated dependencies [07a4887e]
11
+ - Updated dependencies [ea2ae711]
12
+ - Updated dependencies [17d0cc46]
13
+ - Updated dependencies [d2d1d6b2]
14
+ - @modern-js/utils@1.4.0
15
+ - @modern-js/plugin-design-token@1.0.3
16
+
17
+ ## 1.2.6
18
+
19
+ ### Patch Changes
20
+
21
+ - bebb39b6: chore: improve devDependencies and peerDependencies
22
+ - 132f7b53: feat: move config declarations to @modern-js/core
23
+ - Updated dependencies [bebb39b6]
24
+ - Updated dependencies [132f7b53]
25
+ - @modern-js/plugin-design-token@1.0.3
26
+ - @modern-js/utils@1.3.7
27
+
28
+ ## 1.2.5
29
+
30
+ ### Patch Changes
31
+
32
+ - b851d628: feat: convert to new plugin
33
+ - 61e3f623: feat: convert to new plugin
34
+ - Updated dependencies [c2046f37]
35
+ - Updated dependencies [10379961]
36
+ - Updated dependencies [61e3f623]
37
+ - @modern-js/utils@1.3.6
38
+ - @modern-js/plugin-design-token@1.0.2
39
+
3
40
  ## 1.2.4
4
41
 
5
42
  ### Patch Changes
@@ -7,54 +7,56 @@ exports.default = void 0;
7
7
 
8
8
  var _utils = require("@modern-js/utils");
9
9
 
10
- var _tailwind = require("./tailwind");
11
-
12
- const core = _utils.Import.lazy('@modern-js/core', require); // support designSystem.supportStyledComponents
13
-
14
-
15
- core.usePlugins([require.resolve('@modern-js/plugin-design-token/cli')]);
10
+ var _cli = _interopRequireDefault(require("@modern-js/plugin-design-token/cli"));
16
11
 
17
- var _default = core.createPlugin(() => ({
18
- validateSchema() {
19
- return _utils.PLUGIN_SCHEMAS['@modern-js/plugin-tailwindcss'];
20
- },
12
+ var _tailwind = require("./tailwind");
21
13
 
22
- config() {
23
- return {
24
- tools: {
25
- // TODO: Add interface about postcss config
26
- // TODO: In module project, also is called, but should not be called.
27
- postcss: config => {
28
- const modernConfig = core.useResolvedConfigContext();
29
- const tailwindConfig = (0, _tailwind.getTailwindConfig)(modernConfig, {
30
- pureConfig: {
31
- content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx', // about storybook
32
- './storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ var _default = () => ({
17
+ name: '@modern-js/plugin-tailwindcss',
18
+ // support designSystem.supportStyledComponents
19
+ usePlugins: [(0, _cli.default)()],
20
+ setup: api => ({
21
+ validateSchema() {
22
+ return _utils.PLUGIN_SCHEMAS['@modern-js/plugin-tailwindcss'];
23
+ },
24
+
25
+ config() {
26
+ return {
27
+ tools: {
28
+ // TODO: Add interface about postcss config
29
+ // TODO: In module project, also is called, but should not be called.
30
+ postcss: config => {
31
+ const modernConfig = api.useResolvedConfigContext();
32
+ const tailwindConfig = (0, _tailwind.getTailwindConfig)(modernConfig, {
33
+ pureConfig: {
34
+ content: ['./config/html/**/*.html', './config/html/**/*.ejs', './config/html/**/*.hbs', './src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx', // about storybook
35
+ './storybook/**/*', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
36
+ }
37
+ });
38
+
39
+ if (Array.isArray(config.postcssOptions.plugins)) {
40
+ config.postcssOptions.plugins.push(require('tailwindcss')(tailwindConfig));
41
+ } else {
42
+ config.postcssOptions.plugins = [require('tailwindcss')(tailwindConfig)];
33
43
  }
34
- });
35
-
36
- if (Array.isArray(config.postcssOptions.plugins)) {
37
- config.postcssOptions.plugins.push(require('tailwindcss')(tailwindConfig));
38
- } else {
39
- config.postcssOptions.plugins = [require('tailwindcss')(tailwindConfig)];
40
44
  }
41
45
  }
42
- }
43
- };
44
- },
45
-
46
- moduleTailwindConfig() {
47
- const modernConfig = core.useResolvedConfigContext();
48
- const tailwindConfig = (0, _tailwind.getTailwindConfig)(modernConfig, {
49
- pureConfig: {
50
- content: ['./src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx', './src/**/*.less', './src/**/*.css', './src/**/*.sass', './src/**/*.scss', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
51
- }
52
- });
53
- return require('tailwindcss')(tailwindConfig);
54
- }
55
-
56
- }), {
57
- name: '@modern-js/plugin-tailwindcss'
46
+ };
47
+ },
48
+
49
+ moduleTailwindConfig() {
50
+ const modernConfig = api.useResolvedConfigContext();
51
+ const tailwindConfig = (0, _tailwind.getTailwindConfig)(modernConfig, {
52
+ pureConfig: {
53
+ content: ['./src/**/*.js', './src/**/*.jsx', './src/**/*.ts', './src/**/*.tsx', './src/**/*.less', './src/**/*.css', './src/**/*.sass', './src/**/*.scss', './styles/**/*.less', './styles/**/*.css', './styles/**/*.sass', './styles/**/*.scss']
54
+ }
55
+ });
56
+ return require('tailwindcss')(tailwindConfig);
57
+ }
58
+
59
+ })
58
60
  });
59
61
 
60
62
  exports.default = _default;
@@ -10,8 +10,6 @@ Object.defineProperty(exports, "default", {
10
10
  }
11
11
  });
12
12
 
13
- require("./types");
14
-
15
13
  var _cli = _interopRequireDefault(require("./cli"));
16
14
 
17
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -7,9 +7,7 @@ exports.getTailwindConfig = void 0;
7
7
 
8
8
  var _utils = require("@modern-js/utils");
9
9
 
10
- const cloneDeep = _utils.Import.lazy('lodash.clonedeep', require);
11
-
12
- const merge = _utils.Import.lazy('lodash.merge', require);
10
+ var _lodash = require("@modern-js/utils/lodash");
13
11
 
14
12
  const checkIfExistNotAllowKeys = tailwindConfig => {
15
13
  const notAllowExistKeys = ['theme'];
@@ -19,13 +17,13 @@ const checkIfExistNotAllowKeys = tailwindConfig => {
19
17
  };
20
18
 
21
19
  const getPureDesignSystemConfig = designSystemConfig => {
22
- const pureDesignSystemConfig = cloneDeep(designSystemConfig);
20
+ const pureDesignSystemConfig = (0, _lodash.cloneDeep)(designSystemConfig);
23
21
  delete pureDesignSystemConfig.supportStyledComponents;
24
22
  return pureDesignSystemConfig;
25
23
  };
26
24
 
27
25
  const getTailwindConfig = (config, option = {}) => {
28
- const purgeConfig = merge({
26
+ const purgeConfig = (0, _lodash.merge)({
29
27
  // TODO: how the operating environment is determined
30
28
  enabled: process.env.NODE_ENV === 'production',
31
29
  // TODO: Remove or not
@@ -1,3 +1,5 @@
1
- declare const _default: any;
1
+ import type { CliPlugin } from '@modern-js/core';
2
+
3
+ declare const _default: () => CliPlugin;
2
4
 
3
5
  export default _default;
@@ -1,2 +1 @@
1
- import './types';
2
1
  export { default } from './cli';
package/jest.config.js CHANGED
@@ -2,7 +2,6 @@ const sharedConfig = require('@scripts/jest-config');
2
2
 
3
3
  /** @type {import('@jest/types').Config.InitialOptions} */
4
4
  module.exports = {
5
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
5
  ...sharedConfig,
7
6
  rootDir: __dirname,
8
7
  };
package/modern.config.js CHANGED
@@ -1,2 +1,8 @@
1
1
  /** @type {import('@modern-js/module-tools').UserConfig} */
2
- module.exports = {};
2
+ module.exports = {
3
+ output: {
4
+ packageFields: {
5
+ main: 'CJS+ES6',
6
+ },
7
+ },
8
+ };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.2.4",
14
+ "version": "1.2.7",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -29,39 +29,17 @@
29
29
  "./cli": {
30
30
  "jsnext:source": "./src/cli.ts",
31
31
  "default": "./dist/js/node/cli.js"
32
- },
33
- "./types": {
34
- "node": {
35
- "import": "./dist/js/modern/types.js",
36
- "require": "./dist/js/node/types.js",
37
- "types": "./dist/types/types.d.ts"
38
- },
39
- "default": "./dist/js/treeshaking/types.js"
40
- }
41
- },
42
- "typesVersions": {
43
- "*": {
44
- ".": [
45
- "./dist/types/index.d.ts"
46
- ],
47
- "types": [
48
- "./dist/types/types.d.ts"
49
- ]
50
32
  }
51
33
  },
52
34
  "dependencies": {
53
35
  "@babel/runtime": "^7",
54
- "@modern-js/utils": "^1.3.3",
55
- "@modern-js/plugin-design-token": "^1.0.1",
56
- "lodash.clonedeep": "^4.5.0",
57
- "lodash.merge": "^4.6.2"
36
+ "@modern-js/utils": "^1.4.0",
37
+ "@modern-js/plugin-design-token": "^1.0.3"
58
38
  },
59
39
  "devDependencies": {
60
- "@modern-js/core": "^1.4.4",
40
+ "@modern-js/core": "1.7.0",
61
41
  "@scripts/build": "0.0.0",
62
42
  "@types/jest": "^26",
63
- "@types/lodash.clonedeep": "^4.5.6",
64
- "@types/lodash.merge": "^4.6.6",
65
43
  "@types/node": "^14",
66
44
  "@types/tailwindcss": "^2.2.1",
67
45
  "typescript": "^4",
@@ -70,23 +48,16 @@
70
48
  "@scripts/jest-config": "0.0.0"
71
49
  },
72
50
  "peerDependencies": {
73
- "@modern-js/core": "^1.4.4",
74
51
  "tailwindcss": "^2.0.4"
75
52
  },
76
53
  "sideEffects": false,
77
- "modernConfig": {
78
- "output": {
79
- "packageFields": {
80
- "main": "CJS+ES6"
81
- }
82
- }
83
- },
84
54
  "publishConfig": {
85
55
  "registry": "https://registry.npmjs.org/",
86
56
  "access": "public"
87
57
  },
88
58
  "scripts": {
89
59
  "new": "modern new",
60
+ "dev": "modern build --watch",
90
61
  "build": "modern build",
91
62
  "test": "jest --passWithNoTests"
92
63
  },
@@ -1,3 +0,0 @@
1
- "use strict";
2
-
3
- require("@modern-js/core");
@@ -1,9 +0,0 @@
1
- import '@modern-js/core';
2
- declare module '@modern-js/core' {
3
- interface ToolsConfig {
4
- tailwindcss?: Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
5
- }
6
- interface SourceConfig {
7
- designSystem?: Record<string, any>;
8
- }
9
- }