@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
@@ -0,0 +1,2 @@
1
+ export { normalizeRoutes, generateRoutesContent, IPageRouteConfig } from './routes';
2
+ export * from './store';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.generateRoutesContent = exports.normalizeRoutes = void 0;
18
+ var routes_1 = require("./routes");
19
+ Object.defineProperty(exports, "normalizeRoutes", { enumerable: true, get: function () { return routes_1.normalizeRoutes; } });
20
+ Object.defineProperty(exports, "generateRoutesContent", { enumerable: true, get: function () { return routes_1.generateRoutesContent; } });
21
+ __exportStar(require("./store"), exports);
@@ -0,0 +1,8 @@
1
+ import { IPageRouteConfig, IPageRouteConfigWithId } from '@shuvi/platform-shared/shared';
2
+ export { IPageRouteConfig };
3
+ /**
4
+ * returns JSON string of IRawPageRouteRecord
5
+ */
6
+ export declare function serializeRoutes(routes: IPageRouteConfigWithId[]): string;
7
+ export declare function normalizeRoutes(routes: IPageRouteConfig[], componentDir: string, parentPath?: string): IPageRouteConfigWithId[];
8
+ export declare const generateRoutesContent: (routes: IPageRouteConfigWithId[]) => string;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.generateRoutesContent = exports.normalizeRoutes = exports.serializeRoutes = void 0;
15
+ const crypto_1 = require("crypto");
16
+ const constants_1 = require("@shuvi/shared/lib/constants");
17
+ const file_1 = require("@shuvi/utils/lib/file");
18
+ function genRouteId(filepath) {
19
+ return (0, crypto_1.createHash)('md4').update(filepath).digest('hex').substr(0, 4);
20
+ }
21
+ /**
22
+ * returns JSON string of IRawPageRouteRecord
23
+ */
24
+ function serializeRoutes(routes) {
25
+ let res = '';
26
+ for (let index = 0; index < routes.length; index++) {
27
+ const _a = routes[index], { children: childRoutes } = _a, route = __rest(_a, ["children"]);
28
+ const id = route.id;
29
+ let strRoute = '';
30
+ const keys = Object.keys(route);
31
+ for (let index = 0; index < keys.length; index++) {
32
+ const key = keys[index];
33
+ if (key === 'component') {
34
+ const { component } = route;
35
+ const componentSource = component;
36
+ const componentSourceWithAffix = `${componentSource}?${constants_1.ROUTE_RESOURCE_QUERYSTRING}`;
37
+ // `webpackExports` works with production and optimization.minimize, check compiled dist
38
+ strRoute +=
39
+ `__componentSourceWithAffix__: "${componentSourceWithAffix}",
40
+ __componentSource__: "${componentSource}",
41
+ __import__: () => import(
42
+ /* webpackChunkName: "page-${id}" */
43
+ /* webpackExports: "default" */
44
+ "${componentSourceWithAffix}"),
45
+ __resolveWeak__: () => [require.resolveWeak("${componentSourceWithAffix}")]`.trim();
46
+ }
47
+ else {
48
+ strRoute += `${key}: ${JSON.stringify(route[key])}`;
49
+ }
50
+ strRoute += `,\n`;
51
+ }
52
+ if (childRoutes && childRoutes.length > 0) {
53
+ strRoute += `children: ${serializeRoutes(childRoutes)},\n`;
54
+ }
55
+ res += `{${strRoute}},\n`;
56
+ }
57
+ return `[${res}]`;
58
+ }
59
+ exports.serializeRoutes = serializeRoutes;
60
+ function normalizeRoutes(routes, componentDir, parentPath = '') {
61
+ const res = [];
62
+ for (let index = 0; index < routes.length; index++) {
63
+ const route = Object.assign({}, routes[index]);
64
+ const pathWithoutSlash = route.path.replace(/^\//, '').replace(/\/$/, '');
65
+ const fullpath = parentPath + '/' + pathWithoutSlash;
66
+ if (route.component) {
67
+ route.component = (0, file_1.normalizePath)(route.component, componentDir);
68
+ }
69
+ // todo: add origin file to gen id
70
+ route.id = genRouteId(`${fullpath}@${route.component}`);
71
+ if (route.children && route.children.length > 0) {
72
+ route.children = normalizeRoutes(route.children, componentDir, fullpath);
73
+ }
74
+ res.push(route);
75
+ }
76
+ return res;
77
+ }
78
+ exports.normalizeRoutes = normalizeRoutes;
79
+ const generateRoutesContent = (routes) => {
80
+ const serialized = serializeRoutes(routes);
81
+ return `export default ${serialized}`;
82
+ };
83
+ exports.generateRoutesContent = generateRoutesContent;
@@ -0,0 +1,3 @@
1
+ import { IPageRouteConfigWithId } from '@shuvi/platform-shared/shared';
2
+ export declare const setRoutes: (newRoutes: IPageRouteConfigWithId[]) => void;
3
+ export declare const getRoutes: () => IPageRouteConfigWithId[];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRoutes = exports.setRoutes = void 0;
4
+ let routes = [];
5
+ const setRoutes = (newRoutes) => {
6
+ routes = newRoutes;
7
+ };
8
+ exports.setRoutes = setRoutes;
9
+ const getRoutes = () => routes;
10
+ exports.getRoutes = getRoutes;
@@ -0,0 +1,19 @@
1
+ export { getPageMiddleware, IHtmlDocument, ITemplateData, IViewServer, IViewClient } from './lib';
2
+ declare const _default: {
3
+ core: import("@shuvi/hook").IPluginInstance<{
4
+ extendConfig: import("@shuvi/hook").SyncWaterfallHook<import("@shuvi/service").Config, void>;
5
+ afterInit: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
6
+ afterBuild: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
7
+ afterDestroy: import("@shuvi/hook").AsyncParallelHook<void, void, void>;
8
+ afterBundlerDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerDoneExtra, void, void>;
9
+ afterBundlerTargetDone: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").BundlerTargetDoneExtra, void, void>;
10
+ configWebpack: import("@shuvi/hook").AsyncSeriesWaterfallHook<import("@shuvi/service/lib/core/lifecycleTypes").WebpackChainType, import("@shuvi/service/lib/core/lifecycleTypes").ConfigWebpackAssistant>;
11
+ addExtraTarget: import("@shuvi/hook").AsyncParallelHook<import("@shuvi/service/lib/core/lifecycleTypes").ExtraTargetAssistant, void, import("@shuvi/service/lib/core/lifecycleTypes").TargetChain>;
12
+ addResource: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").Resources | import("@shuvi/service/lib/core/lifecycleTypes").Resources[]>;
13
+ addRuntimeFile: import("@shuvi/hook").AsyncParallelHook<void, import("@shuvi/service/lib/core/lifecycleTypes").AddRuntimeFileUtils, import("@shuvi/service/lib/project/index").FileOptions<any, any> | import("@shuvi/service/lib/project/index").FileOptions<any, any>[]>;
14
+ addRuntimeService: import("@shuvi/hook").AsyncParallelHook<void, void, import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService | import("@shuvi/service/lib/core/lifecycleTypes").RuntimeService[]>;
15
+ } & import("@shuvi/service/lib/core/apiTypes").CustomCorePluginHooks, import("@shuvi/service").IPluginContext>;
16
+ server: import("@shuvi/hook").IPluginInstance<import("@shuvi/service/lib/server/plugin").BuiltInServerPluginHooks & import("@shuvi/service/lib/server/pluginTypes").CustomServerPluginHooks, import("@shuvi/service").IServerPluginContext>;
17
+ types: string;
18
+ };
19
+ export default _default;
@@ -0,0 +1,28 @@
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
+ exports.getPageMiddleware = void 0;
7
+ const service_1 = require("@shuvi/service");
8
+ const paths_1 = require("../../paths");
9
+ const server_1 = __importDefault(require("./server"));
10
+ var lib_1 = require("./lib");
11
+ Object.defineProperty(exports, "getPageMiddleware", { enumerable: true, get: function () { return lib_1.getPageMiddleware; } });
12
+ const core = (0, service_1.createPlugin)({
13
+ addRuntimeFile: ({ defineFile }, context) => {
14
+ const { config: { router: { history } } } = context;
15
+ const routerConfigFile = defineFile({
16
+ name: 'routerConfig.js',
17
+ content: () => {
18
+ return `export const historyMode = "${history}";`;
19
+ }
20
+ });
21
+ return [routerConfigFile];
22
+ }
23
+ });
24
+ exports.default = {
25
+ core,
26
+ server: server_1.default,
27
+ types: (0, paths_1.resolvePkgFile)('lib/node/features/html-render/shuvi-app.d.ts')
28
+ };
@@ -0,0 +1,3 @@
1
+ import { IManifest } from '@shuvi/toolpack/lib/webpack/types';
2
+ import { IRouteRecord } from '@shuvi/router';
3
+ export default function generateFilesByRoutId(assetMap: IManifest, routes: IRouteRecord[]): Record<string, string[]>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function generateFilesByRoutId(assetMap, routes) {
4
+ let filesByRoutId = {};
5
+ const loadable = assetMap.loadble;
6
+ routes.forEach(({ id, __componentSourceWithAffix__ }) => {
7
+ if (id && __componentSourceWithAffix__) {
8
+ filesByRoutId[id] = loadable[__componentSourceWithAffix__].files;
9
+ }
10
+ });
11
+ return filesByRoutId;
12
+ }
13
+ exports.default = generateFilesByRoutId;
@@ -0,0 +1,2 @@
1
+ import { IRequestHandlerWithNext, IServerPluginContext } from '@shuvi/service';
2
+ export declare function getPageMiddleware(api: IServerPluginContext): IRequestHandlerWithNext;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getPageMiddleware = void 0;
13
+ const utils_1 = require("@shuvi/service/lib/server/utils");
14
+ const renderToHTML_1 = require("./renderToHTML");
15
+ const shared_1 = require("@shuvi/platform-shared/shared");
16
+ function createPageHandler(serverPluginContext) {
17
+ return function (req, res) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const result = yield (0, renderToHTML_1.renderToHTML)({
20
+ req: req,
21
+ serverPluginContext
22
+ });
23
+ if ((0, shared_1.isRedirect)(result)) {
24
+ const redirectResp = result;
25
+ res.writeHead(redirectResp.status, {
26
+ Location: redirectResp.headers.get('Location')
27
+ });
28
+ res.end();
29
+ }
30
+ else if ((0, shared_1.isText)(result)) {
31
+ const textResp = result;
32
+ res.statusCode = textResp.status;
33
+ (0, utils_1.sendHTML)(req, res, textResp.data);
34
+ }
35
+ else {
36
+ // shuold never reach here
37
+ throw new Error('Unexpected reponse type from renderToHTML');
38
+ }
39
+ });
40
+ };
41
+ }
42
+ function getPageMiddleware(api) {
43
+ let pageHandler = createPageHandler(api);
44
+ return function (req, res, next) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ try {
47
+ pageHandler = yield api.serverPluginRunner.handlePageRequest(pageHandler);
48
+ yield pageHandler(req, res);
49
+ }
50
+ catch (error) {
51
+ next(error);
52
+ }
53
+ });
54
+ };
55
+ }
56
+ exports.getPageMiddleware = getPageMiddleware;
@@ -0,0 +1,4 @@
1
+ export { getPageMiddleware } from './getPageMiddleware';
2
+ export { renderToHTML } from './renderToHTML';
3
+ export * from './renderer';
4
+ export * from './pageLoader';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.renderToHTML = exports.getPageMiddleware = void 0;
18
+ var getPageMiddleware_1 = require("./getPageMiddleware");
19
+ Object.defineProperty(exports, "getPageMiddleware", { enumerable: true, get: function () { return getPageMiddleware_1.getPageMiddleware; } });
20
+ var renderToHTML_1 = require("./renderToHTML");
21
+ Object.defineProperty(exports, "renderToHTML", { enumerable: true, get: function () { return renderToHTML_1.renderToHTML; } });
22
+ __exportStar(require("./renderer"), exports);
23
+ __exportStar(require("./pageLoader"), exports);
@@ -0,0 +1 @@
1
+ export declare function ifComponentHasLoader(component: string): boolean;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ifComponentHasLoader = void 0;
27
+ const fs = __importStar(require("fs"));
28
+ const file_utils_1 = require("@shuvi/service/lib/project/file-utils");
29
+ const file_1 = require("@shuvi/utils/lib/file");
30
+ function ifComponentHasLoader(component) {
31
+ const file = (0, file_1.resolveFile)(component);
32
+ if (file) {
33
+ const content = fs.readFileSync(file, 'utf-8');
34
+ try {
35
+ const exports = (0, file_utils_1.getExports)(content);
36
+ return exports.includes('loader');
37
+ }
38
+ catch (_a) { }
39
+ }
40
+ return false;
41
+ }
42
+ exports.ifComponentHasLoader = ifComponentHasLoader;
@@ -0,0 +1,6 @@
1
+ import { IRequest, IServerPluginContext } from '@shuvi/service';
2
+ import { Response } from '@shuvi/platform-shared/shared';
3
+ export declare function renderToHTML({ req, serverPluginContext }: {
4
+ req: IRequest;
5
+ serverPluginContext: IServerPluginContext;
6
+ }): Promise<Response>;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.renderToHTML = void 0;
13
+ const resources_1 = require("@shuvi/service/lib/resources");
14
+ const shared_1 = require("@shuvi/platform-shared/shared");
15
+ const renderer_1 = require("./renderer");
16
+ const htmlTag_1 = require("./renderer/htmlTag");
17
+ function addEssentialTagsIfMissing(document) {
18
+ let hasMetaCharset = false;
19
+ let hasMetaViewport = false;
20
+ for (const { tagName, attrs } of document.headTags) {
21
+ if (hasMetaCharset && hasMetaViewport) {
22
+ break;
23
+ }
24
+ if (tagName === 'meta') {
25
+ if (attrs.charset) {
26
+ hasMetaCharset = true;
27
+ }
28
+ else if (attrs.name === 'viewport') {
29
+ hasMetaViewport = true;
30
+ }
31
+ }
32
+ }
33
+ if (!hasMetaCharset) {
34
+ document.headTags.unshift((0, htmlTag_1.tag)('meta', {
35
+ charset: 'utf-8'
36
+ }));
37
+ }
38
+ if (!hasMetaViewport) {
39
+ document.headTags.unshift((0, htmlTag_1.tag)('meta', {
40
+ name: 'viewport',
41
+ content: 'width=device-width,minimum-scale=1,initial-scale=1'
42
+ }));
43
+ }
44
+ return document;
45
+ }
46
+ function renderToHTML({ req, serverPluginContext }) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ let result;
49
+ const renderer = new renderer_1.Renderer({ serverPluginContext });
50
+ const { application } = resources_1.server;
51
+ const app = application.createApp({
52
+ req,
53
+ ssr: serverPluginContext.config.ssr
54
+ });
55
+ try {
56
+ yield app.init();
57
+ const publicApp = app.getPublicAPI();
58
+ let doc = yield renderer.renderDocument({
59
+ app: publicApp,
60
+ req
61
+ });
62
+ if ((0, shared_1.isResponse)(doc)) {
63
+ result = doc;
64
+ }
65
+ else {
66
+ addEssentialTagsIfMissing(doc);
67
+ yield serverPluginContext.serverPluginRunner.modifyHtml(doc, app.context);
68
+ const htmlStr = renderer.renderDocumentToString(doc);
69
+ const appError = app.error.getError;
70
+ result = (0, shared_1.text)(htmlStr, {
71
+ status: appError && typeof appError.code !== 'undefined' ? appError.code : 200
72
+ });
73
+ }
74
+ }
75
+ finally {
76
+ yield app.dispose();
77
+ }
78
+ return result;
79
+ });
80
+ }
81
+ exports.renderToHTML = renderToHTML;
@@ -0,0 +1,17 @@
1
+ import { IAppData, Response } from '@shuvi/platform-shared/shared';
2
+ import { IServerPluginContext } from '@shuvi/service';
3
+ import { IHtmlDocument, IHtmlTag, IApplication } from './types';
4
+ import { IRendererConstructorOptions, IRenderDocumentOptions } from './types';
5
+ export declare type AppData = Omit<IAppData, 'filesByRoutId' | 'publicPath'>;
6
+ export declare abstract class BaseRenderer {
7
+ protected _serverPluginContext: IServerPluginContext;
8
+ protected _app?: IApplication;
9
+ constructor({ serverPluginContext }: IRendererConstructorOptions);
10
+ abstract renderDocument({ app, req }: IRenderDocumentOptions): Promise<IHtmlDocument | Response> | IHtmlDocument | Response;
11
+ protected _getMainAssetTags(): {
12
+ styles: IHtmlTag<any>[];
13
+ scripts: IHtmlTag<any>[];
14
+ };
15
+ protected _getAppContainerTag(html?: string): IHtmlTag<'div'>;
16
+ protected _getInlineAppData(app: IApplication, appData: AppData): IHtmlTag;
17
+ }
@@ -0,0 +1,70 @@
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
+ exports.BaseRenderer = void 0;
7
+ const htmlescape_1 = require("@shuvi/utils/lib/htmlescape");
8
+ const service_1 = require("@shuvi/service");
9
+ const constants_1 = require("@shuvi/shared/lib/constants");
10
+ const resources_1 = require("@shuvi/service/lib/resources");
11
+ const generateFilesByRoutId_1 = __importDefault(require("../generateFilesByRoutId"));
12
+ const htmlTag_1 = require("./htmlTag");
13
+ class BaseRenderer {
14
+ constructor({ serverPluginContext }) {
15
+ this._serverPluginContext = serverPluginContext;
16
+ }
17
+ _getMainAssetTags() {
18
+ const styles = [];
19
+ const scripts = [];
20
+ const entrypoints = resources_1.clientManifest.entries[service_1.BUILD_CLIENT_RUNTIME_MAIN];
21
+ const polyfill = resources_1.clientManifest.bundles[service_1.BUILD_CLIENT_RUNTIME_POLYFILL];
22
+ scripts.push((0, htmlTag_1.tag)('script', {
23
+ src: this._serverPluginContext.getAssetPublicUrl(polyfill)
24
+ }));
25
+ entrypoints.js.forEach((asset) => {
26
+ scripts.push((0, htmlTag_1.tag)('script', {
27
+ src: this._serverPluginContext.getAssetPublicUrl(asset)
28
+ }));
29
+ });
30
+ if (entrypoints.css) {
31
+ entrypoints.css.forEach((asset) => {
32
+ styles.push((0, htmlTag_1.tag)('link', {
33
+ rel: 'stylesheet',
34
+ href: this._serverPluginContext.getAssetPublicUrl(asset)
35
+ }));
36
+ });
37
+ }
38
+ if (this._serverPluginContext.mode === 'development') {
39
+ styles.push((0, htmlTag_1.tag)('style', {
40
+ [constants_1.DEV_STYLE_HIDE_FOUC]: true
41
+ }, 'body{display:none}'),
42
+ /**
43
+ * this element is used to mount development styles so the
44
+ * ordering matches production
45
+ * (by default, style-loader injects at the bottom of <head />)
46
+ */
47
+ (0, htmlTag_1.tag)('style', {
48
+ id: constants_1.DEV_STYLE_ANCHOR_ID
49
+ }));
50
+ }
51
+ return {
52
+ styles,
53
+ scripts
54
+ };
55
+ }
56
+ _getAppContainerTag(html = '') {
57
+ return (0, htmlTag_1.tag)('div', {
58
+ id: constants_1.CLIENT_CONTAINER_ID
59
+ }, html);
60
+ }
61
+ _getInlineAppData(app, appData) {
62
+ const routes = app.router.routes || [];
63
+ const data = JSON.stringify(Object.assign(Object.assign({}, appData), { filesByRoutId: (0, generateFilesByRoutId_1.default)(resources_1.clientManifest, routes), publicPath: this._serverPluginContext.getAssetPublicUrl() }));
64
+ return (0, htmlTag_1.tag)('script', {
65
+ id: constants_1.CLIENT_APPDATA_ID,
66
+ type: 'application/json'
67
+ }, (0, htmlescape_1.htmlEscapeJsonString)(data));
68
+ }
69
+ }
70
+ exports.BaseRenderer = BaseRenderer;
@@ -0,0 +1,4 @@
1
+ import { IHtmlAttrs, IHtmlTag } from './types';
2
+ export declare function stringifyAttrs(attrs: IHtmlAttrs): string;
3
+ export declare function stringifyTag(tag: IHtmlTag): string;
4
+ export declare function tag<T extends string>(tagName: T, attrs: IHtmlAttrs, innerHTML?: string): IHtmlTag<T>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tag = exports.stringifyTag = exports.stringifyAttrs = void 0;
4
+ const htmlescape_1 = require("@shuvi/utils/lib/htmlescape");
5
+ /**
6
+ * All html tag elements which must not contain innerHTML
7
+ * @see https://www.w3.org/TR/html5/syntax.html#void-elements
8
+ */
9
+ const voidTags = [
10
+ 'area',
11
+ 'base',
12
+ 'br',
13
+ 'col',
14
+ 'embed',
15
+ 'hr',
16
+ 'img',
17
+ 'input',
18
+ 'keygen',
19
+ 'link',
20
+ 'meta',
21
+ 'param',
22
+ 'source',
23
+ 'track',
24
+ 'wbr'
25
+ ];
26
+ // the result will have an extra leading space
27
+ function stringifyAttrs(attrs) {
28
+ var _a;
29
+ const attrNames = Object.keys(attrs);
30
+ const res = [''];
31
+ for (let index = 0; index < attrNames.length; index++) {
32
+ const attributeName = attrNames[index];
33
+ if (attributeName === 'textContent')
34
+ continue;
35
+ if (attrs[attributeName] === false) {
36
+ continue;
37
+ }
38
+ if (attrs[attributeName] === true) {
39
+ res.push((0, htmlescape_1.htmlEscapeContent)(attributeName));
40
+ }
41
+ else {
42
+ res.push(`${(0, htmlescape_1.htmlEscapeContent)(attributeName)}="${(0, htmlescape_1.htmlEscapeContent)(((_a = attrs[attributeName]) === null || _a === void 0 ? void 0 : _a.toString()) || '')}"`);
43
+ }
44
+ }
45
+ return res.join(' ');
46
+ }
47
+ exports.stringifyAttrs = stringifyAttrs;
48
+ function stringifyTag(tag) {
49
+ const attr = stringifyAttrs(tag.attrs);
50
+ const voidTag = voidTags.indexOf(tag.tagName) !== -1;
51
+ let res = `<${tag.tagName}${attr}`;
52
+ if (voidTag) {
53
+ return `${res} />`;
54
+ }
55
+ res += '>';
56
+ res +=
57
+ tag.innerHTML ||
58
+ (tag.attrs.textContent ? (0, htmlescape_1.htmlEscapeContent)(tag.attrs.textContent) : '');
59
+ res += '</' + tag.tagName + '>';
60
+ return res;
61
+ }
62
+ exports.stringifyTag = stringifyTag;
63
+ function tag(tagName, attrs, innerHTML) {
64
+ return {
65
+ tagName: tagName,
66
+ attrs: attrs || {},
67
+ innerHTML
68
+ };
69
+ }
70
+ exports.tag = tag;
@@ -0,0 +1,15 @@
1
+ import { IRendererConstructorOptions, IRenderDocumentOptions } from './types';
2
+ import { IHtmlDocument } from './types';
3
+ export * from './types';
4
+ export interface ITemplateData {
5
+ [x: string]: any;
6
+ }
7
+ export declare class Renderer {
8
+ private _documentTemplate;
9
+ private _serverPluginContext;
10
+ private _ssrRenderer;
11
+ private _spaRenderer;
12
+ constructor(options: IRendererConstructorOptions);
13
+ renderDocument(options: IRenderDocumentOptions): import("@shuvi/platform-shared/shared").Response | IHtmlDocument | Promise<import("@shuvi/platform-shared/shared").Response | IHtmlDocument>;
14
+ renderDocumentToString(document: IHtmlDocument, templateData?: ITemplateData): string;
15
+ }