@modern-js/server-core 2.14.0 → 2.16.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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # @modern-js/server-plugin
2
2
 
3
+ ## 2.16.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 4e876ab: chore: package.json include the monorepo-relative directory
8
+
9
+ chore: 在 package.json 中声明 monorepo 的子路径
10
+
11
+ - Updated dependencies [5954330]
12
+ - Updated dependencies [7596520]
13
+ - Updated dependencies [4e876ab]
14
+ - @modern-js/utils@2.16.0
15
+ - @modern-js/plugin@2.16.0
16
+
17
+ ## 2.15.0
18
+
19
+ ### Patch Changes
20
+
21
+ - @modern-js/plugin@2.15.0
22
+ - @modern-js/utils@2.15.0
23
+
3
24
  ## 2.14.0
4
25
 
5
26
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -1,20 +1,21 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var src_exports = {};
16
- module.exports = __toCommonJS(src_exports);
17
- __reExport(src_exports, require("./plugin"), module.exports);
18
- __reExport(src_exports, require("@modern-js/plugin"), module.exports);
19
- __reExport(src_exports, require("./loadPlugins"), module.exports);
20
- __reExport(src_exports, require("./types/config"), module.exports);
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
+ }
@@ -1,52 +1,34 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
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
- module.exports = __toCommonJS(loadPlugins_exports);
23
- var import_utils = require("@modern-js/utils");
24
- var import_plugin = require("./plugin");
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, import_plugin.createPlugin)(p.setup, p)
15
+ module: (0, _plugin.createPlugin)(p.setup, p)
30
16
  };
31
17
  }
32
- const pluginPath = (0, import_utils.tryResolve)(p, appDirectory);
33
- const module2 = (0, import_utils.compatRequire)(pluginPath);
34
- const pluginInstance = module2();
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, import_plugin.createPlugin)(pluginInstance.setup, pluginInstance)
22
+ module: (0, _plugin.createPlugin)(pluginInstance.setup, pluginInstance)
37
23
  };
38
24
  };
39
25
  const loadPlugins = (appDirectory, configPlugins, options) => {
40
- const loadedPlugins = (0, import_utils.getInternalPlugins)(
41
- appDirectory,
42
- options.internalPlugins
43
- );
44
- return [...loadedPlugins, ...configPlugins].map((plugin) => {
45
- const { module: module2 } = resolvePlugin(plugin, appDirectory);
46
- return module2;
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
- });
@@ -1,66 +1,58 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
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
- __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 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
- createPlugin: () => createPlugin,
16
+ useConfigContext: () => useConfigContext,
17
+ useAppContext: () => useAppContext,
23
18
  createServerManager: () => createServerManager,
24
19
  serverManager: () => serverManager,
25
- setAppContext: () => setAppContext,
26
- useAppContext: () => useAppContext,
27
- useConfigContext: () => useConfigContext
20
+ createPlugin: () => createPlugin
28
21
  });
29
- module.exports = __toCommonJS(plugin_exports);
30
- var import_plugin = require("@modern-js/plugin");
31
- const gather = (0, import_plugin.createParallelWorkflow)();
32
- const config = (0, import_plugin.createWaterfall)();
33
- const prepare = (0, import_plugin.createWaterfall)();
34
- const prepareLoaderHandler = (0, import_plugin.createAsyncPipeline)();
35
- const prepareWebServer = (0, import_plugin.createAsyncPipeline)();
36
- const prepareApiServer = (0, import_plugin.createAsyncPipeline)();
37
- const onApiChange = (0, import_plugin.createWaterfall)();
38
- const repack = (0, import_plugin.createWaterfall)();
39
- const beforeDevServer = (0, import_plugin.createParallelWorkflow)();
40
- const setupCompiler = (0, import_plugin.createParallelWorkflow)();
41
- const afterDevServer = (0, import_plugin.createParallelWorkflow)();
42
- const beforeRouteSet = (0, import_plugin.createAsyncPipeline)();
43
- const afterRouteSet = (0, import_plugin.createAsyncPipeline)();
44
- const beforeProdServer = (0, import_plugin.createParallelWorkflow)();
45
- const afterProdServer = (0, import_plugin.createParallelWorkflow)();
46
- const listen = (0, import_plugin.createParallelWorkflow)();
47
- const beforeServerReset = (0, import_plugin.createParallelWorkflow)();
48
- const afterServerReset = (0, import_plugin.createParallelWorkflow)();
49
- const extendSSRContext = (0, import_plugin.createAsyncWaterfall)();
50
- const extendContext = (0, import_plugin.createAsyncPipeline)();
51
- const handleError = (0, import_plugin.createParallelWorkflow)();
52
- const beforeMatch = (0, import_plugin.createAsyncPipeline)();
53
- const afterMatch = (0, import_plugin.createAsyncPipeline)();
54
- const prefetch = (0, import_plugin.createParallelWorkflow)();
55
- const renderToString = (0, import_plugin.createAsyncPipeline)();
56
- const beforeRender = (0, import_plugin.createAsyncPipeline)();
57
- const afterRender = (0, import_plugin.createAsyncPipeline)();
58
- const beforeSend = (0, import_plugin.createAsyncPipeline)();
59
- const afterSend = (0, import_plugin.createParallelWorkflow)();
60
- const reset = (0, import_plugin.createParallelWorkflow)();
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, import_plugin.createContext)({});
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, import_plugin.createAsyncManager)(serverHooks, pluginAPI);
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
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var config_exports = {};
16
- module.exports = __toCommonJS(config_exports);
17
- __reExport(config_exports, require("./bff"), module.exports);
18
- __reExport(config_exports, require("./html"), module.exports);
19
- __reExport(config_exports, require("./output"), module.exports);
20
- __reExport(config_exports, require("./server"), module.exports);
21
- __reExport(config_exports, require("./source"), module.exports);
22
- __reExport(config_exports, require("./tools"), module.exports);
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
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
+ });
@@ -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
- appDirectory,
24
- options.internalPlugins
25
- );
26
- return [...loadedPlugins, ...configPlugins].map((plugin) => {
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
- };
@@ -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": "web-infra-dev/modern.js",
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.14.0",
18
+ "version": "2.16.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.14.0",
32
- "@modern-js/utils": "2.14.0"
35
+ "@modern-js/plugin": "2.16.0",
36
+ "@modern-js/utils": "2.16.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.14.0",
42
- "@modern-js/babel-preset-app": "2.14.0",
43
- "@scripts/build": "2.14.0",
44
- "@scripts/jest-config": "2.14.0"
45
+ "@modern-js/types": "2.16.0",
46
+ "@modern-js/babel-preset-app": "2.16.0",
47
+ "@scripts/build": "2.16.0",
48
+ "@scripts/jest-config": "2.16.0"
45
49
  },
46
50
  "sideEffects": false,
47
51
  "publishConfig": {