@modern-js/core 2.53.0 → 2.54.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/context.d.ts +3 -3
- package/dist/context.js +3 -2
- package/dist/createCli.d.ts +1 -3
- package/dist/createCli.js +4 -3
- package/dist/types/context.d.ts +5 -3
- package/dist/types/coreOptions.d.ts +1 -0
- package/package.json +8 -8
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CliPlugin, UserConfig, IAppContext,
|
|
1
|
+
import type { CliPlugin, UserConfig, IAppContext, NormalizedConfig } 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,10 +19,11 @@ 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,
|
|
22
|
+
export declare const initAppContext: ({ appDirectory, plugins, configFile, runtimeConfigFile, options, serverConfigFile, }: {
|
|
23
23
|
appDirectory: string;
|
|
24
24
|
plugins: CliPlugin[];
|
|
25
25
|
configFile: string | false;
|
|
26
|
+
runtimeConfigFile: string | false;
|
|
26
27
|
options?: {
|
|
27
28
|
metaName?: string | undefined;
|
|
28
29
|
srcDir?: string | undefined;
|
|
@@ -31,5 +32,4 @@ export declare const initAppContext: ({ appDirectory, plugins, configFile, optio
|
|
|
31
32
|
sharedDir?: string | undefined;
|
|
32
33
|
} | undefined;
|
|
33
34
|
serverConfigFile: string;
|
|
34
|
-
serverInternalPlugins: InternalPlugins;
|
|
35
35
|
}) => IAppContext;
|
package/dist/context.js
CHANGED
|
@@ -48,14 +48,14 @@ const setAppContext = (value) => AppContext.set(value);
|
|
|
48
48
|
const useAppContext = () => AppContext.use().value;
|
|
49
49
|
const useConfigContext = () => ConfigContext.use().value;
|
|
50
50
|
const useResolvedConfigContext = () => ResolvedConfigContext.use().value;
|
|
51
|
-
const initAppContext = ({ appDirectory, plugins, configFile, options, serverConfigFile
|
|
51
|
+
const initAppContext = ({ appDirectory, plugins, configFile, runtimeConfigFile, options, serverConfigFile }) => {
|
|
52
52
|
const { metaName = "modern-js", srcDir = "src", distDir = "", apiDir = "api", sharedDir = "shared" } = options || {};
|
|
53
53
|
return {
|
|
54
54
|
metaName,
|
|
55
55
|
appDirectory,
|
|
56
56
|
configFile,
|
|
57
|
+
runtimeConfigFile,
|
|
57
58
|
serverConfigFile,
|
|
58
|
-
serverInternalPlugins,
|
|
59
59
|
ip: import_utils.address.ip(),
|
|
60
60
|
port: 0,
|
|
61
61
|
packageName: require(import_path.default.resolve(appDirectory, "./package.json")).name,
|
|
@@ -65,6 +65,7 @@ const initAppContext = ({ appDirectory, plugins, configFile, options, serverConf
|
|
|
65
65
|
distDirectory: distDir,
|
|
66
66
|
sharedDirectory: import_path.default.resolve(appDirectory, sharedDir),
|
|
67
67
|
nodeModulesDirectory: import_path.default.resolve(appDirectory, "./node_modules"),
|
|
68
|
+
serverPlugins: [],
|
|
68
69
|
internalDirectory: import_path.default.resolve(appDirectory, `./node_modules/.${metaName}`),
|
|
69
70
|
plugins,
|
|
70
71
|
htmlTemplates: {},
|
package/dist/createCli.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { CoreOptions } from './types';
|
|
2
|
-
export declare const mergeOptions: (options?: CoreOptions) => CoreOptions
|
|
3
|
-
serverConfigFile: string;
|
|
4
|
-
};
|
|
2
|
+
export declare const mergeOptions: (options?: CoreOptions) => CoreOptions;
|
|
5
3
|
export declare const createCli: () => {
|
|
6
4
|
init: (options?: CoreOptions) => Promise<{
|
|
7
5
|
resolved: import("./types").NormalizedConfig<{}>;
|
package/dist/createCli.js
CHANGED
|
@@ -35,6 +35,7 @@ const setProgramVersion = (version = "unknown") => {
|
|
|
35
35
|
};
|
|
36
36
|
const mergeOptions = (options) => {
|
|
37
37
|
const defaultOptions = {
|
|
38
|
+
runtimeConfigFile: import_utils.DEFAULT_RUNTIME_CONFIG,
|
|
38
39
|
serverConfigFile: import_utils.DEFAULT_SERVER_CONFIG
|
|
39
40
|
};
|
|
40
41
|
return {
|
|
@@ -46,7 +47,7 @@ const createCli = () => {
|
|
|
46
47
|
let hooksRunner;
|
|
47
48
|
let initOptions;
|
|
48
49
|
const init = async (options) => {
|
|
49
|
-
var _mergedOptions_options, _mergedOptions_internalPlugins, _mergedOptions_internalPlugins1
|
|
50
|
+
var _mergedOptions_options, _mergedOptions_internalPlugins, _mergedOptions_internalPlugins1;
|
|
50
51
|
import_manager.manager.clear();
|
|
51
52
|
const mergedOptions = mergeOptions(options);
|
|
52
53
|
initOptions = mergedOptions;
|
|
@@ -68,9 +69,9 @@ const createCli = () => {
|
|
|
68
69
|
appDirectory,
|
|
69
70
|
plugins,
|
|
70
71
|
configFile: loaded.filePath,
|
|
72
|
+
runtimeConfigFile: (mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.runtimeConfigFile) || "",
|
|
71
73
|
options: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.options,
|
|
72
|
-
serverConfigFile: mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.serverConfigFile
|
|
73
|
-
serverInternalPlugins: (mergedOptions === null || mergedOptions === void 0 ? void 0 : (_mergedOptions_internalPlugins2 = mergedOptions.internalPlugins) === null || _mergedOptions_internalPlugins2 === void 0 ? void 0 : _mergedOptions_internalPlugins2.server) || import_utils.INTERNAL_SERVER_PLUGINS
|
|
74
|
+
serverConfigFile: (mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.serverConfigFile) || ""
|
|
74
75
|
});
|
|
75
76
|
import_context.ConfigContext.set(loaded.config);
|
|
76
77
|
import_context.AppContext.set(appContext);
|
package/dist/types/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Entrypoint,
|
|
1
|
+
import { Entrypoint, ServerRoute, HtmlTemplates, HtmlPartials, ServerPlugin } from '@modern-js/types';
|
|
2
2
|
import type { UniBuilderInstance, UniBuilderWebpackInstance } from '@modern-js/uni-builder';
|
|
3
3
|
export type ToolsType = 'app-tools' | 'module-tools' | 'monorepo-tools';
|
|
4
4
|
export interface IAppContext {
|
|
@@ -22,10 +22,12 @@ export interface IAppContext {
|
|
|
22
22
|
nodeModulesDirectory: string;
|
|
23
23
|
/** Path to the configuration file */
|
|
24
24
|
configFile: string | false;
|
|
25
|
+
/** Path to the runtime configuration file */
|
|
26
|
+
runtimeConfigFile: string | false;
|
|
25
27
|
/** Path to the server configuration file */
|
|
26
28
|
serverConfigFile: string;
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
+
/** Server Plugins */
|
|
30
|
+
serverPlugins: ServerPlugin[];
|
|
29
31
|
/** IPv4 address of the current machine */
|
|
30
32
|
ip?: string;
|
|
31
33
|
/** Port number of the development server */
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"modern",
|
|
15
15
|
"modern.js"
|
|
16
16
|
],
|
|
17
|
-
"version": "2.
|
|
17
|
+
"version": "2.54.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.
|
|
75
|
-
"@modern-js/
|
|
76
|
-
"@modern-js/
|
|
74
|
+
"@modern-js/node-bundle-require": "2.54.1",
|
|
75
|
+
"@modern-js/plugin": "2.54.1",
|
|
76
|
+
"@modern-js/utils": "2.54.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/uni-builder": "2.
|
|
85
|
-
"@modern-js/types": "2.
|
|
86
|
-
"@scripts/build": "2.
|
|
87
|
-
"@scripts/jest-config": "2.
|
|
84
|
+
"@modern-js/uni-builder": "2.54.1",
|
|
85
|
+
"@modern-js/types": "2.54.1",
|
|
86
|
+
"@scripts/build": "2.54.1",
|
|
87
|
+
"@scripts/jest-config": "2.54.1"
|
|
88
88
|
},
|
|
89
89
|
"sideEffects": false,
|
|
90
90
|
"publishConfig": {
|