@modern-js/core 1.9.2 → 1.10.0
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 +15 -0
- package/compiled/ajv-keywords/index.d.ts +1 -0
- package/compiled/ajv-keywords/package.json +1 -1
- package/compiled/better-ajv-errors/index.d.ts +1 -0
- package/compiled/better-ajv-errors/package.json +1 -1
- package/compiled/v8-compile-cache/index.d.ts +1 -0
- package/compiled/v8-compile-cache/package.json +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +19 -28
- package/dist/config/types/index.d.ts +36 -36
- package/dist/index.js +55 -60
- package/dist/initWatcher.js +3 -12
- package/package.json +7 -8
- package/tsconfig.json +1 -0
- package/compiled/ajv-keywords/ajv/dist/ajv.d.ts +0 -16
- package/compiled/ajv-keywords/ajv/dist/compile/codegen/code.d.ts +0 -40
- package/compiled/ajv-keywords/ajv/dist/compile/codegen/index.d.ts +0 -79
- package/compiled/ajv-keywords/ajv/dist/compile/codegen/scope.d.ts +0 -79
- package/compiled/ajv-keywords/ajv/dist/compile/errors.d.ts +0 -13
- package/compiled/ajv-keywords/ajv/dist/compile/index.d.ts +0 -80
- package/compiled/ajv-keywords/ajv/dist/compile/ref_error.d.ts +0 -6
- package/compiled/ajv-keywords/ajv/dist/compile/resolve.d.ts +0 -12
- package/compiled/ajv-keywords/ajv/dist/compile/rules.d.ts +0 -28
- package/compiled/ajv-keywords/ajv/dist/compile/util.d.ts +0 -40
- package/compiled/ajv-keywords/ajv/dist/compile/validate/index.d.ts +0 -42
- package/compiled/ajv-keywords/ajv/dist/compile/validate/subschema.d.ts +0 -47
- package/compiled/ajv-keywords/ajv/dist/core.d.ts +0 -173
- package/compiled/ajv-keywords/ajv/dist/runtime/validation_error.d.ts +0 -7
- package/compiled/ajv-keywords/ajv/dist/types/index.d.ts +0 -183
- package/compiled/ajv-keywords/ajv/dist/types/json-schema.d.ts +0 -124
- package/compiled/ajv-keywords/ajv/dist/types/jtd-schema.d.ts +0 -169
- package/compiled/ajv-keywords/dist/index.d.ts +0 -4
- package/compiled/ajv-keywords/uri-js/dist/es5/uri.all.d.ts +0 -59
- package/compiled/better-ajv-errors/ajv/dist/ajv.d.ts +0 -16
- package/compiled/better-ajv-errors/ajv/dist/compile/codegen/code.d.ts +0 -40
- package/compiled/better-ajv-errors/ajv/dist/compile/codegen/index.d.ts +0 -79
- package/compiled/better-ajv-errors/ajv/dist/compile/codegen/scope.d.ts +0 -79
- package/compiled/better-ajv-errors/ajv/dist/compile/errors.d.ts +0 -13
- package/compiled/better-ajv-errors/ajv/dist/compile/index.d.ts +0 -80
- package/compiled/better-ajv-errors/ajv/dist/compile/ref_error.d.ts +0 -6
- package/compiled/better-ajv-errors/ajv/dist/compile/resolve.d.ts +0 -12
- package/compiled/better-ajv-errors/ajv/dist/compile/rules.d.ts +0 -28
- package/compiled/better-ajv-errors/ajv/dist/compile/util.d.ts +0 -40
- package/compiled/better-ajv-errors/ajv/dist/compile/validate/index.d.ts +0 -42
- package/compiled/better-ajv-errors/ajv/dist/compile/validate/subschema.d.ts +0 -47
- package/compiled/better-ajv-errors/ajv/dist/core.d.ts +0 -173
- package/compiled/better-ajv-errors/ajv/dist/runtime/validation_error.d.ts +0 -7
- package/compiled/better-ajv-errors/ajv/dist/types/index.d.ts +0 -183
- package/compiled/better-ajv-errors/ajv/dist/types/json-schema.d.ts +0 -124
- package/compiled/better-ajv-errors/ajv/dist/types/jtd-schema.d.ts +0 -169
- package/compiled/better-ajv-errors/typings.d.ts +0 -24
- package/compiled/better-ajv-errors/uri-js/dist/es5/uri.all.d.ts +0 -59
- package/dist/js/modern/cli.js +0 -29
- package/dist/js/modern/config/defaults.js +0 -103
- package/dist/js/modern/config/index.js +0 -115
- package/dist/js/modern/config/mergeConfig.js +0 -22
- package/dist/js/modern/config/schema/deploy.js +0 -17
- package/dist/js/modern/config/schema/index.js +0 -107
- package/dist/js/modern/config/schema/output.js +0 -147
- package/dist/js/modern/config/schema/server.js +0 -170
- package/dist/js/modern/config/schema/source.js +0 -59
- package/dist/js/modern/config/schema/tools.js +0 -36
- package/dist/js/modern/config/types/electron.js +0 -1
- package/dist/js/modern/config/types/index.js +0 -1
- package/dist/js/modern/config/types/less.js +0 -0
- package/dist/js/modern/config/types/sass.js +0 -0
- package/dist/js/modern/config/types/ssg.js +0 -0
- package/dist/js/modern/config/types/test.js +0 -0
- package/dist/js/modern/config/types/unbundle.js +0 -0
- package/dist/js/modern/context.js +0 -63
- package/dist/js/modern/index.js +0 -169
- package/dist/js/modern/initWatcher.js +0 -62
- package/dist/js/modern/loadEnv.js +0 -14
- package/dist/js/modern/loadPlugins.js +0 -122
- package/dist/js/modern/manager.js +0 -28
- package/dist/js/modern/pluginAPI.js +0 -11
- package/dist/js/modern/utils/commander.js +0 -19
- package/dist/js/modern/utils/repeatKeyWarning.js +0 -18
- package/dist/js/node/cli.js +0 -35
- package/dist/js/node/config/defaults.js +0 -110
- package/dist/js/node/config/index.js +0 -182
- package/dist/js/node/config/mergeConfig.js +0 -32
- package/dist/js/node/config/schema/deploy.js +0 -26
- package/dist/js/node/config/schema/index.js +0 -127
- package/dist/js/node/config/schema/output.js +0 -156
- package/dist/js/node/config/schema/server.js +0 -179
- package/dist/js/node/config/schema/source.js +0 -68
- package/dist/js/node/config/schema/tools.js +0 -43
- package/dist/js/node/config/types/electron.js +0 -5
- package/dist/js/node/config/types/index.js +0 -5
- package/dist/js/node/config/types/less.js +0 -0
- package/dist/js/node/config/types/sass.js +0 -0
- package/dist/js/node/config/types/ssg.js +0 -0
- package/dist/js/node/config/types/test.js +0 -0
- package/dist/js/node/config/types/unbundle.js +0 -0
- package/dist/js/node/context.js +0 -93
- package/dist/js/node/index.js +0 -329
- package/dist/js/node/initWatcher.js +0 -82
- package/dist/js/node/loadEnv.js +0 -30
- package/dist/js/node/loadPlugins.js +0 -134
- package/dist/js/node/manager.js +0 -45
- package/dist/js/node/pluginAPI.js +0 -54
- package/dist/js/node/utils/commander.js +0 -32
- package/dist/js/node/utils/repeatKeyWarning.js +0 -31
- package/dist/types/cli.d.ts +0 -1
- package/dist/types/config/defaults.d.ts +0 -28
- package/dist/types/config/index.d.ts +0 -12
- package/dist/types/config/mergeConfig.d.ts +0 -31
- package/dist/types/config/schema/deploy.d.ts +0 -16
- package/dist/types/config/schema/index.d.ts +0 -466
- package/dist/types/config/schema/output.d.ts +0 -146
- package/dist/types/config/schema/server.d.ts +0 -182
- package/dist/types/config/schema/source.d.ts +0 -58
- package/dist/types/config/schema/tools.d.ts +0 -36
- package/dist/types/config/types/electron.d.ts +0 -13
- package/dist/types/config/types/index.d.ts +0 -252
- package/dist/types/config/types/less.d.ts +0 -10
- package/dist/types/config/types/sass.d.ts +0 -8
- package/dist/types/config/types/ssg.d.ts +0 -13
- package/dist/types/config/types/test.d.ts +0 -15
- package/dist/types/config/types/unbundle.d.ts +0 -28
- package/dist/types/context.d.ts +0 -47
- package/dist/types/index.d.ts +0 -64
- package/dist/types/initWatcher.d.ts +0 -3
- package/dist/types/loadEnv.d.ts +0 -1
- package/dist/types/loadPlugins.d.ts +0 -44
- package/dist/types/manager.d.ts +0 -75
- package/dist/types/pluginAPI.d.ts +0 -13
- package/dist/types/utils/commander.d.ts +0 -4
- package/dist/types/utils/repeatKeyWarning.d.ts +0 -3
package/dist/types/index.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { INTERNAL_PLUGINS } from '@modern-js/utils';
|
|
2
|
-
import type { Hooks } from '@modern-js/types';
|
|
3
|
-
import { ErrorObject } from 'ajv';
|
|
4
|
-
import { TransformPlugin } from './loadPlugins';
|
|
5
|
-
import { IAppContext, initAppContext } from './context';
|
|
6
|
-
import type { NormalizedConfig } from './config/mergeConfig';
|
|
7
|
-
export type { Hooks };
|
|
8
|
-
export * from './config';
|
|
9
|
-
export * from '@modern-js/plugin';
|
|
10
|
-
export * from '@modern-js/plugin/node';
|
|
11
|
-
export { manager, mountHook, usePlugins, createPlugin, registerHook } from './manager';
|
|
12
|
-
export type { CliHooks, CliPlugin, CliHookCallbacks } from './manager';
|
|
13
|
-
export { AppContext, ConfigContext, ResolvedConfigContext, useAppContext, useConfigContext, useResolvedConfigContext } from './pluginAPI';
|
|
14
|
-
export type { PluginAPI } from './pluginAPI';
|
|
15
|
-
export type { NormalizedConfig, IAppContext };
|
|
16
|
-
declare const initAppDir: (cwd?: string | undefined) => Promise<string>;
|
|
17
|
-
export interface CoreOptions {
|
|
18
|
-
configFile?: string;
|
|
19
|
-
serverConfigFile?: string;
|
|
20
|
-
packageJsonConfig?: string;
|
|
21
|
-
plugins?: typeof INTERNAL_PLUGINS;
|
|
22
|
-
transformPlugin?: TransformPlugin;
|
|
23
|
-
onSchemaError?: (error: ErrorObject) => void;
|
|
24
|
-
options?: {
|
|
25
|
-
metaName?: string;
|
|
26
|
-
srcDir?: string;
|
|
27
|
-
distDir?: string;
|
|
28
|
-
sharedDir?: string;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export declare const mergeOptions: (options?: CoreOptions | undefined) => {
|
|
32
|
-
configFile?: string | undefined;
|
|
33
|
-
serverConfigFile: string;
|
|
34
|
-
packageJsonConfig?: string | undefined;
|
|
35
|
-
plugins?: {
|
|
36
|
-
[name: string]: {
|
|
37
|
-
cli?: string | undefined;
|
|
38
|
-
server?: string | undefined;
|
|
39
|
-
};
|
|
40
|
-
} | undefined;
|
|
41
|
-
transformPlugin?: TransformPlugin | undefined;
|
|
42
|
-
onSchemaError?: ((error: ErrorObject) => void) | undefined;
|
|
43
|
-
options?: {
|
|
44
|
-
metaName?: string | undefined;
|
|
45
|
-
srcDir?: string | undefined;
|
|
46
|
-
distDir?: string | undefined;
|
|
47
|
-
sharedDir?: string | undefined;
|
|
48
|
-
} | undefined;
|
|
49
|
-
};
|
|
50
|
-
export declare const cli: {
|
|
51
|
-
init: (argv?: string[], options?: CoreOptions | undefined) => Promise<{
|
|
52
|
-
loadedConfig: import("./config").LoadedConfig;
|
|
53
|
-
appContext: IAppContext;
|
|
54
|
-
resolved: NormalizedConfig;
|
|
55
|
-
}>;
|
|
56
|
-
run: (argv: string[], options?: CoreOptions | undefined) => Promise<void>;
|
|
57
|
-
restart: () => Promise<void>;
|
|
58
|
-
};
|
|
59
|
-
export { initAppDir, initAppContext };
|
|
60
|
-
declare module '@modern-js/utils/compiled/commander' {
|
|
61
|
-
interface Command {
|
|
62
|
-
commandsMap: Map<string, Command>;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { LoadedConfig } from './config';
|
|
2
|
-
import { HooksRunner } from './manager';
|
|
3
|
-
export declare const initWatcher: (loaded: LoadedConfig, appDirectory: string, configDir: string | undefined, hooksRunner: HooksRunner, argv: string[]) => Promise<import("@modern-js/utils").FSWatcher | undefined>;
|
package/dist/types/loadEnv.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const loadEnv: (appDirectory: string, mode?: string) => void;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { INTERNAL_PLUGINS } from '@modern-js/utils';
|
|
2
|
-
import type { UserConfig } from './config';
|
|
3
|
-
import { CliPlugin } from './manager';
|
|
4
|
-
declare type PluginItem = string | [string, any];
|
|
5
|
-
export declare type LoadedPlugin = {
|
|
6
|
-
cli?: CliPlugin;
|
|
7
|
-
server?: string;
|
|
8
|
-
serverPkg?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare type TransformPlugin = (plugin: PluginConfig, resolvedConfig: UserConfig, pluginOptions?: any) => PluginConfig;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated
|
|
13
|
-
* Using NewPluginConfig insteand.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
declare type OldPluginConfig = Array<PluginItem | {
|
|
17
|
-
cli?: PluginItem;
|
|
18
|
-
server?: PluginItem;
|
|
19
|
-
}>;
|
|
20
|
-
declare type NewPluginConfig = CliPlugin[] | {
|
|
21
|
-
cli?: CliPlugin[];
|
|
22
|
-
/** Custom server plugin is not supported yet. */
|
|
23
|
-
|
|
24
|
-
server?: never;
|
|
25
|
-
};
|
|
26
|
-
export declare type PluginConfig = OldPluginConfig | NewPluginConfig;
|
|
27
|
-
export declare function getAppPlugins(appDirectory: string, oldPluginConfig: OldPluginConfig, internalPlugins?: typeof INTERNAL_PLUGINS): (PluginItem | {
|
|
28
|
-
cli?: PluginItem | undefined;
|
|
29
|
-
server?: PluginItem | undefined;
|
|
30
|
-
})[];
|
|
31
|
-
/**
|
|
32
|
-
* Load internal plugins which in @modern-js scope and user's custom plugins.
|
|
33
|
-
* @param appDirectory - Application root directory.
|
|
34
|
-
* @param userConfig - Resolved user config.
|
|
35
|
-
* @param options.internalPlugins - Internal plugins.
|
|
36
|
-
* @param options.transformPlugin - transform plugin before using it. Used for compatible with legacy jupiter plugins.
|
|
37
|
-
* @returns Plugin Objects has been required.
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
export declare const loadPlugins: (appDirectory: string, userConfig: UserConfig, options?: {
|
|
41
|
-
internalPlugins?: typeof INTERNAL_PLUGINS;
|
|
42
|
-
transformPlugin?: TransformPlugin;
|
|
43
|
-
}) => LoadedPlugin[];
|
|
44
|
-
export {};
|
package/dist/types/manager.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { ToThreads, ToRunners, AsyncSetup, PluginOptions, AsyncWorkflow, AsyncWaterfall, ParallelWorkflow } from '@modern-js/plugin';
|
|
2
|
-
import type { Hooks } from '@modern-js/types';
|
|
3
|
-
import type { Command } from './utils/commander';
|
|
4
|
-
import type { NormalizedConfig } from './config/mergeConfig';
|
|
5
|
-
import type { UserConfig } from './config';
|
|
6
|
-
import { pluginAPI } from './pluginAPI';
|
|
7
|
-
export declare type HooksRunner = ToRunners<{
|
|
8
|
-
config: ParallelWorkflow<void, UserConfig>;
|
|
9
|
-
resolvedConfig: AsyncWaterfall<{
|
|
10
|
-
resolved: NormalizedConfig;
|
|
11
|
-
}>;
|
|
12
|
-
validateSchema: ParallelWorkflow<void>;
|
|
13
|
-
prepare: AsyncWorkflow<void, void>;
|
|
14
|
-
commands: AsyncWorkflow<{
|
|
15
|
-
program: Command;
|
|
16
|
-
}, void>;
|
|
17
|
-
watchFiles: ParallelWorkflow<void>;
|
|
18
|
-
fileChange: AsyncWorkflow<{
|
|
19
|
-
filename: string;
|
|
20
|
-
eventType: 'add' | 'change' | 'unlink';
|
|
21
|
-
}, void>;
|
|
22
|
-
beforeExit: AsyncWorkflow<void, void>;
|
|
23
|
-
beforeRestart: AsyncWorkflow<void, void>;
|
|
24
|
-
}>;
|
|
25
|
-
declare const baseHooks: {
|
|
26
|
-
config: ParallelWorkflow<void, UserConfig>;
|
|
27
|
-
resolvedConfig: AsyncWaterfall<{
|
|
28
|
-
resolved: NormalizedConfig;
|
|
29
|
-
}>;
|
|
30
|
-
validateSchema: ParallelWorkflow<void, unknown>;
|
|
31
|
-
prepare: AsyncWorkflow<void, void>;
|
|
32
|
-
commands: AsyncWorkflow<{
|
|
33
|
-
program: Command;
|
|
34
|
-
}, void>;
|
|
35
|
-
watchFiles: ParallelWorkflow<void, unknown>;
|
|
36
|
-
fileChange: AsyncWorkflow<{
|
|
37
|
-
filename: string;
|
|
38
|
-
eventType: 'add' | 'change' | 'unlink';
|
|
39
|
-
}, void>;
|
|
40
|
-
beforeExit: AsyncWorkflow<void, void>;
|
|
41
|
-
beforeRestart: AsyncWorkflow<void, void>;
|
|
42
|
-
};
|
|
43
|
-
/** All hooks of cli plugin. */
|
|
44
|
-
|
|
45
|
-
export declare type CliHooks = typeof baseHooks & Hooks;
|
|
46
|
-
/** All hook callbacks of cli plugin. */
|
|
47
|
-
|
|
48
|
-
export declare type CliHookCallbacks = ToThreads<CliHooks>;
|
|
49
|
-
export declare const manager: import("@modern-js/plugin").AsyncManager<CliHooks, {
|
|
50
|
-
setAppContext: (value: import("@modern-js/types").IAppContext) => void;
|
|
51
|
-
useAppContext: () => import("@modern-js/types").IAppContext;
|
|
52
|
-
useConfigContext: () => UserConfig;
|
|
53
|
-
useResolvedConfigContext: () => NormalizedConfig;
|
|
54
|
-
}>;
|
|
55
|
-
/** Plugin options of a cli plugin. */
|
|
56
|
-
|
|
57
|
-
export declare type CliPlugin = PluginOptions<CliHooks, AsyncSetup<CliHooks, typeof pluginAPI>>;
|
|
58
|
-
export declare const createPlugin: (setup?: AsyncSetup<CliHooks, {
|
|
59
|
-
setAppContext: (value: import("@modern-js/types").IAppContext) => void;
|
|
60
|
-
useAppContext: () => import("@modern-js/types").IAppContext;
|
|
61
|
-
useConfigContext: () => UserConfig;
|
|
62
|
-
useResolvedConfigContext: () => NormalizedConfig;
|
|
63
|
-
}> | undefined, options?: PluginOptions<CliHooks, AsyncSetup<CliHooks, {
|
|
64
|
-
setAppContext: (value: import("@modern-js/types").IAppContext) => void;
|
|
65
|
-
useAppContext: () => import("@modern-js/types").IAppContext;
|
|
66
|
-
useConfigContext: () => UserConfig;
|
|
67
|
-
useResolvedConfigContext: () => NormalizedConfig;
|
|
68
|
-
}>> | undefined) => import("@modern-js/plugin").AsyncPlugin<CliHooks, {
|
|
69
|
-
setAppContext: (value: import("@modern-js/types").IAppContext) => void;
|
|
70
|
-
useAppContext: () => import("@modern-js/types").IAppContext;
|
|
71
|
-
useConfigContext: () => UserConfig;
|
|
72
|
-
useResolvedConfigContext: () => NormalizedConfig;
|
|
73
|
-
}>, registerHook: (newHooks: Partial<CliHooks>) => void, mountHook: () => ToRunners<CliHooks>;
|
|
74
|
-
export declare const usePlugins: (plugins: string[]) => void;
|
|
75
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { CommonAPI } from '@modern-js/plugin';
|
|
2
|
-
import type { CliHooks } from './manager';
|
|
3
|
-
import { AppContext, ConfigContext, useAppContext, useConfigContext, ResolvedConfigContext, useResolvedConfigContext } from './context';
|
|
4
|
-
export declare const pluginAPI: {
|
|
5
|
-
setAppContext: (value: import("@modern-js/types/cli").IAppContext) => void;
|
|
6
|
-
useAppContext: () => import("@modern-js/types/cli").IAppContext;
|
|
7
|
-
useConfigContext: () => import("./config").UserConfig;
|
|
8
|
-
useResolvedConfigContext: () => import(".").NormalizedConfig;
|
|
9
|
-
};
|
|
10
|
-
/** all apis for cli plugin */
|
|
11
|
-
|
|
12
|
-
export declare type PluginAPI = typeof pluginAPI & CommonAPI<CliHooks>;
|
|
13
|
-
export { AppContext, ConfigContext, ResolvedConfigContext, useAppContext, useConfigContext, useResolvedConfigContext };
|