@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
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getAppPlugins = getAppPlugins;
|
|
7
|
-
exports.loadPlugins = void 0;
|
|
8
|
-
|
|
9
|
-
var _utils = require("@modern-js/utils");
|
|
10
|
-
|
|
11
|
-
var _manager = require("./manager");
|
|
12
|
-
|
|
13
|
-
const debug = (0, _utils.createDebugger)('load-plugins');
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Try to resolve plugin entry file path.
|
|
17
|
-
* @param name - Plugin name.
|
|
18
|
-
* @param appDirectory - Application root directory.
|
|
19
|
-
* @returns Resolved file path.
|
|
20
|
-
*/
|
|
21
|
-
const tryResolve = (name, appDirectory) => {
|
|
22
|
-
let filePath = '';
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
filePath = require.resolve(name, {
|
|
26
|
-
paths: [appDirectory]
|
|
27
|
-
});
|
|
28
|
-
delete require.cache[filePath];
|
|
29
|
-
} catch (err) {
|
|
30
|
-
if (err.code === 'MODULE_NOT_FOUND') {
|
|
31
|
-
throw new Error(`Can not find plugin ${name}.`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
throw err;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return filePath;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
function getAppPlugins(appDirectory, oldPluginConfig, internalPlugins) {
|
|
41
|
-
const allPlugins = internalPlugins || _utils.INTERNAL_PLUGINS;
|
|
42
|
-
const appPlugins = [...Object.keys(allPlugins).filter(name => {
|
|
43
|
-
const config = allPlugins[name];
|
|
44
|
-
|
|
45
|
-
if (config.forced === true) {
|
|
46
|
-
// 参考 packages/cli/core/src/cli.ts 文件
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return (0, _utils.isDepExists)(appDirectory, name);
|
|
51
|
-
}).map(name => allPlugins[name]), ...oldPluginConfig];
|
|
52
|
-
return appPlugins;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const resolveCliPlugin = (p, userConfig, appDirectory, transformPlugin) => {
|
|
56
|
-
const pkg = typeof p === 'string' ? p : p[0];
|
|
57
|
-
const pluginOptions = typeof p === 'string' ? undefined : p[1];
|
|
58
|
-
const path = tryResolve(pkg, appDirectory);
|
|
59
|
-
let module = (0, _utils.compatRequire)(path);
|
|
60
|
-
|
|
61
|
-
if (transformPlugin) {
|
|
62
|
-
module = transformPlugin(module, userConfig, pluginOptions);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (typeof module === 'function') {
|
|
66
|
-
const result = module(pluginOptions);
|
|
67
|
-
return (0, _manager.createPlugin)(result.setup, result);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return module;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const isOldPluginConfig = config => Array.isArray(config) && config.some(item => {
|
|
74
|
-
if (typeof item === 'string' || Array.isArray(item)) {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return 'cli' in item || 'server' in item;
|
|
79
|
-
});
|
|
80
|
-
/**
|
|
81
|
-
* Load internal plugins which in @modern-js scope and user's custom plugins.
|
|
82
|
-
* @param appDirectory - Application root directory.
|
|
83
|
-
* @param userConfig - Resolved user config.
|
|
84
|
-
* @param options.internalPlugins - Internal plugins.
|
|
85
|
-
* @param options.transformPlugin - transform plugin before using it. Used for compatible with legacy jupiter plugins.
|
|
86
|
-
* @returns Plugin Objects has been required.
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const loadPlugins = (appDirectory, userConfig, options = {}) => {
|
|
91
|
-
const pluginConfig = userConfig.plugins;
|
|
92
|
-
const plugins = getAppPlugins(appDirectory, isOldPluginConfig(pluginConfig) ? pluginConfig : [], options.internalPlugins);
|
|
93
|
-
const loadedPlugins = plugins.map(plugin => {
|
|
94
|
-
const _plugin = typeof plugin === 'string' || Array.isArray(plugin) ? {
|
|
95
|
-
cli: plugin
|
|
96
|
-
} : plugin;
|
|
97
|
-
|
|
98
|
-
const {
|
|
99
|
-
cli,
|
|
100
|
-
server
|
|
101
|
-
} = _plugin;
|
|
102
|
-
const loadedPlugin = {};
|
|
103
|
-
|
|
104
|
-
if (cli) {
|
|
105
|
-
loadedPlugin.cli = resolveCliPlugin(cli, userConfig, appDirectory, options.transformPlugin);
|
|
106
|
-
} // server plugins don't support to accept params
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (server && typeof server === 'string') {
|
|
110
|
-
loadedPlugin.server = server;
|
|
111
|
-
loadedPlugin.serverPkg = server;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
debug(`resolve plugin %s: %s`, plugin, {
|
|
115
|
-
cli: loadedPlugin.cli,
|
|
116
|
-
server: loadedPlugin.server
|
|
117
|
-
});
|
|
118
|
-
return loadedPlugin;
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
if (!isOldPluginConfig(pluginConfig)) {
|
|
122
|
-
const cliPlugins = Array.isArray(pluginConfig) ? pluginConfig : pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.cli;
|
|
123
|
-
|
|
124
|
-
if (cliPlugins !== null && cliPlugins !== void 0 && cliPlugins.length) {
|
|
125
|
-
loadedPlugins.push(...cliPlugins.map(item => ({
|
|
126
|
-
cli: (0, _manager.createPlugin)(item.setup, item)
|
|
127
|
-
})));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return loadedPlugins;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
exports.loadPlugins = loadPlugins;
|
package/dist/js/node/manager.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.usePlugins = exports.registerHook = exports.mountHook = exports.manager = exports.createPlugin = void 0;
|
|
7
|
-
|
|
8
|
-
var _plugin = require("@modern-js/plugin");
|
|
9
|
-
|
|
10
|
-
var _utils = require("@modern-js/utils");
|
|
11
|
-
|
|
12
|
-
var _pluginAPI = require("./pluginAPI");
|
|
13
|
-
|
|
14
|
-
const baseHooks = {
|
|
15
|
-
config: (0, _plugin.createParallelWorkflow)(),
|
|
16
|
-
resolvedConfig: (0, _plugin.createAsyncWaterfall)(),
|
|
17
|
-
validateSchema: (0, _plugin.createParallelWorkflow)(),
|
|
18
|
-
prepare: (0, _plugin.createAsyncWorkflow)(),
|
|
19
|
-
commands: (0, _plugin.createAsyncWorkflow)(),
|
|
20
|
-
watchFiles: (0, _plugin.createParallelWorkflow)(),
|
|
21
|
-
fileChange: (0, _plugin.createAsyncWorkflow)(),
|
|
22
|
-
beforeExit: (0, _plugin.createAsyncWorkflow)(),
|
|
23
|
-
beforeRestart: (0, _plugin.createAsyncWorkflow)()
|
|
24
|
-
};
|
|
25
|
-
/** All hooks of cli plugin. */
|
|
26
|
-
|
|
27
|
-
const manager = (0, _plugin.createAsyncManager)(baseHooks, _pluginAPI.pluginAPI);
|
|
28
|
-
/** Plugin options of a cli plugin. */
|
|
29
|
-
|
|
30
|
-
exports.manager = manager;
|
|
31
|
-
const {
|
|
32
|
-
createPlugin,
|
|
33
|
-
registerHook,
|
|
34
|
-
useRunner: mountHook
|
|
35
|
-
} = manager;
|
|
36
|
-
exports.mountHook = mountHook;
|
|
37
|
-
exports.registerHook = registerHook;
|
|
38
|
-
exports.createPlugin = createPlugin;
|
|
39
|
-
|
|
40
|
-
const usePlugins = plugins => plugins.forEach(pluginPath => {
|
|
41
|
-
const module = (0, _utils.compatRequire)(require.resolve(pluginPath));
|
|
42
|
-
manager.usePlugin(module);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
exports.usePlugins = usePlugins;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "AppContext", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _context.AppContext;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "ConfigContext", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _context.ConfigContext;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "ResolvedConfigContext", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _context.ResolvedConfigContext;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
exports.pluginAPI = void 0;
|
|
25
|
-
Object.defineProperty(exports, "useAppContext", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _context.useAppContext;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "useConfigContext", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return _context.useConfigContext;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(exports, "useResolvedConfigContext", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function () {
|
|
40
|
-
return _context.useResolvedConfigContext;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
var _context = require("./context");
|
|
45
|
-
|
|
46
|
-
const pluginAPI = {
|
|
47
|
-
setAppContext: _context.setAppContext,
|
|
48
|
-
useAppContext: _context.useAppContext,
|
|
49
|
-
useConfigContext: _context.useConfigContext,
|
|
50
|
-
useResolvedConfigContext: _context.useResolvedConfigContext
|
|
51
|
-
};
|
|
52
|
-
/** all apis for cli plugin */
|
|
53
|
-
|
|
54
|
-
exports.pluginAPI = pluginAPI;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.initCommandsMap = initCommandsMap;
|
|
7
|
-
Object.defineProperty(exports, "program", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _utils.program;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
var _utils = require("@modern-js/utils");
|
|
15
|
-
|
|
16
|
-
function initCommandsMap() {
|
|
17
|
-
if (!_utils.program.hasOwnProperty('commandsMap')) {
|
|
18
|
-
Object.defineProperty(_utils.program, 'commandsMap', {
|
|
19
|
-
get() {
|
|
20
|
-
const map = new Map();
|
|
21
|
-
|
|
22
|
-
for (const command of _utils.program.commands) {
|
|
23
|
-
map.set(command._name, command);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return map;
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
configurable: false
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.repeatKeyWarning = exports.deepGet = void 0;
|
|
7
|
-
|
|
8
|
-
var _schema = require("../config/schema");
|
|
9
|
-
|
|
10
|
-
const deepGet = (obj, key) => {
|
|
11
|
-
for (const p of key.split('.')) {
|
|
12
|
-
// eslint-disable-next-line no-param-reassign
|
|
13
|
-
obj = obj ? obj[p] : undefined;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return obj;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
exports.deepGet = deepGet;
|
|
20
|
-
|
|
21
|
-
const repeatKeyWarning = (schema, jsConfig, pkgConfig) => {
|
|
22
|
-
const keys = (0, _schema.traverseSchema)(schema);
|
|
23
|
-
|
|
24
|
-
for (const key of keys) {
|
|
25
|
-
if (deepGet(jsConfig, key) !== undefined && deepGet(pkgConfig, key) !== undefined) {
|
|
26
|
-
throw new Error(`The same configuration ${key} exists in modern.config.js and package.json.\n Please remove it from package.json.`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
exports.repeatKeyWarning = repeatKeyWarning;
|
package/dist/types/cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { OutputConfig, ServerConfig, SourceConfig } from '.';
|
|
2
|
-
export declare const defaults: {
|
|
3
|
-
source: SourceConfig;
|
|
4
|
-
output: OutputConfig;
|
|
5
|
-
server: ServerConfig;
|
|
6
|
-
dev: {
|
|
7
|
-
assetPrefix: boolean;
|
|
8
|
-
https: boolean;
|
|
9
|
-
};
|
|
10
|
-
deploy: {
|
|
11
|
-
domain: string;
|
|
12
|
-
domainByEntries: undefined;
|
|
13
|
-
};
|
|
14
|
-
tools: {
|
|
15
|
-
webpack: undefined;
|
|
16
|
-
babel: undefined;
|
|
17
|
-
postcss: undefined;
|
|
18
|
-
autoprefixer: undefined;
|
|
19
|
-
lodash: undefined;
|
|
20
|
-
devServer: undefined;
|
|
21
|
-
tsLoader: undefined;
|
|
22
|
-
terser: undefined;
|
|
23
|
-
minifyCss: undefined;
|
|
24
|
-
};
|
|
25
|
-
plugins: never[];
|
|
26
|
-
runtime: {};
|
|
27
|
-
runtimeByEntries: {};
|
|
28
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ErrorObject } from 'ajv';
|
|
2
|
-
import { defaults } from './defaults';
|
|
3
|
-
import { mergeConfig, NormalizedConfig } from './mergeConfig';
|
|
4
|
-
import { PluginValidateSchema } from './schema';
|
|
5
|
-
import type { UserConfig, ConfigParam, LoadedConfig } from './types';
|
|
6
|
-
export { defaults as defaultsConfig };
|
|
7
|
-
export { mergeConfig };
|
|
8
|
-
export * from './types';
|
|
9
|
-
export declare const addServerConfigToDeps: (dependencies: string[], appDirectory: string, serverConfigFile: string) => Promise<void>;
|
|
10
|
-
export declare const defineConfig: (config: ConfigParam) => ConfigParam;
|
|
11
|
-
export declare const loadUserConfig: (appDirectory: string, filePath?: string | undefined, packageJsonConfig?: string | undefined) => Promise<LoadedConfig>;
|
|
12
|
-
export declare const resolveConfig: (loaded: LoadedConfig, configs: UserConfig[], schemas: PluginValidateSchema[], restartWithExistingPort: number, argv: string[], onSchemaError?: (error: ErrorObject) => void) => Promise<NormalizedConfig>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { UserConfig, SourceConfig, ToolsConfig } from '.';
|
|
2
|
-
export interface NormalizedSourceConfig extends Omit<SourceConfig, 'alias' | 'moduleScopes'> {
|
|
3
|
-
alias: SourceConfig['alias'] | Array<SourceConfig['alias']>;
|
|
4
|
-
moduleScopes: SourceConfig['moduleScopes'] | Array<SourceConfig['moduleScopes']>;
|
|
5
|
-
}
|
|
6
|
-
export interface NormalizedToolsConfig extends Omit<ToolsConfig, 'webpack' | 'babel' | 'postcss' | 'autoprefixer' | 'lodash' | 'tsLoader' | 'terser' | 'minifyCss' | 'esbuild' | 'styledComponents'> {
|
|
7
|
-
webpack: ToolsConfig['webpack'] | Array<NonNullable<ToolsConfig['webpack']>>;
|
|
8
|
-
babel: ToolsConfig['babel'] | Array<NonNullable<ToolsConfig['babel']>>;
|
|
9
|
-
postcss: ToolsConfig['postcss'] | Array<NonNullable<ToolsConfig['postcss']>>;
|
|
10
|
-
styledComponents: ToolsConfig['styledComponents'] | Array<NonNullable<ToolsConfig['styledComponents']>>;
|
|
11
|
-
autoprefixer: ToolsConfig['autoprefixer'] | Array<NonNullable<ToolsConfig['autoprefixer']>>;
|
|
12
|
-
lodash: ToolsConfig['lodash'] | Array<ToolsConfig['lodash']>;
|
|
13
|
-
tsLoader: ToolsConfig['tsLoader'] | Array<NonNullable<ToolsConfig['tsLoader']>>;
|
|
14
|
-
terser: ToolsConfig['terser'] | Array<NonNullable<ToolsConfig['terser']>>;
|
|
15
|
-
minifyCss: ToolsConfig['minifyCss'] | Array<NonNullable<ToolsConfig['minifyCss']>>;
|
|
16
|
-
esbuild: ToolsConfig['esbuild'] | Array<NonNullable<ToolsConfig['esbuild']>>;
|
|
17
|
-
}
|
|
18
|
-
export interface NormalizedConfig extends Omit<Required<UserConfig>, 'source' | 'tools'> {
|
|
19
|
-
source: NormalizedSourceConfig;
|
|
20
|
-
tools: NormalizedToolsConfig;
|
|
21
|
-
cliOptions?: Record<string, any>;
|
|
22
|
-
_raw: UserConfig;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* merge configuration from modern.config.js and plugins.
|
|
26
|
-
*
|
|
27
|
-
* @param configs - Configuration from modern.config.ts or plugin's config hook.
|
|
28
|
-
* @returns - normalized user config.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
export declare const mergeConfig: (configs: Array<UserConfig | NormalizedConfig>) => NormalizedConfig;
|