@modern-js/module-tools 1.0.0 → 1.1.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/.eslintrc.js ADDED
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ extends: ['@modern-js'],
3
+ parserOptions: {
4
+ project: require.resolve('./tsconfig.json'),
5
+ },
6
+ ignorePatterns: ['types.d.ts'],
7
+ };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # @modern-js/module-tools
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0fa83663: support more .env files
8
+ - Updated dependencies [6f7fe574]
9
+ - Updated dependencies [0fa83663]
10
+ - Updated dependencies [f594fbc8]
11
+ - @modern-js/core@1.1.2
12
+ - @modern-js/babel-preset-module@1.1.1
13
+ - @modern-js/css-config@1.1.1
14
+ - @modern-js/i18n-cli-language-detector@1.1.1
15
+ - @modern-js/plugin-analyze@1.1.1
16
+ - @modern-js/plugin-changeset@1.1.1
17
+ - @modern-js/plugin-fast-refresh@1.1.1
18
+ - @modern-js/plugin-i18n@1.1.1
19
+ - @modern-js/new-action@1.1.2
20
+ - @modern-js/babel-compiler@1.1.2
21
+ - @modern-js/style-compiler@1.1.1
22
+ - @modern-js/module-tools-hooks@1.1.1
23
+ - @modern-js/utils@1.1.2
24
+
25
+ ## 1.1.0
26
+
27
+ ### Minor Changes
28
+
29
+ - 96119db2: Relese v1.1.0
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [96119db2]
34
+ - Updated dependencies [6b802b2a]
35
+ - Updated dependencies [eb00b569]
36
+ - @modern-js/babel-preset-module@1.1.0
37
+ - @modern-js/core@1.1.0
38
+ - @modern-js/css-config@1.1.0
39
+ - @modern-js/i18n-cli-language-detector@1.1.0
40
+ - @modern-js/plugin-analyze@1.1.0
41
+ - @modern-js/plugin-changeset@1.1.0
42
+ - @modern-js/plugin-fast-refresh@1.1.0
43
+ - @modern-js/plugin-i18n@1.1.0
44
+ - @modern-js/new-action@1.1.0
45
+ - @modern-js/babel-compiler@1.1.0
46
+ - @modern-js/style-compiler@1.1.0
47
+ - @modern-js/module-tools-hooks@1.1.0
48
+ - @modern-js/utils@1.1.0
49
+
50
+ ## 1.0.1
51
+
52
+ ### Patch Changes
53
+
54
+ - feat: update generator template
55
+ - Updated dependencies [undefined]
56
+ - @modern-js/new-action@1.0.1
57
+
3
58
  ## 1.0.0
4
59
 
5
60
  ### Patch Changes
package/README.md CHANGED
@@ -17,10 +17,7 @@
17
17
 
18
18
  > The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
19
19
 
20
- - 介绍 Modern.js (即将上线)
21
- - [迈入现代 Web 开发](https://zhuanlan.zhihu.com/p/386607009)
22
- - [现代 Web 开发者问卷调查报告](https://zhuanlan.zhihu.com/p/403206195)
23
- - [字节跳动是如何落地微前端的](https://mp.weixin.qq.com/s/L9wbfNG5fTXF5bx7dcgj4Q)
20
+ - [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)
24
21
 
25
22
  ## Getting Started
26
23
 
@@ -16,11 +16,6 @@ export const build = async ({
16
16
  appDirectory
17
17
  } = core.useAppContext();
18
18
  const modernConfig = core.useResolvedConfigContext();
19
- const {
20
- output: {
21
- path: outputPath = 'dist'
22
- }
23
- } = modernConfig;
24
19
  const tsconfigPath = path.join(appDirectory, tsconfigName);
25
20
  dotenv.config();
26
21
  const isTsProject = tsConfigutils.existTsConfigFile(tsconfigPath);
@@ -28,20 +23,17 @@ export const build = async ({
28
23
  valid.valideBeforeTask({
29
24
  modernConfig,
30
25
  tsconfigPath
31
- });
32
-
33
- if (_clear) {
34
- fs.removeSync(path.join(appDirectory, outputPath));
35
- } // TODO: 一些配置只需要从modernConfig中获取
36
-
26
+ }); // TODO: 一些配置只需要从modernConfig中获取
37
27
 
38
28
  await buildFeature.build({
29
+ appDirectory,
39
30
  enableWatchMode: _watch,
40
31
  isTsProject,
41
32
  platform,
42
33
  sourceDir: 'src',
43
34
  tsconfigName,
44
- enableTscCompiler
35
+ enableTscCompiler,
36
+ clear: _clear
45
37
  }, modernConfig);
46
38
  process.on('SIGBREAK', () => {
47
39
  console.info('exit');
@@ -1,4 +1,5 @@
1
- import { Import } from '@modern-js/utils';
1
+ import path from 'path';
2
+ import { Import, fs } from '@modern-js/utils';
2
3
  const buildFeature = Import.lazy('./build', require);
3
4
  const buildWatchFeature = Import.lazy('./build-watch', require); // const bp: typeof import('./build-platform') = Import.lazy(
4
5
  // './build-platform',
@@ -7,9 +8,16 @@ const buildWatchFeature = Import.lazy('./build-watch', require); // const bp: ty
7
8
 
8
9
  export const build = async (config, modernConfig) => {
9
10
  const {
11
+ appDirectory,
10
12
  enableWatchMode,
11
- platform
12
- } = config; // TODO: maybe need watch mode in build platform
13
+ platform,
14
+ clear = true
15
+ } = config;
16
+ const {
17
+ output: {
18
+ path: outputPath = 'dist'
19
+ }
20
+ } = modernConfig; // TODO: maybe need watch mode in build platform
13
21
 
14
22
  if (typeof platform === 'boolean' && platform) {
15
23
  // await bp.buildPlatform({ platform: 'all', isTsProject });
@@ -21,6 +29,10 @@ export const build = async (config, modernConfig) => {
21
29
  return;
22
30
  }
23
31
 
32
+ if (clear) {
33
+ fs.removeSync(path.join(appDirectory, outputPath));
34
+ }
35
+
24
36
  if (enableWatchMode) {
25
37
  await buildWatchFeature.buildInWatchMode(config, modernConfig);
26
38
  } else {
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-classes-per-file */
2
1
  import * as path from 'path';
3
2
  import * as os from 'os';
4
3
  import { Import, chalk } from '@modern-js/utils';
@@ -189,6 +188,4 @@ export class TimeCounter {
189
188
  }
190
189
 
191
190
  }
192
- /* eslint-enable max-classes-per-file */
193
-
194
191
  TimeCounter._now = void 0;
@@ -1,4 +1,4 @@
1
- import { Import, upath } from '@modern-js/utils';
1
+ import { Import } from '@modern-js/utils';
2
2
  const core = Import.lazy('@modern-js/core', require); // const { createPlugin, usePlugins, defineConfig } = core;
3
3
 
4
4
  const hooks = Import.lazy('@modern-js/module-tools-hooks', require);
@@ -9,7 +9,7 @@ const lang = Import.lazy('./utils/language', require);
9
9
  export const {
10
10
  defineConfig
11
11
  } = core;
12
- core.usePlugins([upath.normalizeSafe(require.resolve('@modern-js/plugin-changeset/cli')), upath.normalizeSafe(require.resolve('@modern-js/plugin-analyze/cli'))]);
12
+ core.usePlugins([require.resolve('@modern-js/plugin-changeset/cli'), require.resolve('@modern-js/plugin-analyze/cli')]);
13
13
  export default core.createPlugin(() => {
14
14
  const locale = lang.getLocaleLanguage();
15
15
  local.i18n.changeLanguage({
@@ -74,20 +74,17 @@ const taskMain = async ({
74
74
  } = appContext;
75
75
  const lessOption = await core.mountHook().moduleLessConfig({
76
76
  modernConfig
77
- }, // eslint-disable-next-line @typescript-eslint/require-await
78
- {
77
+ }, {
79
78
  onLast: async _ => undefined
80
79
  });
81
80
  const sassOption = await core.mountHook().moduleSassConfig({
82
81
  modernConfig
83
- }, // eslint-disable-next-line @typescript-eslint/require-await
84
- {
82
+ }, {
85
83
  onLast: async _ => undefined
86
84
  });
87
85
  const tailwindPlugin = await core.mountHook().moduleTailwindConfig({
88
86
  modernConfig
89
- }, // eslint-disable-next-line @typescript-eslint/require-await
90
- {
87
+ }, {
91
88
  onLast: async _ => undefined
92
89
  });
93
90
  const postcssOption = getPostcssOption(appDirectory, modernConfig);
@@ -77,15 +77,9 @@ const taskMain = async ({
77
77
  appDirectory
78
78
  } = appContext;
79
79
  const lessOption = await core.mountHook().moduleLessConfig({
80
- modernConfig
81
- }, // eslint-disable-next-line @typescript-eslint/require-await
82
- {
83
80
  onLast: async _ => null
84
81
  });
85
82
  const sassOption = await core.mountHook().moduleSassConfig({
86
- modernConfig
87
- }, // eslint-disable-next-line @typescript-eslint/require-await
88
- {
89
83
  onLast: async _ => null
90
84
  });
91
85
  const postcssOption = getPostcssOption(appDirectory, modernConfig);
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-classes-per-file */
2
1
  import EventEmitter from 'events';
3
2
  import { Import } from '@modern-js/utils';
4
3
  const chalk = Import.lazy('chalk', require);
@@ -106,5 +105,4 @@ export class LoggerManager extends EventEmitter {
106
105
  console.info(loggerText.value);
107
106
  }
108
107
 
109
- }
110
- /* eslint-enable max-classes-per-file */
108
+ }
@@ -34,11 +34,6 @@ const build = async ({
34
34
  appDirectory
35
35
  } = core.useAppContext();
36
36
  const modernConfig = core.useResolvedConfigContext();
37
- const {
38
- output: {
39
- path: outputPath = 'dist'
40
- }
41
- } = modernConfig;
42
37
  const tsconfigPath = path.join(appDirectory, tsconfigName);
43
38
  dotenv.config();
44
39
  const isTsProject = tsConfigutils.existTsConfigFile(tsconfigPath);
@@ -46,20 +41,17 @@ const build = async ({
46
41
  valid.valideBeforeTask({
47
42
  modernConfig,
48
43
  tsconfigPath
49
- });
50
-
51
- if (_clear) {
52
- _utils.fs.removeSync(path.join(appDirectory, outputPath));
53
- } // TODO: 一些配置只需要从modernConfig中获取
54
-
44
+ }); // TODO: 一些配置只需要从modernConfig中获取
55
45
 
56
46
  await buildFeature.build({
47
+ appDirectory,
57
48
  enableWatchMode: _watch,
58
49
  isTsProject,
59
50
  platform,
60
51
  sourceDir: 'src',
61
52
  tsconfigName,
62
- enableTscCompiler
53
+ enableTscCompiler,
54
+ clear: _clear
63
55
  }, modernConfig);
64
56
  process.on('SIGBREAK', () => {
65
57
  console.info('exit');
@@ -5,8 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.build = void 0;
7
7
 
8
+ var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _utils = require("@modern-js/utils");
9
11
 
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  const buildFeature = _utils.Import.lazy('./build', require);
11
15
 
12
16
  const buildWatchFeature = _utils.Import.lazy('./build-watch', require); // const bp: typeof import('./build-platform') = Import.lazy(
@@ -17,9 +21,16 @@ const buildWatchFeature = _utils.Import.lazy('./build-watch', require); // const
17
21
 
18
22
  const build = async (config, modernConfig) => {
19
23
  const {
24
+ appDirectory,
20
25
  enableWatchMode,
21
- platform
22
- } = config; // TODO: maybe need watch mode in build platform
26
+ platform,
27
+ clear = true
28
+ } = config;
29
+ const {
30
+ output: {
31
+ path: outputPath = 'dist'
32
+ }
33
+ } = modernConfig; // TODO: maybe need watch mode in build platform
23
34
 
24
35
  if (typeof platform === 'boolean' && platform) {
25
36
  // await bp.buildPlatform({ platform: 'all', isTsProject });
@@ -31,6 +42,10 @@ const build = async (config, modernConfig) => {
31
42
  return;
32
43
  }
33
44
 
45
+ if (clear) {
46
+ _utils.fs.removeSync(_path.default.join(appDirectory, outputPath));
47
+ }
48
+
34
49
  if (enableWatchMode) {
35
50
  await buildWatchFeature.buildInWatchMode(config, modernConfig);
36
51
  } else {
@@ -15,7 +15,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
15
15
 
16
16
  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; }
17
17
 
18
- /* eslint-disable max-classes-per-file */
19
18
  const constants = _utils.Import.lazy('./constants', require);
20
19
 
21
20
  const core = _utils.Import.lazy('@modern-js/core', require); // 硬解字符串返回相应格式的对象
@@ -220,8 +219,6 @@ class TimeCounter {
220
219
  }
221
220
 
222
221
  }
223
- /* eslint-enable max-classes-per-file */
224
-
225
222
 
226
223
  exports.TimeCounter = TimeCounter;
227
224
  TimeCounter._now = void 0;
@@ -24,7 +24,7 @@ const {
24
24
  defineConfig
25
25
  } = core;
26
26
  exports.defineConfig = defineConfig;
27
- core.usePlugins([_utils.upath.normalizeSafe(require.resolve('@modern-js/plugin-changeset/cli')), _utils.upath.normalizeSafe(require.resolve('@modern-js/plugin-analyze/cli'))]);
27
+ core.usePlugins([require.resolve('@modern-js/plugin-changeset/cli'), require.resolve('@modern-js/plugin-analyze/cli')]);
28
28
 
29
29
  var _default = core.createPlugin(() => {
30
30
  const locale = lang.getLocaleLanguage();
@@ -90,20 +90,17 @@ const taskMain = async ({
90
90
  } = appContext;
91
91
  const lessOption = await core.mountHook().moduleLessConfig({
92
92
  modernConfig
93
- }, // eslint-disable-next-line @typescript-eslint/require-await
94
- {
93
+ }, {
95
94
  onLast: async _ => undefined
96
95
  });
97
96
  const sassOption = await core.mountHook().moduleSassConfig({
98
97
  modernConfig
99
- }, // eslint-disable-next-line @typescript-eslint/require-await
100
- {
98
+ }, {
101
99
  onLast: async _ => undefined
102
100
  });
103
101
  const tailwindPlugin = await core.mountHook().moduleTailwindConfig({
104
102
  modernConfig
105
- }, // eslint-disable-next-line @typescript-eslint/require-await
106
- {
103
+ }, {
107
104
  onLast: async _ => undefined
108
105
  });
109
106
  const postcssOption = getPostcssOption(appDirectory, modernConfig);
@@ -93,15 +93,9 @@ const taskMain = async ({
93
93
  appDirectory
94
94
  } = appContext;
95
95
  const lessOption = await core.mountHook().moduleLessConfig({
96
- modernConfig
97
- }, // eslint-disable-next-line @typescript-eslint/require-await
98
- {
99
96
  onLast: async _ => null
100
97
  });
101
98
  const sassOption = await core.mountHook().moduleSassConfig({
102
- modernConfig
103
- }, // eslint-disable-next-line @typescript-eslint/require-await
104
- {
105
99
  onLast: async _ => null
106
100
  });
107
101
  const postcssOption = getPostcssOption(appDirectory, modernConfig);
@@ -11,7 +11,6 @@ var _utils = require("@modern-js/utils");
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
- /* eslint-disable max-classes-per-file */
15
14
  const chalk = _utils.Import.lazy('chalk', require);
16
15
 
17
16
  const clearFlag = '\x1Bc';
@@ -127,7 +126,5 @@ class LoggerManager extends _events.default {
127
126
  }
128
127
 
129
128
  }
130
- /* eslint-enable max-classes-per-file */
131
-
132
129
 
133
130
  exports.LoggerManager = LoggerManager;
@@ -18,12 +18,14 @@ export interface IPackageFields {
18
18
  module?: JsSyntaxType;
19
19
  }
20
20
  export interface IBuildConfig {
21
+ appDirectory: string;
21
22
  platform: boolean | Exclude<Platform, 'all'>;
22
23
  enableTscCompiler: boolean;
23
24
  enableWatchMode?: boolean;
24
25
  isTsProject: boolean;
25
26
  sourceDir: string;
26
27
  tsconfigName?: string;
28
+ clear?: boolean;
27
29
  }
28
30
  export interface IPackageModeValue {
29
31
  type: 'module' | 'commonjs';
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.0.0",
14
+ "version": "1.1.1",
15
15
  "bin": {
16
16
  "modern": "./bin/modern.js"
17
17
  },
@@ -44,19 +44,19 @@
44
44
  "@babel/runtime": "^7",
45
45
  "@babel/traverse": "^7.15.0",
46
46
  "@babel/types": "^7.15.0",
47
- "@modern-js/babel-compiler": "^1.0.0",
48
- "@modern-js/babel-preset-module": "^1.0.0",
49
- "@modern-js/core": "^1.0.0",
50
- "@modern-js/css-config": "^1.0.0",
51
- "@modern-js/i18n-cli-language-detector": "^1.0.0",
52
- "@modern-js/module-tools-hooks": "^1.0.0",
53
- "@modern-js/new-action": "^1.0.0",
54
- "@modern-js/plugin-analyze": "^1.0.0",
55
- "@modern-js/plugin-changeset": "^1.0.0",
56
- "@modern-js/plugin-fast-refresh": "^1.0.0",
57
- "@modern-js/plugin-i18n": "^1.0.0",
58
- "@modern-js/style-compiler": "^1.0.0",
59
- "@modern-js/utils": "^1.0.0",
47
+ "@modern-js/babel-compiler": "^1.1.2",
48
+ "@modern-js/babel-preset-module": "^1.1.1",
49
+ "@modern-js/core": "^1.1.2",
50
+ "@modern-js/css-config": "^1.1.1",
51
+ "@modern-js/i18n-cli-language-detector": "^1.1.1",
52
+ "@modern-js/module-tools-hooks": "^1.1.1",
53
+ "@modern-js/new-action": "^1.1.2",
54
+ "@modern-js/plugin-analyze": "^1.1.1",
55
+ "@modern-js/plugin-changeset": "^1.1.1",
56
+ "@modern-js/plugin-fast-refresh": "^1.1.1",
57
+ "@modern-js/plugin-i18n": "^1.1.1",
58
+ "@modern-js/style-compiler": "^1.1.1",
59
+ "@modern-js/utils": "^1.1.2",
60
60
  "chalk": "^4.1.2",
61
61
  "chokidar": "^3.5.2",
62
62
  "dotenv": "^10.0.0",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "devDependencies": {
77
77
  "@babel/preset-typescript": "^7.15.0",
78
- "@modern-js/babel-chain": "^1.0.0",
78
+ "@modern-js/babel-chain": "^1.1.1",
79
79
  "@types/babel__core": "^7.1.15",
80
80
  "@types/babel__generator": "^7.6.3",
81
81
  "@types/babel__traverse": "^7.14.2",
@@ -88,8 +88,8 @@
88
88
  "@types/signale": "^1.4.2",
89
89
  "commander": "^8.1.0",
90
90
  "typescript": "^4",
91
- "@modern-js/plugin-testing": "^1.0.0",
92
- "@modern-js/module-tools": "^1.0.0"
91
+ "@modern-js/plugin-testing": "^1.1.0",
92
+ "@modern-js/module-tools": "^1.1.0"
93
93
  },
94
94
  "sideEffects": false,
95
95
  "modernConfig": {
@@ -39,9 +39,6 @@ export const build = async ({
39
39
  }: IBuildOption) => {
40
40
  const { appDirectory } = core.useAppContext();
41
41
  const modernConfig = core.useResolvedConfigContext();
42
- const {
43
- output: { path: outputPath = 'dist' },
44
- } = modernConfig;
45
42
  const tsconfigPath = path.join(appDirectory, tsconfigName);
46
43
  dotenv.config();
47
44
  const isTsProject = tsConfigutils.existTsConfigFile(tsconfigPath);
@@ -49,19 +46,17 @@ export const build = async ({
49
46
 
50
47
  valid.valideBeforeTask({ modernConfig, tsconfigPath });
51
48
 
52
- if (clear) {
53
- fs.removeSync(path.join(appDirectory, outputPath));
54
- }
55
-
56
49
  // TODO: 一些配置只需要从modernConfig中获取
57
50
  await buildFeature.build(
58
51
  {
52
+ appDirectory,
59
53
  enableWatchMode: watch,
60
54
  isTsProject,
61
55
  platform,
62
56
  sourceDir: 'src',
63
57
  tsconfigName,
64
58
  enableTscCompiler,
59
+ clear,
65
60
  },
66
61
  modernConfig,
67
62
  );
@@ -1,4 +1,5 @@
1
- import { Import } from '@modern-js/utils';
1
+ import path from 'path';
2
+ import { Import, fs } from '@modern-js/utils';
2
3
  import type { NormalizedConfig } from '@modern-js/core';
3
4
  import type { IBuildConfig } from '../../types';
4
5
 
@@ -16,7 +17,10 @@ export const build = async (
16
17
  config: IBuildConfig,
17
18
  modernConfig: NormalizedConfig,
18
19
  ) => {
19
- const { enableWatchMode, platform } = config;
20
+ const { appDirectory, enableWatchMode, platform, clear = true } = config;
21
+ const {
22
+ output: { path: outputPath = 'dist' },
23
+ } = modernConfig;
20
24
  // TODO: maybe need watch mode in build platform
21
25
  if (typeof platform === 'boolean' && platform) {
22
26
  // await bp.buildPlatform({ platform: 'all', isTsProject });
@@ -28,6 +32,10 @@ export const build = async (
28
32
  return;
29
33
  }
30
34
 
35
+ if (clear) {
36
+ fs.removeSync(path.join(appDirectory, outputPath));
37
+ }
38
+
31
39
  if (enableWatchMode) {
32
40
  await buildWatchFeature.buildInWatchMode(config, modernConfig);
33
41
  } else {
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-classes-per-file */
2
1
  import * as path from 'path';
3
2
  import * as os from 'os';
4
3
  import { Import, chalk } from '@modern-js/utils';
@@ -234,5 +233,3 @@ export class TimeCounter {
234
233
  return span < 1000 ? `${span}ms` : `${(span / 1000).toFixed(2)}s`;
235
234
  }
236
235
  }
237
-
238
- /* eslint-enable max-classes-per-file */
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Import, upath } from '@modern-js/utils';
1
+ import { Import } from '@modern-js/utils';
2
2
 
3
3
  const core: typeof import('@modern-js/core') = Import.lazy(
4
4
  '@modern-js/core',
@@ -20,8 +20,8 @@ const lang: typeof import('./utils/language') = Import.lazy(
20
20
  export const { defineConfig } = core;
21
21
 
22
22
  core.usePlugins([
23
- upath.normalizeSafe(require.resolve('@modern-js/plugin-changeset/cli')),
24
- upath.normalizeSafe(require.resolve('@modern-js/plugin-analyze/cli')),
23
+ require.resolve('@modern-js/plugin-changeset/cli'),
24
+ require.resolve('@modern-js/plugin-analyze/cli'),
25
25
  ]);
26
26
 
27
27
  export default core.createPlugin(
@@ -97,21 +97,24 @@ const taskMain = async ({
97
97
  } = modernConfig.output as ModuleToolsOutput;
98
98
  const { appDirectory } = appContext;
99
99
 
100
- const lessOption = await core.mountHook().moduleLessConfig(
101
- { modernConfig },
102
- // eslint-disable-next-line @typescript-eslint/require-await
103
- { onLast: async (_: any) => undefined },
104
- );
105
- const sassOption = await core.mountHook().moduleSassConfig(
106
- { modernConfig },
107
- // eslint-disable-next-line @typescript-eslint/require-await
108
- { onLast: async (_: any) => undefined },
109
- );
110
- const tailwindPlugin = await core.mountHook().moduleTailwindConfig(
111
- { modernConfig },
112
- // eslint-disable-next-line @typescript-eslint/require-await
113
- { onLast: async (_: any) => undefined },
114
- );
100
+ const lessOption = await core
101
+ .mountHook()
102
+ .moduleLessConfig(
103
+ { modernConfig },
104
+ { onLast: async (_: any) => undefined },
105
+ );
106
+ const sassOption = await core
107
+ .mountHook()
108
+ .moduleSassConfig(
109
+ { modernConfig },
110
+ { onLast: async (_: any) => undefined },
111
+ );
112
+ const tailwindPlugin = await core
113
+ .mountHook()
114
+ .moduleTailwindConfig(
115
+ { modernConfig },
116
+ { onLast: async (_: any) => undefined },
117
+ );
115
118
  const postcssOption = getPostcssOption(appDirectory, modernConfig);
116
119
  if (tailwindPlugin) {
117
120
  postcssOption.plugins?.push(tailwindPlugin);
@@ -107,14 +107,12 @@ const taskMain = async ({
107
107
  } = modernConfig.output as ModuleToolsOutput;
108
108
  const { appDirectory } = appContext;
109
109
 
110
- const lessOption = await (core.mountHook() as any).moduleLessConfig(
111
- { modernConfig }, // eslint-disable-next-line @typescript-eslint/require-await
112
- { onLast: async (_: any) => null as any },
113
- );
114
- const sassOption = await (core.mountHook() as any).moduleSassConfig(
115
- { modernConfig }, // eslint-disable-next-line @typescript-eslint/require-await
116
- { onLast: async (_: any) => null as any },
117
- );
110
+ const lessOption = await (core.mountHook() as any).moduleLessConfig({
111
+ onLast: async (_: any) => null as any,
112
+ });
113
+ const sassOption = await (core.mountHook() as any).moduleSassConfig({
114
+ onLast: async (_: any) => null as any,
115
+ });
118
116
  const postcssOption = getPostcssOption(appDirectory, modernConfig);
119
117
  const existStylesDir = checkStylesDirExist({ appDirectory });
120
118
  const compilerMessage = {
package/src/types.ts CHANGED
@@ -29,12 +29,14 @@ export interface IPackageFields {
29
29
  }
30
30
 
31
31
  export interface IBuildConfig {
32
+ appDirectory: string;
32
33
  platform: boolean | Exclude<Platform, 'all'>;
33
34
  enableTscCompiler: boolean;
34
35
  enableWatchMode?: boolean;
35
36
  isTsProject: boolean;
36
37
  sourceDir: string;
37
38
  tsconfigName?: string;
39
+ clear?: boolean;
38
40
  }
39
41
 
40
42
  export interface IPackageModeValue {
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-classes-per-file */
2
1
  import type { ChildProcess } from 'child_process';
3
2
  import EventEmitter from 'events';
4
3
  import { Import } from '@modern-js/utils';
@@ -140,5 +139,3 @@ export class LoggerManager extends EventEmitter {
140
139
  console.info(loggerText.value);
141
140
  }
142
141
  }
143
-
144
- /* eslint-enable max-classes-per-file */