@modern-js/app-tools 2.15.0 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/dist/cjs/analyze/constants.js +37 -61
  3. package/dist/cjs/analyze/generateCode.js +102 -127
  4. package/dist/cjs/analyze/getBundleEntry.js +33 -66
  5. package/dist/cjs/analyze/getClientRoutes/getRoutes.js +61 -117
  6. package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +61 -115
  7. package/dist/cjs/analyze/getClientRoutes/index.js +15 -28
  8. package/dist/cjs/analyze/getClientRoutes/utils.js +24 -48
  9. package/dist/cjs/analyze/getFileSystemEntry.js +39 -79
  10. package/dist/cjs/analyze/getHtmlTemplate.js +88 -98
  11. package/dist/cjs/analyze/getServerRoutes.js +67 -110
  12. package/dist/cjs/analyze/index.js +265 -257
  13. package/dist/cjs/analyze/isDefaultExportFunction.js +66 -44
  14. package/dist/cjs/analyze/makeLegalIdentifier.js +7 -25
  15. package/dist/cjs/analyze/nestedRoutes.js +99 -104
  16. package/dist/cjs/analyze/templates.js +49 -110
  17. package/dist/cjs/analyze/utils.js +98 -102
  18. package/dist/cjs/builder/builder-rspack/adapterCopy.js +58 -100
  19. package/dist/cjs/builder/builder-rspack/index.js +14 -30
  20. package/dist/cjs/builder/builder-webpack/adapterModern.js +33 -50
  21. package/dist/cjs/builder/builder-webpack/createCopyPattern.js +16 -32
  22. package/dist/cjs/builder/builder-webpack/index.js +65 -46
  23. package/dist/cjs/builder/generator/createBuilderOptions.js +10 -26
  24. package/dist/cjs/builder/generator/createBuilderProviderConfig.js +11 -27
  25. package/dist/cjs/builder/generator/getBuilderTargets.js +13 -29
  26. package/dist/cjs/builder/generator/index.js +61 -55
  27. package/dist/cjs/builder/index.js +53 -43
  28. package/dist/cjs/builder/shared/builderPlugins/adapterBasic.js +13 -36
  29. package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +90 -90
  30. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +108 -111
  31. package/dist/cjs/builder/shared/builderPlugins/index.js +20 -19
  32. package/dist/cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +30 -30
  33. package/dist/cjs/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +32 -38
  34. package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +86 -116
  35. package/dist/cjs/builder/shared/bundlerPlugins/index.js +20 -19
  36. package/dist/cjs/builder/shared/createCopyInfo.js +16 -42
  37. package/dist/cjs/builder/shared/index.js +20 -19
  38. package/dist/cjs/builder/shared/loaders/serverModuleLoader.js +8 -24
  39. package/dist/cjs/builder/shared/types.js +4 -15
  40. package/dist/cjs/commands/build.js +23 -40
  41. package/dist/cjs/commands/deploy.js +7 -25
  42. package/dist/cjs/commands/dev.js +38 -57
  43. package/dist/cjs/commands/index.js +20 -19
  44. package/dist/cjs/commands/inspect.js +10 -30
  45. package/dist/cjs/commands/serve.js +28 -66
  46. package/dist/cjs/config/default.js +34 -34
  47. package/dist/cjs/config/index.js +20 -19
  48. package/dist/cjs/config/initialize/index.js +11 -29
  49. package/dist/cjs/config/initialize/inits.js +103 -82
  50. package/dist/cjs/config/legacy/createHtmlConfig.js +8 -40
  51. package/dist/cjs/config/legacy/createOutputConfig.js +8 -51
  52. package/dist/cjs/config/legacy/createSourceConfig.js +8 -38
  53. package/dist/cjs/config/legacy/createToolsConfig.js +8 -43
  54. package/dist/cjs/config/legacy/index.js +22 -46
  55. package/dist/cjs/defineConfig.js +16 -31
  56. package/dist/cjs/exports/server.js +7 -25
  57. package/dist/cjs/hooks.js +33 -51
  58. package/dist/cjs/index.js +185 -166
  59. package/dist/cjs/initialize/index.js +84 -100
  60. package/dist/cjs/locale/en.js +13 -27
  61. package/dist/cjs/locale/index.js +18 -28
  62. package/dist/cjs/locale/zh.js +13 -27
  63. package/dist/cjs/schema/Schema.js +27 -31
  64. package/dist/cjs/schema/index.js +141 -71
  65. package/dist/cjs/schema/legacy.js +273 -96
  66. package/dist/cjs/types/config/deploy.js +4 -15
  67. package/dist/cjs/types/config/dev.js +4 -15
  68. package/dist/cjs/types/config/experiments.js +4 -15
  69. package/dist/cjs/types/config/html.js +4 -15
  70. package/dist/cjs/types/config/index.js +18 -17
  71. package/dist/cjs/types/config/output.js +4 -15
  72. package/dist/cjs/types/config/performance.js +4 -15
  73. package/dist/cjs/types/config/security.js +4 -15
  74. package/dist/cjs/types/config/source.js +4 -15
  75. package/dist/cjs/types/config/tools.js +4 -15
  76. package/dist/cjs/types/hooks.js +4 -15
  77. package/dist/cjs/types/index.js +20 -19
  78. package/dist/cjs/types/legacyConfig/deploy.js +4 -15
  79. package/dist/cjs/types/legacyConfig/dev.js +4 -15
  80. package/dist/cjs/types/legacyConfig/index.js +4 -15
  81. package/dist/cjs/types/legacyConfig/output.js +4 -15
  82. package/dist/cjs/types/legacyConfig/source.js +4 -15
  83. package/dist/cjs/types/legacyConfig/tools.js +4 -15
  84. package/dist/cjs/types/utils.js +4 -15
  85. package/dist/cjs/utils/config.js +74 -79
  86. package/dist/cjs/utils/createServer.js +16 -42
  87. package/dist/cjs/utils/env.js +7 -25
  88. package/dist/cjs/utils/generateWatchFiles.js +31 -52
  89. package/dist/cjs/utils/getSelectedEntries.js +13 -35
  90. package/dist/cjs/utils/getServerInternalPlugins.js +8 -29
  91. package/dist/cjs/utils/printInstructions.js +10 -28
  92. package/dist/cjs/utils/restart.js +13 -31
  93. package/dist/cjs/utils/routes.js +18 -39
  94. package/dist/cjs/utils/types.js +4 -15
  95. package/dist/esm/analyze/constants.js +40 -41
  96. package/dist/esm/analyze/generateCode.js +477 -455
  97. package/dist/esm/analyze/getBundleEntry.js +53 -54
  98. package/dist/esm/analyze/getClientRoutes/getRoutes.js +201 -202
  99. package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +199 -200
  100. package/dist/esm/analyze/getClientRoutes/index.js +2 -3
  101. package/dist/esm/analyze/getClientRoutes/utils.js +15 -15
  102. package/dist/esm/analyze/getFileSystemEntry.js +86 -87
  103. package/dist/esm/analyze/getHtmlTemplate.js +289 -278
  104. package/dist/esm/analyze/getServerRoutes.js +203 -190
  105. package/dist/esm/analyze/index.js +679 -651
  106. package/dist/esm/analyze/isDefaultExportFunction.js +38 -39
  107. package/dist/esm/analyze/makeLegalIdentifier.js +8 -9
  108. package/dist/esm/analyze/nestedRoutes.js +400 -392
  109. package/dist/esm/analyze/templates.js +536 -509
  110. package/dist/esm/analyze/utils.js +357 -336
  111. package/dist/esm/builder/builder-rspack/adapterCopy.js +347 -330
  112. package/dist/esm/builder/builder-rspack/index.js +8 -9
  113. package/dist/esm/builder/builder-webpack/adapterModern.js +51 -43
  114. package/dist/esm/builder/builder-webpack/createCopyPattern.js +31 -32
  115. package/dist/esm/builder/builder-webpack/index.js +266 -249
  116. package/dist/esm/builder/generator/createBuilderOptions.js +37 -38
  117. package/dist/esm/builder/generator/createBuilderProviderConfig.js +62 -63
  118. package/dist/esm/builder/generator/getBuilderTargets.js +13 -14
  119. package/dist/esm/builder/generator/index.js +203 -196
  120. package/dist/esm/builder/index.js +183 -176
  121. package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +90 -91
  122. package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +300 -291
  123. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +337 -329
  124. package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +108 -97
  125. package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +66 -64
  126. package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +364 -337
  127. package/dist/esm/builder/shared/createCopyInfo.js +9 -10
  128. package/dist/esm/builder/shared/loaders/serverModuleLoader.js +2 -3
  129. package/dist/esm/builder/shared/types.js +1 -1
  130. package/dist/esm/commands/build.js +279 -272
  131. package/dist/esm/commands/deploy.js +150 -144
  132. package/dist/esm/commands/dev.js +296 -289
  133. package/dist/esm/commands/inspect.js +144 -138
  134. package/dist/esm/commands/serve.js +241 -235
  135. package/dist/esm/config/default.js +202 -203
  136. package/dist/esm/config/initialize/index.js +7 -8
  137. package/dist/esm/config/initialize/inits.js +189 -181
  138. package/dist/esm/config/legacy/createHtmlConfig.js +17 -18
  139. package/dist/esm/config/legacy/createOutputConfig.js +41 -42
  140. package/dist/esm/config/legacy/createSourceConfig.js +38 -39
  141. package/dist/esm/config/legacy/createToolsConfig.js +24 -25
  142. package/dist/esm/config/legacy/index.js +31 -32
  143. package/dist/esm/defineConfig.js +52 -53
  144. package/dist/esm/exports/server.js +1 -2
  145. package/dist/esm/hooks.js +26 -27
  146. package/dist/esm/index.js +685 -671
  147. package/dist/esm/initialize/index.js +276 -269
  148. package/dist/esm/locale/en.js +36 -37
  149. package/dist/esm/locale/index.js +2 -2
  150. package/dist/esm/locale/zh.js +36 -37
  151. package/dist/esm/schema/Schema.js +255 -244
  152. package/dist/esm/schema/index.js +165 -165
  153. package/dist/esm/schema/legacy.js +316 -317
  154. package/dist/esm/types/config/deploy.js +1 -1
  155. package/dist/esm/types/config/dev.js +1 -1
  156. package/dist/esm/types/config/experiments.js +1 -1
  157. package/dist/esm/types/config/html.js +1 -1
  158. package/dist/esm/types/config/output.js +1 -1
  159. package/dist/esm/types/config/performance.js +1 -1
  160. package/dist/esm/types/config/security.js +1 -1
  161. package/dist/esm/types/config/source.js +1 -1
  162. package/dist/esm/types/config/tools.js +1 -1
  163. package/dist/esm/types/hooks.js +1 -1
  164. package/dist/esm/types/legacyConfig/deploy.js +1 -1
  165. package/dist/esm/types/legacyConfig/dev.js +1 -1
  166. package/dist/esm/types/legacyConfig/index.js +1 -1
  167. package/dist/esm/types/legacyConfig/output.js +1 -1
  168. package/dist/esm/types/legacyConfig/source.js +1 -1
  169. package/dist/esm/types/legacyConfig/tools.js +1 -1
  170. package/dist/esm/types/utils.js +1 -1
  171. package/dist/esm/utils/config.js +285 -278
  172. package/dist/esm/utils/createServer.js +242 -234
  173. package/dist/esm/utils/env.js +11 -12
  174. package/dist/esm/utils/generateWatchFiles.js +205 -190
  175. package/dist/esm/utils/getSelectedEntries.js +180 -173
  176. package/dist/esm/utils/getServerInternalPlugins.js +197 -191
  177. package/dist/esm/utils/printInstructions.js +147 -141
  178. package/dist/esm/utils/restart.js +179 -173
  179. package/dist/esm/utils/routes.js +146 -139
  180. package/dist/esm/utils/types.js +1 -1
  181. package/dist/esm-node/analyze/constants.js +31 -46
  182. package/dist/esm-node/analyze/generateCode.js +28 -94
  183. package/dist/esm-node/analyze/getBundleEntry.js +8 -27
  184. package/dist/esm-node/analyze/getClientRoutes/getRoutes.js +24 -65
  185. package/dist/esm-node/analyze/getClientRoutes/getRoutesLegacy.js +24 -63
  186. package/dist/esm-node/analyze/getClientRoutes/index.js +2 -6
  187. package/dist/esm-node/analyze/getClientRoutes/utils.js +5 -19
  188. package/dist/esm-node/analyze/getFileSystemEntry.js +10 -37
  189. package/dist/esm-node/analyze/getHtmlTemplate.js +29 -59
  190. package/dist/esm-node/analyze/getServerRoutes.js +43 -75
  191. package/dist/esm-node/analyze/index.js +208 -230
  192. package/dist/esm-node/analyze/isDefaultExportFunction.js +7 -5
  193. package/dist/esm-node/analyze/makeLegalIdentifier.js +1 -4
  194. package/dist/esm-node/analyze/nestedRoutes.js +23 -43
  195. package/dist/esm-node/analyze/templates.js +22 -69
  196. package/dist/esm-node/analyze/utils.js +66 -60
  197. package/dist/esm-node/builder/builder-rspack/adapterCopy.js +40 -62
  198. package/dist/esm-node/builder/builder-rspack/index.js +4 -5
  199. package/dist/esm-node/builder/builder-webpack/adapterModern.js +24 -26
  200. package/dist/esm-node/builder/builder-webpack/createCopyPattern.js +3 -10
  201. package/dist/esm-node/builder/builder-webpack/index.js +13 -11
  202. package/dist/esm-node/builder/generator/createBuilderOptions.js +4 -5
  203. package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +5 -6
  204. package/dist/esm-node/builder/generator/getBuilderTargets.js +5 -11
  205. package/dist/esm-node/builder/generator/index.js +7 -16
  206. package/dist/esm-node/builder/index.js +2 -7
  207. package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +2 -6
  208. package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +34 -60
  209. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +54 -74
  210. package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +23 -8
  211. package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +25 -16
  212. package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +66 -76
  213. package/dist/esm-node/builder/shared/createCopyInfo.js +2 -8
  214. package/dist/esm-node/builder/shared/loaders/serverModuleLoader.js +1 -4
  215. package/dist/esm-node/builder/shared/types.js +1 -0
  216. package/dist/esm-node/commands/build.js +7 -9
  217. package/dist/esm-node/commands/deploy.js +1 -4
  218. package/dist/esm-node/commands/dev.js +19 -27
  219. package/dist/esm-node/commands/inspect.js +3 -8
  220. package/dist/esm-node/commands/serve.js +7 -25
  221. package/dist/esm-node/config/default.js +20 -11
  222. package/dist/esm-node/config/initialize/index.js +1 -4
  223. package/dist/esm-node/config/initialize/inits.js +48 -54
  224. package/dist/esm-node/config/legacy/createHtmlConfig.js +2 -19
  225. package/dist/esm-node/config/legacy/createOutputConfig.js +2 -30
  226. package/dist/esm-node/config/legacy/createSourceConfig.js +2 -17
  227. package/dist/esm-node/config/legacy/createToolsConfig.js +2 -22
  228. package/dist/esm-node/config/legacy/index.js +3 -18
  229. package/dist/esm-node/defineConfig.js +7 -13
  230. package/dist/esm-node/exports/server.js +1 -4
  231. package/dist/esm-node/hooks.js +2 -9
  232. package/dist/esm-node/index.js +95 -120
  233. package/dist/esm-node/initialize/index.js +74 -87
  234. package/dist/esm-node/locale/en.js +7 -6
  235. package/dist/esm-node/locale/index.js +5 -5
  236. package/dist/esm-node/locale/zh.js +7 -6
  237. package/dist/esm-node/schema/Schema.js +19 -8
  238. package/dist/esm-node/schema/index.js +121 -36
  239. package/dist/esm-node/schema/legacy.js +262 -72
  240. package/dist/esm-node/types/config/deploy.js +1 -0
  241. package/dist/esm-node/types/config/dev.js +1 -0
  242. package/dist/esm-node/types/config/experiments.js +1 -0
  243. package/dist/esm-node/types/config/html.js +1 -0
  244. package/dist/esm-node/types/config/output.js +1 -0
  245. package/dist/esm-node/types/config/performance.js +1 -0
  246. package/dist/esm-node/types/config/security.js +1 -0
  247. package/dist/esm-node/types/config/source.js +1 -0
  248. package/dist/esm-node/types/config/tools.js +1 -0
  249. package/dist/esm-node/types/hooks.js +1 -0
  250. package/dist/esm-node/types/legacyConfig/deploy.js +1 -0
  251. package/dist/esm-node/types/legacyConfig/dev.js +1 -0
  252. package/dist/esm-node/types/legacyConfig/index.js +1 -0
  253. package/dist/esm-node/types/legacyConfig/output.js +1 -0
  254. package/dist/esm-node/types/legacyConfig/source.js +1 -0
  255. package/dist/esm-node/types/legacyConfig/tools.js +1 -0
  256. package/dist/esm-node/types/utils.js +1 -0
  257. package/dist/esm-node/utils/config.js +16 -47
  258. package/dist/esm-node/utils/createServer.js +5 -12
  259. package/dist/esm-node/utils/env.js +1 -4
  260. package/dist/esm-node/utils/generateWatchFiles.js +13 -20
  261. package/dist/esm-node/utils/getSelectedEntries.js +2 -9
  262. package/dist/esm-node/utils/getServerInternalPlugins.js +2 -8
  263. package/dist/esm-node/utils/printInstructions.js +1 -4
  264. package/dist/esm-node/utils/restart.js +2 -11
  265. package/dist/esm-node/utils/routes.js +4 -4
  266. package/dist/esm-node/utils/types.js +1 -0
  267. package/dist/types/index.d.ts +2 -2
  268. package/package.json +29 -25
@@ -1,39 +1,38 @@
1
- var ZH_LOCALE = {
2
- command: {
3
- shared: {
4
- analyze: "分析构建产物体积,查看各个模块打包后的大小",
5
- config: "指定配置文件路径,可以为相对路径或绝对路径"
6
- },
7
- dev: {
8
- describe: "启动开发服务器",
9
- entry: "指定入口,编译特定的页面",
10
- apiOnly: "仅启动 API 接口服务",
11
- webOnly: "仅启动 Web 服务",
12
- selectEntry: "请选择需要构建的入口",
13
- requireEntry: "请至少选择一个入口"
14
- },
15
- build: {
16
- describe: "构建生产环境产物"
17
- },
18
- serve: {
19
- describe: "启动生产环境服务"
20
- },
21
- deploy: {
22
- describe: "部署应用"
23
- },
24
- new: {
25
- describe: "Web App 项目中执行生成器",
26
- debug: "开启 Debug 模式,打印调试日志信息",
27
- config: "生成器运行默认配置(JSON 字符串)",
28
- distTag: "生成器使用特殊的 npm Tag 版本",
29
- registry: "生成器运行过程中定制 npm Registry",
30
- lang: "设置 new 命令执行语言(zh 或者 en)"
31
- },
32
- inspect: {
33
- env: "查看指定环境下的配置",
34
- output: "指定在 dist 目录下输出的路径",
35
- verbose: "在结果中展示函数的完整内容"
36
- }
1
+ export var ZH_LOCALE = {
2
+ command: {
3
+ shared: {
4
+ analyze: "分析构建产物体积,查看各个模块打包后的大小",
5
+ config: "指定配置文件路径,可以为相对路径或绝对路径"
6
+ },
7
+ dev: {
8
+ describe: "启动开发服务器",
9
+ entry: "指定入口,编译特定的页面",
10
+ apiOnly: "仅启动 API 接口服务",
11
+ webOnly: "仅启动 Web 服务",
12
+ selectEntry: "请选择需要构建的入口",
13
+ requireEntry: "请至少选择一个入口"
14
+ },
15
+ build: {
16
+ describe: "构建生产环境产物"
17
+ },
18
+ serve: {
19
+ describe: "启动生产环境服务"
20
+ },
21
+ deploy: {
22
+ describe: "部署应用"
23
+ },
24
+ new: {
25
+ describe: "Web App 项目中执行生成器",
26
+ debug: "开启 Debug 模式,打印调试日志信息",
27
+ config: "生成器运行默认配置(JSON 字符串)",
28
+ distTag: "生成器使用特殊的 npm Tag 版本",
29
+ registry: "生成器运行过程中定制 npm Registry",
30
+ lang: "设置 new 命令执行语言(zh 或者 en)"
31
+ },
32
+ inspect: {
33
+ env: "查看指定环境下的配置",
34
+ output: "指定在 dist 目录下输出的路径",
35
+ verbose: "在结果中展示函数的完整内容"
37
36
  }
37
+ }
38
38
  };
39
- export { ZH_LOCALE };
@@ -1,273 +1,284 @@
1
- function _arrayLikeToArray(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length)
3
+ len = arr.length;
4
+ for (var i = 0, arr2 = new Array(len); i < len; i++)
5
+ arr2[i] = arr[i];
6
+ return arr2;
5
7
  }
6
- function _arrayWithHoles(arr) {
7
- if (Array.isArray(arr)) return arr;
8
+ function _array_with_holes(arr) {
9
+ if (Array.isArray(arr))
10
+ return arr;
8
11
  }
9
- function _assertThisInitialized(self) {
10
- if (self === void 0) {
11
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12
- }
13
- return self;
14
- }
15
- function _classCallCheck(instance, Constructor) {
16
- if (!(instance instanceof Constructor)) {
17
- throw new TypeError("Cannot call a class as a function");
18
- }
12
+ function _assert_this_initialized(self) {
13
+ if (self === void 0) {
14
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15
+ }
16
+ return self;
19
17
  }
20
- function isNativeReflectConstruct() {
21
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
22
- if (Reflect.construct.sham) return false;
23
- if (typeof Proxy === "function") return true;
24
- try {
25
- Date.prototype.toString.call(Reflect.construct(Date, [], function() {}));
26
- return true;
27
- } catch (e) {
28
- return false;
29
- }
18
+ function _class_call_check(instance, Constructor) {
19
+ if (!(instance instanceof Constructor)) {
20
+ throw new TypeError("Cannot call a class as a function");
21
+ }
30
22
  }
31
23
  function _construct(Parent, args, Class) {
32
- if (isNativeReflectConstruct()) {
33
- _construct = Reflect.construct;
34
- } else {
35
- _construct = function _construct(Parent, args, Class) {
36
- var a = [
37
- null
38
- ];
39
- a.push.apply(a, args);
40
- var Constructor = Function.bind.apply(Parent, a);
41
- var instance = new Constructor();
42
- if (Class) _setPrototypeOf(instance, Class.prototype);
43
- return instance;
44
- };
45
- }
46
- return _construct.apply(null, arguments);
24
+ if (_is_native_reflect_construct()) {
25
+ _construct = Reflect.construct;
26
+ } else {
27
+ _construct = function construct(Parent2, args2, Class2) {
28
+ var a = [
29
+ null
30
+ ];
31
+ a.push.apply(a, args2);
32
+ var Constructor = Function.bind.apply(Parent2, a);
33
+ var instance = new Constructor();
34
+ if (Class2)
35
+ _set_prototype_of(instance, Class2.prototype);
36
+ return instance;
37
+ };
38
+ }
39
+ return _construct.apply(null, arguments);
47
40
  }
48
41
  function _defineProperties(target, props) {
49
- for(var i = 0; i < props.length; i++){
50
- var descriptor = props[i];
51
- descriptor.enumerable = descriptor.enumerable || false;
52
- descriptor.configurable = true;
53
- if ("value" in descriptor) descriptor.writable = true;
54
- Object.defineProperty(target, descriptor.key, descriptor);
55
- }
42
+ for (var i = 0; i < props.length; i++) {
43
+ var descriptor = props[i];
44
+ descriptor.enumerable = descriptor.enumerable || false;
45
+ descriptor.configurable = true;
46
+ if ("value" in descriptor)
47
+ descriptor.writable = true;
48
+ Object.defineProperty(target, descriptor.key, descriptor);
49
+ }
56
50
  }
57
- function _createClass(Constructor, protoProps, staticProps) {
58
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
59
- if (staticProps) _defineProperties(Constructor, staticProps);
60
- return Constructor;
51
+ function _create_class(Constructor, protoProps, staticProps) {
52
+ if (protoProps)
53
+ _defineProperties(Constructor.prototype, protoProps);
54
+ if (staticProps)
55
+ _defineProperties(Constructor, staticProps);
56
+ return Constructor;
61
57
  }
62
- function _defineProperty(obj, key, value) {
63
- if (key in obj) {
64
- Object.defineProperty(obj, key, {
65
- value: value,
66
- enumerable: true,
67
- configurable: true,
68
- writable: true
69
- });
70
- } else {
71
- obj[key] = value;
72
- }
73
- return obj;
58
+ function _define_property(obj, key, value) {
59
+ if (key in obj) {
60
+ Object.defineProperty(obj, key, {
61
+ value,
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true
65
+ });
66
+ } else {
67
+ obj[key] = value;
68
+ }
69
+ return obj;
74
70
  }
75
- function _getPrototypeOf(o) {
76
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
77
- return o.__proto__ || Object.getPrototypeOf(o);
78
- };
79
- return _getPrototypeOf(o);
71
+ function _get_prototype_of(o) {
72
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o2) {
73
+ return o2.__proto__ || Object.getPrototypeOf(o2);
74
+ };
75
+ return _get_prototype_of(o);
80
76
  }
81
77
  function _inherits(subClass, superClass) {
82
- if (typeof superClass !== "function" && superClass !== null) {
83
- throw new TypeError("Super expression must either be null or a function");
78
+ if (typeof superClass !== "function" && superClass !== null) {
79
+ throw new TypeError("Super expression must either be null or a function");
80
+ }
81
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
82
+ constructor: {
83
+ value: subClass,
84
+ writable: true,
85
+ configurable: true
84
86
  }
85
- subClass.prototype = Object.create(superClass && superClass.prototype, {
86
- constructor: {
87
- value: subClass,
88
- writable: true,
89
- configurable: true
90
- }
91
- });
92
- if (superClass) _setPrototypeOf(subClass, superClass);
87
+ });
88
+ if (superClass)
89
+ _set_prototype_of(subClass, superClass);
93
90
  }
94
- function _isNativeFunction(fn) {
95
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
91
+ function _is_native_function(fn) {
92
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
96
93
  }
97
- function _iterableToArrayLimit(arr, i) {
98
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
99
- if (_i == null) return;
100
- var _arr = [];
101
- var _n = true;
102
- var _d = false;
103
- var _s, _e;
94
+ function _iterable_to_array_limit(arr, i) {
95
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
96
+ if (_i == null)
97
+ return;
98
+ var _arr = [];
99
+ var _n = true;
100
+ var _d = false;
101
+ var _s, _e;
102
+ try {
103
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
104
+ _arr.push(_s.value);
105
+ if (i && _arr.length === i)
106
+ break;
107
+ }
108
+ } catch (err) {
109
+ _d = true;
110
+ _e = err;
111
+ } finally {
104
112
  try {
105
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
106
- _arr.push(_s.value);
107
- if (i && _arr.length === i) break;
108
- }
109
- } catch (err) {
110
- _d = true;
111
- _e = err;
112
- } finally{
113
- try {
114
- if (!_n && _i["return"] != null) _i["return"]();
115
- } finally{
116
- if (_d) throw _e;
117
- }
113
+ if (!_n && _i["return"] != null)
114
+ _i["return"]();
115
+ } finally {
116
+ if (_d)
117
+ throw _e;
118
118
  }
119
- return _arr;
119
+ }
120
+ return _arr;
120
121
  }
121
- function _nonIterableRest() {
122
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
122
+ function _non_iterable_rest() {
123
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
123
124
  }
124
- function _possibleConstructorReturn(self, call) {
125
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
126
- return call;
127
- }
128
- return _assertThisInitialized(self);
125
+ function _possible_constructor_return(self, call) {
126
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
127
+ return call;
128
+ }
129
+ return _assert_this_initialized(self);
129
130
  }
130
- function _setPrototypeOf(o, p) {
131
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
132
- o.__proto__ = p;
133
- return o;
134
- };
135
- return _setPrototypeOf(o, p);
131
+ function _set_prototype_of(o, p) {
132
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o2, p2) {
133
+ o2.__proto__ = p2;
134
+ return o2;
135
+ };
136
+ return _set_prototype_of(o, p);
136
137
  }
137
- function _slicedToArray(arr, i) {
138
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
138
+ function _sliced_to_array(arr, i) {
139
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
139
140
  }
140
- var _typeof = function(obj) {
141
- "@swc/helpers - typeof";
142
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
143
- };
144
- function _unsupportedIterableToArray(o, minLen) {
145
- if (!o) return;
146
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
147
- var n = Object.prototype.toString.call(o).slice(8, -1);
148
- if (n === "Object" && o.constructor) n = o.constructor.name;
149
- if (n === "Map" || n === "Set") return Array.from(n);
150
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
141
+ function _type_of(obj) {
142
+ "@swc/helpers - typeof";
143
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
151
144
  }
152
- function _wrapNativeSuper(Class) {
153
- var _cache = typeof Map === "function" ? new Map() : undefined;
154
- _wrapNativeSuper = function _wrapNativeSuper(Class) {
155
- if (Class === null || !_isNativeFunction(Class)) return Class;
156
- if (typeof Class !== "function") {
157
- throw new TypeError("Super expression must either be null or a function");
158
- }
159
- if (typeof _cache !== "undefined") {
160
- if (_cache.has(Class)) return _cache.get(Class);
161
- _cache.set(Class, Wrapper);
162
- }
163
- function Wrapper() {
164
- return _construct(Class, arguments, _getPrototypeOf(this).constructor);
165
- }
166
- Wrapper.prototype = Object.create(Class.prototype, {
167
- constructor: {
168
- value: Wrapper,
169
- enumerable: false,
170
- writable: true,
171
- configurable: true
172
- }
173
- });
174
- return _setPrototypeOf(Wrapper, Class);
175
- };
176
- return _wrapNativeSuper(Class);
145
+ function _unsupported_iterable_to_array(o, minLen) {
146
+ if (!o)
147
+ return;
148
+ if (typeof o === "string")
149
+ return _array_like_to_array(o, minLen);
150
+ var n = Object.prototype.toString.call(o).slice(8, -1);
151
+ if (n === "Object" && o.constructor)
152
+ n = o.constructor.name;
153
+ if (n === "Map" || n === "Set")
154
+ return Array.from(n);
155
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
156
+ return _array_like_to_array(o, minLen);
177
157
  }
178
- function _isNativeReflectConstruct() {
179
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
180
- if (Reflect.construct.sham) return false;
181
- if (typeof Proxy === "function") return true;
182
- try {
183
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
184
- return true;
185
- } catch (e) {
186
- return false;
158
+ function _wrap_native_super(Class) {
159
+ var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
160
+ _wrap_native_super = function wrapNativeSuper(Class2) {
161
+ if (Class2 === null || !_is_native_function(Class2))
162
+ return Class2;
163
+ if (typeof Class2 !== "function") {
164
+ throw new TypeError("Super expression must either be null or a function");
165
+ }
166
+ if (typeof _cache !== "undefined") {
167
+ if (_cache.has(Class2))
168
+ return _cache.get(Class2);
169
+ _cache.set(Class2, Wrapper);
170
+ }
171
+ function Wrapper() {
172
+ return _construct(Class2, arguments, _get_prototype_of(this).constructor);
187
173
  }
174
+ Wrapper.prototype = Object.create(Class2.prototype, {
175
+ constructor: {
176
+ value: Wrapper,
177
+ enumerable: false,
178
+ writable: true,
179
+ configurable: true
180
+ }
181
+ });
182
+ return _set_prototype_of(Wrapper, Class2);
183
+ };
184
+ return _wrap_native_super(Class);
188
185
  }
189
- function _createSuper(Derived) {
190
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
191
- return function _createSuperInternal() {
192
- var Super = _getPrototypeOf(Derived), result;
193
- if (hasNativeReflectConstruct) {
194
- var NewTarget = _getPrototypeOf(this).constructor;
195
- result = Reflect.construct(Super, arguments, NewTarget);
196
- } else {
197
- result = Super.apply(this, arguments);
198
- }
199
- return _possibleConstructorReturn(this, result);
200
- };
186
+ function _is_native_reflect_construct() {
187
+ if (typeof Reflect === "undefined" || !Reflect.construct)
188
+ return false;
189
+ if (Reflect.construct.sham)
190
+ return false;
191
+ if (typeof Proxy === "function")
192
+ return true;
193
+ try {
194
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
195
+ }));
196
+ return true;
197
+ } catch (e) {
198
+ return false;
199
+ }
201
200
  }
202
- import { merge } from "@modern-js/utils/lodash";
203
- var Schema = /*#__PURE__*/ function(Map1) {
204
- "use strict";
205
- _inherits(Schema, Map1);
206
- var _super = _createSuper(Schema);
207
- function Schema() {
208
- var baseSchema = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
209
- _classCallCheck(this, Schema);
210
- var _this;
211
- _this = _super.call(this);
212
- _defineProperty(_assertThisInitialized(_this), "schema", void 0);
213
- _this.schema = baseSchema;
214
- return _this;
201
+ function _create_super(Derived) {
202
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
203
+ return function _createSuperInternal() {
204
+ var Super = _get_prototype_of(Derived), result;
205
+ if (hasNativeReflectConstruct) {
206
+ var NewTarget = _get_prototype_of(this).constructor;
207
+ result = Reflect.construct(Super, arguments, NewTarget);
208
+ } else {
209
+ result = Super.apply(this, arguments);
215
210
  }
216
- _createClass(Schema, [
217
- {
218
- key: "setSchema",
219
- value: function setSchema(key, object) {
220
- var _this = this;
221
- Object.entries(object).forEach(function(param) {
222
- var _param = _slicedToArray(param, 2), k = _param[0], v = _param[1];
223
- var target = "".concat(key, ".").concat(k);
224
- _this.set(target, v);
225
- });
226
- return this;
227
- }
228
- },
229
- {
230
- key: "set",
231
- value: function set(key, value) {
232
- if (this.has(key)) {
233
- merge(this.schema[key], value);
234
- } else {
235
- this.schema[key] = value;
236
- }
237
- return this;
238
- }
239
- },
240
- {
241
- key: "has",
242
- value: function has(key) {
243
- return key in this.schema;
244
- }
245
- },
246
- {
247
- key: "get",
248
- value: function get(key) {
249
- return this.schema[key];
250
- }
251
- },
252
- {
253
- key: "delete",
254
- value: function _delete(key) {
255
- return delete this.schema[key];
256
- }
257
- },
258
- {
259
- key: "generate",
260
- value: function generate() {
261
- return Object.entries(this.schema).map(function(param) {
262
- var _param = _slicedToArray(param, 2), target = _param[0], schema = _param[1];
263
- return {
264
- target: target,
265
- schema: schema
266
- };
267
- });
268
- }
211
+ return _possible_constructor_return(this, result);
212
+ };
213
+ }
214
+ import { merge } from "@modern-js/utils/lodash";
215
+ export var Schema = /* @__PURE__ */ function(Map1) {
216
+ "use strict";
217
+ _inherits(Schema2, Map1);
218
+ var _super = _create_super(Schema2);
219
+ function Schema2() {
220
+ var baseSchema = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
221
+ _class_call_check(this, Schema2);
222
+ var _this;
223
+ _this = _super.call(this);
224
+ _define_property(_assert_this_initialized(_this), "schema", void 0);
225
+ _this.schema = baseSchema;
226
+ return _this;
227
+ }
228
+ _create_class(Schema2, [
229
+ {
230
+ key: "setSchema",
231
+ value: function setSchema(key, object) {
232
+ var _this = this;
233
+ Object.entries(object).forEach(function(param) {
234
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
235
+ var target = "".concat(key, ".").concat(k);
236
+ _this.set(target, v);
237
+ });
238
+ return this;
239
+ }
240
+ },
241
+ {
242
+ key: "set",
243
+ value: function set(key, value) {
244
+ if (this.has(key)) {
245
+ merge(this.schema[key], value);
246
+ } else {
247
+ this.schema[key] = value;
269
248
  }
270
- ]);
271
- return Schema;
272
- }(_wrapNativeSuper(Map));
273
- export { Schema };
249
+ return this;
250
+ }
251
+ },
252
+ {
253
+ key: "has",
254
+ value: function has(key) {
255
+ return key in this.schema;
256
+ }
257
+ },
258
+ {
259
+ key: "get",
260
+ value: function get(key) {
261
+ return this.schema[key];
262
+ }
263
+ },
264
+ {
265
+ key: "delete",
266
+ value: function _delete(key) {
267
+ return delete this.schema[key];
268
+ }
269
+ },
270
+ {
271
+ key: "generate",
272
+ value: function generate() {
273
+ return Object.entries(this.schema).map(function(param) {
274
+ var _param = _sliced_to_array(param, 2), target = _param[0], schema = _param[1];
275
+ return {
276
+ target,
277
+ schema
278
+ };
279
+ });
280
+ }
281
+ }
282
+ ]);
283
+ return Schema2;
284
+ }(_wrap_native_super(Map));