@modern-js/core 0.0.0-options-202112031434 → 0.0.0-options-202112061447
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/js/modern/config/schema/server.js +3 -0
- package/dist/js/modern/index.js +3 -2
- package/dist/js/node/config/schema/server.js +3 -0
- package/dist/js/node/index.js +19 -1
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/config/schema/index.d.ts +3 -0
- package/dist/types/config/schema/server.d.ts +3 -0
- package/dist/types/index.d.ts +6 -4
- package/package.json +5 -5
- package/src/config/index.ts +1 -0
- package/src/config/schema/server.ts +1 -0
- package/src/index.ts +4 -2
package/dist/js/modern/index.js
CHANGED
|
@@ -60,7 +60,7 @@ const createCli = () => {
|
|
|
60
60
|
manager.clear();
|
|
61
61
|
const appDirectory = await initAppDir();
|
|
62
62
|
loadEnv(appDirectory);
|
|
63
|
-
const loaded = await loadUserConfig(appDirectory);
|
|
63
|
+
const loaded = await loadUserConfig(appDirectory, options === null || options === void 0 ? void 0 : options.configFile);
|
|
64
64
|
let plugins = loadPlugins(appDirectory, loaded.config.plugins || [], options === null || options === void 0 ? void 0 : options.plugins);
|
|
65
65
|
|
|
66
66
|
if (options !== null && options !== void 0 && options.beforeUsePlugins) {
|
|
@@ -150,4 +150,5 @@ const createCli = () => {
|
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
-
export const cli = createCli();
|
|
153
|
+
export const cli = createCli();
|
|
154
|
+
export { loadUserConfig, initAppDir, initAppContext };
|
package/dist/js/node/index.js
CHANGED
|
@@ -10,10 +10,13 @@ var _exportNames = {
|
|
|
10
10
|
mountHook: true,
|
|
11
11
|
usePlugins: true,
|
|
12
12
|
cli: true,
|
|
13
|
+
initAppDir: true,
|
|
13
14
|
defineConfig: true,
|
|
15
|
+
loadUserConfig: true,
|
|
14
16
|
defaultsConfig: true,
|
|
15
17
|
mergeConfig: true,
|
|
16
18
|
AppContext: true,
|
|
19
|
+
initAppContext: true,
|
|
17
20
|
useAppContext: true,
|
|
18
21
|
useConfigContext: true,
|
|
19
22
|
useResolvedConfigContext: true
|
|
@@ -37,6 +40,19 @@ Object.defineProperty(exports, "defineConfig", {
|
|
|
37
40
|
return _config.defineConfig;
|
|
38
41
|
}
|
|
39
42
|
});
|
|
43
|
+
Object.defineProperty(exports, "initAppContext", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _context.initAppContext;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
exports.initAppDir = void 0;
|
|
50
|
+
Object.defineProperty(exports, "loadUserConfig", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return _config.loadUserConfig;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
40
56
|
exports.manager = void 0;
|
|
41
57
|
Object.defineProperty(exports, "mergeConfig", {
|
|
42
58
|
enumerable: true,
|
|
@@ -158,6 +174,8 @@ const initAppDir = async () => {
|
|
|
158
174
|
return _path.default.dirname(pkg);
|
|
159
175
|
};
|
|
160
176
|
|
|
177
|
+
exports.initAppDir = initAppDir;
|
|
178
|
+
|
|
161
179
|
const createCli = () => {
|
|
162
180
|
let hooksRunner;
|
|
163
181
|
let isRestart = false;
|
|
@@ -167,7 +185,7 @@ const createCli = () => {
|
|
|
167
185
|
manager.clear();
|
|
168
186
|
const appDirectory = await initAppDir();
|
|
169
187
|
(0, _loadEnv.loadEnv)(appDirectory);
|
|
170
|
-
const loaded = await (0, _config.loadUserConfig)(appDirectory);
|
|
188
|
+
const loaded = await (0, _config.loadUserConfig)(appDirectory, options === null || options === void 0 ? void 0 : options.configFile);
|
|
171
189
|
let plugins = (0, _loadPlugins.loadPlugins)(appDirectory, loaded.config.plugins || [], options === null || options === void 0 ? void 0 : options.plugins);
|
|
172
190
|
|
|
173
191
|
if (options !== null && options !== void 0 && options.beforeUsePlugins) {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { INTERNAL_PLUGINS } from '@modern-js/utils';
|
|
|
2
2
|
import { ParallelWorkflow, AsyncWorkflow, Progresses2Runners, AsyncWaterfall } from '@modern-js/plugin';
|
|
3
3
|
import type { Hooks } from '@modern-js/types';
|
|
4
4
|
import { Command } from './utils/commander';
|
|
5
|
-
import { defineConfig, UserConfig, ToolsConfig } from './config';
|
|
6
|
-
import { AppContext, IAppContext, useAppContext, useConfigContext, useResolvedConfigContext } from './context';
|
|
5
|
+
import { defineConfig, loadUserConfig, UserConfig, ToolsConfig } from './config';
|
|
6
|
+
import { AppContext, IAppContext, initAppContext, useAppContext, useConfigContext, useResolvedConfigContext } from './context';
|
|
7
7
|
import { NormalizedConfig } from './config/mergeConfig';
|
|
8
8
|
export type { Hooks };
|
|
9
9
|
export { defaultsConfig, mergeConfig } from './config';
|
|
@@ -90,8 +90,9 @@ export declare const createPlugin: (initializer: import("@modern-js/plugin").Asy
|
|
|
90
90
|
export declare const usePlugins: (plugins: string[]) => void;
|
|
91
91
|
export { defineConfig, AppContext, useAppContext, useConfigContext, useResolvedConfigContext };
|
|
92
92
|
export type { NormalizedConfig, IAppContext, UserConfig, ToolsConfig };
|
|
93
|
+
declare const initAppDir: () => Promise<string>;
|
|
93
94
|
export interface CoreOptions {
|
|
94
|
-
|
|
95
|
+
configFile?: string;
|
|
95
96
|
plugins?: typeof INTERNAL_PLUGINS;
|
|
96
97
|
beforeUsePlugins: (plugins: any, config: any) => {
|
|
97
98
|
cli: any;
|
|
@@ -106,4 +107,5 @@ export declare const cli: {
|
|
|
106
107
|
}>;
|
|
107
108
|
run: (argv: string[], options?: CoreOptions | undefined) => Promise<void>;
|
|
108
109
|
restart: () => Promise<void>;
|
|
109
|
-
};
|
|
110
|
+
};
|
|
111
|
+
export { loadUserConfig, initAppDir, initAppContext };
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.0-options-
|
|
14
|
+
"version": "0.0.0-options-202112061447",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@babel/code-frame": "^7.14.5",
|
|
48
48
|
"@babel/runtime": "^7",
|
|
49
|
-
"@modern-js/load-config": "
|
|
50
|
-
"@modern-js/plugin": "
|
|
51
|
-
"@modern-js/utils": "
|
|
49
|
+
"@modern-js/load-config": "^1.1.1",
|
|
50
|
+
"@modern-js/plugin": "^1.1.2",
|
|
51
|
+
"@modern-js/utils": "^1.1.2",
|
|
52
52
|
"address": "^1.1.2",
|
|
53
53
|
"ajv": "^8.6.2",
|
|
54
54
|
"ajv-keywords": "^5.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/babel__code-frame": "^7.0.3",
|
|
68
|
-
"@modern-js/types": "
|
|
68
|
+
"@modern-js/types": "^1.1.2",
|
|
69
69
|
"@types/jest": "^26",
|
|
70
70
|
"@types/lodash.clonedeep": "^4.5.6",
|
|
71
71
|
"@types/lodash.mergewith": "^4.6.6",
|
package/src/config/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -139,7 +139,7 @@ const initAppDir = async (): Promise<string> => {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
export interface CoreOptions {
|
|
142
|
-
|
|
142
|
+
configFile?: string;
|
|
143
143
|
plugins?: typeof INTERNAL_PLUGINS;
|
|
144
144
|
beforeUsePlugins: (plugins: any, config: any) => { cli: any; server: any }[];
|
|
145
145
|
}
|
|
@@ -157,7 +157,7 @@ const createCli = () => {
|
|
|
157
157
|
|
|
158
158
|
loadEnv(appDirectory);
|
|
159
159
|
|
|
160
|
-
const loaded = await loadUserConfig(appDirectory);
|
|
160
|
+
const loaded = await loadUserConfig(appDirectory, options?.configFile);
|
|
161
161
|
|
|
162
162
|
let plugins = loadPlugins(
|
|
163
163
|
appDirectory,
|
|
@@ -268,3 +268,5 @@ const createCli = () => {
|
|
|
268
268
|
};
|
|
269
269
|
|
|
270
270
|
export const cli = createCli();
|
|
271
|
+
|
|
272
|
+
export { loadUserConfig, initAppDir, initAppContext };
|