@modern-js/core 0.0.0-options-202112061451 → 0.0.0-runtime-2021112193858
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 +50 -0
- package/dist/js/modern/config/index.js +2 -2
- package/dist/js/modern/config/schema/output.js +0 -3
- package/dist/js/modern/config/schema/server.js +1 -1
- package/dist/js/modern/index.js +3 -3
- package/dist/js/modern/loadPlugins.js +3 -1
- package/dist/js/node/config/index.js +2 -2
- package/dist/js/node/config/schema/output.js +0 -3
- package/dist/js/node/config/schema/server.js +1 -1
- package/dist/js/node/index.js +16 -2
- package/dist/js/node/loadPlugins.js +3 -1
- package/dist/types/config/index.d.ts +2 -2
- package/dist/types/config/mergeConfig.d.ts +1 -0
- package/dist/types/config/schema/index.d.ts +1 -4
- package/dist/types/config/schema/output.d.ts +0 -3
- package/dist/types/config/schema/server.d.ts +1 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/loadPlugins.d.ts +2 -0
- package/package.json +15 -17
- package/src/config/index.ts +2 -2
- package/src/config/mergeConfig.ts +1 -0
- package/src/config/schema/output.ts +0 -1
- package/src/config/schema/server.ts +1 -1
- package/src/index.ts +6 -1
- package/src/loadPlugins.ts +2 -0
- package/tests/loadPlugin.test.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# @modern-js/core
|
|
2
2
|
|
|
3
|
+
## 0.0.0-runtime-2021112193858
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8698465e: fix: dependence version
|
|
8
|
+
- e04914ce: add route types, fix metrics types
|
|
9
|
+
- e04914ce: add route types, fix metrics types
|
|
10
|
+
- Updated dependencies [8698465e]
|
|
11
|
+
- @modern-js/load-config@0.0.0-runtime-2021112193858
|
|
12
|
+
- @modern-js/plugin@0.0.0-runtime-2021112193858
|
|
13
|
+
- @modern-js/utils@0.0.0-runtime-2021112193858
|
|
14
|
+
|
|
15
|
+
## 1.1.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- d73ff455: support multi process product
|
|
20
|
+
- d73ff455: support multi process product
|
|
21
|
+
- d73ff455: support multi process product
|
|
22
|
+
- d73ff455: support multi process product
|
|
23
|
+
- d73ff455: support multi process product
|
|
24
|
+
- Updated dependencies [d927bc83]
|
|
25
|
+
- Updated dependencies [d73ff455]
|
|
26
|
+
- Updated dependencies [9c1ab865]
|
|
27
|
+
- Updated dependencies [d73ff455]
|
|
28
|
+
- Updated dependencies [d73ff455]
|
|
29
|
+
- Updated dependencies [d73ff455]
|
|
30
|
+
- Updated dependencies [d73ff455]
|
|
31
|
+
- @modern-js/utils@1.1.4
|
|
32
|
+
|
|
33
|
+
## 1.1.3
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 085a6a58: refactor server plugin
|
|
38
|
+
- 085a6a58: refactor server plugin
|
|
39
|
+
- 085a6a58: refactor server conifg
|
|
40
|
+
- d4fcc73a: add options.plugins:
|
|
41
|
+
- 085a6a58: support server runtime
|
|
42
|
+
- ed1f6b12: feat: support build --analyze
|
|
43
|
+
- a5ebbb00: fix: remove enableUsageBuiltIns config
|
|
44
|
+
- 085a6a58: feat: refactor server plugin
|
|
45
|
+
- Updated dependencies [085a6a58]
|
|
46
|
+
- Updated dependencies [085a6a58]
|
|
47
|
+
- Updated dependencies [085a6a58]
|
|
48
|
+
- Updated dependencies [d280ea33]
|
|
49
|
+
- Updated dependencies [085a6a58]
|
|
50
|
+
- Updated dependencies [085a6a58]
|
|
51
|
+
- @modern-js/utils@1.1.3
|
|
52
|
+
|
|
3
53
|
## 1.1.2
|
|
4
54
|
|
|
5
55
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
package/dist/js/modern/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
@@ -37,7 +37,7 @@ export const {
|
|
|
37
37
|
useRunner: mountHook
|
|
38
38
|
} = manager;
|
|
39
39
|
export const usePlugins = plugins => plugins.forEach(plugin => manager.usePlugin(compatRequire(require.resolve(plugin))));
|
|
40
|
-
export { defineConfig, AppContext, useAppContext, useConfigContext, useResolvedConfigContext };
|
|
40
|
+
export { defineConfig, AppContext, ResolvedConfigContext, useAppContext, useConfigContext, useResolvedConfigContext, ConfigContext };
|
|
41
41
|
|
|
42
42
|
const initAppDir = async () => {
|
|
43
43
|
const pkg = await pkgUp({
|
|
@@ -60,7 +60,9 @@ export const loadPlugins = (appDirectory, pluginConfig, internalPlugins) => {
|
|
|
60
60
|
});
|
|
61
61
|
return {
|
|
62
62
|
cli: cli && compatRequire(cli),
|
|
63
|
-
|
|
63
|
+
cliPath: typeof plugin === 'string' ? plugin : plugin.cli,
|
|
64
|
+
server: server && compatRequire(server),
|
|
65
|
+
serverPath: typeof plugin === 'string' ? undefined : plugin.server
|
|
64
66
|
};
|
|
65
67
|
});
|
|
66
68
|
};
|
|
@@ -44,9 +44,9 @@ var _schema = require("./schema");
|
|
|
44
44
|
|
|
45
45
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
46
46
|
|
|
47
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
47
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
48
48
|
|
|
49
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
49
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
50
50
|
|
|
51
51
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
52
52
|
|
package/dist/js/node/index.js
CHANGED
|
@@ -16,7 +16,9 @@ var _exportNames = {
|
|
|
16
16
|
defaultsConfig: true,
|
|
17
17
|
mergeConfig: true,
|
|
18
18
|
AppContext: true,
|
|
19
|
+
ConfigContext: true,
|
|
19
20
|
initAppContext: true,
|
|
21
|
+
ResolvedConfigContext: true,
|
|
20
22
|
useAppContext: true,
|
|
21
23
|
useConfigContext: true,
|
|
22
24
|
useResolvedConfigContext: true
|
|
@@ -27,6 +29,18 @@ Object.defineProperty(exports, "AppContext", {
|
|
|
27
29
|
return _context.AppContext;
|
|
28
30
|
}
|
|
29
31
|
});
|
|
32
|
+
Object.defineProperty(exports, "ConfigContext", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _context.ConfigContext;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "ResolvedConfigContext", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _context.ResolvedConfigContext;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
30
44
|
exports.createPlugin = exports.cli = void 0;
|
|
31
45
|
Object.defineProperty(exports, "defaultsConfig", {
|
|
32
46
|
enumerable: true,
|
|
@@ -127,9 +141,9 @@ var _loadEnv = require("./loadEnv");
|
|
|
127
141
|
|
|
128
142
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
129
143
|
|
|
130
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
144
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
131
145
|
|
|
132
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
146
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
133
147
|
|
|
134
148
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
135
149
|
|
|
@@ -68,7 +68,9 @@ const loadPlugins = (appDirectory, pluginConfig, internalPlugins) => {
|
|
|
68
68
|
});
|
|
69
69
|
return {
|
|
70
70
|
cli: cli && (0, _utils.compatRequire)(cli),
|
|
71
|
-
|
|
71
|
+
cliPath: typeof plugin === 'string' ? plugin : plugin.cli,
|
|
72
|
+
server: server && (0, _utils.compatRequire)(server),
|
|
73
|
+
serverPath: typeof plugin === 'string' ? undefined : plugin.server
|
|
72
74
|
};
|
|
73
75
|
});
|
|
74
76
|
};
|
|
@@ -72,8 +72,8 @@ export interface ServerConfig {
|
|
|
72
72
|
ssrByEntries?: Record<string, boolean | Record<string, unknown>>;
|
|
73
73
|
baseUrl?: string | Array<string>;
|
|
74
74
|
port?: number;
|
|
75
|
-
logger?: Record<string,
|
|
76
|
-
|
|
75
|
+
logger?: Record<string, any>;
|
|
76
|
+
metrics?: Record<string, any>;
|
|
77
77
|
enableMicroFrontendDebug?: boolean;
|
|
78
78
|
}
|
|
79
79
|
export interface DevConfig {
|
|
@@ -17,6 +17,7 @@ export interface NormalizedToolsConfig extends Omit<ToolsConfig, 'webpack' | 'ba
|
|
|
17
17
|
export interface NormalizedConfig extends Omit<Required<UserConfig>, 'source' | 'tools'> {
|
|
18
18
|
source: NormalizedSourceConfig;
|
|
19
19
|
tools: NormalizedToolsConfig;
|
|
20
|
+
cliOptions?: Record<string, any>;
|
|
20
21
|
_raw: UserConfig;
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
@@ -173,9 +173,6 @@ export declare const patchSchema: (pluginSchemas: Array<PluginValidateSchema | P
|
|
|
173
173
|
enableLatestDecorators: {
|
|
174
174
|
type: string;
|
|
175
175
|
};
|
|
176
|
-
enableUsageBuiltIns: {
|
|
177
|
-
type: string;
|
|
178
|
-
};
|
|
179
176
|
enableTsLoader: {
|
|
180
177
|
type: string;
|
|
181
178
|
};
|
|
@@ -382,7 +379,7 @@ export declare const patchSchema: (pluginSchemas: Array<PluginValidateSchema | P
|
|
|
382
379
|
logger: {
|
|
383
380
|
type: string;
|
|
384
381
|
};
|
|
385
|
-
|
|
382
|
+
metrics: {
|
|
386
383
|
type: string;
|
|
387
384
|
};
|
|
388
385
|
proxy: {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ParallelWorkflow, AsyncWorkflow, Progresses2Runners, AsyncWaterfall } f
|
|
|
3
3
|
import type { Hooks } from '@modern-js/types';
|
|
4
4
|
import { Command } from './utils/commander';
|
|
5
5
|
import { defineConfig, loadUserConfig, UserConfig, ToolsConfig } from './config';
|
|
6
|
-
import { AppContext, IAppContext, initAppContext, useAppContext, useConfigContext, useResolvedConfigContext } from './context';
|
|
6
|
+
import { AppContext, ConfigContext, IAppContext, initAppContext, ResolvedConfigContext, useAppContext, useConfigContext, useResolvedConfigContext } from './context';
|
|
7
7
|
import { NormalizedConfig } from './config/mergeConfig';
|
|
8
8
|
export type { Hooks };
|
|
9
9
|
export { defaultsConfig, mergeConfig } from './config';
|
|
@@ -88,7 +88,7 @@ export declare const createPlugin: (initializer: import("@modern-js/plugin").Asy
|
|
|
88
88
|
beforeExit: AsyncWorkflow<void, void>;
|
|
89
89
|
} & import("@modern-js/plugin").ClearDraftProgress<Hooks>>;
|
|
90
90
|
export declare const usePlugins: (plugins: string[]) => void;
|
|
91
|
-
export { defineConfig, AppContext, useAppContext, useConfigContext, useResolvedConfigContext };
|
|
91
|
+
export { defineConfig, AppContext, ResolvedConfigContext, useAppContext, useConfigContext, useResolvedConfigContext, ConfigContext };
|
|
92
92
|
export type { NormalizedConfig, IAppContext, UserConfig, ToolsConfig };
|
|
93
93
|
declare const initAppDir: () => Promise<string>;
|
|
94
94
|
export interface CoreOptions {
|
|
@@ -96,7 +96,9 @@ export interface CoreOptions {
|
|
|
96
96
|
plugins?: typeof INTERNAL_PLUGINS;
|
|
97
97
|
beforeUsePlugins: (plugins: any, config: any) => {
|
|
98
98
|
cli: any;
|
|
99
|
+
cliPath: any;
|
|
99
100
|
server: any;
|
|
101
|
+
serverPath: any;
|
|
100
102
|
}[];
|
|
101
103
|
}
|
|
102
104
|
export declare const cli: {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.0-
|
|
14
|
+
"version": "0.0.0-runtime-2021112193858",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -35,20 +35,12 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"bin": "./bin/modern-js.js",
|
|
38
|
-
"scripts": {
|
|
39
|
-
"prepare": "pnpm build",
|
|
40
|
-
"prepublishOnly": "pnpm build -- --platform",
|
|
41
|
-
"new": "modern new",
|
|
42
|
-
"build": "modern build",
|
|
43
|
-
"dev": "modern build --watch",
|
|
44
|
-
"test": "modern test --passWithNoTests"
|
|
45
|
-
},
|
|
46
38
|
"dependencies": {
|
|
47
39
|
"@babel/code-frame": "^7.14.5",
|
|
48
40
|
"@babel/runtime": "^7",
|
|
49
|
-
"@modern-js/load-config": "^
|
|
50
|
-
"@modern-js/plugin": "^
|
|
51
|
-
"@modern-js/utils": "^
|
|
41
|
+
"@modern-js/load-config": "^0.0.0-runtime-2021112193858",
|
|
42
|
+
"@modern-js/plugin": "^0.0.0-runtime-2021112193858",
|
|
43
|
+
"@modern-js/utils": "^0.0.0-runtime-2021112193858",
|
|
52
44
|
"address": "^1.1.2",
|
|
53
45
|
"ajv": "^8.6.2",
|
|
54
46
|
"ajv-keywords": "^5.0.0",
|
|
@@ -65,7 +57,7 @@
|
|
|
65
57
|
},
|
|
66
58
|
"devDependencies": {
|
|
67
59
|
"@types/babel__code-frame": "^7.0.3",
|
|
68
|
-
"@modern-js/types": "^
|
|
60
|
+
"@modern-js/types": "^0.0.0-runtime-2021112193858",
|
|
69
61
|
"@types/jest": "^26",
|
|
70
62
|
"@types/lodash.clonedeep": "^4.5.6",
|
|
71
63
|
"@types/lodash.mergewith": "^4.6.6",
|
|
@@ -73,9 +65,9 @@
|
|
|
73
65
|
"@types/react": "^17",
|
|
74
66
|
"@types/react-dom": "^17",
|
|
75
67
|
"@types/signale": "^1.4.2",
|
|
76
|
-
"typescript": "^4",
|
|
77
|
-
"@modern-js/plugin-testing": "^
|
|
78
|
-
"@modern-js/module-tools": "^
|
|
68
|
+
"typescript": "^4.4.4",
|
|
69
|
+
"@modern-js/plugin-testing": "^0.0.0-runtime-2021112193858",
|
|
70
|
+
"@modern-js/module-tools": "^0.0.0-runtime-2021112193858"
|
|
79
71
|
},
|
|
80
72
|
"sideEffects": false,
|
|
81
73
|
"modernConfig": {
|
|
@@ -86,5 +78,11 @@
|
|
|
86
78
|
"publishConfig": {
|
|
87
79
|
"registry": "https://registry.npmjs.org/",
|
|
88
80
|
"access": "public"
|
|
81
|
+
},
|
|
82
|
+
"scripts": {
|
|
83
|
+
"new": "modern new",
|
|
84
|
+
"build": "modern build",
|
|
85
|
+
"dev": "modern build --watch",
|
|
86
|
+
"test": "modern test --passWithNoTests"
|
|
89
87
|
}
|
|
90
|
-
}
|
|
88
|
+
}
|
package/src/config/index.ts
CHANGED
|
@@ -106,8 +106,8 @@ export interface ServerConfig {
|
|
|
106
106
|
ssrByEntries?: Record<string, boolean | Record<string, unknown>>;
|
|
107
107
|
baseUrl?: string | Array<string>;
|
|
108
108
|
port?: number;
|
|
109
|
-
logger?: Record<string,
|
|
110
|
-
|
|
109
|
+
logger?: Record<string, any>;
|
|
110
|
+
metrics?: Record<string, any>;
|
|
111
111
|
enableMicroFrontendDebug?: boolean;
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -46,7 +46,6 @@ export const output = {
|
|
|
46
46
|
disableInlineRuntimeChunk: { type: 'boolean' },
|
|
47
47
|
disableAssetsCache: { type: 'boolean' },
|
|
48
48
|
enableLatestDecorators: { type: 'boolean' },
|
|
49
|
-
enableUsageBuiltIns: { type: 'boolean' },
|
|
50
49
|
enableTsLoader: { type: 'boolean' },
|
|
51
50
|
dataUriLimit: { type: 'number' },
|
|
52
51
|
templateParameters: { type: 'object' },
|
|
@@ -99,7 +99,7 @@ export const server = {
|
|
|
99
99
|
middleware: { instanceof: ['Array', 'Function'] },
|
|
100
100
|
renderHook: { instanceof: 'Function' },
|
|
101
101
|
logger: { type: 'object' },
|
|
102
|
-
|
|
102
|
+
metrics: { type: 'object' },
|
|
103
103
|
proxy: { type: 'object' },
|
|
104
104
|
enableMicroFrontendDebug: { type: 'boolean' },
|
|
105
105
|
},
|
package/src/index.ts
CHANGED
|
@@ -119,9 +119,11 @@ export const usePlugins = (plugins: string[]) =>
|
|
|
119
119
|
export {
|
|
120
120
|
defineConfig,
|
|
121
121
|
AppContext,
|
|
122
|
+
ResolvedConfigContext,
|
|
122
123
|
useAppContext,
|
|
123
124
|
useConfigContext,
|
|
124
125
|
useResolvedConfigContext,
|
|
126
|
+
ConfigContext,
|
|
125
127
|
};
|
|
126
128
|
|
|
127
129
|
export type { NormalizedConfig, IAppContext, UserConfig, ToolsConfig };
|
|
@@ -141,7 +143,10 @@ const initAppDir = async (): Promise<string> => {
|
|
|
141
143
|
export interface CoreOptions {
|
|
142
144
|
configFile?: string;
|
|
143
145
|
plugins?: typeof INTERNAL_PLUGINS;
|
|
144
|
-
beforeUsePlugins: (
|
|
146
|
+
beforeUsePlugins: (
|
|
147
|
+
plugins: any,
|
|
148
|
+
config: any,
|
|
149
|
+
) => { cli: any; cliPath: any; server: any; serverPath: any }[];
|
|
145
150
|
}
|
|
146
151
|
|
|
147
152
|
const createCli = () => {
|
package/src/loadPlugins.ts
CHANGED
|
@@ -77,7 +77,9 @@ export const loadPlugins = (
|
|
|
77
77
|
|
|
78
78
|
return {
|
|
79
79
|
cli: cli && compatRequire(cli),
|
|
80
|
+
cliPath: typeof plugin === 'string' ? plugin : plugin.cli,
|
|
80
81
|
server: server && compatRequire(server),
|
|
82
|
+
serverPath: typeof plugin === 'string' ? undefined : plugin.server,
|
|
81
83
|
};
|
|
82
84
|
});
|
|
83
85
|
};
|
package/tests/loadPlugin.test.ts
CHANGED
|
@@ -14,8 +14,8 @@ describe('load plugins', () => {
|
|
|
14
14
|
]);
|
|
15
15
|
|
|
16
16
|
expect(plugins).toEqual([
|
|
17
|
-
{ cli: { name: 'a' } },
|
|
18
|
-
{ server: { name: 'b' } },
|
|
17
|
+
{ cli: { name: 'a' }, cliPath: path.join(fixture, './test-plugin-a.js') },
|
|
18
|
+
{ server: { name: 'b' }, serverPath: './test-plugin-b' },
|
|
19
19
|
]);
|
|
20
20
|
});
|
|
21
21
|
|