@shuvi/platform-web 1.0.0-rc.4 → 1.0.0-rc.7

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.
Files changed (77) hide show
  1. package/esm/shared/appTypes.d.ts +4 -2
  2. package/esm/shared/renderTypes.d.ts +6 -5
  3. package/esm/shared/routeTypes.d.ts +4 -9
  4. package/esm/shuvi-app/app/client.js +11 -16
  5. package/esm/shuvi-app/app/server.js +10 -9
  6. package/esm/shuvi-app/dev/hotDevClient.d.ts +0 -1
  7. package/esm/shuvi-app/dev/hotDevClient.js +30 -51
  8. package/esm/shuvi-app/dev/websocket.d.ts +0 -1
  9. package/esm/shuvi-app/helper/serializeServerError.d.ts +2 -0
  10. package/esm/shuvi-app/helper/serializeServerError.js +21 -0
  11. package/esm/shuvi-app/react/AppContainer.d.ts +2 -3
  12. package/esm/shuvi-app/react/AppContainer.jsx +3 -4
  13. package/esm/shuvi-app/react/getRoutes.js +5 -3
  14. package/esm/shuvi-app/react/{redox-react → model}/RedoxWrapper.d.ts +3 -3
  15. package/esm/shuvi-app/react/{redox-react → model}/RedoxWrapper.jsx +3 -3
  16. package/esm/shuvi-app/react/model/runtime.d.ts +8 -0
  17. package/esm/shuvi-app/react/{redox-react → model}/runtime.js +6 -3
  18. package/esm/shuvi-app/react/store.d.ts +5 -0
  19. package/esm/shuvi-app/react/store.js +3 -0
  20. package/esm/shuvi-app/react/types.d.ts +0 -7
  21. package/esm/shuvi-app/react/useLoaderData.js +9 -20
  22. package/esm/shuvi-app/react/view/ReactView.client.jsx +25 -4
  23. package/esm/shuvi-app/react/view/ReactView.server.jsx +17 -14
  24. package/esm/shuvi-app/shuvi-runtime-index.d.ts +3 -3
  25. package/lib/node/features/custom-server/index.d.ts +1 -1
  26. package/lib/node/features/custom-server/server.d.ts +1 -1
  27. package/lib/node/features/filesystem-routes/api/apiRouteHandler.d.ts +7 -7
  28. package/lib/node/features/filesystem-routes/api/apiRouteHandler.js +0 -4
  29. package/lib/node/features/filesystem-routes/api/middleware.d.ts +2 -2
  30. package/lib/node/features/filesystem-routes/index.d.ts +1 -13
  31. package/lib/node/features/filesystem-routes/index.js +3 -41
  32. package/lib/node/features/filesystem-routes/middleware/middleware.d.ts +2 -2
  33. package/lib/node/features/filesystem-routes/page/routes.js +1 -1
  34. package/lib/node/features/html-render/index.js +1 -1
  35. package/lib/node/features/html-render/lib/getPageMiddleware.d.ts +2 -2
  36. package/lib/node/features/html-render/lib/index.d.ts +0 -1
  37. package/lib/node/features/html-render/lib/index.js +1 -3
  38. package/lib/node/features/html-render/lib/renderToHTML.d.ts +2 -2
  39. package/lib/node/features/html-render/lib/renderToHTML.js +7 -48
  40. package/lib/node/features/html-render/lib/renderer/base.d.ts +6 -6
  41. package/lib/node/features/html-render/lib/renderer/base.js +5 -5
  42. package/lib/node/features/html-render/lib/renderer/index.d.ts +5 -4
  43. package/lib/node/features/html-render/lib/renderer/index.js +69 -6
  44. package/lib/node/features/html-render/lib/renderer/spa.d.ts +2 -2
  45. package/lib/node/features/html-render/lib/renderer/spa.js +4 -6
  46. package/lib/node/features/html-render/lib/renderer/ssr.d.ts +2 -2
  47. package/lib/node/features/html-render/lib/renderer/ssr.js +5 -6
  48. package/lib/node/features/html-render/lib/renderer/types.d.ts +8 -5
  49. package/lib/node/features/html-render/server.d.ts +1 -1
  50. package/lib/node/features/index.js +1 -3
  51. package/lib/node/features/model/index.d.ts +1 -13
  52. package/lib/node/features/model/runtime.d.ts +3 -3
  53. package/lib/node/features/model/runtime.js +2 -0
  54. package/lib/node/features/model/shuvi-app.d.ts +2 -2
  55. package/lib/node/features/on-demand-compile-page/index.d.ts +1 -13
  56. package/lib/node/features/on-demand-compile-page/onDemandRouteManager.d.ts +3 -3
  57. package/lib/node/paths.js +0 -2
  58. package/lib/node/shuvi-runtime-server.d.ts +18 -0
  59. package/lib/node/shuvi-runtime-server.js +2 -0
  60. package/lib/node/shuvi-type-extensions-node.d.ts +0 -6
  61. package/lib/node/targets/react/bundler/index.d.ts +1 -13
  62. package/lib/node/targets/react/index.d.ts +2 -26
  63. package/lib/node/targets/react/index.js +2 -2
  64. package/lib/node/targets/react/model/index.d.ts +6 -0
  65. package/lib/node/targets/react/{redox-react → model}/index.js +7 -6
  66. package/lib/shared/appTypes.d.ts +4 -2
  67. package/lib/shared/renderTypes.d.ts +6 -5
  68. package/lib/shared/routeTypes.d.ts +4 -9
  69. package/package.json +14 -14
  70. package/esm/shuvi-app/react/redox-react/runtime.d.ts +0 -8
  71. package/esm/shuvi-app/shuvi-runtime-server.d.ts +0 -6
  72. package/esm/shuvi-app/shuvi-runtime-server.js +0 -1
  73. package/lib/node/features/webpack-watch-wait-for-file-builder/index.d.ts +0 -16
  74. package/lib/node/features/webpack-watch-wait-for-file-builder/index.js +0 -25
  75. package/lib/node/features/webpack-watch-wait-for-file-builder/webpack-watch-wait-for-file-builder-plugin.d.ts +0 -12
  76. package/lib/node/features/webpack-watch-wait-for-file-builder/webpack-watch-wait-for-file-builder-plugin.js +0 -32
  77. package/lib/node/targets/react/redox-react/index.d.ts +0 -18
@@ -1,8 +0,0 @@
1
- import { IStoreManager } from '@shuvi/redox';
2
- declare module '@shuvi/runtime' {
3
- interface CustomAppContext {
4
- store: IStoreManager;
5
- }
6
- }
7
- declare const _default: import("@shuvi/platform-shared/shared").IPluginInstance<import("@shuvi/platform-shared/shared").BuiltInRuntimePluginHooks & import("@shuvi/runtime").CustomRuntimePluginHooks, void>;
8
- export default _default;
@@ -1,6 +0,0 @@
1
- import { IServerModule as _IServerModule } from '../shared';
2
- declare type ServerModule = Required<_IServerModule>;
3
- export declare type GetPageDataFunction = ServerModule['getPageData'];
4
- export declare type HandlePageRequestFunction = ServerModule['handlePageRequest'];
5
- export declare type ModifyHtmlFunction = ServerModule['modifyHtml'];
6
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- declare const _default: {
2
- core: import("@shuvi/hook").IPluginInstance<{
3
- extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
4
- afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
5
- afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
6
- afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
7
- afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
8
- afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
9
- configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
10
- addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
11
- addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
12
- addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOption<any, any> | import("@shuvi/service/lib/project/index").FileOption<any, any>[]>;
13
- addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
14
- } & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
15
- };
16
- export default _default;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const service_1 = require("@shuvi/service");
7
- const webpack_watch_wait_for_file_builder_plugin_1 = __importDefault(require("./webpack-watch-wait-for-file-builder-plugin"));
8
- const plugin = (0, service_1.createPlugin)({
9
- configWebpack(config, _, ctx) {
10
- if (ctx.mode === 'development') {
11
- config
12
- .plugin('webpack-watch-wait-for-file-builder-plugin')
13
- .use(webpack_watch_wait_for_file_builder_plugin_1.default, [
14
- {
15
- onBuildStart: ctx.onBuildStart,
16
- onBuildEnd: ctx.onBuildEnd
17
- }
18
- ]);
19
- }
20
- return config;
21
- }
22
- });
23
- exports.default = {
24
- core: plugin
25
- };
@@ -1,12 +0,0 @@
1
- import { IPluginContext } from '@shuvi/service';
2
- import { Compiler, Plugin } from '@shuvi/toolpack/lib/webpack';
3
- declare type Options = {
4
- onBuildStart: IPluginContext['onBuildStart'];
5
- onBuildEnd: IPluginContext['onBuildEnd'];
6
- };
7
- export default class WebpackWatchWaitForFileBuilderPlugin implements Plugin {
8
- options: Options;
9
- constructor(options: Options);
10
- apply(compiler: Compiler): void;
11
- }
12
- export {};
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class WebpackWatchWaitForFileBuilderPlugin {
4
- constructor(options) {
5
- this.options = options;
6
- }
7
- apply(compiler) {
8
- const { onBuildEnd, onBuildStart } = this.options;
9
- /**
10
- * watching.suspend will pause the real action in the watcher handler but still collecting changed files.
11
- * watching.resume will resume its action
12
- *
13
- * We make sure onBuildStart is faster than webpack's watcher and make it suspend.
14
- *
15
- * And resume when onBuildEnd.
16
- *
17
- * In this way, during build of fileBuilder, webpack will not trigger any watchRun event but keep watching changed files.
18
- */
19
- onBuildStart(() => {
20
- compiler.watching.suspend();
21
- });
22
- onBuildEnd(({ buildStatus }) => {
23
- if (buildStatus === 'fulfilled') {
24
- setTimeout(() => {
25
- compiler.watching.resume();
26
- // FIXME: timeout for resuming need further investigation
27
- }, 100);
28
- }
29
- });
30
- }
31
- }
32
- exports.default = WebpackWatchWaitForFileBuilderPlugin;
@@ -1,18 +0,0 @@
1
- export declare const RedoxReactPlugin: {
2
- core: import("@shuvi/hook").IPluginInstance<{
3
- extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
4
- afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
5
- afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
6
- afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
7
- afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
8
- afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
9
- configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
10
- addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
11
- addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
12
- addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOption<any, any> | import("@shuvi/service/lib/project/index").FileOption<any, any>[]>;
13
- addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
14
- } & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
15
- runtime: {
16
- plugin: string;
17
- };
18
- };