@modern-js/core 2.0.0-beta.3 → 2.0.0-beta.4
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 +96 -0
- package/dist/context.d.ts +3 -2
- package/dist/context.js +2 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/manager.d.ts +1 -1
- package/dist/types/config/index.d.ts +2 -6
- package/dist/types/context.d.ts +2 -0
- package/dist/types/hooks.d.ts +18 -0
- package/dist/types/plugin.d.ts +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,101 @@
|
|
|
1
1
|
# @modern-js/core
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.4
|
|
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
|
+
- b8494ef: feat: remove use plugin types restrict
|
|
34
|
+
feat: 移除使用 plugin 类型限制
|
|
35
|
+
- e4558a0: 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
|
+
- ea7cf06: 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 [7879e8f]
|
|
74
|
+
- Updated dependencies [6aca875]
|
|
75
|
+
- Updated dependencies [2e6031955e]
|
|
76
|
+
- Updated dependencies [a2509bfbdb]
|
|
77
|
+
- Updated dependencies [7b7d12c]
|
|
78
|
+
- Updated dependencies [92f0eade39]
|
|
79
|
+
- Updated dependencies [edd1cfb1af]
|
|
80
|
+
- Updated dependencies [cc971eabfc]
|
|
81
|
+
- Updated dependencies [5b9049f2e9]
|
|
82
|
+
- Updated dependencies [92004d1906]
|
|
83
|
+
- Updated dependencies [b8bbe036c7]
|
|
84
|
+
- Updated dependencies [d5a31df781]
|
|
85
|
+
- Updated dependencies [dda38c9c3e]
|
|
86
|
+
- Updated dependencies [3bbea92b2a]
|
|
87
|
+
- Updated dependencies [b710adb843]
|
|
88
|
+
- Updated dependencies [f179749375]
|
|
89
|
+
- Updated dependencies [ea7cf06]
|
|
90
|
+
- Updated dependencies [bbe4c4a]
|
|
91
|
+
- Updated dependencies [e4558a0]
|
|
92
|
+
- Updated dependencies [abf3421a75]
|
|
93
|
+
- Updated dependencies [543be9558e]
|
|
94
|
+
- Updated dependencies [14b712da84]
|
|
95
|
+
- @modern-js/utils@2.0.0-beta.4
|
|
96
|
+
- @modern-js/node-bundle-require@2.0.0-beta.4
|
|
97
|
+
- @modern-js/plugin@2.0.0-beta.4
|
|
98
|
+
|
|
3
99
|
## 2.0.0-beta.3
|
|
4
100
|
|
|
5
101
|
### Major Changes
|
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';
|
|
@@ -25,6 +26,7 @@ export interface CoreOptions {
|
|
|
25
26
|
distDir?: string;
|
|
26
27
|
sharedDir?: string;
|
|
27
28
|
};
|
|
29
|
+
toolsType?: ToolsType;
|
|
28
30
|
}
|
|
29
31
|
export declare const mergeOptions: (options?: CoreOptions) => {
|
|
30
32
|
cwd?: string | undefined;
|
|
@@ -44,6 +46,7 @@ export declare const mergeOptions: (options?: CoreOptions) => {
|
|
|
44
46
|
distDir?: string | undefined;
|
|
45
47
|
sharedDir?: string | undefined;
|
|
46
48
|
} | undefined;
|
|
49
|
+
toolsType?: ToolsType | undefined;
|
|
47
50
|
};
|
|
48
51
|
export declare const cli: {
|
|
49
52
|
init: (options?: CoreOptions) => Promise<{
|
package/dist/index.js
CHANGED
|
@@ -87,6 +87,7 @@ const createCli = () => {
|
|
|
87
87
|
});
|
|
88
88
|
plugins.forEach(plugin => plugin && manager_1.manager.usePlugin(plugin));
|
|
89
89
|
const appContext = (0, context_1.initAppContext)({
|
|
90
|
+
toolsType: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.toolsType,
|
|
90
91
|
appDirectory,
|
|
91
92
|
plugins,
|
|
92
93
|
configFile: loaded.filePath,
|
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
|
|
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<{}, {}, {}, {}>;
|
|
@@ -7,25 +7,21 @@ 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<
|
|
14
|
+
plugins?: PluginConfig<any>;
|
|
17
15
|
} & Omit<Extends['userConfig'], 'plugins' | 'testing'>;
|
|
18
16
|
export declare type NormalizedConfig<Extends extends {
|
|
19
17
|
hooks?: ExtendHooks;
|
|
20
18
|
userConfig?: ExtendUserConfig;
|
|
21
19
|
normalizedConfig?: ExtendNormalizedConfig;
|
|
22
20
|
} = {}, ExtendHooks extends Record<string, any> = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends {
|
|
23
|
-
source?: Record<string, any>;
|
|
24
|
-
tools?: Record<string, any>;
|
|
25
21
|
testing?: Record<string, any>;
|
|
26
22
|
[property: string]: any;
|
|
27
23
|
} = {}> = {
|
|
28
|
-
plugins: PluginConfig<
|
|
24
|
+
plugins: PluginConfig<any>;
|
|
29
25
|
testing: BaseTestingNormalizedConfig<DropUndefined<Extends['normalizedConfig']>['testing']>;
|
|
30
26
|
} & Omit<Extends['normalizedConfig'], 'plugins' | 'testing'>;
|
|
31
27
|
export declare type LoadedConfig<Extends extends {
|
package/dist/types/context.d.ts
CHANGED
|
@@ -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;
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -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']
|
|
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.
|
|
13
|
+
"version": "2.0.0-beta.4",
|
|
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.
|
|
55
|
-
"@modern-js/
|
|
56
|
-
"@modern-js/
|
|
54
|
+
"@modern-js/node-bundle-require": "2.0.0-beta.4",
|
|
55
|
+
"@modern-js/plugin": "2.0.0-beta.4",
|
|
56
|
+
"@modern-js/utils": "2.0.0-beta.4"
|
|
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.
|
|
76
|
-
"@modern-js/babel-preset-app": "2.0.0-beta.
|
|
77
|
-
"@modern-js/types": "2.0.0-beta.
|
|
78
|
-
"@scripts/build": "2.0.0-beta.
|
|
79
|
-
"@scripts/jest-config": "2.0.0-beta.
|
|
75
|
+
"@modern-js/builder-shared": "2.0.0-beta.4",
|
|
76
|
+
"@modern-js/babel-preset-app": "2.0.0-beta.4",
|
|
77
|
+
"@modern-js/types": "2.0.0-beta.4",
|
|
78
|
+
"@scripts/build": "2.0.0-beta.4",
|
|
79
|
+
"@scripts/jest-config": "2.0.0-beta.4"
|
|
80
80
|
},
|
|
81
81
|
"sideEffects": false,
|
|
82
82
|
"publishConfig": {
|