@modern-js/module-tools 1.0.0-rc.3 → 1.0.0-rc.8

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,6 +1,122 @@
1
1
  # @modern-js/module-tools
2
2
 
3
+ ## 1.0.0-rc.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 224f7fe: fix server route match
8
+ - 204c626: feat: initial
9
+ - Updated dependencies [224f7fe]
10
+ - Updated dependencies [204c626]
11
+ - @modern-js/babel-preset-module@1.0.0-rc.8
12
+ - @modern-js/core@1.0.0-rc.8
13
+ - @modern-js/css-config@1.0.0-rc.8
14
+ - @modern-js/i18n-cli-language-detector@1.0.0-rc.8
15
+ - @modern-js/plugin-analyze@1.0.0-rc.8
16
+ - @modern-js/plugin-changeset@1.0.0-rc.8
17
+ - @modern-js/plugin-fast-refresh@1.0.0-rc.8
18
+ - @modern-js/plugin-i18n@1.0.0-rc.8
19
+ - @modern-js/new-action@1.0.0-rc.8
20
+ - @modern-js/babel-compiler@1.0.0-rc.8
21
+ - @modern-js/style-compiler@1.0.0-rc.8
22
+ - @modern-js/module-tools-hooks@1.0.0-rc.8
23
+ - @modern-js/plugin@1.0.0-rc.8
24
+ - @modern-js/utils@1.0.0-rc.8
25
+
26
+ ## 1.0.0-rc.7
27
+
28
+ ### Patch Changes
29
+
30
+ - 224f7fe: fix server route match
31
+ - 204c626: feat: initial
32
+ - Updated dependencies [224f7fe]
33
+ - Updated dependencies [204c626]
34
+ - @modern-js/babel-preset-module@1.0.0-rc.7
35
+ - @modern-js/core@1.0.0-rc.7
36
+ - @modern-js/css-config@1.0.0-rc.7
37
+ - @modern-js/i18n-cli-language-detector@1.0.0-rc.7
38
+ - @modern-js/plugin-analyze@1.0.0-rc.7
39
+ - @modern-js/plugin-changeset@1.0.0-rc.7
40
+ - @modern-js/plugin-fast-refresh@1.0.0-rc.7
41
+ - @modern-js/plugin-i18n@1.0.0-rc.7
42
+ - @modern-js/new-action@1.0.0-rc.7
43
+ - @modern-js/babel-compiler@1.0.0-rc.7
44
+ - @modern-js/style-compiler@1.0.0-rc.7
45
+ - @modern-js/module-tools-hooks@1.0.0-rc.7
46
+ - @modern-js/plugin@1.0.0-rc.7
47
+ - @modern-js/utils@1.0.0-rc.7
48
+
49
+ ## 1.0.0-rc.6
50
+
51
+ ### Patch Changes
52
+
53
+ - 224f7fe: fix server route match
54
+ - 204c626: feat: initial
55
+ - Updated dependencies [224f7fe]
56
+ - Updated dependencies [204c626]
57
+ - @modern-js/babel-preset-module@1.0.0-rc.6
58
+ - @modern-js/core@1.0.0-rc.6
59
+ - @modern-js/css-config@1.0.0-rc.6
60
+ - @modern-js/i18n-cli-language-detector@1.0.0-rc.6
61
+ - @modern-js/plugin-analyze@1.0.0-rc.6
62
+ - @modern-js/plugin-changeset@1.0.0-rc.6
63
+ - @modern-js/plugin-fast-refresh@1.0.0-rc.6
64
+ - @modern-js/plugin-i18n@1.0.0-rc.6
65
+ - @modern-js/new-action@1.0.0-rc.6
66
+ - @modern-js/babel-compiler@1.0.0-rc.6
67
+ - @modern-js/style-compiler@1.0.0-rc.6
68
+ - @modern-js/module-tools-hooks@1.0.0-rc.6
69
+ - @modern-js/plugin@1.0.0-rc.6
70
+ - @modern-js/utils@1.0.0-rc.6
71
+
72
+ ## 1.0.0-rc.5
73
+
74
+ ### Patch Changes
75
+
76
+ - 224f7fe: fix server route match
77
+ - 204c626: feat: initial
78
+ - Updated dependencies [224f7fe]
79
+ - Updated dependencies [204c626]
80
+ - @modern-js/babel-preset-module@1.0.0-rc.5
81
+ - @modern-js/core@1.0.0-rc.5
82
+ - @modern-js/css-config@1.0.0-rc.5
83
+ - @modern-js/i18n-cli-language-detector@1.0.0-rc.5
84
+ - @modern-js/plugin-analyze@1.0.0-rc.5
85
+ - @modern-js/plugin-changeset@1.0.0-rc.5
86
+ - @modern-js/plugin-fast-refresh@1.0.0-rc.5
87
+ - @modern-js/plugin-i18n@1.0.0-rc.5
88
+ - @modern-js/new-action@1.0.0-rc.5
89
+ - @modern-js/babel-compiler@1.0.0-rc.5
90
+ - @modern-js/style-compiler@1.0.0-rc.5
91
+ - @modern-js/module-tools-hooks@1.0.0-rc.5
92
+ - @modern-js/plugin@1.0.0-rc.5
93
+ - @modern-js/utils@1.0.0-rc.5
94
+
95
+ ## 1.0.0-rc.4
96
+
97
+ ### Patch Changes
98
+
99
+ - fix server route match
100
+ - 204c626: feat: initial
101
+ - Updated dependencies [undefined]
102
+ - Updated dependencies [204c626]
103
+ - @modern-js/babel-preset-module@1.0.0-rc.4
104
+ - @modern-js/core@1.0.0-rc.4
105
+ - @modern-js/css-config@1.0.0-rc.4
106
+ - @modern-js/i18n-cli-language-detector@1.0.0-rc.4
107
+ - @modern-js/plugin-analyze@1.0.0-rc.4
108
+ - @modern-js/plugin-changeset@1.0.0-rc.4
109
+ - @modern-js/plugin-fast-refresh@1.0.0-rc.4
110
+ - @modern-js/plugin-i18n@1.0.0-rc.4
111
+ - @modern-js/new-action@1.0.0-rc.4
112
+ - @modern-js/babel-compiler@1.0.0-rc.4
113
+ - @modern-js/style-compiler@1.0.0-rc.4
114
+ - @modern-js/module-tools-hooks@1.0.0-rc.4
115
+ - @modern-js/plugin@1.0.0-rc.4
116
+ - @modern-js/utils@1.0.0-rc.4
117
+
3
118
  ## 1.0.0-rc.3
119
+
4
120
  ### Patch Changes
5
121
 
6
122
  - feat: initial
@@ -34,7 +34,7 @@ export const devStorybook = async config => {
34
34
  if (findStorybook) {
35
35
  await findStorybook.runTask(config);
36
36
  } else {
37
- console.info(chalk.yellow('You need to enable storybook functionality with the `new` script or `modern new` or install @modern-js/plugin-storybook')); // eslint-disable-next-line no-process-exit
37
+ console.info(chalk.yellow('No development features found.\nYou can use the `new` command to enable the development features')); // eslint-disable-next-line no-process-exit
38
38
 
39
39
  process.exit(0);
40
40
  }
@@ -56,6 +56,7 @@ const copyOriginStyleFiles = ({
56
56
 
57
57
  for (const styleFile of styleFiles) {
58
58
  const file = path.relative(targetDir, styleFile);
59
+ fs.ensureDirSync(path.dirname(path.join(outputDir, file)));
59
60
  fs.copyFileSync(styleFile, path.join(outputDir, file));
60
61
  }
61
62
  };
@@ -76,15 +77,28 @@ const taskMain = async ({
76
77
  modernConfig
77
78
  }, // eslint-disable-next-line @typescript-eslint/require-await
78
79
  {
79
- onLast: async _ => null
80
+ onLast: async _ => undefined
80
81
  });
81
82
  const sassOption = await core.mountHook().moduleSassConfig({
82
83
  modernConfig
83
84
  }, // eslint-disable-next-line @typescript-eslint/require-await
84
85
  {
85
- onLast: async _ => null
86
+ onLast: async _ => undefined
87
+ });
88
+ const tailwindPlugin = await core.mountHook().moduleTailwindConfig({
89
+ modernConfig
90
+ }, // eslint-disable-next-line @typescript-eslint/require-await
91
+ {
92
+ onLast: async _ => undefined
86
93
  });
87
94
  const postcssOption = getPostcssOption(appDirectory, modernConfig);
95
+
96
+ if (tailwindPlugin) {
97
+ var _postcssOption$plugin;
98
+
99
+ (_postcssOption$plugin = postcssOption.plugins) === null || _postcssOption$plugin === void 0 ? void 0 : _postcssOption$plugin.push(tailwindPlugin);
100
+ }
101
+
88
102
  const {
89
103
  importStyle
90
104
  } = modernConfig.output;
@@ -62,7 +62,9 @@ export const resolveBabelConfig = (appDirectory, modernConfig, option) => {
62
62
  }, {
63
63
  type: option.type,
64
64
  syntax: option.syntax
65
- });
65
+ }); // Preventing warning when files are too large
66
+
67
+ internalBabelConfig.compact = false;
66
68
  const babelChain = getModuleBabelChain({
67
69
  appDirectory,
68
70
  enableReactPreset: true,
@@ -51,7 +51,7 @@ const devStorybook = async config => {
51
51
  if (findStorybook) {
52
52
  await findStorybook.runTask(config);
53
53
  } else {
54
- console.info(_chalk.default.yellow('You need to enable storybook functionality with the `new` script or `modern new` or install @modern-js/plugin-storybook')); // eslint-disable-next-line no-process-exit
54
+ console.info(_chalk.default.yellow('No development features found.\nYou can use the `new` command to enable the development features')); // eslint-disable-next-line no-process-exit
55
55
 
56
56
  process.exit(0);
57
57
  }
@@ -72,6 +72,8 @@ const copyOriginStyleFiles = ({
72
72
  for (const styleFile of styleFiles) {
73
73
  const file = path.relative(targetDir, styleFile);
74
74
 
75
+ _utils.fs.ensureDirSync(path.dirname(path.join(outputDir, file)));
76
+
75
77
  _utils.fs.copyFileSync(styleFile, path.join(outputDir, file));
76
78
  }
77
79
  };
@@ -92,15 +94,28 @@ const taskMain = async ({
92
94
  modernConfig
93
95
  }, // eslint-disable-next-line @typescript-eslint/require-await
94
96
  {
95
- onLast: async _ => null
97
+ onLast: async _ => undefined
96
98
  });
97
99
  const sassOption = await core.mountHook().moduleSassConfig({
98
100
  modernConfig
99
101
  }, // eslint-disable-next-line @typescript-eslint/require-await
100
102
  {
101
- onLast: async _ => null
103
+ onLast: async _ => undefined
104
+ });
105
+ const tailwindPlugin = await core.mountHook().moduleTailwindConfig({
106
+ modernConfig
107
+ }, // eslint-disable-next-line @typescript-eslint/require-await
108
+ {
109
+ onLast: async _ => undefined
102
110
  });
103
111
  const postcssOption = getPostcssOption(appDirectory, modernConfig);
112
+
113
+ if (tailwindPlugin) {
114
+ var _postcssOption$plugin;
115
+
116
+ (_postcssOption$plugin = postcssOption.plugins) === null || _postcssOption$plugin === void 0 ? void 0 : _postcssOption$plugin.push(tailwindPlugin);
117
+ }
118
+
104
119
  const {
105
120
  importStyle
106
121
  } = modernConfig.output;
@@ -74,7 +74,9 @@ const resolveBabelConfig = (appDirectory, modernConfig, option) => {
74
74
  }, {
75
75
  type: option.type,
76
76
  syntax: option.syntax
77
- });
77
+ }); // Preventing warning when files are too large
78
+
79
+ internalBabelConfig.compact = false;
78
80
  const babelChain = (0, _babelPresetModule.getModuleBabelChain)({
79
81
  appDirectory,
80
82
  enableReactPreset: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/module-tools",
3
- "version": "1.0.0-rc.3",
3
+ "version": "1.0.0-rc.8",
4
4
  "bin": {
5
5
  "modern": "./bin/modern.js"
6
6
  },
@@ -33,20 +33,20 @@
33
33
  "@babel/runtime": "^7",
34
34
  "@babel/traverse": "^7.15.0",
35
35
  "@babel/types": "^7.15.0",
36
- "@modern-js/babel-compiler": "^1.0.0-rc.3",
37
- "@modern-js/babel-preset-module": "^1.0.0-rc.3",
38
- "@modern-js/core": "^1.0.0-rc.3",
39
- "@modern-js/css-config": "^1.0.0-rc.3",
40
- "@modern-js/i18n-cli-language-detector": "^1.0.0-rc.3",
41
- "@modern-js/module-tools-hooks": "^1.0.0-rc.3",
42
- "@modern-js/new-action": "^1.0.0-rc.3",
43
- "@modern-js/plugin": "^1.0.0-rc.3",
44
- "@modern-js/plugin-analyze": "^1.0.0-rc.3",
45
- "@modern-js/plugin-changeset": "^1.0.0-rc.3",
46
- "@modern-js/plugin-fast-refresh": "^1.0.0-rc.3",
47
- "@modern-js/plugin-i18n": "^1.0.0-rc.3",
48
- "@modern-js/style-compiler": "^1.0.0-rc.3",
49
- "@modern-js/utils": "^1.0.0-rc.3",
36
+ "@modern-js/babel-compiler": "^1.0.0-rc.8",
37
+ "@modern-js/babel-preset-module": "^1.0.0-rc.8",
38
+ "@modern-js/core": "^1.0.0-rc.8",
39
+ "@modern-js/css-config": "^1.0.0-rc.8",
40
+ "@modern-js/i18n-cli-language-detector": "^1.0.0-rc.8",
41
+ "@modern-js/module-tools-hooks": "^1.0.0-rc.8",
42
+ "@modern-js/new-action": "^1.0.0-rc.8",
43
+ "@modern-js/plugin": "^1.0.0-rc.8",
44
+ "@modern-js/plugin-analyze": "^1.0.0-rc.8",
45
+ "@modern-js/plugin-changeset": "^1.0.0-rc.8",
46
+ "@modern-js/plugin-fast-refresh": "^1.0.0-rc.8",
47
+ "@modern-js/plugin-i18n": "^1.0.0-rc.8",
48
+ "@modern-js/style-compiler": "^1.0.0-rc.8",
49
+ "@modern-js/utils": "^1.0.0-rc.8",
50
50
  "chalk": "^4.1.2",
51
51
  "chokidar": "^3.5.2",
52
52
  "dotenv": "^10.0.0",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "devDependencies": {
67
67
  "@babel/preset-typescript": "^7.15.0",
68
- "@modern-js/babel-chain": "^1.0.0-rc.3",
68
+ "@modern-js/babel-chain": "^1.0.0-rc.8",
69
69
  "@types/babel__core": "^7.1.15",
70
70
  "@types/babel__generator": "^7.6.3",
71
71
  "@types/babel__traverse": "^7.14.2",
@@ -78,8 +78,8 @@
78
78
  "@types/signale": "^1.4.2",
79
79
  "commander": "^8.1.0",
80
80
  "typescript": "^4",
81
- "@modern-js/plugin-testing": "^1.0.0-rc.3",
82
- "@modern-js/module-tools": "^1.0.0-rc.3"
81
+ "@modern-js/plugin-testing": "^1.0.0-rc.8",
82
+ "@modern-js/module-tools": "^1.0.0-rc.8"
83
83
  },
84
84
  "sideEffects": false,
85
85
  "modernConfig": {
@@ -87,7 +87,7 @@
87
87
  "packageMode": "node-js"
88
88
  }
89
89
  },
90
- "publicCnfig": {
90
+ "publishConfig": {
91
91
  "registry": "https://registry.npmjs.org/",
92
92
  "access": "public"
93
93
  },
@@ -53,7 +53,7 @@ export const devStorybook = async (config: IDevConfig) => {
53
53
  } else {
54
54
  console.info(
55
55
  chalk.yellow(
56
- 'You need to enable storybook functionality with the `new` script or `modern new` or install @modern-js/plugin-storybook',
56
+ 'No development features found.\nYou can use the `new` command to enable the development features',
57
57
  ),
58
58
  );
59
59
  // eslint-disable-next-line no-process-exit
@@ -82,6 +82,7 @@ const copyOriginStyleFiles = ({
82
82
  }
83
83
  for (const styleFile of styleFiles) {
84
84
  const file = path.relative(targetDir, styleFile);
85
+ fs.ensureDirSync(path.dirname(path.join(outputDir, file)));
85
86
  fs.copyFileSync(styleFile, path.join(outputDir, file));
86
87
  }
87
88
  };
@@ -100,17 +101,26 @@ const taskMain = async ({
100
101
  } = modernConfig.output as ModuleToolsOutput;
101
102
  const { appDirectory } = appContext;
102
103
 
103
- const lessOption = await (core.mountHook() as any).moduleLessConfig(
104
+ const lessOption = await core.mountHook().moduleLessConfig(
104
105
  { modernConfig },
105
106
  // eslint-disable-next-line @typescript-eslint/require-await
106
- { onLast: async (_: any) => null as any },
107
+ { onLast: async (_: any) => undefined },
107
108
  );
108
- const sassOption = await (core.mountHook() as any).moduleSassConfig(
109
+ const sassOption = await core.mountHook().moduleSassConfig(
109
110
  { modernConfig },
110
111
  // eslint-disable-next-line @typescript-eslint/require-await
111
- { onLast: async (_: any) => null as any },
112
+ { onLast: async (_: any) => undefined },
113
+ );
114
+ const tailwindPlugin = await core.mountHook().moduleTailwindConfig(
115
+ { modernConfig },
116
+ // eslint-disable-next-line @typescript-eslint/require-await
117
+ { onLast: async (_: any) => undefined },
112
118
  );
113
119
  const postcssOption = getPostcssOption(appDirectory, modernConfig);
120
+ if (tailwindPlugin) {
121
+ postcssOption.plugins?.push(tailwindPlugin);
122
+ }
123
+
114
124
  const { importStyle } = modernConfig.output as ModuleToolsOutput;
115
125
  const existStylesDir = checkStylesDirExist({ appDirectory });
116
126
  // 编译 styles 目录样式
@@ -73,6 +73,10 @@ export const resolveBabelConfig = (
73
73
  syntax: option.syntax,
74
74
  },
75
75
  );
76
+
77
+ // Preventing warning when files are too large
78
+ internalBabelConfig.compact = false;
79
+
76
80
  const babelChain = getModuleBabelChain(
77
81
  {
78
82
  appDirectory,