@modern-js/core 2.41.0 → 2.42.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/dist/bin.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ export {};
@@ -1,2 +1,2 @@
1
1
  import { UserConfig } from '../types';
2
- export declare function createDefaultConfig(): UserConfig;
2
+ export declare function createDefaultConfig(): UserConfig;
@@ -3,4 +3,4 @@ import { LoadedConfig, UserConfig } from '../types';
3
3
  * Assign the pkg config into the user config.
4
4
  */
5
5
  export declare const assignPkgConfig: (userConfig?: UserConfig, pkgConfig?: UserConfig) => UserConfig;
6
- export declare function createLoadedConfig(appDirectory: string, filePath?: string, packageJsonConfig?: string, loadedConfig?: UserConfig): Promise<LoadedConfig<{}>>;
6
+ export declare function createLoadedConfig(appDirectory: string, filePath?: string, packageJsonConfig?: string, loadedConfig?: UserConfig): Promise<LoadedConfig<{}>>;
@@ -1,2 +1,2 @@
1
1
  import type { UserConfig, NormalizedConfig, LoadedConfig } from '../types';
2
- export declare const createResolveConfig: (loaded: LoadedConfig<{}>, configs: UserConfig[]) => Promise<NormalizedConfig>;
2
+ export declare const createResolveConfig: (loaded: LoadedConfig<{}>, configs: UserConfig[]) => Promise<NormalizedConfig>;
@@ -1,4 +1,4 @@
1
1
  export * from './createLoadedConfig';
2
2
  export * from './createResolvedConfig';
3
3
  export * from './createDefaultConfig';
4
- export { loadConfig } from './loadConfig';
4
+ export { loadConfig } from './loadConfig';
@@ -28,8 +28,8 @@ export declare const getConfigFilePath: (appDirectory: string, filePath?: string
28
28
  * @returns Object contain config file path, user config object and dependency files used by config file.
29
29
  */
30
30
  export declare const loadConfig: <T>(appDirectory: string, configFile: string | false, packageJsonConfig?: string, loadedConfig?: T | undefined) => Promise<{
31
- path: string | false;
32
- config?: T | undefined;
33
- dependencies?: string[] | undefined;
34
- pkgConfig?: T | undefined;
35
- }>;
31
+ path: string | false;
32
+ config?: T | undefined;
33
+ dependencies?: string[] | undefined;
34
+ pkgConfig?: T | undefined;
35
+ }>;
package/dist/context.d.ts CHANGED
@@ -19,24 +19,17 @@ 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: ({
23
- appDirectory,
24
- plugins,
25
- configFile,
26
- options,
27
- serverConfigFile,
28
- serverInternalPlugins
29
- }: {
30
- appDirectory: string;
31
- plugins: CliPlugin[];
32
- configFile: string | false;
33
- options?: {
34
- metaName?: string | undefined;
35
- srcDir?: string | undefined;
36
- apiDir?: string | undefined;
37
- distDir?: string | undefined;
38
- sharedDir?: string | undefined;
39
- } | undefined;
40
- serverConfigFile: string;
41
- serverInternalPlugins: InternalPlugins;
42
- }) => IAppContext;
22
+ export declare const initAppContext: ({ appDirectory, plugins, configFile, options, serverConfigFile, serverInternalPlugins, }: {
23
+ appDirectory: string;
24
+ plugins: CliPlugin[];
25
+ configFile: string | false;
26
+ options?: {
27
+ metaName?: string | undefined;
28
+ srcDir?: string | undefined;
29
+ apiDir?: string | undefined;
30
+ distDir?: string | undefined;
31
+ sharedDir?: string | undefined;
32
+ } | undefined;
33
+ serverConfigFile: string;
34
+ serverInternalPlugins: InternalPlugins;
35
+ }) => IAppContext;
@@ -1,17 +1,17 @@
1
1
  import type { CoreOptions } from './types';
2
2
  export declare const mergeOptions: (options?: CoreOptions) => CoreOptions & {
3
- serverConfigFile: string;
3
+ serverConfigFile: string;
4
4
  };
5
5
  export declare const createCli: () => {
6
- init: (options?: CoreOptions) => Promise<{
7
- resolved: import("./types").NormalizedConfig<{}>;
8
- appContext: import("./types").IAppContext;
9
- }>;
10
- run: (options?: CoreOptions) => Promise<void>;
11
- test: (argv: string[], options?: {
12
- coreOptions?: CoreOptions;
13
- disableWatcher?: boolean;
14
- }) => Promise<void>;
15
- runCommand: (command: string, commandOptions?: string[], options?: CoreOptions) => Promise<void>;
16
- getPrevInitOptions: () => CoreOptions | undefined;
17
- };
6
+ init: (options?: CoreOptions) => Promise<{
7
+ resolved: import("./types").NormalizedConfig<{}>;
8
+ appContext: import("./types").IAppContext;
9
+ }>;
10
+ run: (options?: CoreOptions) => Promise<void>;
11
+ test: (argv: string[], options?: {
12
+ coreOptions?: CoreOptions;
13
+ disableWatcher?: boolean;
14
+ }) => Promise<void>;
15
+ runCommand: (command: string, commandOptions?: string[], options?: CoreOptions) => Promise<void>;
16
+ getPrevInitOptions: () => CoreOptions | undefined;
17
+ };
package/dist/index.d.ts CHANGED
@@ -4,22 +4,22 @@ export * from '@modern-js/plugin';
4
4
  export { loadConfig } from './config';
5
5
  export { mergeConfig, initAppDir } from './utils';
6
6
  export { manager, createPlugin, registerHook } from './manager';
7
- export { AppContext, ConfigContext, ResolvedConfigContext, useAppContext, useConfigContext, useResolvedConfigContext, initAppContext } from './context';
7
+ export { AppContext, ConfigContext, ResolvedConfigContext, useAppContext, useConfigContext, useResolvedConfigContext, initAppContext, } from './context';
8
8
  export declare const cli: {
9
- init: (options?: import("./types").CoreOptions | undefined) => Promise<{
10
- resolved: import("./types").NormalizedConfig<{}>;
11
- appContext: import("./types").IAppContext;
12
- }>;
13
- run: (options?: import("./types").CoreOptions | undefined) => Promise<void>;
14
- test: (argv: string[], options?: {
15
- coreOptions?: import("./types").CoreOptions | undefined;
16
- disableWatcher?: boolean | undefined;
17
- } | undefined) => Promise<void>;
18
- runCommand: (command: string, commandOptions?: string[], options?: import("./types").CoreOptions | undefined) => Promise<void>;
19
- getPrevInitOptions: () => import("./types").CoreOptions | undefined;
9
+ init: (options?: import("./types").CoreOptions | undefined) => Promise<{
10
+ resolved: import("./types").NormalizedConfig<{}>;
11
+ appContext: import("./types").IAppContext;
12
+ }>;
13
+ run: (options?: import("./types").CoreOptions | undefined) => Promise<void>;
14
+ test: (argv: string[], options?: {
15
+ coreOptions?: import("./types").CoreOptions | undefined;
16
+ disableWatcher?: boolean | undefined;
17
+ } | undefined) => Promise<void>;
18
+ runCommand: (command: string, commandOptions?: string[], options?: import("./types").CoreOptions | undefined) => Promise<void>;
19
+ getPrevInitOptions: () => import("./types").CoreOptions | undefined;
20
20
  };
21
21
  declare module '@modern-js/utils/compiled/commander' {
22
- interface Command {
23
- commandsMap: Map<string, Command>;
24
- }
25
- }
22
+ interface Command {
23
+ commandsMap: Map<string, Command>;
24
+ }
25
+ }
package/dist/loadEnv.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const loadEnv: (appDirectory: string, mode?: string) => void;
1
+ export declare const loadEnv: (appDirectory: string, mode?: string) => void;
@@ -9,7 +9,7 @@ export declare const isOldPluginConfig: (config?: PluginConfig) => config is Old
9
9
  * @returns Plugin Objects has been required.
10
10
  */
11
11
  export declare const loadPlugins: (appDirectory: string, userConfig: UserConfig, options?: {
12
- internalPlugins?: InternalPlugins;
13
- autoLoad?: InternalPlugins;
14
- forceAutoLoadPlugins?: boolean;
15
- }) => Promise<CliPlugin[]>;
12
+ internalPlugins?: InternalPlugins;
13
+ autoLoad?: InternalPlugins;
14
+ forceAutoLoadPlugins?: boolean;
15
+ }) => Promise<CliPlugin[]>;
package/dist/manager.d.ts CHANGED
@@ -1,135 +1,135 @@
1
1
  import { BasePluginAPI } from './types';
2
2
  export declare const manager: import("@modern-js/plugin").AsyncManager<{
3
- beforeConfig: import("@modern-js/plugin").AsyncWorkflow<void, void>;
4
- config: import("@modern-js/plugin").ParallelWorkflow<void, import("./types").UserConfig<{}>>;
5
- resolvedConfig: import("@modern-js/plugin").AsyncWaterfall<{
6
- resolved: import("./types").NormalizedConfig<{}>;
7
- }>;
8
- prepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
9
- afterPrepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
10
- watchFiles: import("@modern-js/plugin").ParallelWorkflow<void, string[] | {
11
- files: string[];
12
- isPrivate: boolean;
13
- }>;
14
- fileChange: import("@modern-js/plugin").AsyncWorkflow<{
15
- filename: string;
16
- eventType: "add" | "unlink" | "change";
17
- isPrivate: boolean;
18
- }, void>;
19
- commands: import("@modern-js/plugin").AsyncWorkflow<{
20
- program: import("@modern-js/utils").Command;
21
- }, void>;
22
- beforeExit: import("@modern-js/plugin").Workflow<void, void>;
23
- addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
3
+ beforeConfig: import("@modern-js/plugin").AsyncWorkflow<void, void>;
4
+ config: import("@modern-js/plugin").ParallelWorkflow<void, import("./types").UserConfig<{}>>;
5
+ resolvedConfig: import("@modern-js/plugin").AsyncWaterfall<{
6
+ resolved: import("./types").NormalizedConfig<{}>;
7
+ }>;
8
+ prepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
9
+ afterPrepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
10
+ watchFiles: import("@modern-js/plugin").ParallelWorkflow<void, string[] | {
11
+ files: string[];
12
+ isPrivate: boolean;
13
+ }>;
14
+ fileChange: import("@modern-js/plugin").AsyncWorkflow<{
15
+ filename: string;
16
+ eventType: "add" | "unlink" | "change";
17
+ isPrivate: boolean;
18
+ }, void>;
19
+ commands: import("@modern-js/plugin").AsyncWorkflow<{
20
+ program: import("@modern-js/utils").Command;
21
+ }, void>;
22
+ beforeExit: import("@modern-js/plugin").Workflow<void, void>;
23
+ addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
24
24
  }, BasePluginAPI<{}>>;
25
25
  export declare const createPlugin: (setup?: import("@modern-js/plugin").AsyncSetup<{
26
26
  beforeConfig: import("@modern-js/plugin").AsyncWorkflow<void, void>;
27
27
  config: import("@modern-js/plugin").ParallelWorkflow<void, import("./types").UserConfig<{}>>;
28
28
  resolvedConfig: import("@modern-js/plugin").AsyncWaterfall<{
29
- resolved: import("./types").NormalizedConfig<{}>;
29
+ resolved: import("./types").NormalizedConfig<{}>;
30
30
  }>;
31
31
  prepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
32
32
  afterPrepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
33
33
  watchFiles: import("@modern-js/plugin").ParallelWorkflow<void, string[] | {
34
- files: string[];
35
- isPrivate: boolean;
34
+ files: string[];
35
+ isPrivate: boolean;
36
36
  }>;
37
37
  fileChange: import("@modern-js/plugin").AsyncWorkflow<{
38
- filename: string;
39
- eventType: "add" | "unlink" | "change";
40
- isPrivate: boolean;
38
+ filename: string;
39
+ eventType: "add" | "unlink" | "change";
40
+ isPrivate: boolean;
41
41
  }, void>;
42
42
  commands: import("@modern-js/plugin").AsyncWorkflow<{
43
- program: import("@modern-js/utils").Command;
43
+ program: import("@modern-js/utils").Command;
44
44
  }, void>;
45
45
  beforeExit: import("@modern-js/plugin").Workflow<void, void>;
46
46
  addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
47
- }, BasePluginAPI<{}>> | undefined, options?: import("@modern-js/plugin").PluginOptions<{
47
+ }, BasePluginAPI<{}>> | undefined, options?: import("@modern-js/plugin").PluginOptions<{
48
48
  beforeConfig: import("@modern-js/plugin").AsyncWorkflow<void, void>;
49
49
  config: import("@modern-js/plugin").ParallelWorkflow<void, import("./types").UserConfig<{}>>;
50
50
  resolvedConfig: import("@modern-js/plugin").AsyncWaterfall<{
51
- resolved: import("./types").NormalizedConfig<{}>;
51
+ resolved: import("./types").NormalizedConfig<{}>;
52
52
  }>;
53
53
  prepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
54
54
  afterPrepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
55
55
  watchFiles: import("@modern-js/plugin").ParallelWorkflow<void, string[] | {
56
- files: string[];
57
- isPrivate: boolean;
56
+ files: string[];
57
+ isPrivate: boolean;
58
58
  }>;
59
59
  fileChange: import("@modern-js/plugin").AsyncWorkflow<{
60
- filename: string;
61
- eventType: "add" | "unlink" | "change";
62
- isPrivate: boolean;
60
+ filename: string;
61
+ eventType: "add" | "unlink" | "change";
62
+ isPrivate: boolean;
63
63
  }, void>;
64
64
  commands: import("@modern-js/plugin").AsyncWorkflow<{
65
- program: import("@modern-js/utils").Command;
65
+ program: import("@modern-js/utils").Command;
66
66
  }, void>;
67
67
  beforeExit: import("@modern-js/plugin").Workflow<void, void>;
68
68
  addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
69
- }, import("@modern-js/plugin").AsyncSetup<{
69
+ }, import("@modern-js/plugin").AsyncSetup<{
70
70
  beforeConfig: import("@modern-js/plugin").AsyncWorkflow<void, void>;
71
71
  config: import("@modern-js/plugin").ParallelWorkflow<void, import("./types").UserConfig<{}>>;
72
72
  resolvedConfig: import("@modern-js/plugin").AsyncWaterfall<{
73
- resolved: import("./types").NormalizedConfig<{}>;
73
+ resolved: import("./types").NormalizedConfig<{}>;
74
74
  }>;
75
75
  prepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
76
76
  afterPrepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
77
77
  watchFiles: import("@modern-js/plugin").ParallelWorkflow<void, string[] | {
78
- files: string[];
79
- isPrivate: boolean;
78
+ files: string[];
79
+ isPrivate: boolean;
80
80
  }>;
81
81
  fileChange: import("@modern-js/plugin").AsyncWorkflow<{
82
- filename: string;
83
- eventType: "add" | "unlink" | "change";
84
- isPrivate: boolean;
82
+ filename: string;
83
+ eventType: "add" | "unlink" | "change";
84
+ isPrivate: boolean;
85
85
  }, void>;
86
86
  commands: import("@modern-js/plugin").AsyncWorkflow<{
87
- program: import("@modern-js/utils").Command;
87
+ program: import("@modern-js/utils").Command;
88
88
  }, void>;
89
89
  beforeExit: import("@modern-js/plugin").Workflow<void, void>;
90
90
  addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
91
- }, BasePluginAPI<{}>>> | undefined) => import("@modern-js/plugin").AsyncPlugin<{
91
+ }, BasePluginAPI<{}>>> | undefined) => import("@modern-js/plugin").AsyncPlugin<{
92
92
  beforeConfig: import("@modern-js/plugin").AsyncWorkflow<void, void>;
93
93
  config: import("@modern-js/plugin").ParallelWorkflow<void, import("./types").UserConfig<{}>>;
94
94
  resolvedConfig: import("@modern-js/plugin").AsyncWaterfall<{
95
- resolved: import("./types").NormalizedConfig<{}>;
95
+ resolved: import("./types").NormalizedConfig<{}>;
96
96
  }>;
97
97
  prepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
98
98
  afterPrepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
99
99
  watchFiles: import("@modern-js/plugin").ParallelWorkflow<void, string[] | {
100
- files: string[];
101
- isPrivate: boolean;
100
+ files: string[];
101
+ isPrivate: boolean;
102
102
  }>;
103
103
  fileChange: import("@modern-js/plugin").AsyncWorkflow<{
104
- filename: string;
105
- eventType: "add" | "unlink" | "change";
106
- isPrivate: boolean;
104
+ filename: string;
105
+ eventType: "add" | "unlink" | "change";
106
+ isPrivate: boolean;
107
107
  }, void>;
108
108
  commands: import("@modern-js/plugin").AsyncWorkflow<{
109
- program: import("@modern-js/utils").Command;
109
+ program: import("@modern-js/utils").Command;
110
110
  }, void>;
111
111
  beforeExit: import("@modern-js/plugin").Workflow<void, void>;
112
112
  addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
113
- }, BasePluginAPI<{}>>, registerHook: (newHooks: Partial<{
113
+ }, BasePluginAPI<{}>>, registerHook: (newHooks: Partial<{
114
114
  beforeConfig: import("@modern-js/plugin").AsyncWorkflow<void, void>;
115
115
  config: import("@modern-js/plugin").ParallelWorkflow<void, import("./types").UserConfig<{}>>;
116
116
  resolvedConfig: import("@modern-js/plugin").AsyncWaterfall<{
117
- resolved: import("./types").NormalizedConfig<{}>;
117
+ resolved: import("./types").NormalizedConfig<{}>;
118
118
  }>;
119
119
  prepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
120
120
  afterPrepare: import("@modern-js/plugin").AsyncWorkflow<void, void>;
121
121
  watchFiles: import("@modern-js/plugin").ParallelWorkflow<void, string[] | {
122
- files: string[];
123
- isPrivate: boolean;
122
+ files: string[];
123
+ isPrivate: boolean;
124
124
  }>;
125
125
  fileChange: import("@modern-js/plugin").AsyncWorkflow<{
126
- filename: string;
127
- eventType: "add" | "unlink" | "change";
128
- isPrivate: boolean;
126
+ filename: string;
127
+ eventType: "add" | "unlink" | "change";
128
+ isPrivate: boolean;
129
129
  }, void>;
130
130
  commands: import("@modern-js/plugin").AsyncWorkflow<{
131
- program: import("@modern-js/utils").Command;
131
+ program: import("@modern-js/utils").Command;
132
132
  }, void>;
133
133
  beforeExit: import("@modern-js/plugin").Workflow<void, void>;
134
134
  addRuntimeExports: import("@modern-js/plugin").AsyncWaterfall<void>;
135
- }>) => void;
135
+ }>) => void;
package/dist/nodeApi.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { CoreOptions } from '.';
2
2
  export declare const dev: (options?: CoreOptions, commandOptions?: string[]) => void;
3
3
  export declare const build: (options?: CoreOptions, commandOptions?: string[]) => void;
4
- export declare const deploy: (options?: CoreOptions, commandOptions?: string[]) => void;
4
+ export declare const deploy: (options?: CoreOptions, commandOptions?: string[]) => void;
package/dist/runBin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { CoreOptions } from '.';
3
3
  export declare const run: (otherCoreOptions?: CoreOptions, options?: {
4
- override?: boolean | ((coreOptions: CoreOptions) => Promise<CoreOptions> | CoreOptions) | undefined;
5
- }) => Promise<void>;
4
+ override?: boolean | ((coreOptions: CoreOptions) => Promise<CoreOptions> | CoreOptions) | undefined;
5
+ }) => Promise<void>;
@@ -1,46 +1,46 @@
1
1
  import { PluginConfig } from '../plugin';
2
2
  export type UserConfig<Extends extends {
3
- hooks?: ExtendHooks;
4
- userConfig?: ExtendUserConfig;
5
- normalizedConfig?: ExtendNormalizedConfig;
3
+ hooks?: ExtendHooks;
4
+ userConfig?: ExtendUserConfig;
5
+ normalizedConfig?: ExtendNormalizedConfig;
6
6
  } = {}, ExtendHooks extends Record<string, any> = {}, ExtendUserConfig extends {
7
- [property: string]: any;
7
+ [property: string]: any;
8
8
  } = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = {
9
- plugins?: PluginConfig;
10
- /**
11
- * auto load plugin that exist in the package.json
12
- *
13
- * **default: `false`**
14
- */
15
- autoLoadPlugins?: boolean;
9
+ plugins?: PluginConfig;
10
+ /**
11
+ * auto load plugin that exist in the package.json
12
+ *
13
+ * **default: `false`**
14
+ */
15
+ autoLoadPlugins?: boolean;
16
16
  } & Omit<Extends['userConfig'], 'plugins'>;
17
17
  export type NormalizedConfig<Extends extends {
18
- hooks?: ExtendHooks;
19
- userConfig?: ExtendUserConfig;
20
- normalizedConfig?: ExtendNormalizedConfig;
18
+ hooks?: ExtendHooks;
19
+ userConfig?: ExtendUserConfig;
20
+ normalizedConfig?: ExtendNormalizedConfig;
21
21
  } = {}, ExtendHooks extends Record<string, any> = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends {
22
- [property: string]: any;
22
+ [property: string]: any;
23
23
  } = {}> = {
24
- plugins: PluginConfig;
25
- /**
26
- * Auto load plugin that exist in the package.json
27
- *
28
- * **default: `false`**
29
- */
30
- autoLoadPlugins: boolean;
24
+ plugins: PluginConfig;
25
+ /**
26
+ * Auto load plugin that exist in the package.json
27
+ *
28
+ * **default: `false`**
29
+ */
30
+ autoLoadPlugins: boolean;
31
31
  } & Omit<Extends['normalizedConfig'], 'plugins'>;
32
32
  export type LoadedConfig<Extends extends {
33
- hooks?: ExtendHooks;
34
- userConfig?: ExtendUserConfig;
33
+ hooks?: ExtendHooks;
34
+ userConfig?: ExtendUserConfig;
35
35
  } = {}, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}> = {
36
- config: UserConfig<Extends>;
37
- filePath: string | false;
38
- dependencies: string[];
39
- pkgConfig: UserConfig<Extends>;
40
- jsConfig: UserConfig<Extends>;
36
+ config: UserConfig<Extends>;
37
+ filePath: string | false;
38
+ dependencies: string[];
39
+ pkgConfig: UserConfig<Extends>;
40
+ jsConfig: UserConfig<Extends>;
41
41
  };
42
42
  export type ConfigParams = {
43
- env: string;
44
- command: string;
43
+ env: string;
44
+ command: string;
45
45
  };
46
- export type UserConfigExport<Config = UserConfig> = Config | ((env: ConfigParams) => Config | Promise<Config>);
46
+ export type UserConfigExport<Config = UserConfig> = Config | ((env: ConfigParams) => Config | Promise<Config>);
@@ -2,70 +2,70 @@ import { Entrypoint, InternalPlugins, ServerRoute, HtmlTemplates, HtmlPartials }
2
2
  import { BuilderInstance } from '@modern-js/builder-shared';
3
3
  export type ToolsType = 'app-tools' | 'module-tools' | 'monorepo-tools';
4
4
  export interface IAppContext {
5
- /** name for generating conventional constants, such as .modern-js */
6
- metaName: string;
7
- /** Root directory of the current project */
8
- appDirectory: string;
9
- /** Source code directory */
10
- srcDirectory: string;
11
- /** Directory for output files */
12
- distDirectory: string;
13
- /** Directory for API modules */
14
- apiDirectory: string;
15
- /** Directory for lambda modules */
16
- lambdaDirectory: string;
17
- /** Directory for shared modules */
18
- sharedDirectory: string;
19
- /** Directory for framework temp files */
20
- internalDirectory: string;
21
- /** node_modules directory */
22
- nodeModulesDirectory: string;
23
- /** Path to the configuration file */
24
- configFile: string | false;
25
- /** Path to the server configuration file */
26
- serverConfigFile: string;
27
- /** Currently registered server plugins */
28
- serverInternalPlugins: InternalPlugins;
29
- /** IPv4 address of the current machine */
30
- ip?: string;
31
- /** Port number of the development server */
32
- port?: number;
33
- /** Name of the current project's package.json */
34
- packageName: string;
35
- /** Currently registered plugins */
36
- plugins: any[];
37
- /** Information for entry points */
38
- entrypoints: Entrypoint[];
39
- /** Selected entry points */
40
- checkedEntries: string[];
41
- /** Information for server routes */
42
- serverRoutes: ServerRoute[];
43
- /** Whether to use api only mode */
44
- apiOnly: boolean;
45
- /** The Builder instance */
46
- builder?: BuilderInstance;
47
- /** Tools type of the current project */
48
- toolsType?: ToolsType;
49
- /** Type of the bundler being used */
50
- bundlerType?: 'webpack' | 'rspack' | 'esbuild';
51
- /**
52
- * The alias path for internal usage
53
- * @private
54
- */
55
- internalDirAlias: string;
56
- /**
57
- * The alias path for internal usage
58
- * @private
59
- */
60
- internalSrcAlias: string;
61
- /**
62
- * Information for HTML templates
63
- * @private
64
- */
65
- htmlTemplates: HtmlTemplates;
66
- /**
67
- * Information for HTML templates by entry
68
- * @private
69
- */
70
- partialsByEntrypoint?: Record<string, HtmlPartials>;
71
- }
5
+ /** name for generating conventional constants, such as .modern-js */
6
+ metaName: string;
7
+ /** Root directory of the current project */
8
+ appDirectory: string;
9
+ /** Source code directory */
10
+ srcDirectory: string;
11
+ /** Directory for output files */
12
+ distDirectory: string;
13
+ /** Directory for API modules */
14
+ apiDirectory: string;
15
+ /** Directory for lambda modules */
16
+ lambdaDirectory: string;
17
+ /** Directory for shared modules */
18
+ sharedDirectory: string;
19
+ /** Directory for framework temp files */
20
+ internalDirectory: string;
21
+ /** node_modules directory */
22
+ nodeModulesDirectory: string;
23
+ /** Path to the configuration file */
24
+ configFile: string | false;
25
+ /** Path to the server configuration file */
26
+ serverConfigFile: string;
27
+ /** Currently registered server plugins */
28
+ serverInternalPlugins: InternalPlugins;
29
+ /** IPv4 address of the current machine */
30
+ ip?: string;
31
+ /** Port number of the development server */
32
+ port?: number;
33
+ /** Name of the current project's package.json */
34
+ packageName: string;
35
+ /** Currently registered plugins */
36
+ plugins: any[];
37
+ /** Information for entry points */
38
+ entrypoints: Entrypoint[];
39
+ /** Selected entry points */
40
+ checkedEntries: string[];
41
+ /** Information for server routes */
42
+ serverRoutes: ServerRoute[];
43
+ /** Whether to use api only mode */
44
+ apiOnly: boolean;
45
+ /** The Builder instance */
46
+ builder?: BuilderInstance;
47
+ /** Tools type of the current project */
48
+ toolsType?: ToolsType;
49
+ /** Type of the bundler being used */
50
+ bundlerType?: 'webpack' | 'rspack' | 'esbuild';
51
+ /**
52
+ * The alias path for internal usage
53
+ * @private
54
+ */
55
+ internalDirAlias: string;
56
+ /**
57
+ * The alias path for internal usage
58
+ * @private
59
+ */
60
+ internalSrcAlias: string;
61
+ /**
62
+ * Information for HTML templates
63
+ * @private
64
+ */
65
+ htmlTemplates: HtmlTemplates;
66
+ /**
67
+ * Information for HTML templates by entry
68
+ * @private
69
+ */
70
+ partialsByEntrypoint?: Record<string, HtmlPartials>;
71
+ }
@@ -1,28 +1,28 @@
1
1
  import type { InternalPlugins } from './plugin';
2
2
  import type { UserConfig } from './config';
3
3
  export interface CoreOptions {
4
- cwd?: string;
5
- version?: string;
6
- configFile?: string;
7
- /**
8
- * The initial log message when CLI started
9
- */
10
- initialLog?: string;
11
- serverConfigFile?: string;
12
- packageJsonConfig?: string;
13
- internalPlugins?: {
14
- cli?: InternalPlugins;
15
- server?: InternalPlugins;
16
- autoLoad?: InternalPlugins;
17
- };
18
- options?: {
19
- metaName?: string;
20
- srcDir?: string;
21
- distDir?: string;
22
- sharedDir?: string;
23
- };
24
- /** force the modern-js core auto register plugin exist in the package.json */
25
- forceAutoLoadPlugins?: boolean;
26
- /** config for Node API */
27
- loadedConfig?: UserConfig;
28
- }
4
+ cwd?: string;
5
+ version?: string;
6
+ configFile?: string;
7
+ /**
8
+ * The initial log message when CLI started
9
+ */
10
+ initialLog?: string;
11
+ serverConfigFile?: string;
12
+ packageJsonConfig?: string;
13
+ internalPlugins?: {
14
+ cli?: InternalPlugins;
15
+ server?: InternalPlugins;
16
+ autoLoad?: InternalPlugins;
17
+ };
18
+ options?: {
19
+ metaName?: string;
20
+ srcDir?: string;
21
+ distDir?: string;
22
+ sharedDir?: string;
23
+ };
24
+ /** force the modern-js core auto register plugin exist in the package.json */
25
+ forceAutoLoadPlugins?: boolean;
26
+ /** config for Node API */
27
+ loadedConfig?: UserConfig;
28
+ }
@@ -2,52 +2,52 @@ import { Workflow, ParallelWorkflow, AsyncWaterfall, AsyncWorkflow, ToRunners, T
2
2
  import type { Command } from '@modern-js/utils';
3
3
  import type { UserConfig, NormalizedConfig } from './config';
4
4
  export type BaseHooks<Extends extends {
5
- hooks?: ExtendHooks;
6
- userConfig?: ExtendUserConfig;
7
- normalizedConfig?: ExtendNormalizedConfig;
5
+ hooks?: ExtendHooks;
6
+ userConfig?: ExtendUserConfig;
7
+ normalizedConfig?: ExtendNormalizedConfig;
8
8
  }, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = {
9
- beforeConfig: AsyncWorkflow<void, void>;
10
- config: ParallelWorkflow<void, UserConfig<Extends>>;
11
- resolvedConfig: AsyncWaterfall<{
12
- resolved: NormalizedConfig<Extends>;
13
- }>;
14
- prepare: AsyncWorkflow<void, void>;
15
- afterPrepare: AsyncWorkflow<void, void>;
16
- watchFiles: ParallelWorkflow<void, string[] | {
17
- files: string[];
18
- isPrivate: boolean;
19
- }>;
20
- fileChange: AsyncWorkflow<{
21
- filename: string;
22
- eventType: 'add' | 'change' | 'unlink';
23
- isPrivate: boolean;
24
- }, void>;
25
- commands: AsyncWorkflow<{
26
- program: Command;
27
- }, void>;
28
- beforeExit: Workflow<void, void>;
29
- addRuntimeExports: AsyncWaterfall<void>;
9
+ beforeConfig: AsyncWorkflow<void, void>;
10
+ config: ParallelWorkflow<void, UserConfig<Extends>>;
11
+ resolvedConfig: AsyncWaterfall<{
12
+ resolved: NormalizedConfig<Extends>;
13
+ }>;
14
+ prepare: AsyncWorkflow<void, void>;
15
+ afterPrepare: AsyncWorkflow<void, void>;
16
+ watchFiles: ParallelWorkflow<void, string[] | {
17
+ files: string[];
18
+ isPrivate: boolean;
19
+ }>;
20
+ fileChange: AsyncWorkflow<{
21
+ filename: string;
22
+ eventType: 'add' | 'change' | 'unlink';
23
+ isPrivate: boolean;
24
+ }, void>;
25
+ commands: AsyncWorkflow<{
26
+ program: Command;
27
+ }, void>;
28
+ beforeExit: Workflow<void, void>;
29
+ addRuntimeExports: AsyncWaterfall<void>;
30
30
  };
31
31
  export type CliHooksRunner<Extends extends {
32
- hooks?: ExtendHooks;
33
- userConfig?: ExtendUserConfig;
34
- normalizedConfig?: ExtendNormalizedConfig;
32
+ hooks?: ExtendHooks;
33
+ userConfig?: ExtendUserConfig;
34
+ normalizedConfig?: ExtendNormalizedConfig;
35
35
  } = {}, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = ToRunners<BaseHooks<Extends> & Extends['hooks']>;
36
36
  export type CliHookCallbacks = ToThreads<BaseHooks<{}>>;
37
37
  export interface DevToolData<DevOptions = any> {
38
- name: string;
39
- subCommands?: string[];
40
- menuItem?: {
41
38
  name: string;
42
- value: string;
43
- };
44
- action: (options: DevOptions, context: {
45
- isTsProject?: boolean;
46
- }) => void | Promise<void>;
39
+ subCommands?: string[];
40
+ menuItem?: {
41
+ name: string;
42
+ value: string;
43
+ };
44
+ action: (options: DevOptions, context: {
45
+ isTsProject?: boolean;
46
+ }) => void | Promise<void>;
47
47
  }
48
48
  export interface RegisterBuildPlatformResult {
49
- platform: string | string[];
50
- build: (currentPlatform: string, context: {
51
- isTsProject: boolean;
52
- }) => void | Promise<void>;
53
- }
49
+ platform: string | string[];
50
+ build: (currentPlatform: string, context: {
51
+ isTsProject: boolean;
52
+ }) => void | Promise<void>;
53
+ }
@@ -3,4 +3,4 @@ export * from './config';
3
3
  export * from './pluginAPI';
4
4
  export * from './hooks';
5
5
  export * from './context';
6
- export * from './coreOptions';
6
+ export * from './coreOptions';
@@ -4,9 +4,9 @@ import { BasePluginAPI } from './pluginAPI';
4
4
  export type { InternalPlugins } from '@modern-js/types';
5
5
  /** Plugin options of a cli plugin. */
6
6
  export type CliPlugin<Extends extends {
7
- hooks?: ExtendHooks;
8
- userConfig?: ExtendUserConfig;
9
- normalizedConfig?: ExtendNormalizedConfig;
7
+ hooks?: ExtendHooks;
8
+ userConfig?: ExtendUserConfig;
9
+ normalizedConfig?: ExtendNormalizedConfig;
10
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 type PluginItem = string | [string, any];
12
12
  /**
@@ -19,4 +19,4 @@ export type OldPluginConfig = Array<PluginItem>;
19
19
  * this avoids potential type mismatch issues when using different version plugins.
20
20
  */
21
21
  export type NewPluginConfig = PluginOptions<any, (...args: any[]) => void>[];
22
- export type PluginConfig = OldPluginConfig | NewPluginConfig;
22
+ export type PluginConfig = OldPluginConfig | NewPluginConfig;
@@ -2,17 +2,17 @@ import { CommonAPI } from '@modern-js/plugin';
2
2
  import type { setAppContext, useAppContext, useResolvedConfigContext, useConfigContext } from '../context';
3
3
  import { BaseHooks } from './hooks';
4
4
  export type BasePluginAPI<Extends extends {
5
- hooks?: ExtendHooks;
6
- userConfig?: ExtendUserConfig;
7
- normalizedConfig?: ExtendNormalizedConfig;
5
+ hooks?: ExtendHooks;
6
+ userConfig?: ExtendUserConfig;
7
+ normalizedConfig?: ExtendNormalizedConfig;
8
8
  }, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}, ExtendNormalizedConfig extends Record<string, any> = {}> = {
9
- setAppContext: typeof setAppContext;
10
- useAppContext: typeof useAppContext;
11
- useConfigContext: typeof useConfigContext<Extends>;
12
- useResolvedConfigContext: typeof useResolvedConfigContext<Extends>;
9
+ setAppContext: typeof setAppContext;
10
+ useAppContext: typeof useAppContext;
11
+ useConfigContext: typeof useConfigContext<Extends>;
12
+ useResolvedConfigContext: typeof useResolvedConfigContext<Extends>;
13
13
  };
14
14
  /** all apis for cli plugin */
15
15
  export type PluginAPI<Extends extends {
16
- hooks?: ExtendHooks;
17
- userConfig?: ExtendUserConfig;
18
- } = {}, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}> = BasePluginAPI<Extends> & CommonAPI<BaseHooks<Extends> & Extends['hooks']>;
16
+ hooks?: ExtendHooks;
17
+ userConfig?: ExtendUserConfig;
18
+ } = {}, ExtendHooks extends {} = {}, ExtendUserConfig extends Record<string, any> = {}> = BasePluginAPI<Extends> & CommonAPI<BaseHooks<Extends> & Extends['hooks']>;
@@ -1 +1 @@
1
- export declare function checkIsDuplicationPlugin(plugins: (string | undefined)[], autoLoadPlugin?: boolean): void;
1
+ export declare function checkIsDuplicationPlugin(plugins: (string | undefined)[], autoLoadPlugin?: boolean): void;
@@ -1,4 +1,4 @@
1
1
  import { program, Command } from '@modern-js/utils';
2
2
  export declare function initCommandsMap(): void;
3
3
  export type { Command };
4
- export { program };
4
+ export { program };
@@ -1,2 +1,2 @@
1
1
  import type { CliHooksRunner, IAppContext } from '../types';
2
- export declare const createFileWatcher: (appContext: IAppContext, hooksRunner: CliHooksRunner) => Promise<import("@modern-js/utils").FSWatcher | undefined>;
2
+ export declare const createFileWatcher: (appContext: IAppContext, hooksRunner: CliHooksRunner) => Promise<import("@modern-js/utils").FSWatcher | undefined>;
@@ -2,4 +2,4 @@ export * from './commander';
2
2
  export * from './createFileWatcher';
3
3
  export * from './initAppDir';
4
4
  export * from './mergeConfig';
5
- export * from './checkIsDuplicationPlugin';
5
+ export * from './checkIsDuplicationPlugin';
@@ -1 +1 @@
1
- export declare const initAppDir: (cwd?: string) => Promise<string>;
1
+ export declare const initAppDir: (cwd?: string) => Promise<string>;
@@ -1,2 +1,2 @@
1
1
  import { UserConfig, NormalizedConfig } from '../types';
2
- export declare const mergeConfig: <ExtendConfig extends Record<string, any>>(configs: (UserConfig<ExtendConfig> | NormalizedConfig<ExtendConfig>)[]) => NormalizedConfig<ExtendConfig>;
2
+ export declare const mergeConfig: <ExtendConfig extends Record<string, any>>(configs: (UserConfig<ExtendConfig> | NormalizedConfig<ExtendConfig>)[]) => NormalizedConfig<ExtendConfig>;
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "modern",
15
15
  "modern.js"
16
16
  ],
17
- "version": "2.41.0",
17
+ "version": "2.42.1",
18
18
  "jsnext:source": "./src/index.ts",
19
19
  "types": "./dist/index.d.ts",
20
20
  "main": "./dist/index.js",
@@ -71,9 +71,9 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@swc/helpers": "0.5.3",
74
- "@modern-js/node-bundle-require": "2.41.0",
75
- "@modern-js/utils": "2.41.0",
76
- "@modern-js/plugin": "2.41.0"
74
+ "@modern-js/node-bundle-require": "2.42.1",
75
+ "@modern-js/plugin": "2.42.1",
76
+ "@modern-js/utils": "2.42.1"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@types/jest": "^29",
@@ -81,10 +81,10 @@
81
81
  "tsm": "2.3.0",
82
82
  "jest": "^29",
83
83
  "typescript": "^5",
84
- "@modern-js/types": "2.41.0",
85
- "@scripts/build": "2.41.0",
86
- "@scripts/jest-config": "2.41.0",
87
- "@modern-js/builder-shared": "2.41.0"
84
+ "@modern-js/builder-shared": "2.42.1",
85
+ "@scripts/build": "2.42.1",
86
+ "@modern-js/types": "2.42.1",
87
+ "@scripts/jest-config": "2.42.1"
88
88
  },
89
89
  "sideEffects": false,
90
90
  "publishConfig": {