@modern-js/server-core 1.21.3 → 2.0.0-beta.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,11 +1,34 @@
1
1
  # @modern-js/server-plugin
2
2
 
3
- ## 1.21.3
3
+ ## 2.0.0-beta.0
4
4
 
5
- ### Patch Changes
5
+ ### Major Changes
6
+
7
+ - dda38c9: chore: v2
8
+
9
+ ### Minor Changes
6
10
 
7
- - @modern-js/plugin@1.21.3
8
- - @modern-js/utils@1.21.3
11
+ - 543be95: feat: compile server loader and support handle loader request
12
+ feat: 编译 server loader 并支持处理 loader 的请求
13
+
14
+ ### Patch Changes
15
+
16
+ - 15bf09d9c: feat: support completely custom server, export render() api for render single page
17
+ feat: 支持完全自定义 Server,导出 render() 方法用来渲染单个页面
18
+ - cc971eabf: refactor: move server plugin load logic in `@modern-js/core`
19
+ refactor:移除在 `@modern-js/core` 中的 server 插件加载逻辑
20
+ - Updated dependencies [edd1cfb1a]
21
+ - Updated dependencies [cc971eabf]
22
+ - Updated dependencies [5b9049f]
23
+ - Updated dependencies [b8bbe036c]
24
+ - Updated dependencies [d5a31df78]
25
+ - Updated dependencies [dda38c9]
26
+ - Updated dependencies [3bbea92b2]
27
+ - Updated dependencies [abf3421]
28
+ - Updated dependencies [543be95]
29
+ - Updated dependencies [14b712d]
30
+ - @modern-js/utils@2.0.0-beta.0
31
+ - @modern-js/plugin@2.0.0-beta.0
9
32
 
10
33
  ## 1.21.2
11
34
 
@@ -1,47 +1,29 @@
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
-
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
-
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
-
7
- import { compatRequire, tryResolve } from '@modern-js/utils';
1
+ import { compatRequire, getInternalPlugins, tryResolve } from '@modern-js/utils';
8
2
  import { createPlugin } from "./plugin";
9
- export const loadPlugins = (plugins, appDirectory) => {
10
- const resolvePlugin = p => {
11
- const isPluginInstance = typeof p !== 'string' && !Array.isArray(p);
12
-
13
- if (isPluginInstance) {
14
- return {
15
- module: createPlugin(p.setup, p)
16
- };
17
- }
18
3
 
19
- const [pkg, options] = typeof p === 'string' ? [p, undefined] : p;
20
- const pluginPath = tryResolve(pkg, appDirectory);
21
- let module = compatRequire(pluginPath);
22
- const useNewSyntax = typeof module === 'function';
23
-
24
- if (useNewSyntax) {
25
- const plugin = module(options);
26
- module = createPlugin(plugin.setup, plugin);
27
- }
4
+ const resolvePlugin = (p, appDirectory) => {
5
+ const isPluginInstance = typeof p !== 'string';
28
6
 
7
+ if (isPluginInstance) {
29
8
  return {
30
- pkg,
31
- path: pluginPath,
32
- module
9
+ module: createPlugin(p.setup, p)
33
10
  };
11
+ }
12
+
13
+ const pluginPath = tryResolve(p, appDirectory);
14
+ const module = compatRequire(pluginPath);
15
+ const pluginInstance = module();
16
+ return {
17
+ module: createPlugin(pluginInstance.setup, pluginInstance)
34
18
  };
19
+ };
35
20
 
36
- return plugins.map(plugin => {
21
+ export const loadPlugins = (appDirectory, configPlugins, options) => {
22
+ const loadedPlugins = getInternalPlugins(appDirectory, options.internalPlugins);
23
+ return [...loadedPlugins, ...configPlugins].map(plugin => {
37
24
  const {
38
- pkg,
39
- path,
40
25
  module
41
- } = resolvePlugin(plugin);
42
- return _objectSpread(_objectSpread({}, module), {}, {
43
- pluginPath: path,
44
- pkg
45
- });
26
+ } = resolvePlugin(plugin, appDirectory);
27
+ return module;
46
28
  });
47
29
  };
@@ -1,10 +1,10 @@
1
1
  import { createContext, createAsyncManager, createAsyncPipeline, createAsyncWaterfall, createParallelWorkflow, createWaterfall } from '@modern-js/plugin';
2
2
  // collect all middleware register in server plugins
3
- const gather = createParallelWorkflow();
4
- // config
3
+ const gather = createParallelWorkflow(); // config
4
+
5
5
  const config = createWaterfall();
6
6
  const prepare = createWaterfall();
7
- const create = createAsyncPipeline();
7
+ const preparebeforeRouteHandler = createAsyncPipeline();
8
8
  const prepareWebServer = createAsyncPipeline();
9
9
  const prepareApiServer = createAsyncPipeline();
10
10
  const onApiChange = createWaterfall();
@@ -56,7 +56,7 @@ const serverHooks = {
56
56
  gather,
57
57
  config,
58
58
  prepare,
59
- create,
59
+ preparebeforeRouteHandler,
60
60
  prepareWebServer,
61
61
  prepareApiServer,
62
62
  onApiChange,
@@ -9,49 +9,30 @@ var _utils = require("@modern-js/utils");
9
9
 
10
10
  var _plugin = require("./plugin");
11
11
 
12
- 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; }
13
-
14
- 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; }
15
-
16
- 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; }
17
-
18
- const loadPlugins = (plugins, appDirectory) => {
19
- const resolvePlugin = p => {
20
- const isPluginInstance = typeof p !== 'string' && !Array.isArray(p);
21
-
22
- if (isPluginInstance) {
23
- return {
24
- module: (0, _plugin.createPlugin)(p.setup, p)
25
- };
26
- }
27
-
28
- const [pkg, options] = typeof p === 'string' ? [p, undefined] : p;
29
- const pluginPath = (0, _utils.tryResolve)(pkg, appDirectory);
30
- let module = (0, _utils.compatRequire)(pluginPath);
31
- const useNewSyntax = typeof module === 'function';
32
-
33
- if (useNewSyntax) {
34
- const plugin = module(options);
35
- module = (0, _plugin.createPlugin)(plugin.setup, plugin);
36
- }
12
+ const resolvePlugin = (p, appDirectory) => {
13
+ const isPluginInstance = typeof p !== 'string';
37
14
 
15
+ if (isPluginInstance) {
38
16
  return {
39
- pkg,
40
- path: pluginPath,
41
- module
17
+ module: (0, _plugin.createPlugin)(p.setup, p)
42
18
  };
19
+ }
20
+
21
+ const pluginPath = (0, _utils.tryResolve)(p, appDirectory);
22
+ const module = (0, _utils.compatRequire)(pluginPath);
23
+ const pluginInstance = module();
24
+ return {
25
+ module: (0, _plugin.createPlugin)(pluginInstance.setup, pluginInstance)
43
26
  };
27
+ };
44
28
 
45
- return plugins.map(plugin => {
29
+ const loadPlugins = (appDirectory, configPlugins, options) => {
30
+ const loadedPlugins = (0, _utils.getInternalPlugins)(appDirectory, options.internalPlugins);
31
+ return [...loadedPlugins, ...configPlugins].map(plugin => {
46
32
  const {
47
- pkg,
48
- path,
49
33
  module
50
- } = resolvePlugin(plugin);
51
- return _objectSpread(_objectSpread({}, module), {}, {
52
- pluginPath: path,
53
- pkg
54
- });
34
+ } = resolvePlugin(plugin, appDirectory);
35
+ return module;
55
36
  });
56
37
  };
57
38
 
@@ -8,11 +8,11 @@ exports.useConfigContext = exports.useAppContext = exports.setAppContext = expor
8
8
  var _plugin = require("@modern-js/plugin");
9
9
 
10
10
  // collect all middleware register in server plugins
11
- const gather = (0, _plugin.createParallelWorkflow)();
12
- // config
11
+ const gather = (0, _plugin.createParallelWorkflow)(); // config
12
+
13
13
  const config = (0, _plugin.createWaterfall)();
14
14
  const prepare = (0, _plugin.createWaterfall)();
15
- const create = (0, _plugin.createAsyncPipeline)();
15
+ const preparebeforeRouteHandler = (0, _plugin.createAsyncPipeline)();
16
16
  const prepareWebServer = (0, _plugin.createAsyncPipeline)();
17
17
  const prepareApiServer = (0, _plugin.createAsyncPipeline)();
18
18
  const onApiChange = (0, _plugin.createWaterfall)();
@@ -75,7 +75,7 @@ const serverHooks = {
75
75
  gather,
76
76
  config,
77
77
  prepare,
78
- create,
78
+ preparebeforeRouteHandler,
79
79
  prepareWebServer,
80
80
  prepareApiServer,
81
81
  onApiChange,
@@ -1,4 +1,64 @@
1
+ import { InternalPlugins } from '@modern-js/types';
1
2
  import { ServerPlugin } from './plugin';
2
- declare type Plugin = string | [string, any] | ServerPlugin;
3
- export declare const loadPlugins: (plugins: Plugin[], appDirectory: string) => any[];
4
- export {};
3
+ export declare const loadPlugins: (appDirectory: string, configPlugins: ServerPlugin[], options: {
4
+ internalPlugins?: InternalPlugins;
5
+ }) => import("@modern-js/plugin").AsyncPlugin<{
6
+ gather: import("@modern-js/plugin").ParallelWorkflow<{
7
+ addWebMiddleware: (_input: any) => void;
8
+ addAPIMiddleware: (_input: any) => void;
9
+ }, unknown>;
10
+ config: import("@modern-js/plugin").Waterfall<import("./plugin").ServerConfig>;
11
+ prepare: import("@modern-js/plugin").Waterfall<void>;
12
+ preparebeforeRouteHandler: import("@modern-js/plugin").AsyncPipeline<{
13
+ serverRoutes: import("@modern-js/types").ServerRoute[];
14
+ distDir: string;
15
+ }, import("./plugin").BeforeRouteHandler>;
16
+ prepareWebServer: import("@modern-js/plugin").AsyncPipeline<import("./plugin").WebServerStartInput, import("./plugin").WebAdapter>;
17
+ prepareApiServer: import("@modern-js/plugin").AsyncPipeline<import("./plugin").APIServerStartInput, import("./plugin").Adapter>;
18
+ onApiChange: import("@modern-js/plugin").Waterfall<{
19
+ filename: string;
20
+ event: "add" | "unlink" | "change";
21
+ }[]>;
22
+ beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<import("./plugin").ServerOptions, any>;
23
+ setupCompiler: import("@modern-js/plugin").ParallelWorkflow<Record<string, unknown>, any[]>;
24
+ afterDevServer: import("@modern-js/plugin").ParallelWorkflow<import("./plugin").ServerOptions, any>;
25
+ beforeRouteSet: import("@modern-js/plugin").AsyncPipeline<import("./plugin").Route[], import("./plugin").Route[]>;
26
+ afterRouteSet: import("@modern-js/plugin").AsyncPipeline<unknown, unknown>;
27
+ beforeProdServer: import("@modern-js/plugin").ParallelWorkflow<import("./plugin").ServerOptions, any>;
28
+ afterProdServer: import("@modern-js/plugin").ParallelWorkflow<import("./plugin").ServerOptions, any>;
29
+ listen: import("@modern-js/plugin").ParallelWorkflow<{
30
+ ip: string;
31
+ port: number;
32
+ }, any[]>;
33
+ beforeServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
34
+ afterServerReset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
35
+ extendSSRContext: import("@modern-js/plugin").AsyncWaterfall<import("@modern-js/types").BaseSSRServerContext>;
36
+ extendContext: import("@modern-js/plugin").AsyncPipeline<import("@modern-js/types").ModernServerContext, import("@modern-js/types").ModernServerContext>;
37
+ handleError: import("@modern-js/plugin").ParallelWorkflow<{
38
+ error: Error;
39
+ }, unknown>;
40
+ beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
41
+ context: import("@modern-js/types").ModernServerContext;
42
+ }, any>;
43
+ afterMatch: import("@modern-js/plugin").AsyncPipeline<import("@modern-js/types").AfterMatchContext, any>;
44
+ prefetch: import("@modern-js/plugin").ParallelWorkflow<{
45
+ context: import("./plugin").SSRServerContext;
46
+ }, unknown>;
47
+ renderToString: import("@modern-js/plugin").AsyncPipeline<{
48
+ App: import("react").Component<{}, {}, any>;
49
+ context: import("./plugin").RenderContext;
50
+ }, string>;
51
+ beforeRender: import("@modern-js/plugin").AsyncPipeline<{
52
+ context: import("@modern-js/types").ModernServerContext;
53
+ }, any>;
54
+ afterRender: import("@modern-js/plugin").AsyncPipeline<import("@modern-js/types").AfterRenderContext, any>;
55
+ beforeSend: import("@modern-js/plugin").AsyncPipeline<import("@modern-js/types").ModernServerContext, import("./plugin").RequestResult>;
56
+ afterSend: import("@modern-js/plugin").ParallelWorkflow<{
57
+ context: import("@modern-js/types").ModernServerContext;
58
+ }, unknown>;
59
+ reset: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
60
+ }, {
61
+ useAppContext: () => import("@modern-js/types").ISAppContext;
62
+ useConfigContext: () => import("@modern-js/core").UserConfig;
63
+ setAppContext: (value: import("@modern-js/types").ISAppContext) => void;
64
+ }>[];
@@ -2,9 +2,8 @@
2
2
  import { IncomingMessage, ServerResponse } from 'http';
3
3
  import type { Component } from 'react';
4
4
  import { CommonAPI, ToThreads, AsyncSetup, PluginOptions } from '@modern-js/plugin';
5
- import type { ModernServerContext, BaseSSRServerContext, Metrics, Logger } from '@modern-js/types/server';
5
+ import type { ModernServerContext, BaseSSRServerContext, AfterMatchContext, AfterRenderContext, MiddlewareContext, ISAppContext, ServerRoute } from '@modern-js/types';
6
6
  import type { NormalizedConfig, UserConfig } from '@modern-js/core';
7
- import type { ISAppContext } from '@modern-js/types';
8
7
  import type { Options } from 'http-proxy-middleware';
9
8
  /** The subset of NormalizedConfig, which really need in server */
10
9
 
@@ -19,19 +18,13 @@ export declare type ServerOptions = {
19
18
  bff: NormalizedConfig['bff'];
20
19
  plugins: NormalizedConfig['plugins'];
21
20
  };
22
- declare type ServerInitInput = {
23
- loggerOptions: any;
24
- metricsOptions: any;
25
- };
26
- declare type InitExtension = {
27
- logger: Logger;
28
- metrics: Metrics;
29
- };
21
+ export declare type WebAdapter = (ctx: MiddlewareContext) => void | Promise<void>;
30
22
  export declare type Adapter = (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
31
23
  export declare type WebServerStartInput = {
32
24
  pwd: string;
33
25
  config: Record<string, any>;
34
26
  };
27
+ export declare type BeforeRouteHandler = (context: ModernServerContext) => Promise<void>;
35
28
  export declare type APIServerStartInput = {
36
29
  pwd: string;
37
30
  prefix?: string;
@@ -74,8 +67,11 @@ declare const serverHooks: {
74
67
  }, unknown>;
75
68
  config: import("@modern-js/plugin").Waterfall<ServerConfig>;
76
69
  prepare: import("@modern-js/plugin").Waterfall<void>;
77
- create: import("@modern-js/plugin").AsyncPipeline<ServerInitInput, InitExtension>;
78
- prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, Adapter>;
70
+ preparebeforeRouteHandler: import("@modern-js/plugin").AsyncPipeline<{
71
+ serverRoutes: ServerRoute[];
72
+ distDir: string;
73
+ }, BeforeRouteHandler>;
74
+ prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
79
75
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
80
76
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
81
77
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
@@ -99,10 +95,7 @@ declare const serverHooks: {
99
95
  beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
100
96
  context: ModernServerContext;
101
97
  }, any>;
102
- afterMatch: import("@modern-js/plugin").AsyncPipeline<{
103
- context: ModernServerContext;
104
- routeAPI: any;
105
- }, any>;
98
+ afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
106
99
  prefetch: import("@modern-js/plugin").ParallelWorkflow<{
107
100
  context: SSRServerContext;
108
101
  }, unknown>;
@@ -113,10 +106,7 @@ declare const serverHooks: {
113
106
  beforeRender: import("@modern-js/plugin").AsyncPipeline<{
114
107
  context: ModernServerContext;
115
108
  }, any>;
116
- afterRender: import("@modern-js/plugin").AsyncPipeline<{
117
- context: ModernServerContext;
118
- templateAPI: any;
119
- }, any>;
109
+ afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
120
110
  beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
121
111
  afterSend: import("@modern-js/plugin").ParallelWorkflow<{
122
112
  context: ModernServerContext;
@@ -139,8 +129,11 @@ export declare const createServerManager: () => import("@modern-js/plugin").Asyn
139
129
  }, unknown>;
140
130
  config: import("@modern-js/plugin").Waterfall<ServerConfig>;
141
131
  prepare: import("@modern-js/plugin").Waterfall<void>;
142
- create: import("@modern-js/plugin").AsyncPipeline<ServerInitInput, InitExtension>;
143
- prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, Adapter>;
132
+ preparebeforeRouteHandler: import("@modern-js/plugin").AsyncPipeline<{
133
+ serverRoutes: ServerRoute[];
134
+ distDir: string;
135
+ }, BeforeRouteHandler>;
136
+ prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
144
137
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
145
138
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
146
139
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
@@ -164,10 +157,7 @@ export declare const createServerManager: () => import("@modern-js/plugin").Asyn
164
157
  beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
165
158
  context: ModernServerContext;
166
159
  }, any>;
167
- afterMatch: import("@modern-js/plugin").AsyncPipeline<{
168
- context: ModernServerContext;
169
- routeAPI: any;
170
- }, any>;
160
+ afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
171
161
  prefetch: import("@modern-js/plugin").ParallelWorkflow<{
172
162
  context: SSRServerContext;
173
163
  }, unknown>;
@@ -178,10 +168,7 @@ export declare const createServerManager: () => import("@modern-js/plugin").Asyn
178
168
  beforeRender: import("@modern-js/plugin").AsyncPipeline<{
179
169
  context: ModernServerContext;
180
170
  }, any>;
181
- afterRender: import("@modern-js/plugin").AsyncPipeline<{
182
- context: ModernServerContext;
183
- templateAPI: any;
184
- }, any>;
171
+ afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
185
172
  beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
186
173
  afterSend: import("@modern-js/plugin").ParallelWorkflow<{
187
174
  context: ModernServerContext;
@@ -199,8 +186,11 @@ export declare const serverManager: import("@modern-js/plugin").AsyncManager<{
199
186
  }, unknown>;
200
187
  config: import("@modern-js/plugin").Waterfall<ServerConfig>;
201
188
  prepare: import("@modern-js/plugin").Waterfall<void>;
202
- create: import("@modern-js/plugin").AsyncPipeline<ServerInitInput, InitExtension>;
203
- prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, Adapter>;
189
+ preparebeforeRouteHandler: import("@modern-js/plugin").AsyncPipeline<{
190
+ serverRoutes: ServerRoute[];
191
+ distDir: string;
192
+ }, BeforeRouteHandler>;
193
+ prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
204
194
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
205
195
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
206
196
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
@@ -224,10 +214,7 @@ export declare const serverManager: import("@modern-js/plugin").AsyncManager<{
224
214
  beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
225
215
  context: ModernServerContext;
226
216
  }, any>;
227
- afterMatch: import("@modern-js/plugin").AsyncPipeline<{
228
- context: ModernServerContext;
229
- routeAPI: any;
230
- }, any>;
217
+ afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
231
218
  prefetch: import("@modern-js/plugin").ParallelWorkflow<{
232
219
  context: SSRServerContext;
233
220
  }, unknown>;
@@ -238,10 +225,7 @@ export declare const serverManager: import("@modern-js/plugin").AsyncManager<{
238
225
  beforeRender: import("@modern-js/plugin").AsyncPipeline<{
239
226
  context: ModernServerContext;
240
227
  }, any>;
241
- afterRender: import("@modern-js/plugin").AsyncPipeline<{
242
- context: ModernServerContext;
243
- templateAPI: any;
244
- }, any>;
228
+ afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
245
229
  beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
246
230
  afterSend: import("@modern-js/plugin").ParallelWorkflow<{
247
231
  context: ModernServerContext;
@@ -268,8 +252,11 @@ export declare const createPlugin: (setup?: AsyncSetup<{
268
252
  }, unknown>;
269
253
  config: import("@modern-js/plugin").Waterfall<ServerConfig>;
270
254
  prepare: import("@modern-js/plugin").Waterfall<void>;
271
- create: import("@modern-js/plugin").AsyncPipeline<ServerInitInput, InitExtension>;
272
- prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, Adapter>;
255
+ preparebeforeRouteHandler: import("@modern-js/plugin").AsyncPipeline<{
256
+ serverRoutes: ServerRoute[];
257
+ distDir: string;
258
+ }, BeforeRouteHandler>;
259
+ prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
273
260
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
274
261
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
275
262
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
@@ -293,10 +280,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
293
280
  beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
294
281
  context: ModernServerContext;
295
282
  }, any>;
296
- afterMatch: import("@modern-js/plugin").AsyncPipeline<{
297
- context: ModernServerContext;
298
- routeAPI: any;
299
- }, any>;
283
+ afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
300
284
  prefetch: import("@modern-js/plugin").ParallelWorkflow<{
301
285
  context: SSRServerContext;
302
286
  }, unknown>;
@@ -307,10 +291,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
307
291
  beforeRender: import("@modern-js/plugin").AsyncPipeline<{
308
292
  context: ModernServerContext;
309
293
  }, any>;
310
- afterRender: import("@modern-js/plugin").AsyncPipeline<{
311
- context: ModernServerContext;
312
- templateAPI: any;
313
- }, any>;
294
+ afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
314
295
  beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
315
296
  afterSend: import("@modern-js/plugin").ParallelWorkflow<{
316
297
  context: ModernServerContext;
@@ -327,8 +308,11 @@ export declare const createPlugin: (setup?: AsyncSetup<{
327
308
  }, unknown>;
328
309
  config: import("@modern-js/plugin").Waterfall<ServerConfig>;
329
310
  prepare: import("@modern-js/plugin").Waterfall<void>;
330
- create: import("@modern-js/plugin").AsyncPipeline<ServerInitInput, InitExtension>;
331
- prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, Adapter>;
311
+ preparebeforeRouteHandler: import("@modern-js/plugin").AsyncPipeline<{
312
+ serverRoutes: ServerRoute[];
313
+ distDir: string;
314
+ }, BeforeRouteHandler>;
315
+ prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
332
316
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
333
317
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
334
318
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
@@ -352,10 +336,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
352
336
  beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
353
337
  context: ModernServerContext;
354
338
  }, any>;
355
- afterMatch: import("@modern-js/plugin").AsyncPipeline<{
356
- context: ModernServerContext;
357
- routeAPI: any;
358
- }, any>;
339
+ afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
359
340
  prefetch: import("@modern-js/plugin").ParallelWorkflow<{
360
341
  context: SSRServerContext;
361
342
  }, unknown>;
@@ -366,10 +347,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
366
347
  beforeRender: import("@modern-js/plugin").AsyncPipeline<{
367
348
  context: ModernServerContext;
368
349
  }, any>;
369
- afterRender: import("@modern-js/plugin").AsyncPipeline<{
370
- context: ModernServerContext;
371
- templateAPI: any;
372
- }, any>;
350
+ afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
373
351
  beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
374
352
  afterSend: import("@modern-js/plugin").ParallelWorkflow<{
375
353
  context: ModernServerContext;
@@ -382,8 +360,11 @@ export declare const createPlugin: (setup?: AsyncSetup<{
382
360
  }, unknown>;
383
361
  config: import("@modern-js/plugin").Waterfall<ServerConfig>;
384
362
  prepare: import("@modern-js/plugin").Waterfall<void>;
385
- create: import("@modern-js/plugin").AsyncPipeline<ServerInitInput, InitExtension>;
386
- prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, Adapter>;
363
+ preparebeforeRouteHandler: import("@modern-js/plugin").AsyncPipeline<{
364
+ serverRoutes: ServerRoute[];
365
+ distDir: string;
366
+ }, BeforeRouteHandler>;
367
+ prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
387
368
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
388
369
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
389
370
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
@@ -407,10 +388,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
407
388
  beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
408
389
  context: ModernServerContext;
409
390
  }, any>;
410
- afterMatch: import("@modern-js/plugin").AsyncPipeline<{
411
- context: ModernServerContext;
412
- routeAPI: any;
413
- }, any>;
391
+ afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
414
392
  prefetch: import("@modern-js/plugin").ParallelWorkflow<{
415
393
  context: SSRServerContext;
416
394
  }, unknown>;
@@ -421,10 +399,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
421
399
  beforeRender: import("@modern-js/plugin").AsyncPipeline<{
422
400
  context: ModernServerContext;
423
401
  }, any>;
424
- afterRender: import("@modern-js/plugin").AsyncPipeline<{
425
- context: ModernServerContext;
426
- templateAPI: any;
427
- }, any>;
402
+ afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
428
403
  beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
429
404
  afterSend: import("@modern-js/plugin").ParallelWorkflow<{
430
405
  context: ModernServerContext;
@@ -434,15 +409,18 @@ export declare const createPlugin: (setup?: AsyncSetup<{
434
409
  useAppContext: () => ISAppContext;
435
410
  useConfigContext: () => UserConfig;
436
411
  setAppContext: (value: ISAppContext) => void;
437
- }>> | undefined) => import("@modern-js/plugin").AsyncPlugin<{
412
+ }>, Record<string, unknown>> | undefined) => import("@modern-js/plugin").AsyncPlugin<{
438
413
  gather: import("@modern-js/plugin").ParallelWorkflow<{
439
414
  addWebMiddleware: (_input: any) => void;
440
415
  addAPIMiddleware: (_input: any) => void;
441
416
  }, unknown>;
442
417
  config: import("@modern-js/plugin").Waterfall<ServerConfig>;
443
418
  prepare: import("@modern-js/plugin").Waterfall<void>;
444
- create: import("@modern-js/plugin").AsyncPipeline<ServerInitInput, InitExtension>;
445
- prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, Adapter>;
419
+ preparebeforeRouteHandler: import("@modern-js/plugin").AsyncPipeline<{
420
+ serverRoutes: ServerRoute[];
421
+ distDir: string;
422
+ }, BeforeRouteHandler>;
423
+ prepareWebServer: import("@modern-js/plugin").AsyncPipeline<WebServerStartInput, WebAdapter>;
446
424
  prepareApiServer: import("@modern-js/plugin").AsyncPipeline<APIServerStartInput, Adapter>;
447
425
  onApiChange: import("@modern-js/plugin").Waterfall<Change[]>;
448
426
  beforeDevServer: import("@modern-js/plugin").ParallelWorkflow<ServerOptions, any>;
@@ -466,10 +444,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
466
444
  beforeMatch: import("@modern-js/plugin").AsyncPipeline<{
467
445
  context: ModernServerContext;
468
446
  }, any>;
469
- afterMatch: import("@modern-js/plugin").AsyncPipeline<{
470
- context: ModernServerContext;
471
- routeAPI: any;
472
- }, any>;
447
+ afterMatch: import("@modern-js/plugin").AsyncPipeline<AfterMatchContext, any>;
473
448
  prefetch: import("@modern-js/plugin").ParallelWorkflow<{
474
449
  context: SSRServerContext;
475
450
  }, unknown>;
@@ -480,10 +455,7 @@ export declare const createPlugin: (setup?: AsyncSetup<{
480
455
  beforeRender: import("@modern-js/plugin").AsyncPipeline<{
481
456
  context: ModernServerContext;
482
457
  }, any>;
483
- afterRender: import("@modern-js/plugin").AsyncPipeline<{
484
- context: ModernServerContext;
485
- templateAPI: any;
486
- }, any>;
458
+ afterRender: import("@modern-js/plugin").AsyncPipeline<AfterRenderContext, any>;
487
459
  beforeSend: import("@modern-js/plugin").AsyncPipeline<ModernServerContext, RequestResult>;
488
460
  afterSend: import("@modern-js/plugin").ParallelWorkflow<{
489
461
  context: ModernServerContext;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.21.3",
14
+ "version": "2.0.0-beta.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -29,14 +29,14 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@modern-js/plugin": "1.21.3",
33
- "@modern-js/utils": "1.21.3"
32
+ "@modern-js/plugin": "2.0.0-beta.0",
33
+ "@modern-js/utils": "2.0.0-beta.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@modern-js/core": "1.21.3",
37
- "@modern-js/types": "1.21.3",
38
- "@scripts/build": "1.21.3",
39
- "@scripts/jest-config": "1.21.3",
36
+ "@modern-js/core": "2.0.0-beta.0",
37
+ "@modern-js/types": "2.0.0-beta.0",
38
+ "@scripts/build": "2.0.0-beta.0",
39
+ "@scripts/jest-config": "2.0.0-beta.0",
40
40
  "@types/jest": "^27",
41
41
  "@types/node": "^14",
42
42
  "http-proxy-middleware": "^2.0.4",
@@ -54,32 +54,10 @@
54
54
  "registry": "https://registry.npmjs.org/",
55
55
  "access": "public"
56
56
  },
57
- "wireit": {
58
- "build": {
59
- "command": "modern build",
60
- "files": [
61
- "src/**/*",
62
- "tsconfig.json",
63
- "package.json"
64
- ],
65
- "output": [
66
- "dist/**/*"
67
- ]
68
- },
69
- "test": {
70
- "command": "jest --passWithNoTests",
71
- "files": [
72
- "src/**/*",
73
- "tsconfig.json",
74
- "package.json",
75
- "tests/**/*"
76
- ],
77
- "output": []
78
- }
79
- },
80
57
  "scripts": {
81
58
  "new": "modern new",
82
- "build": "wireit",
83
- "test": "wireit"
59
+ "dev": "modern build --watch",
60
+ "build": "modern build",
61
+ "test": "jest --passWithNoTests"
84
62
  }
85
63
  }