@modern-js/server-core 2.15.0 → 2.17.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 +21 -0
- package/dist/cjs/index.js +21 -20
- package/dist/cjs/loadPlugins.js +21 -39
- package/dist/cjs/plugin.js +49 -68
- package/dist/cjs/types/config/bff.js +4 -15
- package/dist/cjs/types/config/dev.js +4 -15
- package/dist/cjs/types/config/html.js +4 -15
- package/dist/cjs/types/config/index.js +23 -22
- package/dist/cjs/types/config/output.js +4 -15
- package/dist/cjs/types/config/server.js +4 -15
- package/dist/cjs/types/config/share.js +4 -15
- package/dist/cjs/types/config/source.js +4 -15
- package/dist/cjs/types/config/tools.js +4 -15
- package/dist/esm/loadPlugins.js +7 -14
- package/dist/esm/plugin.js +9 -26
- package/dist/esm/types/config/bff.js +1 -0
- package/dist/esm/types/config/dev.js +1 -0
- package/dist/esm/types/config/html.js +1 -0
- package/dist/esm/types/config/output.js +1 -0
- package/dist/esm/types/config/server.js +1 -0
- package/dist/esm/types/config/share.js +1 -0
- package/dist/esm/types/config/source.js +1 -0
- package/dist/esm/types/config/tools.js +1 -0
- package/package.json +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @modern-js/server-plugin
|
|
2
2
|
|
|
3
|
+
## 2.17.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @modern-js/plugin@2.17.0
|
|
8
|
+
- @modern-js/utils@2.17.0
|
|
9
|
+
|
|
10
|
+
## 2.16.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 4e876ab: chore: package.json include the monorepo-relative directory
|
|
15
|
+
|
|
16
|
+
chore: 在 package.json 中声明 monorepo 的子路径
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [5954330]
|
|
19
|
+
- Updated dependencies [7596520]
|
|
20
|
+
- Updated dependencies [4e876ab]
|
|
21
|
+
- @modern-js/utils@2.16.0
|
|
22
|
+
- @modern-js/plugin@2.16.0
|
|
23
|
+
|
|
3
24
|
## 2.15.0
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./plugin"), exports);
|
|
6
|
+
_export_star(require("@modern-js/plugin"), exports);
|
|
7
|
+
_export_star(require("./loadPlugins"), exports);
|
|
8
|
+
_export_star(require("./types/config"), exports);
|
|
9
|
+
function _export_star(from, to) {
|
|
10
|
+
Object.keys(from).forEach(function(k) {
|
|
11
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
12
|
+
Object.defineProperty(to, k, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return from[k];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return from;
|
|
21
|
+
}
|
package/dist/cjs/loadPlugins.js
CHANGED
|
@@ -1,52 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var loadPlugins_exports = {};
|
|
19
|
-
__export(loadPlugins_exports, {
|
|
20
|
-
loadPlugins: () => loadPlugins
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
21
4
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
Object.defineProperty(exports, "loadPlugins", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => loadPlugins
|
|
8
|
+
});
|
|
9
|
+
const _utils = require("@modern-js/utils");
|
|
10
|
+
const _plugin = require("./plugin");
|
|
25
11
|
const resolvePlugin = (p, appDirectory) => {
|
|
26
12
|
const isPluginInstance = typeof p !== "string";
|
|
27
13
|
if (isPluginInstance) {
|
|
28
14
|
return {
|
|
29
|
-
module: (0,
|
|
15
|
+
module: (0, _plugin.createPlugin)(p.setup, p)
|
|
30
16
|
};
|
|
31
17
|
}
|
|
32
|
-
const pluginPath = (0,
|
|
33
|
-
const
|
|
34
|
-
const pluginInstance =
|
|
18
|
+
const pluginPath = (0, _utils.tryResolve)(p, appDirectory);
|
|
19
|
+
const module = (0, _utils.compatRequire)(pluginPath);
|
|
20
|
+
const pluginInstance = module();
|
|
35
21
|
return {
|
|
36
|
-
module: (0,
|
|
22
|
+
module: (0, _plugin.createPlugin)(pluginInstance.setup, pluginInstance)
|
|
37
23
|
};
|
|
38
24
|
};
|
|
39
25
|
const loadPlugins = (appDirectory, configPlugins, options) => {
|
|
40
|
-
const loadedPlugins = (0,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const { module
|
|
46
|
-
return
|
|
26
|
+
const loadedPlugins = (0, _utils.getInternalPlugins)(appDirectory, options.internalPlugins);
|
|
27
|
+
return [
|
|
28
|
+
...loadedPlugins,
|
|
29
|
+
...configPlugins
|
|
30
|
+
].map((plugin) => {
|
|
31
|
+
const { module } = resolvePlugin(plugin, appDirectory);
|
|
32
|
+
return module;
|
|
47
33
|
});
|
|
48
34
|
};
|
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
loadPlugins
|
|
52
|
-
});
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -1,66 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
6
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var plugin_exports = {};
|
|
19
|
-
__export(plugin_exports, {
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
20
13
|
AppContext: () => AppContext,
|
|
14
|
+
setAppContext: () => setAppContext,
|
|
21
15
|
ConfigContext: () => ConfigContext,
|
|
22
|
-
|
|
16
|
+
useConfigContext: () => useConfigContext,
|
|
17
|
+
useAppContext: () => useAppContext,
|
|
23
18
|
createServerManager: () => createServerManager,
|
|
24
19
|
serverManager: () => serverManager,
|
|
25
|
-
|
|
26
|
-
useAppContext: () => useAppContext,
|
|
27
|
-
useConfigContext: () => useConfigContext
|
|
20
|
+
createPlugin: () => createPlugin
|
|
28
21
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const AppContext = (0, import_plugin.createContext)({});
|
|
22
|
+
const _plugin = require("@modern-js/plugin");
|
|
23
|
+
const gather = (0, _plugin.createParallelWorkflow)();
|
|
24
|
+
const config = (0, _plugin.createWaterfall)();
|
|
25
|
+
const prepare = (0, _plugin.createWaterfall)();
|
|
26
|
+
const prepareLoaderHandler = (0, _plugin.createAsyncPipeline)();
|
|
27
|
+
const prepareWebServer = (0, _plugin.createAsyncPipeline)();
|
|
28
|
+
const prepareApiServer = (0, _plugin.createAsyncPipeline)();
|
|
29
|
+
const onApiChange = (0, _plugin.createWaterfall)();
|
|
30
|
+
const repack = (0, _plugin.createWaterfall)();
|
|
31
|
+
const beforeDevServer = (0, _plugin.createParallelWorkflow)();
|
|
32
|
+
const setupCompiler = (0, _plugin.createParallelWorkflow)();
|
|
33
|
+
const afterDevServer = (0, _plugin.createParallelWorkflow)();
|
|
34
|
+
const beforeRouteSet = (0, _plugin.createAsyncPipeline)();
|
|
35
|
+
const afterRouteSet = (0, _plugin.createAsyncPipeline)();
|
|
36
|
+
const beforeProdServer = (0, _plugin.createParallelWorkflow)();
|
|
37
|
+
const afterProdServer = (0, _plugin.createParallelWorkflow)();
|
|
38
|
+
const listen = (0, _plugin.createParallelWorkflow)();
|
|
39
|
+
const beforeServerReset = (0, _plugin.createParallelWorkflow)();
|
|
40
|
+
const afterServerReset = (0, _plugin.createParallelWorkflow)();
|
|
41
|
+
const extendSSRContext = (0, _plugin.createAsyncWaterfall)();
|
|
42
|
+
const extendContext = (0, _plugin.createAsyncPipeline)();
|
|
43
|
+
const handleError = (0, _plugin.createParallelWorkflow)();
|
|
44
|
+
const beforeMatch = (0, _plugin.createAsyncPipeline)();
|
|
45
|
+
const afterMatch = (0, _plugin.createAsyncPipeline)();
|
|
46
|
+
const prefetch = (0, _plugin.createParallelWorkflow)();
|
|
47
|
+
const renderToString = (0, _plugin.createAsyncPipeline)();
|
|
48
|
+
const beforeRender = (0, _plugin.createAsyncPipeline)();
|
|
49
|
+
const afterRender = (0, _plugin.createAsyncPipeline)();
|
|
50
|
+
const beforeSend = (0, _plugin.createAsyncPipeline)();
|
|
51
|
+
const afterSend = (0, _plugin.createParallelWorkflow)();
|
|
52
|
+
const reset = (0, _plugin.createParallelWorkflow)();
|
|
53
|
+
const AppContext = (0, _plugin.createContext)({});
|
|
62
54
|
const setAppContext = (value) => AppContext.set(value);
|
|
63
|
-
const ConfigContext = (0,
|
|
55
|
+
const ConfigContext = (0, _plugin.createContext)({});
|
|
64
56
|
const useConfigContext = () => ConfigContext.use().value;
|
|
65
57
|
const useAppContext = () => AppContext.use().value;
|
|
66
58
|
const pluginAPI = {
|
|
@@ -102,17 +94,6 @@ const serverHooks = {
|
|
|
102
94
|
afterSend,
|
|
103
95
|
reset
|
|
104
96
|
};
|
|
105
|
-
const createServerManager = () => (0,
|
|
97
|
+
const createServerManager = () => (0, _plugin.createAsyncManager)(serverHooks, pluginAPI);
|
|
106
98
|
const serverManager = createServerManager();
|
|
107
99
|
const { createPlugin } = serverManager;
|
|
108
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
109
|
-
0 && (module.exports = {
|
|
110
|
-
AppContext,
|
|
111
|
-
ConfigContext,
|
|
112
|
-
createPlugin,
|
|
113
|
-
createServerManager,
|
|
114
|
-
serverManager,
|
|
115
|
-
setAppContext,
|
|
116
|
-
useAppContext,
|
|
117
|
-
useConfigContext
|
|
118
|
-
});
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var bff_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(bff_exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var dev_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(dev_exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var html_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(html_exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./bff"), exports);
|
|
6
|
+
_export_star(require("./html"), exports);
|
|
7
|
+
_export_star(require("./output"), exports);
|
|
8
|
+
_export_star(require("./server"), exports);
|
|
9
|
+
_export_star(require("./source"), exports);
|
|
10
|
+
_export_star(require("./tools"), exports);
|
|
11
|
+
function _export_star(from, to) {
|
|
12
|
+
Object.keys(from).forEach(function(k) {
|
|
13
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
14
|
+
Object.defineProperty(to, k, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function() {
|
|
17
|
+
return from[k];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return from;
|
|
23
|
+
}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var output_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(output_exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var server_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(server_exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var share_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(share_exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var source_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(source_exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var tools_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(tools_exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
package/dist/esm/loadPlugins.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
compatRequire,
|
|
3
|
-
getInternalPlugins,
|
|
4
|
-
tryResolve
|
|
5
|
-
} from "@modern-js/utils";
|
|
1
|
+
import { compatRequire, getInternalPlugins, tryResolve } from "@modern-js/utils";
|
|
6
2
|
import { createPlugin } from "./plugin";
|
|
7
3
|
const resolvePlugin = (p, appDirectory) => {
|
|
8
4
|
const isPluginInstance = typeof p !== "string";
|
|
@@ -18,16 +14,13 @@ const resolvePlugin = (p, appDirectory) => {
|
|
|
18
14
|
module: createPlugin(pluginInstance.setup, pluginInstance)
|
|
19
15
|
};
|
|
20
16
|
};
|
|
21
|
-
const loadPlugins = (appDirectory, configPlugins, options) => {
|
|
22
|
-
const loadedPlugins = getInternalPlugins(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
export const loadPlugins = (appDirectory, configPlugins, options) => {
|
|
18
|
+
const loadedPlugins = getInternalPlugins(appDirectory, options.internalPlugins);
|
|
19
|
+
return [
|
|
20
|
+
...loadedPlugins,
|
|
21
|
+
...configPlugins
|
|
22
|
+
].map((plugin) => {
|
|
27
23
|
const { module } = resolvePlugin(plugin, appDirectory);
|
|
28
24
|
return module;
|
|
29
25
|
});
|
|
30
26
|
};
|
|
31
|
-
export {
|
|
32
|
-
loadPlugins
|
|
33
|
-
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createContext,
|
|
3
|
-
createAsyncManager,
|
|
4
|
-
createAsyncPipeline,
|
|
5
|
-
createAsyncWaterfall,
|
|
6
|
-
createParallelWorkflow,
|
|
7
|
-
createWaterfall
|
|
8
|
-
} from "@modern-js/plugin";
|
|
1
|
+
import { createContext, createAsyncManager, createAsyncPipeline, createAsyncWaterfall, createParallelWorkflow, createWaterfall } from "@modern-js/plugin";
|
|
9
2
|
const gather = createParallelWorkflow();
|
|
10
3
|
const config = createWaterfall();
|
|
11
4
|
const prepare = createWaterfall();
|
|
@@ -36,11 +29,11 @@ const afterRender = createAsyncPipeline();
|
|
|
36
29
|
const beforeSend = createAsyncPipeline();
|
|
37
30
|
const afterSend = createParallelWorkflow();
|
|
38
31
|
const reset = createParallelWorkflow();
|
|
39
|
-
const AppContext = createContext({});
|
|
40
|
-
const setAppContext = (value) => AppContext.set(value);
|
|
41
|
-
const ConfigContext = createContext({});
|
|
42
|
-
const useConfigContext = () => ConfigContext.use().value;
|
|
43
|
-
const useAppContext = () => AppContext.use().value;
|
|
32
|
+
export const AppContext = createContext({});
|
|
33
|
+
export const setAppContext = (value) => AppContext.set(value);
|
|
34
|
+
export const ConfigContext = createContext({});
|
|
35
|
+
export const useConfigContext = () => ConfigContext.use().value;
|
|
36
|
+
export const useAppContext = () => AppContext.use().value;
|
|
44
37
|
const pluginAPI = {
|
|
45
38
|
useAppContext,
|
|
46
39
|
useConfigContext,
|
|
@@ -80,16 +73,6 @@ const serverHooks = {
|
|
|
80
73
|
afterSend,
|
|
81
74
|
reset
|
|
82
75
|
};
|
|
83
|
-
const createServerManager = () => createAsyncManager(serverHooks, pluginAPI);
|
|
84
|
-
const serverManager = createServerManager();
|
|
85
|
-
const { createPlugin } = serverManager;
|
|
86
|
-
export {
|
|
87
|
-
AppContext,
|
|
88
|
-
ConfigContext,
|
|
89
|
-
createPlugin,
|
|
90
|
-
createServerManager,
|
|
91
|
-
serverManager,
|
|
92
|
-
setAppContext,
|
|
93
|
-
useAppContext,
|
|
94
|
-
useConfigContext
|
|
95
|
-
};
|
|
76
|
+
export const createServerManager = () => createAsyncManager(serverHooks, pluginAPI);
|
|
77
|
+
export const serverManager = createServerManager();
|
|
78
|
+
export const { createPlugin } = serverManager;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
"description": "A Progressive React Framework for modern web development.",
|
|
4
4
|
"homepage": "https://modernjs.dev",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/modern.js/issues",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/web-infra-dev/modern.js",
|
|
9
|
+
"directory": "packages/server/core"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"keywords": [
|
|
9
13
|
"react",
|
|
@@ -11,7 +15,7 @@
|
|
|
11
15
|
"modern",
|
|
12
16
|
"modern.js"
|
|
13
17
|
],
|
|
14
|
-
"version": "2.
|
|
18
|
+
"version": "2.17.0",
|
|
15
19
|
"jsnext:source": "./src/index.ts",
|
|
16
20
|
"types": "./dist/types/index.d.ts",
|
|
17
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -28,8 +32,8 @@
|
|
|
28
32
|
}
|
|
29
33
|
},
|
|
30
34
|
"dependencies": {
|
|
31
|
-
"@modern-js/plugin": "2.
|
|
32
|
-
"@modern-js/utils": "2.
|
|
35
|
+
"@modern-js/plugin": "2.17.0",
|
|
36
|
+
"@modern-js/utils": "2.17.0"
|
|
33
37
|
},
|
|
34
38
|
"devDependencies": {
|
|
35
39
|
"@types/jest": "^29",
|
|
@@ -38,10 +42,10 @@
|
|
|
38
42
|
"jest": "^29",
|
|
39
43
|
"ts-jest": "^29.0.5",
|
|
40
44
|
"typescript": "^4",
|
|
41
|
-
"@modern-js/types": "2.
|
|
42
|
-
"@modern-js/babel-preset-app": "2.
|
|
43
|
-
"@scripts/
|
|
44
|
-
"@scripts/
|
|
45
|
+
"@modern-js/types": "2.17.0",
|
|
46
|
+
"@modern-js/babel-preset-app": "2.17.0",
|
|
47
|
+
"@scripts/jest-config": "2.17.0",
|
|
48
|
+
"@scripts/build": "2.17.0"
|
|
45
49
|
},
|
|
46
50
|
"sideEffects": false,
|
|
47
51
|
"publishConfig": {
|