@modern-js/core 2.0.0-beta.3 → 2.0.0-beta.6

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,198 @@
1
1
  # @modern-js/core
2
2
 
3
+ ## 2.0.0-beta.6
4
+
5
+ ### Major Changes
6
+
7
+ - dda38c9c3e: chore: v2
8
+
9
+ ### Minor Changes
10
+
11
+ - c9e800d39a: feat: support React18 streaming SSR
12
+ feat: 支持 React18 流式 SSR
13
+ - 92f0eade39: feat:
14
+
15
+ 1. core: 增加 test 函数
16
+ 2. module plugins: 增加 `babel`, `mainField`, `target` 插件
17
+ 3. storybook: 修改部分逻辑并且增加 tspath webpack 插件
18
+ 4. 增加 designSystem 配置
19
+
20
+ feat:
21
+
22
+ 1. core: add test method
23
+ 2. module plugins: add `babel`, `mainField`, `target` plugin
24
+ 3. storybook: change some logic and add tspath webpack plugin
25
+ 4. add `designSystem` config
26
+
27
+ - edd1cfb1af: feat: modernjs Access builder compiler
28
+ feat: modernjs 接入 builder 构建
29
+ - d5a31df781: refactor: remove unbundle configs and types
30
+
31
+ refactor: 移除 unbundle 相关的配置项和类型定义
32
+
33
+ - b8494ef33b: feat: remove use plugin types restrict
34
+ feat: 移除使用 plugin 类型限制
35
+ - e4558a0bc4: feat:
36
+
37
+ 1. add `runBin` function
38
+ 2. config internal plugins constants in the app/module/doc tools
39
+ 3. add app/module/doc tools internal plugins
40
+
41
+ feat:
42
+
43
+ 1. 添加 `runBin` 函数
44
+ 2. 在 app/module/doc tools 里配置内部插件
45
+ 3. 增加 app/module/doc tools 使用的插件常量
46
+
47
+ ### Patch Changes
48
+
49
+ - 85edee888c: feat(app-tools): support tools.htmlPlugin config
50
+
51
+ feat(app-tools): 支持 tools.htmlPlugin 配置项
52
+
53
+ - b8bbe036c7: feat: change type logic
54
+ feat: 修改类型相关的逻辑
55
+ - 8b8e1bb571: feat: support nested routes
56
+ feat: 支持嵌套路由
57
+ - 3bbea92b2a: feat: support Hook、Middleware new API
58
+ feat: 支持 Hook、Middleware 的新 API
59
+ - b7a96c35fc: fix(app-tools): loose CLI init options after restart
60
+
61
+ fix(app-tools): 修复重启 CLI 后丢失 init options 的问题
62
+
63
+ - cce8ecee2d: fix: handle some `TODO` & `FIXME`, change some tests
64
+ fix: 处理一些 `TODO` 和 `FIXME`, 修改了一些 tests
65
+ - ea7cf06257: chore: bump webpack/babel-loader/postcss-loader/tsconfig-paths
66
+
67
+ chore: 升级 webpack/babel-loader/postcss-loader/tsconfig-paths 版本
68
+
69
+ - 14b712da84: fix: use consistent alias type and default value across packages
70
+
71
+ fix: 在各个包中使用一致的 alias 类型定义和默认值
72
+
73
+ - Updated dependencies [7879e8f711]
74
+ - Updated dependencies [6aca875011]
75
+ - Updated dependencies [2e6031955e]
76
+ - Updated dependencies [a2509bfbdb]
77
+ - Updated dependencies [7b7d12cf8f]
78
+ - Updated dependencies [7efeed4]
79
+ - Updated dependencies [92f0eade39]
80
+ - Updated dependencies [edd1cfb1af]
81
+ - Updated dependencies [cc971eabfc]
82
+ - Updated dependencies [5b9049f2e9]
83
+ - Updated dependencies [92004d1906]
84
+ - Updated dependencies [b8bbe036c7]
85
+ - Updated dependencies [d5a31df781]
86
+ - Updated dependencies [dda38c9c3e]
87
+ - Updated dependencies [3bbea92b2a]
88
+ - Updated dependencies [b710adb843]
89
+ - Updated dependencies [f179749375]
90
+ - Updated dependencies [ea7cf06257]
91
+ - Updated dependencies [bbe4c4ab64]
92
+ - Updated dependencies [e4558a0bc4]
93
+ - Updated dependencies [abf3421a75]
94
+ - Updated dependencies [543be9558e]
95
+ - Updated dependencies [14b712da84]
96
+ - @modern-js/utils@2.0.0-beta.6
97
+ - @modern-js/node-bundle-require@2.0.0-beta.6
98
+ - @modern-js/plugin@2.0.0-beta.6
99
+
100
+ ## 2.0.0-beta.4
101
+
102
+ ### Major Changes
103
+
104
+ - dda38c9c3e: chore: v2
105
+
106
+ ### Minor Changes
107
+
108
+ - c9e800d39a: feat: support React18 streaming SSR
109
+ feat: 支持 React18 流式 SSR
110
+ - 92f0eade39: feat:
111
+
112
+ 1. core: 增加 test 函数
113
+ 2. module plugins: 增加 `babel`, `mainField`, `target` 插件
114
+ 3. storybook: 修改部分逻辑并且增加 tspath webpack 插件
115
+ 4. 增加 designSystem 配置
116
+
117
+ feat:
118
+
119
+ 1. core: add test method
120
+ 2. module plugins: add `babel`, `mainField`, `target` plugin
121
+ 3. storybook: change some logic and add tspath webpack plugin
122
+ 4. add `designSystem` config
123
+
124
+ - edd1cfb1af: feat: modernjs Access builder compiler
125
+ feat: modernjs 接入 builder 构建
126
+ - d5a31df781: refactor: remove unbundle configs and types
127
+
128
+ refactor: 移除 unbundle 相关的配置项和类型定义
129
+
130
+ - b8494ef: feat: remove use plugin types restrict
131
+ feat: 移除使用 plugin 类型限制
132
+ - e4558a0: feat:
133
+
134
+ 1. add `runBin` function
135
+ 2. config internal plugins constants in the app/module/doc tools
136
+ 3. add app/module/doc tools internal plugins
137
+
138
+ feat:
139
+
140
+ 1. 添加 `runBin` 函数
141
+ 2. 在 app/module/doc tools 里配置内部插件
142
+ 3. 增加 app/module/doc tools 使用的插件常量
143
+
144
+ ### Patch Changes
145
+
146
+ - 85edee888c: feat(app-tools): support tools.htmlPlugin config
147
+
148
+ feat(app-tools): 支持 tools.htmlPlugin 配置项
149
+
150
+ - b8bbe036c7: feat: change type logic
151
+ feat: 修改类型相关的逻辑
152
+ - 8b8e1bb571: feat: support nested routes
153
+ feat: 支持嵌套路由
154
+ - 3bbea92b2a: feat: support Hook、Middleware new API
155
+ feat: 支持 Hook、Middleware 的新 API
156
+ - b7a96c35fc: fix(app-tools): loose CLI init options after restart
157
+
158
+ fix(app-tools): 修复重启 CLI 后丢失 init options 的问题
159
+
160
+ - cce8ecee2d: fix: handle some `TODO` & `FIXME`, change some tests
161
+ fix: 处理一些 `TODO` 和 `FIXME`, 修改了一些 tests
162
+ - ea7cf06: chore: bump webpack/babel-loader/postcss-loader/tsconfig-paths
163
+
164
+ chore: 升级 webpack/babel-loader/postcss-loader/tsconfig-paths 版本
165
+
166
+ - 14b712da84: fix: use consistent alias type and default value across packages
167
+
168
+ fix: 在各个包中使用一致的 alias 类型定义和默认值
169
+
170
+ - Updated dependencies [7879e8f]
171
+ - Updated dependencies [6aca875]
172
+ - Updated dependencies [2e6031955e]
173
+ - Updated dependencies [a2509bfbdb]
174
+ - Updated dependencies [7b7d12c]
175
+ - Updated dependencies [92f0eade39]
176
+ - Updated dependencies [edd1cfb1af]
177
+ - Updated dependencies [cc971eabfc]
178
+ - Updated dependencies [5b9049f2e9]
179
+ - Updated dependencies [92004d1906]
180
+ - Updated dependencies [b8bbe036c7]
181
+ - Updated dependencies [d5a31df781]
182
+ - Updated dependencies [dda38c9c3e]
183
+ - Updated dependencies [3bbea92b2a]
184
+ - Updated dependencies [b710adb843]
185
+ - Updated dependencies [f179749375]
186
+ - Updated dependencies [ea7cf06]
187
+ - Updated dependencies [bbe4c4a]
188
+ - Updated dependencies [e4558a0]
189
+ - Updated dependencies [abf3421a75]
190
+ - Updated dependencies [543be9558e]
191
+ - Updated dependencies [14b712da84]
192
+ - @modern-js/utils@2.0.0-beta.4
193
+ - @modern-js/node-bundle-require@2.0.0-beta.4
194
+ - @modern-js/plugin@2.0.0-beta.4
195
+
3
196
  ## 2.0.0-beta.3
4
197
 
5
198
  ### Major Changes
package/dist/bin.js CHANGED
@@ -1,38 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const utils_1 = require("@modern-js/utils");
5
- const _1 = require(".");
6
- const command = process.argv[2];
7
- if (!process.env.NODE_ENV) {
8
- if (['build', 'start', 'deploy', 'release'].includes(command)) {
9
- process.env.NODE_ENV = 'production';
10
- }
11
- else if (command === 'test') {
12
- process.env.NODE_ENV = 'test';
13
- }
14
- else {
15
- process.env.NODE_ENV = 'development';
16
- }
17
- }
18
- const { version } = require('../package.json');
19
- const cliParams = (0, utils_1.minimist)(process.argv.slice(2));
20
- const runOptions = {
21
- version,
22
- };
23
- /**
24
- * Commands that support specify config files
25
- * Some commands can't support this feature, such as `new`
26
- */
27
- const SUPPORT_CONFIG_PARAM_COMMANDS = [
28
- 'dev',
29
- 'build',
30
- 'deploy',
31
- 'start',
32
- 'inspect',
33
- ];
34
- const customConfigFile = cliParams.config || cliParams.c;
35
- if (SUPPORT_CONFIG_PARAM_COMMANDS.includes(command) && customConfigFile) {
36
- runOptions.configFile = customConfigFile;
37
- }
38
- _1.cli.run(runOptions);
4
+ const runBin_1 = require("./runBin");
5
+ (0, runBin_1.run)();
@@ -0,0 +1,2 @@
1
+ import { UserConfig } from '../types';
2
+ export declare function createDefaultConfig(): UserConfig;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDefaultConfig = void 0;
4
+ function createDefaultConfig() {
5
+ return {
6
+ autoLoadPlugins: false,
7
+ };
8
+ }
9
+ exports.createDefaultConfig = createDefaultConfig;
@@ -29,6 +29,7 @@ const constants_1 = require("@modern-js/utils/constants");
29
29
  const patchSchema_1 = require("../schema/patchSchema");
30
30
  const repeatKeyWarning_1 = require("../utils/repeatKeyWarning");
31
31
  const mergeConfig_1 = require("../utils/mergeConfig");
32
+ const createDefaultConfig_1 = require("./createDefaultConfig");
32
33
  const debug = (0, utils_1.createDebugger)('resolve-config');
33
34
  const showAdditionalPropertiesError = async (error) => {
34
35
  if (error.keyword === 'additionalProperties' &&
@@ -84,7 +85,7 @@ loaded, configs, schemas, onSchemaError = showAdditionalPropertiesError) => {
84
85
  throw new Error(`Validate configuration error.`);
85
86
  }
86
87
  }
87
- const resolved = (0, mergeConfig_1.mergeConfig)([...configs, userConfig]);
88
+ const resolved = (0, mergeConfig_1.mergeConfig)([(0, createDefaultConfig_1.createDefaultConfig)(), ...configs, userConfig]);
88
89
  debug('resolved %o', resolved);
89
90
  return resolved;
90
91
  };
@@ -1,2 +1,3 @@
1
1
  export * from './createLoadedConfig';
2
2
  export * from './createResolvedConfig';
3
+ export * from './createDefaultConfig';
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./createLoadedConfig"), exports);
18
18
  __exportStar(require("./createResolvedConfig"), exports);
19
+ __exportStar(require("./createDefaultConfig"), exports);
package/dist/context.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CliPlugin, UserConfig, IAppContext, InternalPlugins, NormalizedConfig } from './types';
1
+ import type { CliPlugin, UserConfig, IAppContext, InternalPlugins, NormalizedConfig, ToolsType } from './types';
2
2
  export declare const AppContext: import("@modern-js/plugin").Context<IAppContext>;
3
3
  export declare const ConfigContext: import("@modern-js/plugin").Context<UserConfig<any, {}, {}, {}>>;
4
4
  export declare const ResolvedConfigContext: import("@modern-js/plugin").Context<NormalizedConfig<any, {}, {}, {}>>;
@@ -19,7 +19,7 @@ export declare const useConfigContext: <Extends extends Record<string, any>>() =
19
19
  * Get normalized content of user config.
20
20
  */
21
21
  export declare const useResolvedConfigContext: <Extends extends Record<string, any>>() => NormalizedConfig<Extends>;
22
- export declare const initAppContext: ({ appDirectory, plugins, configFile, options, serverConfigFile, serverInternalPlugins, }: {
22
+ export declare const initAppContext: ({ appDirectory, plugins, configFile, options, serverConfigFile, serverInternalPlugins, toolsType, }: {
23
23
  appDirectory: string;
24
24
  plugins: CliPlugin[];
25
25
  configFile: string | false;
@@ -31,4 +31,5 @@ export declare const initAppContext: ({ appDirectory, plugins, configFile, optio
31
31
  } | undefined;
32
32
  serverConfigFile: string;
33
33
  serverInternalPlugins: InternalPlugins;
34
+ toolsType?: ToolsType | undefined;
34
35
  }) => IAppContext;
package/dist/context.js CHANGED
@@ -31,7 +31,7 @@ exports.useConfigContext = useConfigContext;
31
31
  */
32
32
  const useResolvedConfigContext = () => exports.ResolvedConfigContext.use().value;
33
33
  exports.useResolvedConfigContext = useResolvedConfigContext;
34
- const initAppContext = ({ appDirectory, plugins, configFile, options, serverConfigFile, serverInternalPlugins, }) => {
34
+ const initAppContext = ({ appDirectory, plugins, configFile, options, serverConfigFile, serverInternalPlugins, toolsType, }) => {
35
35
  const { metaName = 'modern-js', srcDir = 'src', distDir = '', sharedDir = 'shared', } = options || {};
36
36
  return {
37
37
  metaName,
@@ -55,6 +55,7 @@ const initAppContext = ({ appDirectory, plugins, configFile, options, serverConf
55
55
  apiOnly: false,
56
56
  internalDirAlias: `@_${metaName.replace(/-/g, '_')}_internal`,
57
57
  internalSrcAlias: `@_${metaName.replace(/-/g, '_')}_src`,
58
+ toolsType,
58
59
  };
59
60
  };
60
61
  exports.initAppContext = initAppContext;
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { ErrorObject } from '@modern-js/utils/ajv';
2
2
  import { InternalPlugins } from '@modern-js/types';
3
3
  import { TransformPlugin } from './loadPlugins';
4
4
  import { initAppContext } from './context';
5
+ import type { ToolsType } from './types';
5
6
  export * from './types';
6
7
  export * from '@modern-js/plugin';
7
8
  export { manager, mountHook, createPlugin, registerHook } from './manager';
@@ -16,6 +17,7 @@ export interface CoreOptions {
16
17
  internalPlugins?: {
17
18
  cli?: InternalPlugins;
18
19
  server?: InternalPlugins;
20
+ autoLoad?: InternalPlugins;
19
21
  };
20
22
  transformPlugin?: TransformPlugin;
21
23
  onSchemaError?: (error: ErrorObject) => void;
@@ -25,6 +27,9 @@ export interface CoreOptions {
25
27
  distDir?: string;
26
28
  sharedDir?: string;
27
29
  };
30
+ toolsType?: ToolsType;
31
+ /** force the modern-js core auto register plugin exist in the package.json */
32
+ forceAutoLoadPlugins?: boolean;
28
33
  }
29
34
  export declare const mergeOptions: (options?: CoreOptions) => {
30
35
  cwd?: string | undefined;
@@ -35,6 +40,7 @@ export declare const mergeOptions: (options?: CoreOptions) => {
35
40
  internalPlugins?: {
36
41
  cli?: InternalPlugins | undefined;
37
42
  server?: InternalPlugins | undefined;
43
+ autoLoad?: InternalPlugins | undefined;
38
44
  } | undefined;
39
45
  transformPlugin?: TransformPlugin | undefined;
40
46
  onSchemaError?: ((error: ErrorObject) => void) | undefined;
@@ -44,6 +50,8 @@ export declare const mergeOptions: (options?: CoreOptions) => {
44
50
  distDir?: string | undefined;
45
51
  sharedDir?: string | undefined;
46
52
  } | undefined;
53
+ toolsType?: ToolsType | undefined;
54
+ forceAutoLoadPlugins?: boolean | undefined;
47
55
  };
48
56
  export declare const cli: {
49
57
  init: (options?: CoreOptions) => Promise<{
package/dist/index.js CHANGED
@@ -71,7 +71,7 @@ const createCli = () => {
71
71
  let hooksRunner;
72
72
  let initOptions;
73
73
  const init = async (options) => {
74
- var _a, _b, _c, _d;
74
+ var _a, _b, _c, _d, _e;
75
75
  manager_1.manager.clear();
76
76
  const mergedOptions = (0, exports.mergeOptions)(options);
77
77
  initOptions = mergedOptions;
@@ -84,15 +84,18 @@ const createCli = () => {
84
84
  const plugins = await (0, loadPlugins_1.loadPlugins)(appDirectory, loaded.config, {
85
85
  internalPlugins: (_c = mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.internalPlugins) === null || _c === void 0 ? void 0 : _c.cli,
86
86
  transformPlugin: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.transformPlugin,
87
+ autoLoad: (_d = mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.internalPlugins) === null || _d === void 0 ? void 0 : _d.autoLoad,
88
+ forceAutoLoadPlugins: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.forceAutoLoadPlugins,
87
89
  });
88
90
  plugins.forEach(plugin => plugin && manager_1.manager.usePlugin(plugin));
89
91
  const appContext = (0, context_1.initAppContext)({
92
+ toolsType: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.toolsType,
90
93
  appDirectory,
91
94
  plugins,
92
95
  configFile: loaded.filePath,
93
96
  options: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.options,
94
97
  serverConfigFile: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.serverConfigFile,
95
- serverInternalPlugins: ((_d = mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.internalPlugins) === null || _d === void 0 ? void 0 : _d.server) || utils_1.INTERNAL_SERVER_PLUGINS,
98
+ serverInternalPlugins: ((_e = mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.internalPlugins) === null || _e === void 0 ? void 0 : _e.server) || utils_1.INTERNAL_SERVER_PLUGINS,
96
99
  });
97
100
  context_1.ConfigContext.set(loaded.config);
98
101
  context_1.AppContext.set(appContext);
@@ -12,5 +12,7 @@ export declare const isOldPluginConfig: (config?: PluginConfig) => config is Old
12
12
  */
13
13
  export declare const loadPlugins: (appDirectory: string, userConfig: UserConfig, options?: {
14
14
  internalPlugins?: InternalPlugins;
15
+ autoLoad?: InternalPlugins;
15
16
  transformPlugin?: TransformPlugin;
17
+ forceAutoLoadPlugins?: boolean;
16
18
  }) => Promise<CliPlugin<{}, {}, {}, {}>[]>;
@@ -41,8 +41,13 @@ exports.isOldPluginConfig = isOldPluginConfig;
41
41
  const loadPlugins = async (appDirectory, userConfig, options = {}) => {
42
42
  const pluginConfig = userConfig.plugins;
43
43
  const plugins = [
44
- ...(0, utils_1.getInternalPlugins)(appDirectory, options.internalPlugins),
44
+ ...(options.forceAutoLoadPlugins || userConfig.autoLoadPlugins
45
+ ? (0, utils_1.getInternalPlugins)(appDirectory, options.internalPlugins)
46
+ : []),
45
47
  ...((0, exports.isOldPluginConfig)(pluginConfig) ? pluginConfig : []),
48
+ ...(options.autoLoad
49
+ ? (0, utils_1.getInternalPlugins)(appDirectory, options.autoLoad)
50
+ : []),
46
51
  ];
47
52
  const loadedPlugins = await Promise.all(plugins.map(plugin => {
48
53
  const loadedPlugin = resolveCliPlugin(plugin, userConfig, appDirectory, options.transformPlugin);
package/dist/manager.d.ts CHANGED
@@ -48,7 +48,7 @@ export declare const createPlugin: (setup?: import("@modern-js/plugin").AsyncSet
48
48
  }, void>;
49
49
  beforeExit: import("@modern-js/plugin").AsyncWorkflow<void, void>;
50
50
  addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
51
- }, BasePluginAPI<{}, {}, {}, {}>>, Record<string, unknown>, any, any> | undefined) => import("@modern-js/plugin").AsyncPlugin<{
51
+ }, BasePluginAPI<{}, {}, {}, {}>>, Record<string, unknown>> | undefined) => import("@modern-js/plugin").AsyncPlugin<{
52
52
  config: import("@modern-js/plugin").ParallelWorkflow<void, import("./types").UserConfig<{}, {}, {}, {}>>;
53
53
  resolvedConfig: import("@modern-js/plugin").AsyncWaterfall<{
54
54
  resolved: import("./types").NormalizedConfig<{}, {}, {}, {}>;
package/dist/runBin.js CHANGED
@@ -7,7 +7,7 @@ const _1 = require(".");
7
7
  const run = async (otherCoreOptions = {}, options = {}) => {
8
8
  const command = process.argv[2];
9
9
  if (!process.env.NODE_ENV) {
10
- if (['build', 'start', 'deploy', 'release'].includes(command)) {
10
+ if (['build', 'start', 'serve', 'deploy', 'release'].includes(command)) {
11
11
  process.env.NODE_ENV = 'production';
12
12
  }
13
13
  else if (command === 'test') {
@@ -31,6 +31,7 @@ const run = async (otherCoreOptions = {}, options = {}) => {
31
31
  'build',
32
32
  'deploy',
33
33
  'start',
34
+ 'serve',
34
35
  'inspect',
35
36
  ];
36
37
  const customConfigFile = cliParams.config || cliParams.c;
@@ -7,26 +7,34 @@ export declare type UserConfig<Extends extends {
7
7
  userConfig?: ExtendUserConfig;
8
8
  normalizedConfig?: ExtendNormalizedConfig;
9
9
  } = {}, ExtendHooks extends Record<string, any> = {}, ExtendUserConfig extends {
10
- source?: Record<string, any>;
11
- tools?: Record<string, any>;
12
10
  testing?: Record<string, any>;
13
11
  [property: string]: any;
14
12
  } = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = {
15
13
  testing?: BaseTestingUserConfig<DropUndefined<Extends['userConfig']>['testing']>;
16
- plugins?: PluginConfig<Extends>;
14
+ plugins?: PluginConfig<any>;
15
+ /**
16
+ * auto load plugin that exist in the package.json
17
+ *
18
+ * **default: `false`**
19
+ */
20
+ autoLoadPlugins?: boolean;
17
21
  } & Omit<Extends['userConfig'], 'plugins' | 'testing'>;
18
22
  export declare type NormalizedConfig<Extends extends {
19
23
  hooks?: ExtendHooks;
20
24
  userConfig?: ExtendUserConfig;
21
25
  normalizedConfig?: ExtendNormalizedConfig;
22
26
  } = {}, ExtendHooks extends Record<string, any> = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends {
23
- source?: Record<string, any>;
24
- tools?: Record<string, any>;
25
27
  testing?: Record<string, any>;
26
28
  [property: string]: any;
27
29
  } = {}> = {
28
- plugins: PluginConfig<Extends>;
30
+ plugins: PluginConfig<any>;
29
31
  testing: BaseTestingNormalizedConfig<DropUndefined<Extends['normalizedConfig']>['testing']>;
32
+ /**
33
+ * auto load plugin that exist in the package.json
34
+ *
35
+ * **default: `false`**
36
+ */
37
+ autoLoadPlugins: boolean;
30
38
  } & Omit<Extends['normalizedConfig'], 'plugins' | 'testing'>;
31
39
  export declare type LoadedConfig<Extends extends {
32
40
  hooks?: ExtendHooks;
@@ -1,5 +1,6 @@
1
1
  import { Entrypoint, InternalPlugins, ServerRoute, HtmlTemplates } from '@modern-js/types';
2
2
  import { BuilderInstance } from '@modern-js/builder-shared';
3
+ export declare type ToolsType = 'app-tools' | 'module-tools' | 'doc-tools' | 'monorepo-tools';
3
4
  export interface IAppContext {
4
5
  metaName: string;
5
6
  appDirectory: string;
@@ -9,6 +10,7 @@ export interface IAppContext {
9
10
  ip?: string;
10
11
  port?: number;
11
12
  distDirectory: string;
13
+ toolsType?: ToolsType;
12
14
  packageName: string;
13
15
  srcDirectory: string;
14
16
  sharedDirectory: string;
@@ -24,3 +24,21 @@ export declare type CliHooksRunner<Extends extends {
24
24
  normalizedConfig?: ExtendNormalizedConfig;
25
25
  } = {}, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = ToRunners<BaseHooks<Extends> & Extends['hooks']>;
26
26
  export declare type CliHookCallbacks = ToThreads<BaseHooks<{}>>;
27
+ export interface DevToolData<DevOptions = any> {
28
+ name: string;
29
+ subCommands?: string[];
30
+ menuItem?: {
31
+ name: string;
32
+ value: string;
33
+ };
34
+ disableRunBuild?: boolean;
35
+ action: (options: DevOptions, context: {
36
+ isTsProject?: boolean;
37
+ }) => void | Promise<void>;
38
+ }
39
+ export interface RegisterBuildPlatformResult {
40
+ platform: string | string[];
41
+ build: (currentPlatform: string, context: {
42
+ isTsProject: boolean;
43
+ }) => void | Promise<void>;
44
+ }
@@ -7,7 +7,7 @@ export declare type CliPlugin<Extends extends {
7
7
  hooks?: ExtendHooks;
8
8
  userConfig?: ExtendUserConfig;
9
9
  normalizedConfig?: ExtendNormalizedConfig;
10
- } = {}, ExtendHooks extends Record<string, any> = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = PluginOptions<BaseHooks<Extends>, AsyncSetup<BaseHooks<Extends> & Extends['hooks'], BasePluginAPI<Extends>>, Extends['hooks'], BaseHooks<Extends> | BaseHooks<{}>, AsyncSetup<BaseHooks<Extends> & Extends['hooks'], BasePluginAPI<Extends>> | AsyncSetup<BaseHooks<{}>, BasePluginAPI<{}>>>;
10
+ } = {}, ExtendHooks extends Record<string, any> = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = PluginOptions<BaseHooks<Extends>, AsyncSetup<BaseHooks<Extends> & Extends['hooks'], BasePluginAPI<Extends>>, Extends['hooks']>;
11
11
  export declare type PluginItem = string | [string, any];
12
12
  /**
13
13
  * @deprecated
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "modern",
11
11
  "modern.js"
12
12
  ],
13
- "version": "2.0.0-beta.3",
13
+ "version": "2.0.0-beta.6",
14
14
  "jsnext:source": "./src/index.ts",
15
15
  "types": "./dist/index.d.ts",
16
16
  "main": "./dist/index.js",
@@ -51,9 +51,9 @@
51
51
  }
52
52
  },
53
53
  "dependencies": {
54
- "@modern-js/node-bundle-require": "2.0.0-beta.3",
55
- "@modern-js/utils": "2.0.0-beta.3",
56
- "@modern-js/plugin": "2.0.0-beta.3"
54
+ "@modern-js/node-bundle-require": "2.0.0-beta.6",
55
+ "@modern-js/plugin": "2.0.0-beta.6",
56
+ "@modern-js/utils": "2.0.0-beta.6"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@jest/types": "^27.0.6",
@@ -72,11 +72,11 @@
72
72
  "terser-webpack-plugin": "^5.1.4",
73
73
  "typescript": "^4",
74
74
  "webpack": "^5.75.0",
75
- "@modern-js/builder-shared": "2.0.0-beta.3",
76
- "@modern-js/babel-preset-app": "2.0.0-beta.3",
77
- "@modern-js/types": "2.0.0-beta.3",
78
- "@scripts/build": "2.0.0-beta.3",
79
- "@scripts/jest-config": "2.0.0-beta.3"
75
+ "@modern-js/builder-shared": "2.0.0-beta.6",
76
+ "@modern-js/babel-preset-app": "2.0.0-beta.6",
77
+ "@modern-js/types": "2.0.0-beta.6",
78
+ "@scripts/build": "2.0.0-beta.6",
79
+ "@scripts/jest-config": "2.0.0-beta.6"
80
80
  },
81
81
  "sideEffects": false,
82
82
  "publishConfig": {