@modern-js/app-tools 2.0.0-beta.0 → 2.0.0-beta.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 (279) hide show
  1. package/CHANGELOG.md +375 -0
  2. package/dist/js/modern/analyze/generateCode.js +30 -38
  3. package/dist/js/modern/analyze/getBundleEntry.js +5 -13
  4. package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +5 -30
  5. package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +5 -30
  6. package/dist/js/modern/analyze/getClientRoutes/utils.js +0 -3
  7. package/dist/js/modern/analyze/getFileSystemEntry.js +5 -18
  8. package/dist/js/modern/analyze/getHtmlTemplate.js +3 -10
  9. package/dist/js/modern/analyze/getServerRoutes.js +25 -38
  10. package/dist/js/modern/analyze/index.js +90 -48
  11. package/dist/js/modern/analyze/isDefaultExportFunction.js +0 -4
  12. package/dist/js/modern/analyze/makeLegalIdentifier.js +0 -2
  13. package/dist/js/modern/analyze/nestedRoutes.js +8 -33
  14. package/dist/js/modern/analyze/templates.js +22 -37
  15. package/dist/js/modern/analyze/utils.js +0 -7
  16. package/dist/js/modern/builder/builderPlugins/compatModern.js +41 -58
  17. package/dist/js/modern/builder/index.js +56 -37
  18. package/dist/js/modern/builder/share.js +1 -5
  19. package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -8
  20. package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +2 -13
  21. package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +97 -0
  22. package/dist/js/modern/commands/build.js +12 -46
  23. package/dist/js/modern/commands/dev.js +20 -23
  24. package/dist/js/modern/commands/inspect.js +4 -19
  25. package/dist/js/modern/commands/start.js +1 -2
  26. package/dist/js/modern/config/default.js +207 -0
  27. package/dist/js/modern/config/index.js +2 -0
  28. package/dist/js/modern/config/initial/createHtmlConfig.js +32 -0
  29. package/dist/js/modern/{builder → config/initial}/createOutputConfig.js +19 -18
  30. package/dist/js/modern/config/initial/createSourceConfig.js +32 -0
  31. package/dist/js/modern/config/initial/createToolsConfig.js +41 -0
  32. package/dist/js/modern/config/initial/index.js +11 -0
  33. package/dist/js/modern/config/initial/inits.js +117 -0
  34. package/dist/js/modern/config/initial/transformNormalizedConfig.js +40 -0
  35. package/dist/js/modern/defineConfig.js +12 -0
  36. package/dist/js/modern/hooks.js +23 -19
  37. package/dist/js/modern/index.js +12 -19
  38. package/dist/js/modern/initialize/index.js +72 -0
  39. package/dist/js/modern/schema/Schema.js +39 -0
  40. package/dist/js/modern/schema/index.js +139 -0
  41. package/dist/js/modern/schema/legacy.js +284 -0
  42. package/dist/js/modern/types/config/deploy.js +0 -0
  43. package/dist/js/modern/types/config/dev.js +0 -0
  44. package/dist/js/modern/types/config/experiments.js +0 -0
  45. package/dist/js/modern/types/config/html.js +0 -0
  46. package/dist/js/modern/types/config/index.js +2 -0
  47. package/dist/js/modern/types/config/output.js +0 -0
  48. package/dist/js/modern/types/config/performance.js +0 -0
  49. package/dist/js/modern/types/config/security.js +0 -0
  50. package/dist/js/modern/types/config/source.js +0 -0
  51. package/dist/js/modern/types/config/tools.js +0 -0
  52. package/dist/js/modern/types/hooks.js +0 -0
  53. package/dist/js/modern/types/index.js +4 -0
  54. package/dist/js/modern/types/legacyConfig/deploy.js +0 -0
  55. package/dist/js/modern/types/legacyConfig/dev.js +0 -0
  56. package/dist/js/modern/types/legacyConfig/index.js +0 -0
  57. package/dist/js/modern/types/legacyConfig/output.js +1 -0
  58. package/dist/js/modern/types/legacyConfig/source.js +0 -0
  59. package/dist/js/modern/types/legacyConfig/tools.js +0 -0
  60. package/dist/js/modern/utils/config.js +2 -13
  61. package/dist/js/modern/utils/createFileWatcher.js +82 -0
  62. package/dist/js/modern/utils/createServer.js +0 -5
  63. package/dist/js/modern/utils/getSpecifiedEntries.js +0 -6
  64. package/dist/js/modern/utils/printInstructions.js +2 -1
  65. package/dist/js/modern/utils/restart.js +17 -0
  66. package/dist/js/modern/utils/routes.js +0 -2
  67. package/dist/js/node/analyze/generateCode.js +30 -61
  68. package/dist/js/node/analyze/getBundleEntry.js +5 -19
  69. package/dist/js/node/analyze/getClientRoutes/getRoutes.js +5 -45
  70. package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +5 -45
  71. package/dist/js/node/analyze/getClientRoutes/index.js +0 -2
  72. package/dist/js/node/analyze/getClientRoutes/utils.js +0 -14
  73. package/dist/js/node/analyze/getFileSystemEntry.js +5 -26
  74. package/dist/js/node/analyze/getHtmlTemplate.js +3 -24
  75. package/dist/js/node/analyze/getServerRoutes.js +24 -46
  76. package/dist/js/node/analyze/index.js +91 -70
  77. package/dist/js/node/analyze/isDefaultExportFunction.js +0 -12
  78. package/dist/js/node/analyze/makeLegalIdentifier.js +0 -4
  79. package/dist/js/node/analyze/nestedRoutes.js +8 -41
  80. package/dist/js/node/analyze/templates.js +22 -47
  81. package/dist/js/node/analyze/utils.js +0 -20
  82. package/dist/js/node/builder/builderPlugins/compatModern.js +41 -69
  83. package/dist/js/node/builder/index.js +57 -51
  84. package/dist/js/node/builder/share.js +1 -13
  85. package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -10
  86. package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +2 -15
  87. package/dist/js/node/builder/webpackPlugins/routerPlugin.js +105 -0
  88. package/dist/js/node/commands/build.js +10 -57
  89. package/dist/js/node/commands/deploy.js +0 -2
  90. package/dist/js/node/commands/dev.js +19 -34
  91. package/dist/js/node/commands/index.js +0 -6
  92. package/dist/js/node/commands/inspect.js +4 -26
  93. package/dist/js/node/commands/start.js +1 -11
  94. package/dist/js/node/config/default.js +214 -0
  95. package/dist/js/node/config/index.js +31 -0
  96. package/dist/js/node/config/initial/createHtmlConfig.js +38 -0
  97. package/dist/js/node/{builder → config/initial}/createOutputConfig.js +19 -20
  98. package/dist/js/node/config/initial/createSourceConfig.js +38 -0
  99. package/dist/js/node/config/initial/createToolsConfig.js +47 -0
  100. package/dist/js/node/config/initial/index.js +24 -0
  101. package/dist/js/node/config/initial/inits.js +127 -0
  102. package/dist/js/node/config/initial/transformNormalizedConfig.js +46 -0
  103. package/dist/js/node/defineConfig.js +20 -0
  104. package/dist/js/node/exports/server.js +0 -1
  105. package/dist/js/node/hooks.js +23 -30
  106. package/dist/js/node/index.js +35 -48
  107. package/dist/js/node/initialize/index.js +79 -0
  108. package/dist/js/node/locale/index.js +0 -4
  109. package/dist/js/node/schema/Schema.js +46 -0
  110. package/dist/js/node/schema/index.js +152 -0
  111. package/dist/js/node/schema/legacy.js +291 -0
  112. package/dist/js/node/types/config/deploy.js +0 -0
  113. package/dist/js/node/types/config/dev.js +0 -0
  114. package/dist/js/node/types/config/experiments.js +0 -0
  115. package/dist/js/node/types/config/html.js +0 -0
  116. package/dist/js/node/types/config/index.js +16 -0
  117. package/dist/js/node/types/config/output.js +0 -0
  118. package/dist/js/node/types/config/performance.js +0 -0
  119. package/dist/js/node/types/config/security.js +0 -0
  120. package/dist/js/node/types/config/source.js +0 -0
  121. package/dist/js/node/types/config/tools.js +0 -0
  122. package/dist/js/node/types/hooks.js +0 -0
  123. package/dist/js/node/types/index.js +38 -0
  124. package/dist/js/node/types/legacyConfig/deploy.js +0 -0
  125. package/dist/js/node/types/legacyConfig/dev.js +0 -0
  126. package/dist/js/node/types/legacyConfig/index.js +0 -0
  127. package/dist/js/node/types/legacyConfig/output.js +5 -0
  128. package/dist/js/node/types/legacyConfig/source.js +0 -0
  129. package/dist/js/node/types/legacyConfig/tools.js +0 -0
  130. package/dist/js/node/utils/commands.js +0 -2
  131. package/dist/js/node/utils/config.js +2 -26
  132. package/dist/js/node/utils/createFileWatcher.js +90 -0
  133. package/dist/js/node/utils/createServer.js +0 -15
  134. package/dist/js/node/utils/getSpecifiedEntries.js +0 -9
  135. package/dist/js/node/utils/language.js +0 -2
  136. package/dist/js/node/utils/printInstructions.js +2 -5
  137. package/dist/js/node/utils/restart.js +23 -0
  138. package/dist/js/node/utils/routes.js +0 -5
  139. package/dist/js/treeshaking/analyze/generateCode.js +58 -101
  140. package/dist/js/treeshaking/analyze/getBundleEntry.js +12 -20
  141. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +16 -42
  142. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +16 -42
  143. package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +0 -3
  144. package/dist/js/treeshaking/analyze/getFileSystemEntry.js +5 -18
  145. package/dist/js/treeshaking/analyze/getHtmlTemplate.js +3 -27
  146. package/dist/js/treeshaking/analyze/getServerRoutes.js +29 -41
  147. package/dist/js/treeshaking/analyze/index.js +195 -91
  148. package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +0 -4
  149. package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +0 -2
  150. package/dist/js/treeshaking/analyze/nestedRoutes.js +9 -51
  151. package/dist/js/treeshaking/analyze/templates.js +31 -50
  152. package/dist/js/treeshaking/analyze/utils.js +7 -14
  153. package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +50 -68
  154. package/dist/js/treeshaking/builder/index.js +69 -65
  155. package/dist/js/treeshaking/builder/share.js +1 -5
  156. package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +1 -13
  157. package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +2 -14
  158. package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +121 -0
  159. package/dist/js/treeshaking/commands/build.js +41 -116
  160. package/dist/js/treeshaking/commands/deploy.js +0 -3
  161. package/dist/js/treeshaking/commands/dev.js +38 -46
  162. package/dist/js/treeshaking/commands/inspect.js +9 -27
  163. package/dist/js/treeshaking/commands/start.js +1 -9
  164. package/dist/js/treeshaking/config/default.js +200 -0
  165. package/dist/js/treeshaking/config/index.js +2 -0
  166. package/dist/js/treeshaking/config/initial/createHtmlConfig.js +31 -0
  167. package/dist/js/treeshaking/config/initial/createOutputConfig.js +67 -0
  168. package/dist/js/treeshaking/config/initial/createSourceConfig.js +41 -0
  169. package/dist/js/treeshaking/config/initial/createToolsConfig.js +38 -0
  170. package/dist/js/treeshaking/config/initial/index.js +11 -0
  171. package/dist/js/treeshaking/config/initial/inits.js +114 -0
  172. package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +38 -0
  173. package/dist/js/treeshaking/defineConfig.js +14 -0
  174. package/dist/js/treeshaking/hooks.js +23 -19
  175. package/dist/js/treeshaking/index.js +8 -43
  176. package/dist/js/treeshaking/initialize/index.js +121 -0
  177. package/dist/js/treeshaking/schema/Schema.js +75 -0
  178. package/dist/js/treeshaking/schema/index.js +138 -0
  179. package/dist/js/treeshaking/schema/legacy.js +273 -0
  180. package/dist/js/treeshaking/types/config/deploy.js +0 -0
  181. package/dist/js/treeshaking/types/config/dev.js +0 -0
  182. package/dist/js/treeshaking/types/config/experiments.js +0 -0
  183. package/dist/js/treeshaking/types/config/html.js +0 -0
  184. package/dist/js/treeshaking/types/config/index.js +2 -0
  185. package/dist/js/treeshaking/types/config/output.js +0 -0
  186. package/dist/js/treeshaking/types/config/performance.js +0 -0
  187. package/dist/js/treeshaking/types/config/security.js +0 -0
  188. package/dist/js/treeshaking/types/config/source.js +0 -0
  189. package/dist/js/treeshaking/types/config/tools.js +0 -0
  190. package/dist/js/treeshaking/types/hooks.js +0 -0
  191. package/dist/js/treeshaking/types/index.js +4 -0
  192. package/dist/js/treeshaking/types/legacyConfig/deploy.js +0 -0
  193. package/dist/js/treeshaking/types/legacyConfig/dev.js +0 -0
  194. package/dist/js/treeshaking/types/legacyConfig/index.js +0 -0
  195. package/dist/js/treeshaking/types/legacyConfig/output.js +1 -0
  196. package/dist/js/treeshaking/types/legacyConfig/source.js +0 -0
  197. package/dist/js/treeshaking/types/legacyConfig/tools.js +0 -0
  198. package/dist/js/treeshaking/utils/config.js +2 -18
  199. package/dist/js/treeshaking/utils/createFileWatcher.js +123 -0
  200. package/dist/js/treeshaking/utils/createServer.js +0 -10
  201. package/dist/js/treeshaking/utils/getSpecifiedEntries.js +0 -10
  202. package/dist/js/treeshaking/utils/printInstructions.js +0 -5
  203. package/dist/js/treeshaking/utils/restart.js +45 -0
  204. package/dist/js/treeshaking/utils/routes.js +0 -4
  205. package/dist/types/analyze/generateCode.d.ts +3 -2
  206. package/dist/types/analyze/getBundleEntry.d.ts +2 -2
  207. package/dist/types/analyze/getFileSystemEntry.d.ts +2 -2
  208. package/dist/types/analyze/getHtmlTemplate.d.ts +3 -3
  209. package/dist/types/analyze/getServerRoutes.d.ts +3 -2
  210. package/dist/types/analyze/index.d.ts +3 -42
  211. package/dist/types/analyze/nestedRoutes.d.ts +1 -1
  212. package/dist/types/analyze/templates.d.ts +4 -2
  213. package/dist/types/analyze/utils.d.ts +1 -1
  214. package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -3
  215. package/dist/types/builder/index.d.ts +7 -8
  216. package/dist/types/builder/share.d.ts +2 -2
  217. package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +10 -0
  218. package/dist/types/commands/build.d.ts +2 -2
  219. package/dist/types/commands/deploy.d.ts +2 -2
  220. package/dist/types/commands/dev.d.ts +2 -2
  221. package/dist/types/commands/inspect.d.ts +6 -1
  222. package/dist/types/commands/start.d.ts +2 -2
  223. package/dist/types/config/default.d.ts +3 -0
  224. package/dist/types/config/index.d.ts +2 -0
  225. package/dist/types/config/initial/createHtmlConfig.d.ts +2 -0
  226. package/dist/types/config/initial/createOutputConfig.d.ts +2 -0
  227. package/dist/types/config/initial/createSourceConfig.d.ts +2 -0
  228. package/dist/types/config/initial/createToolsConfig.d.ts +2 -0
  229. package/dist/types/config/initial/index.d.ts +4 -0
  230. package/dist/types/config/initial/inits.d.ts +4 -0
  231. package/dist/types/config/initial/transformNormalizedConfig.d.ts +2 -0
  232. package/dist/types/defineConfig.d.ts +7 -0
  233. package/dist/types/hooks.d.ts +2 -42
  234. package/dist/types/index.d.ts +5 -7
  235. package/dist/types/initialize/index.d.ts +3 -0
  236. package/dist/types/schema/Schema.d.ts +14 -0
  237. package/dist/types/schema/index.d.ts +4 -0
  238. package/dist/types/schema/legacy.d.ts +3 -0
  239. package/dist/types/types/config/deploy.d.ts +9 -0
  240. package/dist/types/types/config/dev.d.ts +13 -0
  241. package/dist/types/types/config/experiments.d.ts +4 -0
  242. package/dist/types/types/config/html.d.ts +4 -0
  243. package/dist/types/types/config/index.d.ts +62 -0
  244. package/dist/types/types/config/output.d.ts +23 -0
  245. package/dist/types/types/config/performance.d.ts +4 -0
  246. package/dist/types/types/config/security.d.ts +4 -0
  247. package/dist/types/types/config/source.d.ts +22 -0
  248. package/dist/types/types/config/tools.d.ts +15 -0
  249. package/dist/types/types/hooks.d.ts +80 -0
  250. package/dist/types/types/index.d.ts +23 -0
  251. package/dist/types/types/legacyConfig/deploy.d.ts +8 -0
  252. package/dist/types/types/legacyConfig/dev.d.ts +12 -0
  253. package/dist/types/types/legacyConfig/index.d.ts +33 -0
  254. package/dist/types/types/legacyConfig/output.d.ts +51 -0
  255. package/dist/types/types/legacyConfig/source.d.ts +25 -0
  256. package/dist/types/types/legacyConfig/tools.d.ts +16 -0
  257. package/dist/types/utils/config.d.ts +2 -3
  258. package/dist/types/utils/createFileWatcher.d.ts +3 -0
  259. package/dist/types/utils/printInstructions.d.ts +3 -3
  260. package/dist/types/utils/restart.d.ts +3 -0
  261. package/package.json +26 -25
  262. package/dist/js/modern/builder/createHtmlConfig.js +0 -58
  263. package/dist/js/modern/builder/createSourceConfig.js +0 -85
  264. package/dist/js/modern/builder/createToolsConfig.js +0 -94
  265. package/dist/js/modern/utils/createCompiler.js +0 -58
  266. package/dist/js/node/builder/createHtmlConfig.js +0 -76
  267. package/dist/js/node/builder/createSourceConfig.js +0 -99
  268. package/dist/js/node/builder/createToolsConfig.js +0 -103
  269. package/dist/js/node/utils/createCompiler.js +0 -75
  270. package/dist/js/treeshaking/builder/createHtmlConfig.js +0 -59
  271. package/dist/js/treeshaking/builder/createOutputConfig.js +0 -67
  272. package/dist/js/treeshaking/builder/createSourceConfig.js +0 -100
  273. package/dist/js/treeshaking/builder/createToolsConfig.js +0 -90
  274. package/dist/js/treeshaking/utils/createCompiler.js +0 -117
  275. package/dist/types/builder/createHtmlConfig.d.ts +0 -6
  276. package/dist/types/builder/createOutputConfig.d.ts +0 -3
  277. package/dist/types/builder/createSourceConfig.d.ts +0 -5
  278. package/dist/types/builder/createToolsConfig.d.ts +0 -13
  279. package/dist/types/utils/createCompiler.d.ts +0 -12
@@ -6,33 +6,29 @@ import { makeLegalIdentifier } from "../makeLegalIdentifier";
6
6
  import { FILE_SYSTEM_ROUTES_COMPONENTS_DIR, FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP, FILE_SYSTEM_ROUTES_INDEX, FILE_SYSTEM_ROUTES_LAYOUT } from "../constants";
7
7
  import { replaceWithAlias } from "../utils";
8
8
  import { debug, findLayout, shouldSkip, getRouteWeight } from "./utils";
9
-
10
9
  var compName = function compName(srcDirectory, filePath) {
11
10
  var legalCompName = makeLegalIdentifier(path.relative(srcDirectory, filePath));
12
11
  return "Comp_".concat(legalCompName);
13
12
  };
14
-
15
13
  var layoutNameAbbr = function layoutNameAbbr(filePath) {
16
14
  var prefix = 'L_';
17
15
  var dirName = path.dirname(filePath).split('/').pop() || '';
18
16
  return "".concat(prefix).concat(makeLegalIdentifier(dirName));
19
17
  };
20
-
21
18
  var parents = [];
22
- /* eslint-disable no-param-reassign */
23
19
 
20
+ /* eslint-disable no-param-reassign */
24
21
  var recursiveReadDir = function recursiveReadDir(_ref) {
25
22
  var dir = _ref.dir,
26
- routes = _ref.routes,
27
- _ref$basePath = _ref.basePath,
28
- basePath = _ref$basePath === void 0 ? '/' : _ref$basePath,
29
- srcDirectory = _ref.srcDirectory,
30
- srcAlias = _ref.srcAlias;
23
+ routes = _ref.routes,
24
+ _ref$basePath = _ref.basePath,
25
+ basePath = _ref$basePath === void 0 ? '/' : _ref$basePath,
26
+ srcDirectory = _ref.srcDirectory,
27
+ srcAlias = _ref.srcAlias;
31
28
  var hasDynamicRoute = false;
32
29
  var resetParent = false;
33
30
  var parent = parents[parents.length - 1];
34
31
  var layout = findLayout(dir);
35
-
36
32
  if (layout) {
37
33
  if (basePath === '/') {
38
34
  throw new Error("should use _app instead of _layout in ".concat(dir));
@@ -54,24 +50,17 @@ var recursiveReadDir = function recursiveReadDir(_ref) {
54
50
  routes = route.children;
55
51
  }
56
52
  }
57
-
58
53
  var _iterator = _createForOfIteratorHelper(fs.readdirSync(dir)),
59
- _step;
60
-
54
+ _step;
61
55
  try {
62
56
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
63
57
  var relative = _step.value;
64
58
  var filePath = path.join(dir, relative);
65
-
66
59
  if (!shouldSkip(filePath)) {
67
60
  var filename = path.basename(filePath, path.extname(filePath));
68
-
69
61
  var _alias = replaceWithAlias(srcDirectory, filePath, srcAlias);
70
-
71
62
  var _componentName = compName(srcDirectory, filePath);
72
-
73
63
  var dynamicRouteMatched = FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP.exec(filename);
74
-
75
64
  if (dynamicRouteMatched) {
76
65
  if (hasDynamicRoute) {
77
66
  throw new Error("Can't set two dynamic route in one directory: ".concat(dir));
@@ -79,7 +68,6 @@ var recursiveReadDir = function recursiveReadDir(_ref) {
79
68
  hasDynamicRoute = true;
80
69
  }
81
70
  }
82
-
83
71
  var _route = {
84
72
  path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1]).concat(dynamicRouteMatched[2]) : filename),
85
73
  _component: _alias,
@@ -87,7 +75,6 @@ var recursiveReadDir = function recursiveReadDir(_ref) {
87
75
  parent: parent,
88
76
  type: 'page'
89
77
  };
90
-
91
78
  if (fs.statSync(filePath).isDirectory()) {
92
79
  recursiveReadDir({
93
80
  dir: filePath,
@@ -98,19 +85,15 @@ var recursiveReadDir = function recursiveReadDir(_ref) {
98
85
  });
99
86
  continue;
100
87
  }
101
-
102
88
  if (filename === FILE_SYSTEM_ROUTES_LAYOUT) {
103
89
  continue;
104
90
  }
105
-
106
91
  if (filename === FILE_SYSTEM_ROUTES_INDEX) {
107
92
  _route.path = basePath === '/' ? basePath : "".concat(basePath.substring(0, basePath.length - 1));
108
93
  }
109
-
110
94
  if (filename === '404' && basePath === '/') {
111
95
  _route.path = '*';
112
96
  }
113
-
114
97
  routes.push(_route);
115
98
  }
116
99
  }
@@ -119,26 +102,24 @@ var recursiveReadDir = function recursiveReadDir(_ref) {
119
102
  } finally {
120
103
  _iterator.f();
121
104
  }
122
-
123
105
  if (resetParent) {
124
106
  parents.pop();
125
107
  }
126
108
  };
127
109
  /* eslint-enable no-param-reassign */
128
110
 
129
-
130
111
  var normalizeNestedRoutes = function normalizeNestedRoutes(nested, internalComponentsDir, internalDirectory, internalDirAlias) {
131
112
  var flat = function flat(routes) {
132
113
  return routes.reduce(function (memo, route) {
133
114
  return memo.concat(Array.isArray(route.children) ? flat(route.children) : [route]);
134
115
  }, []);
135
116
  };
136
-
137
117
  var generate = function generate(route) {
138
118
  var codes = [];
139
119
  var lastComponent = route.component;
140
- var imports = ["import React from 'react';", "import ".concat(lastComponent, " from '").concat(route._component, "'")]; // eslint-disable-next-line no-param-reassign, no-cond-assign
120
+ var imports = ["import React from 'react';", "import ".concat(lastComponent, " from '").concat(route._component, "'")];
141
121
 
122
+ // eslint-disable-next-line no-param-reassign, no-cond-assign
142
123
  while (route = route.parent) {
143
124
  var layoutComponent = route.component;
144
125
  var layoutComponentAbbr = layoutNameAbbr(route._component);
@@ -147,7 +128,6 @@ var normalizeNestedRoutes = function normalizeNestedRoutes(nested, internalCompo
147
128
  codes.push("const ".concat(currentComponent, " = props => <").concat(layoutComponent, " Component={").concat(lastComponent, "} {...props} />;"));
148
129
  lastComponent = currentComponent;
149
130
  }
150
-
151
131
  var file = path.resolve(internalComponentsDir, "".concat(lastComponent, ".jsx"));
152
132
  fs.outputFileSync(file, "".concat(imports.join('\n'), "\n").concat(codes.join('\n'), "\nexport default ").concat(lastComponent));
153
133
  return {
@@ -155,7 +135,6 @@ var normalizeNestedRoutes = function normalizeNestedRoutes(nested, internalCompo
155
135
  _component: replaceWithAlias(internalDirectory, file, internalDirAlias)
156
136
  };
157
137
  };
158
-
159
138
  var normalized = flat(nested).map(function (route) {
160
139
  return route.parent ? _objectSpread(_objectSpread(_objectSpread({}, route), generate(route)), {}, {
161
140
  parent: undefined
@@ -165,24 +144,20 @@ var normalizeNestedRoutes = function normalizeNestedRoutes(nested, internalCompo
165
144
  });
166
145
  return normalized;
167
146
  };
168
-
169
147
  export var getClientRoutes = function getClientRoutes(_ref2) {
170
148
  var entrypoint = _ref2.entrypoint,
171
- srcDirectory = _ref2.srcDirectory,
172
- srcAlias = _ref2.srcAlias,
173
- internalDirectory = _ref2.internalDirectory,
174
- internalDirAlias = _ref2.internalDirAlias;
149
+ srcDirectory = _ref2.srcDirectory,
150
+ srcAlias = _ref2.srcAlias,
151
+ internalDirectory = _ref2.internalDirectory,
152
+ internalDirAlias = _ref2.internalDirAlias;
175
153
  var entry = entrypoint.entry,
176
- entryName = entrypoint.entryName;
177
-
154
+ entryName = entrypoint.entryName;
178
155
  if (!fs.existsSync(entry)) {
179
156
  throw new Error("generate file system routes error, ".concat(entry, " directory not found."));
180
157
  }
181
-
182
158
  if (!(fs.existsSync(entry) && fs.statSync(entry).isDirectory())) {
183
159
  throw new Error("generate file system routes error, ".concat(entry, " should be directory."));
184
160
  }
185
-
186
161
  var routes = [];
187
162
  recursiveReadDir({
188
163
  dir: entry,
@@ -194,15 +169,14 @@ export var getClientRoutes = function getClientRoutes(_ref2) {
194
169
  var internalComponentsDir = path.resolve(internalDirectory, "".concat(entryName, "/").concat(FILE_SYSTEM_ROUTES_COMPONENTS_DIR));
195
170
  fs.emptyDirSync(internalComponentsDir);
196
171
  routes = normalizeNestedRoutes(routes, internalComponentsDir, internalDirectory, internalDirAlias);
197
- parents.length = 0; // FIXME: support more situations
172
+ parents.length = 0;
198
173
 
174
+ // FIXME: support more situations
199
175
  routes.sort(function (a, b) {
200
176
  var delta = getRouteWeight(a.path) - getRouteWeight(b.path);
201
-
202
177
  if (delta === 0) {
203
178
  return a.path.length - b.path.length;
204
179
  }
205
-
206
180
  return delta;
207
181
  });
208
182
  debug("fileSystem routes: %o", routes);
@@ -6,33 +6,29 @@ import { makeLegalIdentifier } from "../makeLegalIdentifier";
6
6
  import { FILE_SYSTEM_ROUTES_COMPONENTS_DIR, FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP, FILE_SYSTEM_ROUTES_INDEX, FILE_SYSTEM_ROUTES_LAYOUT } from "../constants";
7
7
  import { replaceWithAlias } from "../utils";
8
8
  import { debug, findLayout, shouldSkip, getRouteWeight } from "./utils";
9
-
10
9
  var compName = function compName(srcDirectory, filePath) {
11
10
  var legalCompName = makeLegalIdentifier(path.relative(srcDirectory, filePath));
12
11
  return "Comp_".concat(legalCompName);
13
12
  };
14
-
15
13
  var layoutNameAbbr = function layoutNameAbbr(filePath) {
16
14
  var prefix = 'L_';
17
15
  var dirName = path.dirname(filePath).split('/').pop() || '';
18
16
  return "".concat(prefix).concat(makeLegalIdentifier(dirName));
19
17
  };
20
-
21
18
  var parents = [];
22
- /* eslint-disable no-param-reassign */
23
19
 
20
+ /* eslint-disable no-param-reassign */
24
21
  var recursiveReadDirLegacy = function recursiveReadDirLegacy(_ref) {
25
22
  var dir = _ref.dir,
26
- routes = _ref.routes,
27
- _ref$basePath = _ref.basePath,
28
- basePath = _ref$basePath === void 0 ? '/' : _ref$basePath,
29
- srcDirectory = _ref.srcDirectory,
30
- srcAlias = _ref.srcAlias;
23
+ routes = _ref.routes,
24
+ _ref$basePath = _ref.basePath,
25
+ basePath = _ref$basePath === void 0 ? '/' : _ref$basePath,
26
+ srcDirectory = _ref.srcDirectory,
27
+ srcAlias = _ref.srcAlias;
31
28
  var hasDynamicRoute = false;
32
29
  var resetParent = false;
33
30
  var parent = parents[parents.length - 1];
34
31
  var layout = findLayout(dir);
35
-
36
32
  if (layout) {
37
33
  if (basePath === '/') {
38
34
  throw new Error("should use _app instead of _layout in ".concat(dir));
@@ -54,24 +50,17 @@ var recursiveReadDirLegacy = function recursiveReadDirLegacy(_ref) {
54
50
  routes = route.routes;
55
51
  }
56
52
  }
57
-
58
53
  var _iterator = _createForOfIteratorHelper(fs.readdirSync(dir)),
59
- _step;
60
-
54
+ _step;
61
55
  try {
62
56
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
63
57
  var relative = _step.value;
64
58
  var filePath = path.join(dir, relative);
65
-
66
59
  if (!shouldSkip(filePath)) {
67
60
  var filename = path.basename(filePath, path.extname(filePath));
68
-
69
61
  var _alias = replaceWithAlias(srcDirectory, filePath, srcAlias);
70
-
71
62
  var _componentName = compName(srcDirectory, filePath);
72
-
73
63
  var dynamicRouteMatched = FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP.exec(filename);
74
-
75
64
  if (dynamicRouteMatched) {
76
65
  if (hasDynamicRoute) {
77
66
  throw new Error("Can't set two dynamic route in one directory: ".concat(dir));
@@ -79,7 +68,6 @@ var recursiveReadDirLegacy = function recursiveReadDirLegacy(_ref) {
79
68
  hasDynamicRoute = true;
80
69
  }
81
70
  }
82
-
83
71
  var _route = {
84
72
  path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1]).concat(dynamicRouteMatched[2]) : filename),
85
73
  _component: _alias,
@@ -87,7 +75,6 @@ var recursiveReadDirLegacy = function recursiveReadDirLegacy(_ref) {
87
75
  exact: true,
88
76
  parent: parent
89
77
  };
90
-
91
78
  if (fs.statSync(filePath).isDirectory()) {
92
79
  recursiveReadDirLegacy({
93
80
  dir: filePath,
@@ -98,20 +85,16 @@ var recursiveReadDirLegacy = function recursiveReadDirLegacy(_ref) {
98
85
  });
99
86
  continue;
100
87
  }
101
-
102
88
  if (filename === FILE_SYSTEM_ROUTES_LAYOUT) {
103
89
  continue;
104
90
  }
105
-
106
91
  if (filename === FILE_SYSTEM_ROUTES_INDEX) {
107
92
  _route.path = basePath === '/' ? basePath : "".concat(basePath.substring(0, basePath.length - 1));
108
93
  }
109
-
110
94
  if (filename === '404' && basePath === '/') {
111
95
  _route.path = '*';
112
96
  _route.exact = false;
113
97
  }
114
-
115
98
  routes.push(_route);
116
99
  }
117
100
  }
@@ -120,26 +103,24 @@ var recursiveReadDirLegacy = function recursiveReadDirLegacy(_ref) {
120
103
  } finally {
121
104
  _iterator.f();
122
105
  }
123
-
124
106
  if (resetParent) {
125
107
  parents.pop();
126
108
  }
127
109
  };
128
110
  /* eslint-enable no-param-reassign */
129
111
 
130
-
131
112
  var normalizeNestedRoutes = function normalizeNestedRoutes(nested, internalComponentsDir, internalDirectory, internalDirAlias) {
132
113
  var flat = function flat(routes) {
133
114
  return routes.reduce(function (memo, route) {
134
115
  return memo.concat(Array.isArray(route.routes) ? flat(route.routes) : [route]);
135
116
  }, []);
136
117
  };
137
-
138
118
  var generate = function generate(route) {
139
119
  var codes = [];
140
120
  var lastComponent = route.component;
141
- var imports = ["import React from 'react';", "import ".concat(lastComponent, " from '").concat(route._component, "'")]; // eslint-disable-next-line no-param-reassign, no-cond-assign
121
+ var imports = ["import React from 'react';", "import ".concat(lastComponent, " from '").concat(route._component, "'")];
142
122
 
123
+ // eslint-disable-next-line no-param-reassign, no-cond-assign
143
124
  while (route = route.parent) {
144
125
  var layoutComponent = route.component;
145
126
  var layoutComponentAbbr = layoutNameAbbr(route._component);
@@ -148,7 +129,6 @@ var normalizeNestedRoutes = function normalizeNestedRoutes(nested, internalCompo
148
129
  codes.push("const ".concat(currentComponent, " = props => <").concat(layoutComponent, " Component={").concat(lastComponent, "} {...props} />;"));
149
130
  lastComponent = currentComponent;
150
131
  }
151
-
152
132
  var file = path.resolve(internalComponentsDir, "".concat(lastComponent, ".jsx"));
153
133
  fs.outputFileSync(file, "".concat(imports.join('\n'), "\n").concat(codes.join('\n'), "\nexport default ").concat(lastComponent));
154
134
  return {
@@ -156,7 +136,6 @@ var normalizeNestedRoutes = function normalizeNestedRoutes(nested, internalCompo
156
136
  _component: replaceWithAlias(internalDirectory, file, internalDirAlias)
157
137
  };
158
138
  };
159
-
160
139
  var normalized = flat(nested).map(function (route) {
161
140
  return route.parent ? _objectSpread(_objectSpread(_objectSpread({}, route), generate(route)), {}, {
162
141
  parent: undefined
@@ -166,24 +145,20 @@ var normalizeNestedRoutes = function normalizeNestedRoutes(nested, internalCompo
166
145
  });
167
146
  return normalized;
168
147
  };
169
-
170
148
  export var getClientRoutes = function getClientRoutes(_ref2) {
171
149
  var entrypoint = _ref2.entrypoint,
172
- srcDirectory = _ref2.srcDirectory,
173
- srcAlias = _ref2.srcAlias,
174
- internalDirectory = _ref2.internalDirectory,
175
- internalDirAlias = _ref2.internalDirAlias;
150
+ srcDirectory = _ref2.srcDirectory,
151
+ srcAlias = _ref2.srcAlias,
152
+ internalDirectory = _ref2.internalDirectory,
153
+ internalDirAlias = _ref2.internalDirAlias;
176
154
  var entry = entrypoint.entry,
177
- entryName = entrypoint.entryName;
178
-
155
+ entryName = entrypoint.entryName;
179
156
  if (!fs.existsSync(entry)) {
180
157
  throw new Error("generate file system routes error, ".concat(entry, " directory not found."));
181
158
  }
182
-
183
159
  if (!(fs.existsSync(entry) && fs.statSync(entry).isDirectory())) {
184
160
  throw new Error("generate file system routes error, ".concat(entry, " should be directory."));
185
161
  }
186
-
187
162
  var routes = [];
188
163
  recursiveReadDirLegacy({
189
164
  dir: entry,
@@ -195,15 +170,14 @@ export var getClientRoutes = function getClientRoutes(_ref2) {
195
170
  var internalComponentsDir = path.resolve(internalDirectory, "".concat(entryName, "/").concat(FILE_SYSTEM_ROUTES_COMPONENTS_DIR));
196
171
  fs.emptyDirSync(internalComponentsDir);
197
172
  routes = normalizeNestedRoutes(routes, internalComponentsDir, internalDirectory, internalDirAlias);
198
- parents.length = 0; // FIXME: support more situations
173
+ parents.length = 0;
199
174
 
175
+ // FIXME: support more situations
200
176
  routes.sort(function (a, b) {
201
177
  var delta = getRouteWeight(a.path) - getRouteWeight(b.path);
202
-
203
178
  if (delta === 0) {
204
179
  return a.path.length - b.path.length;
205
180
  }
206
-
207
181
  return delta;
208
182
  });
209
183
  debug("fileSystem routes: %o", routes);
@@ -16,12 +16,9 @@ export var shouldSkip = function shouldSkip(file) {
16
16
  if (fs.statSync(file).isDirectory()) {
17
17
  return false;
18
18
  }
19
-
20
19
  var ext = path.extname(file);
21
-
22
20
  if (FILE_SYSTEM_ROUTES_IGNORED_REGEX.test(file) || !JS_EXTENSIONS.includes(ext) || FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT === path.basename(file, ext)) {
23
21
  return true;
24
22
  }
25
-
26
23
  return false;
27
24
  };
@@ -3,59 +3,50 @@ import path from 'path';
3
3
  import { findExists, ensureAbsolutePath } from '@modern-js/utils';
4
4
  import { isDefaultExportFunction } from "./isDefaultExportFunction";
5
5
  import { JS_EXTENSIONS, INDEX_FILE_NAME, APP_FILE_NAME, PAGES_DIR_NAME, FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT, NESTED_ROUTES_DIR } from "./constants";
6
-
7
6
  var hasIndex = function hasIndex(dir) {
8
7
  return findExists(JS_EXTENSIONS.map(function (ext) {
9
8
  return path.resolve(dir, "".concat(INDEX_FILE_NAME).concat(ext));
10
9
  }));
11
10
  };
12
-
13
11
  var hasApp = function hasApp(dir) {
14
12
  return findExists(JS_EXTENSIONS.map(function (ext) {
15
13
  return path.resolve(dir, "".concat(APP_FILE_NAME).concat(ext));
16
14
  }));
17
15
  };
18
-
19
16
  var hasPages = function hasPages(dir) {
20
17
  return fs.existsSync(path.join(dir, PAGES_DIR_NAME));
21
18
  };
22
-
23
19
  var hasNestedRoutes = function hasNestedRoutes(dir) {
24
20
  return fs.existsSync(path.join(dir, NESTED_ROUTES_DIR));
25
21
  };
26
-
27
22
  var isBundleEntry = function isBundleEntry(dir) {
28
23
  return hasApp(dir) || hasPages(dir) || hasIndex(dir) || hasNestedRoutes(dir);
29
24
  };
30
-
31
25
  var scanDir = function scanDir(dirs) {
32
26
  return dirs.map(function (dir) {
33
27
  var indexFile = hasIndex(dir);
34
28
  var customBootstrap = isDefaultExportFunction(indexFile) ? indexFile : false;
35
29
  var entryName = path.basename(dir);
36
-
37
30
  if (indexFile && !customBootstrap) {
38
31
  return {
39
32
  entryName: entryName,
40
33
  entry: indexFile,
34
+ absoluteEntryDir: path.resolve(dir),
41
35
  isAutoMount: false
42
36
  };
43
37
  }
44
-
45
38
  var isHasApp = hasApp(dir);
46
-
47
39
  if (isHasApp) {
48
40
  return {
49
41
  entryName: entryName,
50
42
  entry: path.join(dir, APP_FILE_NAME),
51
43
  isAutoMount: true,
44
+ absoluteEntryDir: path.resolve(dir),
52
45
  customBootstrap: customBootstrap
53
46
  };
54
47
  }
55
-
56
48
  var isHasNestedRoutes = hasNestedRoutes(dir);
57
49
  var isHasPages = hasPages(dir);
58
-
59
50
  if (isHasNestedRoutes || isHasPages) {
60
51
  var entrypoint = {
61
52
  entryName: entryName,
@@ -66,33 +57,29 @@ var scanDir = function scanDir(dirs) {
66
57
  }))
67
58
  },
68
59
  isAutoMount: true,
60
+ absoluteEntryDir: path.resolve(dir),
69
61
  customBootstrap: customBootstrap
70
62
  };
71
-
72
63
  if (isHasPages) {
73
64
  entrypoint.entry = path.join(dir, PAGES_DIR_NAME);
74
65
  }
75
-
76
66
  if (isHasNestedRoutes) {
77
67
  entrypoint.nestedRoutesEntry = path.join(dir, NESTED_ROUTES_DIR);
78
68
  }
79
-
80
69
  return entrypoint;
81
70
  }
82
-
83
71
  return {
84
72
  entryName: entryName,
85
73
  entry: indexFile,
74
+ absoluteEntryDir: path.resolve(dir),
86
75
  isAutoMount: false
87
76
  };
88
77
  });
89
78
  };
90
-
91
79
  export var getFileSystemEntry = function getFileSystemEntry(appContext, config) {
92
80
  var appDirectory = appContext.appDirectory;
93
81
  var entriesDir = config.source.entriesDir;
94
- var src = ensureAbsolutePath(appDirectory, entriesDir);
95
-
82
+ var src = ensureAbsolutePath(appDirectory, entriesDir || '');
96
83
  if (fs.existsSync(src)) {
97
84
  if (fs.statSync(src).isDirectory()) {
98
85
  return scanDir(isBundleEntry(src) ? [src] : fs.readdirSync(src).map(function (file) {
@@ -6,7 +6,6 @@ import { fs, findExists, MAIN_ENTRY_NAME } from '@modern-js/utils';
6
6
  import { HTML_PARTIALS_EXTENSIONS, HTML_PARTIALS_FOLDER } from "./constants";
7
7
  import * as templates from "./templates";
8
8
  var PartialPosition;
9
-
10
9
  (function (PartialPosition) {
11
10
  PartialPosition["TOP"] = "top";
12
11
  PartialPosition["HEAD"] = "head";
@@ -14,7 +13,6 @@ var PartialPosition;
14
13
  PartialPosition["BOTTOM"] = "bottom";
15
14
  PartialPosition["INDEX"] = "index";
16
15
  })(PartialPosition || (PartialPosition = {}));
17
-
18
16
  var findPartials = function findPartials(dir, entryName, position) {
19
17
  if (fs.existsSync(dir)) {
20
18
  var base = findExists(HTML_PARTIALS_EXTENSIONS.map(function (ext) {
@@ -28,15 +26,13 @@ var findPartials = function findPartials(dir, entryName, position) {
28
26
  content: fs.readFileSync(file, 'utf8')
29
27
  } : null;
30
28
  }
31
-
32
29
  return null;
33
- }; // generate html template for
34
-
30
+ };
35
31
 
32
+ // generate html template for
36
33
  export var getHtmlTemplate = /*#__PURE__*/function () {
37
34
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(entrypoints, api, _ref) {
38
35
  var appContext, config, appDirectory, internalDirectory, configDir, htmlDir, htmlTemplates, _iterator, _step, _loop;
39
-
40
36
  return _regeneratorRuntime().wrap(function _callee$(_context2) {
41
37
  while (1) {
42
38
  switch (_context2.prev = _context2.next) {
@@ -44,13 +40,12 @@ export var getHtmlTemplate = /*#__PURE__*/function () {
44
40
  appContext = _ref.appContext, config = _ref.config;
45
41
  appDirectory = appContext.appDirectory, internalDirectory = appContext.internalDirectory;
46
42
  configDir = config.source.configDir;
47
- htmlDir = path.resolve(appDirectory, configDir, HTML_PARTIALS_FOLDER);
43
+ htmlDir = path.resolve(appDirectory, configDir || '', HTML_PARTIALS_FOLDER);
48
44
  htmlTemplates = {};
49
45
  _iterator = _createForOfIteratorHelper(entrypoints);
50
46
  _context2.prev = 6;
51
47
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
52
48
  var entrypoint, entryName, name, customIndexTemplate, hookRunners, _yield$hookRunners$ht, partials, templatePath, bottomTemplate;
53
-
54
49
  return _regeneratorRuntime().wrap(function _loop$(_context) {
55
50
  while (1) {
56
51
  switch (_context.prev = _context.next) {
@@ -59,16 +54,13 @@ export var getHtmlTemplate = /*#__PURE__*/function () {
59
54
  entryName = entrypoint.entryName;
60
55
  name = entrypoints.length === 1 && entryName === MAIN_ENTRY_NAME ? '' : entryName;
61
56
  customIndexTemplate = findPartials(htmlDir, name, PartialPosition.INDEX);
62
-
63
57
  if (!customIndexTemplate) {
64
58
  _context.next = 8;
65
59
  break;
66
60
  }
67
-
68
61
  htmlTemplates[entryName] = customIndexTemplate.file;
69
62
  _context.next = 18;
70
63
  break;
71
-
72
64
  case 8:
73
65
  hookRunners = api.useHookRunners();
74
66
  _context.next = 11;
@@ -84,7 +76,6 @@ export var getHtmlTemplate = /*#__PURE__*/function () {
84
76
  body: []
85
77
  })
86
78
  });
87
-
88
79
  case 11:
89
80
  _yield$hookRunners$ht = _context.sent;
90
81
  partials = _yield$hookRunners$ht.partials;
@@ -92,11 +83,9 @@ export var getHtmlTemplate = /*#__PURE__*/function () {
92
83
  fs.outputFileSync(templatePath, templates.html(partials), 'utf8');
93
84
  htmlTemplates[entryName] = templatePath;
94
85
  bottomTemplate = findPartials(htmlDir, name, PartialPosition.BOTTOM);
95
-
96
86
  if (bottomTemplate) {
97
87
  htmlTemplates["__".concat(entryName, "-bottom__")] = bottomTemplate.content;
98
88
  }
99
-
100
89
  case 18:
101
90
  case "end":
102
91
  return _context.stop();
@@ -104,41 +93,29 @@ export var getHtmlTemplate = /*#__PURE__*/function () {
104
93
  }
105
94
  }, _loop);
106
95
  });
107
-
108
96
  _iterator.s();
109
-
110
97
  case 9:
111
98
  if ((_step = _iterator.n()).done) {
112
99
  _context2.next = 13;
113
100
  break;
114
101
  }
115
-
116
102
  return _context2.delegateYield(_loop(), "t0", 11);
117
-
118
103
  case 11:
119
104
  _context2.next = 9;
120
105
  break;
121
-
122
106
  case 13:
123
107
  _context2.next = 18;
124
108
  break;
125
-
126
109
  case 15:
127
110
  _context2.prev = 15;
128
111
  _context2.t1 = _context2["catch"](6);
129
-
130
112
  _iterator.e(_context2.t1);
131
-
132
113
  case 18:
133
114
  _context2.prev = 18;
134
-
135
115
  _iterator.f();
136
-
137
116
  return _context2.finish(18);
138
-
139
117
  case 21:
140
118
  return _context2.abrupt("return", htmlTemplates);
141
-
142
119
  case 22:
143
120
  case "end":
144
121
  return _context2.stop();
@@ -146,7 +123,6 @@ export var getHtmlTemplate = /*#__PURE__*/function () {
146
123
  }
147
124
  }, _callee, null, [[6, 15, 18, 21]]);
148
125
  }));
149
-
150
126
  return function getHtmlTemplate(_x, _x2, _x3) {
151
127
  return _ref2.apply(this, arguments);
152
128
  };