@shuvi/platform-web 0.0.1-rc.34 → 1.0.0-rc.2

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 (238) hide show
  1. package/esm/shared/appTypes.d.ts +15 -0
  2. package/esm/shared/appTypes.js +1 -0
  3. package/esm/shared/configTypes.d.ts +14 -0
  4. package/esm/shared/configTypes.js +1 -0
  5. package/esm/shared/index.d.ts +5 -0
  6. package/esm/shared/index.js +5 -0
  7. package/esm/shared/renderTypes.d.ts +44 -0
  8. package/esm/shared/renderTypes.js +1 -0
  9. package/esm/shared/routeTypes.d.ts +47 -0
  10. package/esm/shared/routeTypes.js +1 -0
  11. package/esm/shared/serverTypes.d.ts +6 -0
  12. package/esm/shared/serverTypes.js +1 -0
  13. package/esm/shuvi-app/app/client.d.ts +2 -0
  14. package/esm/shuvi-app/app/client.js +125 -0
  15. package/esm/shuvi-app/app/server.d.ts +2 -0
  16. package/esm/shuvi-app/app/server.js +67 -0
  17. package/{shuvi-app → esm/shuvi-app}/dev/webpackHotDevClient.d.ts +0 -0
  18. package/{shuvi-app → esm/shuvi-app}/dev/webpackHotDevClient.js +2 -1
  19. package/esm/shuvi-app/entry/client/app.d.ts +2 -0
  20. package/esm/shuvi-app/entry/client/app.js +57 -0
  21. package/esm/shuvi-app/entry/client/index.d.ts +2 -0
  22. package/esm/shuvi-app/entry/client/index.js +12 -0
  23. package/{shuvi-app → esm/shuvi-app}/entry/client/run.dev.d.ts +0 -0
  24. package/{shuvi-app → esm/shuvi-app}/entry/client/run.dev.js +2 -2
  25. package/{shuvi-app → esm/shuvi-app}/entry/client/run.prod.d.ts +0 -0
  26. package/esm/shuvi-app/entry/client/run.prod.js +3 -0
  27. package/{shuvi-app → esm/shuvi-app}/entry/client/setup-env.d.ts +1 -1
  28. package/esm/shuvi-app/entry/client/setup-env.js +17 -0
  29. package/esm/shuvi-app/entry/server/index.d.ts +6 -0
  30. package/esm/shuvi-app/entry/server/index.js +7 -0
  31. package/esm/shuvi-app/react/AppComponent.d.ts +4 -0
  32. package/esm/shuvi-app/react/AppComponent.jsx +6 -0
  33. package/esm/shuvi-app/react/AppContainer.d.ts +6 -0
  34. package/esm/shuvi-app/react/AppContainer.jsx +23 -0
  35. package/esm/shuvi-app/react/Error.d.ts +5 -0
  36. package/esm/shuvi-app/react/Error.jsx +38 -0
  37. package/esm/shuvi-app/react/ErrorBoundary.d.ts +16 -0
  38. package/esm/shuvi-app/react/ErrorBoundary.jsx +25 -0
  39. package/esm/shuvi-app/react/ErrorPage.d.ts +5 -0
  40. package/esm/shuvi-app/react/ErrorPage.jsx +7 -0
  41. package/esm/shuvi-app/react/Link.d.ts +7 -0
  42. package/esm/shuvi-app/react/Link.jsx +115 -0
  43. package/esm/shuvi-app/react/applicationContext.d.ts +7 -0
  44. package/esm/shuvi-app/react/applicationContext.jsx +10 -0
  45. package/esm/shuvi-app/react/dynamic.d.ts +31 -0
  46. package/esm/shuvi-app/react/dynamic.jsx +62 -0
  47. package/esm/shuvi-app/react/getRoutes.d.ts +2 -0
  48. package/esm/shuvi-app/react/getRoutes.js +31 -0
  49. package/esm/shuvi-app/react/head/head-manager-context.d.ts +2 -0
  50. package/esm/shuvi-app/react/head/head-manager-context.js +2 -0
  51. package/esm/shuvi-app/react/head/head-manager.d.ts +10 -0
  52. package/esm/shuvi-app/react/head/head-manager.js +93 -0
  53. package/esm/shuvi-app/react/head/head.d.ts +33 -0
  54. package/esm/shuvi-app/react/head/head.jsx +178 -0
  55. package/esm/shuvi-app/react/head/index.d.ts +4 -0
  56. package/esm/shuvi-app/react/head/index.js +4 -0
  57. package/esm/shuvi-app/react/head/side-effect.d.ts +30 -0
  58. package/esm/shuvi-app/react/head/side-effect.jsx +44 -0
  59. package/esm/shuvi-app/react/head/types.d.ts +15 -0
  60. package/esm/shuvi-app/react/head/types.js +1 -0
  61. package/esm/shuvi-app/react/index.d.ts +4 -0
  62. package/esm/shuvi-app/react/index.js +4 -0
  63. package/esm/shuvi-app/react/loadRouteComponent.d.ts +4 -0
  64. package/esm/shuvi-app/react/loadRouteComponent.jsx +9 -0
  65. package/esm/shuvi-app/react/loadable/index.d.ts +2 -0
  66. package/esm/shuvi-app/react/loadable/index.js +2 -0
  67. package/esm/shuvi-app/react/loadable/loadable-context.d.ts +4 -0
  68. package/esm/shuvi-app/react/loadable/loadable-context.js +3 -0
  69. package/esm/shuvi-app/react/loadable/loadable.d.ts +30 -0
  70. package/esm/shuvi-app/react/loadable/loadable.js +277 -0
  71. package/esm/shuvi-app/react/redox-react/RedoxWrapper.d.ts +8 -0
  72. package/esm/shuvi-app/react/redox-react/RedoxWrapper.jsx +11 -0
  73. package/esm/shuvi-app/react/redox-react/runtime.d.ts +2 -0
  74. package/esm/shuvi-app/react/redox-react/runtime.js +16 -0
  75. package/esm/shuvi-app/react/shuvi-runtime-api.d.ts +5 -0
  76. package/esm/shuvi-app/react/shuvi-runtime-api.js +5 -0
  77. package/esm/shuvi-app/react/types.d.ts +14 -0
  78. package/esm/shuvi-app/react/types.js +1 -0
  79. package/esm/shuvi-app/react/useLoaderData.d.ts +2 -0
  80. package/esm/shuvi-app/react/useLoaderData.js +27 -0
  81. package/esm/shuvi-app/react/utils/getDisplayName.d.ts +2 -0
  82. package/esm/shuvi-app/react/utils/getDisplayName.js +3 -0
  83. package/esm/shuvi-app/react/utils/requestIdleCallback.d.ts +2 -0
  84. package/esm/shuvi-app/react/utils/requestIdleCallback.js +20 -0
  85. package/esm/shuvi-app/react/utils/useIntersection.d.ts +8 -0
  86. package/esm/shuvi-app/react/utils/useIntersection.jsx +91 -0
  87. package/esm/shuvi-app/react/view/ReactView.client.d.ts +5 -0
  88. package/esm/shuvi-app/react/view/ReactView.client.jsx +64 -0
  89. package/esm/shuvi-app/react/view/ReactView.server.d.ts +4 -0
  90. package/esm/shuvi-app/react/view/ReactView.server.jsx +109 -0
  91. package/esm/shuvi-app/react/view/clientView.d.ts +3 -0
  92. package/esm/shuvi-app/react/view/clientView.js +2 -0
  93. package/esm/shuvi-app/react/view/index.d.ts +2 -0
  94. package/esm/shuvi-app/react/view/index.js +7 -0
  95. package/esm/shuvi-app/react/view/render-action.d.ts +10 -0
  96. package/esm/shuvi-app/react/view/render-action.js +29 -0
  97. package/esm/shuvi-app/react/view/serverView.d.ts +3 -0
  98. package/esm/shuvi-app/react/view/serverView.js +2 -0
  99. package/esm/shuvi-app/react/view/transformRoutes.d.ts +2 -0
  100. package/esm/shuvi-app/react/view/transformRoutes.js +3 -0
  101. package/esm/shuvi-app/shuvi-runtime-index.d.ts +4 -0
  102. package/esm/shuvi-app/shuvi-runtime-index.js +2 -0
  103. package/esm/shuvi-app/shuvi-runtime-server.d.ts +6 -0
  104. package/esm/shuvi-app/shuvi-runtime-server.js +1 -0
  105. package/lib/node/features/custom-server/index.d.ts +4 -0
  106. package/lib/node/features/custom-server/index.js +9 -0
  107. package/lib/node/features/custom-server/server.d.ts +2 -0
  108. package/lib/node/features/custom-server/server.js +28 -0
  109. package/lib/node/features/filesystem-routes/api/apiRouteHandler.d.ts +51 -0
  110. package/lib/node/features/filesystem-routes/api/apiRouteHandler.js +237 -0
  111. package/lib/node/features/filesystem-routes/api/apiRoutes.d.ts +7 -0
  112. package/lib/node/features/filesystem-routes/api/apiRoutes.js +35 -0
  113. package/lib/node/features/filesystem-routes/api/index.d.ts +3 -0
  114. package/lib/node/features/filesystem-routes/api/index.js +7 -0
  115. package/lib/node/features/filesystem-routes/api/middleware.d.ts +2 -0
  116. package/lib/node/features/filesystem-routes/api/middleware.js +44 -0
  117. package/lib/node/features/filesystem-routes/hooks.d.ts +3 -0
  118. package/lib/node/features/filesystem-routes/hooks.js +6 -0
  119. package/lib/node/features/filesystem-routes/index.d.ts +20 -0
  120. package/lib/node/features/filesystem-routes/index.js +180 -0
  121. package/lib/node/features/filesystem-routes/middleware/index.d.ts +2 -0
  122. package/lib/node/features/filesystem-routes/middleware/index.js +7 -0
  123. package/lib/node/features/filesystem-routes/middleware/middleware.d.ts +2 -0
  124. package/lib/node/features/filesystem-routes/middleware/middleware.js +42 -0
  125. package/lib/node/features/filesystem-routes/middleware/routes.d.ts +9 -0
  126. package/lib/node/features/filesystem-routes/middleware/routes.js +34 -0
  127. package/lib/node/features/filesystem-routes/page/index.d.ts +2 -0
  128. package/lib/node/features/filesystem-routes/page/index.js +21 -0
  129. package/lib/node/features/filesystem-routes/page/routes.d.ts +8 -0
  130. package/lib/node/features/filesystem-routes/page/routes.js +83 -0
  131. package/lib/node/features/filesystem-routes/page/store.d.ts +3 -0
  132. package/lib/node/features/filesystem-routes/page/store.js +10 -0
  133. package/lib/node/features/html-render/index.d.ts +19 -0
  134. package/lib/node/features/html-render/index.js +28 -0
  135. package/lib/node/features/html-render/lib/generateFilesByRoutId.d.ts +3 -0
  136. package/lib/node/features/html-render/lib/generateFilesByRoutId.js +13 -0
  137. package/lib/node/features/html-render/lib/getPageMiddleware.d.ts +2 -0
  138. package/lib/node/features/html-render/lib/getPageMiddleware.js +56 -0
  139. package/lib/node/features/html-render/lib/index.d.ts +4 -0
  140. package/lib/node/features/html-render/lib/index.js +23 -0
  141. package/lib/node/features/html-render/lib/pageLoader.d.ts +1 -0
  142. package/lib/node/features/html-render/lib/pageLoader.js +42 -0
  143. package/lib/node/features/html-render/lib/renderToHTML.d.ts +6 -0
  144. package/lib/node/features/html-render/lib/renderToHTML.js +81 -0
  145. package/lib/node/features/html-render/lib/renderer/base.d.ts +17 -0
  146. package/lib/node/features/html-render/lib/renderer/base.js +70 -0
  147. package/lib/node/features/html-render/lib/renderer/htmlTag.d.ts +4 -0
  148. package/lib/node/features/html-render/lib/renderer/htmlTag.js +70 -0
  149. package/lib/node/features/html-render/lib/renderer/index.d.ts +15 -0
  150. package/lib/node/features/html-render/lib/renderer/index.js +48 -0
  151. package/lib/node/features/html-render/lib/renderer/spa.d.ts +5 -0
  152. package/lib/node/features/html-render/lib/renderer/spa.js +26 -0
  153. package/lib/node/features/html-render/lib/renderer/ssr.d.ts +5 -0
  154. package/lib/node/features/html-render/lib/renderer/ssr.js +70 -0
  155. package/lib/node/features/html-render/lib/renderer/types.d.ts +20 -0
  156. package/lib/node/features/html-render/lib/renderer/types.js +2 -0
  157. package/lib/node/features/html-render/lib/viewTemplate.d.ts +5 -0
  158. package/lib/node/features/html-render/lib/viewTemplate.js +37 -0
  159. package/lib/node/features/html-render/server.d.ts +2 -0
  160. package/lib/node/features/html-render/server.js +9 -0
  161. package/lib/node/features/html-render/serverHooks.d.ts +10 -0
  162. package/lib/node/features/html-render/serverHooks.js +13 -0
  163. package/lib/node/features/html-render/shuvi-app.d.ts +6 -0
  164. package/lib/node/features/html-render/shuvi-app.js +2 -0
  165. package/lib/node/features/index.d.ts +32 -0
  166. package/lib/node/features/index.js +25 -0
  167. package/lib/node/features/main/buildHtml.d.ts +8 -0
  168. package/lib/node/features/main/buildHtml.js +64 -0
  169. package/lib/node/features/main/generateResource.d.ts +3 -0
  170. package/lib/node/features/main/generateResource.js +56 -0
  171. package/lib/node/features/main/index.d.ts +3 -0
  172. package/lib/node/features/main/index.js +82 -0
  173. package/lib/node/features/middlewares.d.ts +4 -0
  174. package/lib/node/features/middlewares.js +23 -0
  175. package/lib/node/features/model/index.d.ts +21 -0
  176. package/lib/node/features/model/index.js +54 -0
  177. package/lib/node/features/model/runtime.d.ts +13 -0
  178. package/lib/node/features/model/runtime.js +47 -0
  179. package/lib/node/features/model/server.d.ts +3 -0
  180. package/lib/node/features/model/server.js +12 -0
  181. package/lib/node/features/model/shuvi-app.d.ts +6 -0
  182. package/lib/node/features/model/shuvi-app.js +2 -0
  183. package/lib/node/features/on-demand-compile-page/emptyComponent.d.ts +1 -0
  184. package/lib/node/features/on-demand-compile-page/emptyComponent.js +7 -0
  185. package/lib/node/features/on-demand-compile-page/index.d.ts +15 -0
  186. package/lib/node/features/on-demand-compile-page/index.js +36 -0
  187. package/lib/node/features/on-demand-compile-page/onDemandRouteManager.d.ts +11 -0
  188. package/lib/node/features/on-demand-compile-page/onDemandRouteManager.js +104 -0
  189. package/lib/node/index.d.ts +6 -0
  190. package/lib/node/index.js +38 -0
  191. package/lib/{paths.d.ts → node/paths.d.ts} +1 -2
  192. package/lib/node/paths.js +36 -0
  193. package/lib/node/shuvi-type-extensions-node.d.ts +42 -0
  194. package/lib/node/shuvi-type-extensions-node.js +3 -0
  195. package/lib/node/targets/react/bundler/index.d.ts +16 -0
  196. package/lib/node/targets/react/bundler/index.js +102 -0
  197. package/lib/node/targets/react/index.d.ts +32 -0
  198. package/lib/node/targets/react/index.js +28 -0
  199. package/lib/node/targets/react/redox-react/index.d.ts +18 -0
  200. package/lib/node/targets/react/redox-react/index.js +50 -0
  201. package/lib/shared/appTypes.d.ts +15 -0
  202. package/lib/shared/appTypes.js +2 -0
  203. package/lib/shared/configTypes.d.ts +14 -0
  204. package/lib/shared/configTypes.js +2 -0
  205. package/lib/shared/index.d.ts +5 -0
  206. package/lib/shared/index.js +21 -0
  207. package/lib/shared/renderTypes.d.ts +44 -0
  208. package/lib/shared/renderTypes.js +2 -0
  209. package/lib/shared/routeTypes.d.ts +47 -0
  210. package/lib/shared/routeTypes.js +2 -0
  211. package/lib/shared/serverTypes.d.ts +6 -0
  212. package/lib/shared/serverTypes.js +2 -0
  213. package/package.json +78 -15
  214. package/shuvi-type-extensions-node.d.ts +2 -0
  215. package/shuvi-type-extensions-runtime.d.ts +36 -0
  216. package/lib/index.d.ts +0 -3
  217. package/lib/index.js +0 -44
  218. package/lib/paths.js +0 -7
  219. package/shuvi-app/application/client/create-application-factory.d.ts +0 -3
  220. package/shuvi-app/application/client/create-application-factory.js +0 -70
  221. package/shuvi-app/application/client/create-application-history-browser.d.ts +0 -1
  222. package/shuvi-app/application/client/create-application-history-browser.js +0 -3
  223. package/shuvi-app/application/client/create-application-history-hash.d.ts +0 -1
  224. package/shuvi-app/application/client/create-application-history-hash.js +0 -3
  225. package/shuvi-app/application/client/create-application-history-memory.d.ts +0 -1
  226. package/shuvi-app/application/client/create-application-history-memory.js +0 -3
  227. package/shuvi-app/application/server/create-application-spa.d.ts +0 -2
  228. package/shuvi-app/application/server/create-application-spa.js +0 -8
  229. package/shuvi-app/application/server/create-application.d.ts +0 -2
  230. package/shuvi-app/application/server/create-application.js +0 -25
  231. package/shuvi-app/entry/client/index.d.ts +0 -1
  232. package/shuvi-app/entry/client/index.js +0 -11
  233. package/shuvi-app/entry/client/run.prod.js +0 -3
  234. package/shuvi-app/entry/client/setup-app.d.ts +0 -3
  235. package/shuvi-app/entry/client/setup-app.js +0 -38
  236. package/shuvi-app/entry/client/setup-env.js +0 -27
  237. package/shuvi-app/entry/server/index.d.ts +0 -6
  238. package/shuvi-app/entry/server/index.js +0 -7
@@ -1,11 +0,0 @@
1
- // This is the shuvi client-side entry
2
- // IMPORTANT: `setup-env` must be runned before any other codes
3
- import './setup-env';
4
- import { rerender } from './setup-app';
5
- window.__SHUVI = Object.assign(Object.assign({}, (window.__SHUVI || {})), { rerender });
6
- if (process.env.NODE_ENV === 'development') {
7
- require('./run.dev');
8
- }
9
- else {
10
- require('./run.prod');
11
- }
@@ -1,3 +0,0 @@
1
- /// <reference lib="dom" />
2
- import { app } from './setup-app';
3
- app.run();
@@ -1,3 +0,0 @@
1
- declare const app: import("@shuvi/runtime-core").IApplication;
2
- declare const rerender: () => void;
3
- export { app, rerender };
@@ -1,38 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { CLIENT_CONTAINER_ID } from '@shuvi/shared/lib/constants';
11
- // renderer must be imported before application
12
- // we need to init init renderer before import AppComponent
13
- import { view } from '@shuvi/app/core/platform';
14
- import { create } from '@shuvi/app/core/client/application';
15
- import { getAppData } from '@shuvi/platform-core/lib/helper';
16
- const appData = getAppData();
17
- const { routeProps = {} } = appData;
18
- const app = create({
19
- pageData: appData.pageData || {},
20
- routeProps
21
- }, {
22
- render({ appContext, AppComponent, router }) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- const appContainer = document.getElementById(CLIENT_CONTAINER_ID);
25
- view.renderApp({
26
- AppComponent: AppComponent,
27
- router: router,
28
- appData,
29
- appContainer,
30
- appContext
31
- });
32
- });
33
- }
34
- });
35
- const rerender = () => {
36
- app.rerender();
37
- };
38
- export { app, rerender };
@@ -1,27 +0,0 @@
1
- /**
2
- * Following codes should be run beforen any other codes.
3
- * Do not try to import any module from `@shuvi/app`.
4
- */
5
- import { IDENTITY_RUNTIME_PUBLICPATH, IDENTITY_SSR_RUNTIME_PUBLICPATH } from '@shuvi/shared/lib/constants';
6
- import setRuntimeConfig from '@shuvi/app/core/setRuntimeConfig';
7
- import runtimeConfig from '@shuvi/app/core/runtimeConfig';
8
- import { getAppData } from '@shuvi/platform-core/lib/helper';
9
- const win = window;
10
- // server runtime public path
11
- if (win[IDENTITY_SSR_RUNTIME_PUBLICPATH]) {
12
- __webpack_public_path__ = win[IDENTITY_SSR_RUNTIME_PUBLICPATH];
13
- }
14
- // client runtime public path
15
- if (win[IDENTITY_RUNTIME_PUBLICPATH]) {
16
- __webpack_public_path__ = win[IDENTITY_RUNTIME_PUBLICPATH];
17
- }
18
- // === set runtime config ===
19
- const appData = getAppData();
20
- // build-time config for none-ssr
21
- if (runtimeConfig) {
22
- setRuntimeConfig(runtimeConfig);
23
- }
24
- // runtime config from server
25
- if (appData.runtimeConfig) {
26
- setRuntimeConfig(appData.runtimeConfig);
27
- }
@@ -1,6 +0,0 @@
1
- import * as server from '@shuvi/app/user/server';
2
- import * as document from '@shuvi/app/user/document';
3
- import * as application from '@shuvi/app/core/server/application';
4
- import { default as apiRoutes } from '@shuvi/app/core/apiRoutes';
5
- export { server, document, application, apiRoutes };
6
- export { view } from '@shuvi/app/core/platform';
@@ -1,7 +0,0 @@
1
- // This is the shuvi server-side main module exports collection
2
- import * as server from '@shuvi/app/user/server';
3
- import * as document from '@shuvi/app/user/document';
4
- import * as application from '@shuvi/app/core/server/application';
5
- import { default as apiRoutes } from '@shuvi/app/core/apiRoutes';
6
- export { server, document, application, apiRoutes };
7
- export { view } from '@shuvi/app/core/platform';