@modern-js/app-tools 2.15.0 → 2.16.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 +45 -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
@@ -5,96 +5,250 @@ const source = {
5
5
  type: "object",
6
6
  patternProperties: {
7
7
  [ENTRY_NAME_PATTERN]: {
8
- if: { type: "object" },
8
+ if: {
9
+ type: "object"
10
+ },
9
11
  then: {
10
- required: ["entry"],
12
+ required: [
13
+ "entry"
14
+ ],
11
15
  properties: {
12
- entry: { type: ["string", "array"] },
13
- disableMount: { type: "boolean" }
16
+ entry: {
17
+ type: [
18
+ "string",
19
+ "array"
20
+ ]
21
+ },
22
+ disableMount: {
23
+ type: "boolean"
24
+ }
14
25
  },
15
26
  additionalProperties: false
16
27
  },
17
- else: { type: ["string", "array"] }
28
+ else: {
29
+ type: [
30
+ "string",
31
+ "array"
32
+ ]
33
+ }
18
34
  }
19
35
  }
20
36
  },
21
- preEntry: { type: ["string", "array"] },
22
- alias: { typeof: ["object", "function"] },
23
- enableAsyncEntry: { type: "boolean" },
24
- disableDefaultEntries: { type: "boolean" },
25
- envVars: { type: "array" },
26
- globalVars: { typeof: ["object", "function"] },
27
- moduleScopes: { instanceof: ["Array", "Function"] },
28
- entriesDir: { type: "string" },
29
- configDir: { type: "string" },
30
- include: { type: ["array"] }
37
+ preEntry: {
38
+ type: [
39
+ "string",
40
+ "array"
41
+ ]
42
+ },
43
+ alias: {
44
+ typeof: [
45
+ "object",
46
+ "function"
47
+ ]
48
+ },
49
+ enableAsyncEntry: {
50
+ type: "boolean"
51
+ },
52
+ disableDefaultEntries: {
53
+ type: "boolean"
54
+ },
55
+ envVars: {
56
+ type: "array"
57
+ },
58
+ globalVars: {
59
+ typeof: [
60
+ "object",
61
+ "function"
62
+ ]
63
+ },
64
+ moduleScopes: {
65
+ instanceof: [
66
+ "Array",
67
+ "Function"
68
+ ]
69
+ },
70
+ entriesDir: {
71
+ type: "string"
72
+ },
73
+ configDir: {
74
+ type: "string"
75
+ },
76
+ include: {
77
+ type: [
78
+ "array"
79
+ ]
80
+ }
31
81
  };
32
82
  const output = {
33
- assetPrefix: { type: "string" },
34
- path: { type: "string" },
35
- jsPath: { type: "string" },
36
- cssPath: { type: "string" },
37
- htmlPath: { type: "string" },
38
- mediaPath: { type: "string" },
39
- mountId: { type: "string" },
40
- favicon: { type: "string" },
83
+ assetPrefix: {
84
+ type: "string"
85
+ },
86
+ path: {
87
+ type: "string"
88
+ },
89
+ jsPath: {
90
+ type: "string"
91
+ },
92
+ cssPath: {
93
+ type: "string"
94
+ },
95
+ htmlPath: {
96
+ type: "string"
97
+ },
98
+ mediaPath: {
99
+ type: "string"
100
+ },
101
+ mountId: {
102
+ type: "string"
103
+ },
104
+ favicon: {
105
+ type: "string"
106
+ },
41
107
  faviconByEntries: {
42
108
  type: "object",
43
- patternProperties: { [ENTRY_NAME_PATTERN]: { type: "string" } }
109
+ patternProperties: {
110
+ [ENTRY_NAME_PATTERN]: {
111
+ type: "string"
112
+ }
113
+ }
114
+ },
115
+ title: {
116
+ type: "string"
44
117
  },
45
- title: { type: "string" },
46
118
  titleByEntries: {
47
119
  type: "object",
48
- patternProperties: { [ENTRY_NAME_PATTERN]: { type: "string" } }
120
+ patternProperties: {
121
+ [ENTRY_NAME_PATTERN]: {
122
+ type: "string"
123
+ }
124
+ }
125
+ },
126
+ meta: {
127
+ type: "object"
49
128
  },
50
- meta: { type: "object" },
51
129
  metaByEntries: {
52
130
  type: "object",
53
- patternProperties: { [ENTRY_NAME_PATTERN]: { type: "object" } }
131
+ patternProperties: {
132
+ [ENTRY_NAME_PATTERN]: {
133
+ type: "object"
134
+ }
135
+ }
136
+ },
137
+ inject: {
138
+ enum: [
139
+ true,
140
+ "head",
141
+ "body",
142
+ false
143
+ ]
54
144
  },
55
- inject: { enum: [true, "head", "body", false] },
56
145
  injectByEntries: {
57
146
  type: "object",
58
147
  patternProperties: {
59
- [ENTRY_NAME_PATTERN]: { enum: [true, "head", "body", false] }
148
+ [ENTRY_NAME_PATTERN]: {
149
+ enum: [
150
+ true,
151
+ "head",
152
+ "body",
153
+ false
154
+ ]
155
+ }
60
156
  }
61
157
  },
62
- copy: { type: "array" },
63
- scriptExt: { type: "object" },
64
- disableTsChecker: { type: "boolean" },
65
- disableHtmlFolder: { type: "boolean" },
66
- disableCssModuleExtension: { type: "boolean" },
67
- disableCssExtract: { type: "boolean" },
68
- enableCssModuleTSDeclaration: { type: "boolean" },
69
- disableMinimize: { type: "boolean" },
70
- enableInlineStyles: { type: "boolean" },
71
- enableInlineScripts: { type: "boolean" },
72
- disableSourceMap: { type: "boolean" },
73
- disableInlineRuntimeChunk: { type: "boolean" },
74
- disableAssetsCache: { type: "boolean" },
75
- enableLatestDecorators: { type: "boolean" },
76
- enableTsLoader: { type: "boolean" },
77
- dataUriLimit: { type: "number" },
78
- templateParameters: { type: "object" },
158
+ copy: {
159
+ type: "array"
160
+ },
161
+ scriptExt: {
162
+ type: "object"
163
+ },
164
+ disableTsChecker: {
165
+ type: "boolean"
166
+ },
167
+ disableHtmlFolder: {
168
+ type: "boolean"
169
+ },
170
+ disableCssModuleExtension: {
171
+ type: "boolean"
172
+ },
173
+ disableCssExtract: {
174
+ type: "boolean"
175
+ },
176
+ enableCssModuleTSDeclaration: {
177
+ type: "boolean"
178
+ },
179
+ disableMinimize: {
180
+ type: "boolean"
181
+ },
182
+ enableInlineStyles: {
183
+ type: "boolean"
184
+ },
185
+ enableInlineScripts: {
186
+ type: "boolean"
187
+ },
188
+ disableSourceMap: {
189
+ type: "boolean"
190
+ },
191
+ disableInlineRuntimeChunk: {
192
+ type: "boolean"
193
+ },
194
+ disableAssetsCache: {
195
+ type: "boolean"
196
+ },
197
+ enableLatestDecorators: {
198
+ type: "boolean"
199
+ },
200
+ enableTsLoader: {
201
+ type: "boolean"
202
+ },
203
+ dataUriLimit: {
204
+ type: "number"
205
+ },
206
+ templateParameters: {
207
+ type: "object"
208
+ },
79
209
  templateParametersByEntries: {
80
210
  type: "object",
81
- patternProperties: { [ENTRY_NAME_PATTERN]: { type: "object" } }
211
+ patternProperties: {
212
+ [ENTRY_NAME_PATTERN]: {
213
+ type: "object"
214
+ }
215
+ }
82
216
  },
83
217
  polyfill: {
84
218
  type: "string",
85
- enum: ["usage", "entry", "off", "ua"]
219
+ enum: [
220
+ "usage",
221
+ "entry",
222
+ "off",
223
+ "ua"
224
+ ]
225
+ },
226
+ cssModuleLocalIdentName: {
227
+ type: "string"
228
+ },
229
+ federation: {
230
+ type: "object"
86
231
  },
87
- cssModuleLocalIdentName: { type: "string" },
88
- federation: { type: "object" },
89
- disableNodePolyfill: { type: "boolean" }
232
+ disableNodePolyfill: {
233
+ type: "boolean"
234
+ }
90
235
  };
91
236
  const server = {
92
- routes: { type: "object" },
93
- publicRoutes: { type: "object" },
237
+ routes: {
238
+ type: "object"
239
+ },
240
+ publicRoutes: {
241
+ type: "object"
242
+ },
94
243
  ssr: {
95
- type: ["boolean", "object"]
244
+ type: [
245
+ "boolean",
246
+ "object"
247
+ ]
248
+ },
249
+ ssrByEntries: {
250
+ type: "object"
96
251
  },
97
- ssrByEntries: { type: "object" },
98
252
  baseUrl: {
99
253
  anyOf: [
100
254
  {
@@ -108,26 +262,65 @@ const server = {
108
262
  }
109
263
  ]
110
264
  },
111
- port: { type: "number" },
112
- logger: { type: ["boolean", "object"] },
113
- metrics: { type: ["boolean", "object"] },
114
- enableMicroFrontendDebug: { type: "boolean" },
115
- watchOptions: { type: "object" },
116
- compiler: { type: "string" },
117
- enableFrameworkExt: { type: "boolean" }
265
+ port: {
266
+ type: "number"
267
+ },
268
+ logger: {
269
+ type: [
270
+ "boolean",
271
+ "object"
272
+ ]
273
+ },
274
+ metrics: {
275
+ type: [
276
+ "boolean",
277
+ "object"
278
+ ]
279
+ },
280
+ enableMicroFrontendDebug: {
281
+ type: "boolean"
282
+ },
283
+ watchOptions: {
284
+ type: "object"
285
+ },
286
+ compiler: {
287
+ type: "string"
288
+ },
289
+ enableFrameworkExt: {
290
+ type: "boolean"
291
+ }
118
292
  };
119
293
  const dev = {
120
294
  proxy: {
121
- type: ["boolean", "object"]
295
+ type: [
296
+ "boolean",
297
+ "object"
298
+ ]
122
299
  }
123
300
  };
124
301
  const deploy = {
125
- microFrontend: { type: ["boolean", "object"] }
302
+ microFrontend: {
303
+ type: [
304
+ "boolean",
305
+ "object"
306
+ ]
307
+ }
126
308
  };
127
309
  const tools = {
128
- tailwindcss: { type: "object" },
129
- jest: { typeof: ["object", "function"] },
130
- esbuild: { typeof: ["object"] }
310
+ tailwindcss: {
311
+ type: "object"
312
+ },
313
+ jest: {
314
+ typeof: [
315
+ "object",
316
+ "function"
317
+ ]
318
+ },
319
+ esbuild: {
320
+ typeof: [
321
+ "object"
322
+ ]
323
+ }
131
324
  };
132
325
  const bff = {
133
326
  prefix: {
@@ -142,7 +335,4 @@ const bff = {
142
335
  };
143
336
  const schema = new Schema();
144
337
  schema.setSchema("bff", bff).setSchema("dev", dev).setSchema("server", server).setSchema("source", source).setSchema("output", output).setSchema("tools", tools).setSchema("deploy", deploy);
145
- var legacy_default = schema;
146
- export {
147
- legacy_default as default
148
- };
338
+ export default schema;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,30 +1,12 @@
1
1
  import * as path from "path";
2
2
  import { bundle } from "@modern-js/node-bundle-require";
3
- import {
4
- CONFIG_FILE_EXTENSIONS,
5
- fs,
6
- getServerConfig,
7
- OUTPUT_CONFIG_FILE
8
- } from "@modern-js/utils";
9
- const defineServerConfig = (config) => config;
10
- const buildServerConfig = async ({
11
- appDirectory,
12
- distDirectory,
13
- configFile,
14
- options
15
- }) => {
3
+ import { CONFIG_FILE_EXTENSIONS, fs, getServerConfig, OUTPUT_CONFIG_FILE } from "@modern-js/utils";
4
+ export const defineServerConfig = (config) => config;
5
+ export const buildServerConfig = async ({ appDirectory, distDirectory, configFile, options }) => {
16
6
  const configFilePath = await getServerConfig(appDirectory, configFile);
17
- const getOutputFile = async (filepath) => path.resolve(
18
- distDirectory,
19
- `${filepath.replace(
20
- new RegExp(CONFIG_FILE_EXTENSIONS.join("|")),
21
- ""
22
- )}.js`
23
- );
7
+ const getOutputFile = async (filepath) => path.resolve(distDirectory, `${filepath.replace(new RegExp(CONFIG_FILE_EXTENSIONS.join("|")), "")}.js`);
24
8
  if (configFilePath) {
25
- const configHelperFilePath = path.normalize(
26
- path.join(distDirectory, "./config-helper.js")
27
- );
9
+ const configHelperFilePath = path.normalize(path.join(distDirectory, "./config-helper.js"));
28
10
  const helperCode = `
29
11
  export const defineConfig = (config) => config;
30
12
  `;
@@ -37,23 +19,20 @@ const buildServerConfig = async ({
37
19
  {
38
20
  name: "native-build-config",
39
21
  setup(ctx) {
40
- ctx.onResolve(
41
- {
42
- filter: /app-tools\/server/
43
- },
44
- () => {
45
- return {
46
- path: configHelperFilePath
47
- };
48
- }
49
- );
22
+ ctx.onResolve({
23
+ filter: /app-tools\/server/
24
+ }, () => {
25
+ return {
26
+ path: configHelperFilePath
27
+ };
28
+ });
50
29
  }
51
30
  }
52
31
  ]
53
32
  });
54
33
  }
55
34
  };
56
- const safeReplacer = () => {
35
+ export const safeReplacer = () => {
57
36
  const cache = [];
58
37
  const keyCache = [];
59
38
  return function(key, value) {
@@ -68,21 +47,11 @@ const safeReplacer = () => {
68
47
  return value;
69
48
  };
70
49
  };
71
- const emitResolvedConfig = async (appDirectory, resolvedConfig) => {
72
- var _a;
73
- const outputPath = path.join(
74
- appDirectory,
75
- ((_a = resolvedConfig.output.distPath) == null ? void 0 : _a.root) || "./dist",
76
- OUTPUT_CONFIG_FILE
77
- );
50
+ export const emitResolvedConfig = async (appDirectory, resolvedConfig) => {
51
+ var _resolvedConfig_output_distPath;
52
+ const outputPath = path.join(appDirectory, ((_resolvedConfig_output_distPath = resolvedConfig.output.distPath) === null || _resolvedConfig_output_distPath === void 0 ? void 0 : _resolvedConfig_output_distPath.root) || "./dist", OUTPUT_CONFIG_FILE);
78
53
  await fs.writeJSON(outputPath, resolvedConfig, {
79
54
  spaces: 2,
80
55
  replacer: safeReplacer()
81
56
  });
82
57
  };
83
- export {
84
- buildServerConfig,
85
- defineServerConfig,
86
- emitResolvedConfig,
87
- safeReplacer
88
- };
@@ -1,16 +1,16 @@
1
1
  import { Server } from "@modern-js/server";
2
2
  let server = null;
3
- const getServer = () => server;
4
- const setServer = (newServer) => {
3
+ export const getServer = () => server;
4
+ export const setServer = (newServer) => {
5
5
  server = newServer;
6
6
  };
7
- const closeServer = async () => {
7
+ export const closeServer = async () => {
8
8
  if (server) {
9
9
  await server.close();
10
10
  server = null;
11
11
  }
12
12
  };
13
- const createServer = async (options) => {
13
+ export const createServer = async (options) => {
14
14
  if (server) {
15
15
  await server.close();
16
16
  }
@@ -18,7 +18,7 @@ const createServer = async (options) => {
18
18
  const app = await server.init();
19
19
  return app;
20
20
  };
21
- const injectDataLoaderPlugin = (internalPlugins) => {
21
+ export const injectDataLoaderPlugin = (internalPlugins) => {
22
22
  const DataLoaderPlugin = require.resolve("@modern-js/plugin-data-loader/server");
23
23
  return {
24
24
  ...internalPlugins,
@@ -28,10 +28,3 @@ const injectDataLoaderPlugin = (internalPlugins) => {
28
28
  }
29
29
  };
30
30
  };
31
- export {
32
- closeServer,
33
- createServer,
34
- getServer,
35
- injectDataLoaderPlugin,
36
- setServer
37
- };
@@ -1,4 +1,4 @@
1
- function getAutoInjectEnv(appContext) {
1
+ export function getAutoInjectEnv(appContext) {
2
2
  const { metaName } = appContext;
3
3
  const prefix = `${metaName.split(/[-_]/)[0]}_`.toUpperCase();
4
4
  const envReg = new RegExp(`^${prefix}`);
@@ -10,6 +10,3 @@ function getAutoInjectEnv(appContext) {
10
10
  return prev;
11
11
  }, {});
12
12
  }
13
- export {
14
- getAutoInjectEnv
15
- };
@@ -2,32 +2,25 @@ import path from "path";
2
2
  import { fs, getServerConfig } from "@modern-js/utils";
3
3
  const getPackageConfig = (appDirectory, packageJsonConfig) => {
4
4
  const PACKAGE_JSON_CONFIG_NAME = "modernConfig";
5
- const json = JSON.parse(
6
- fs.readFileSync(path.resolve(appDirectory, "./package.json"), "utf8")
7
- );
8
- return json[packageJsonConfig != null ? packageJsonConfig : PACKAGE_JSON_CONFIG_NAME];
5
+ const json = JSON.parse(fs.readFileSync(path.resolve(appDirectory, "./package.json"), "utf8"));
6
+ return json[packageJsonConfig !== null && packageJsonConfig !== void 0 ? packageJsonConfig : PACKAGE_JSON_CONFIG_NAME];
9
7
  };
10
- const addServerConfigToDeps = async (dependencies, appDirectory, serverConfigFile) => {
8
+ export const addServerConfigToDeps = async (dependencies, appDirectory, serverConfigFile) => {
11
9
  const serverConfig = await getServerConfig(appDirectory, serverConfigFile);
12
10
  if (serverConfig) {
13
11
  dependencies.push(serverConfig);
14
12
  }
15
13
  };
16
- async function generateWatchFiles(appContext, configDir) {
14
+ export async function generateWatchFiles(appContext, configDir) {
17
15
  const { appDirectory, configFile } = appContext;
18
16
  const configPath = path.join(appDirectory, configDir || "");
19
- const dependencies = getPackageConfig(
20
- appContext.appDirectory,
21
- appContext.packageName
22
- ) ? [path.resolve(appDirectory, "./package.json")] : [];
23
- await addServerConfigToDeps(
24
- dependencies,
25
- appContext.appDirectory,
26
- appContext.serverConfigFile
27
- );
28
- return [`${configPath}/html`, configFile || "./config", ...dependencies];
17
+ const dependencies = getPackageConfig(appContext.appDirectory, appContext.packageName) ? [
18
+ path.resolve(appDirectory, "./package.json")
19
+ ] : [];
20
+ await addServerConfigToDeps(dependencies, appContext.appDirectory, appContext.serverConfigFile);
21
+ return [
22
+ `${configPath}/html`,
23
+ configFile || "./config",
24
+ ...dependencies
25
+ ];
29
26
  }
30
- export {
31
- addServerConfigToDeps,
32
- generateWatchFiles
33
- };
@@ -1,6 +1,6 @@
1
1
  import { chalk, inquirer } from "@modern-js/utils";
2
2
  import { i18n, localeKeys } from "../locale";
3
- const getSelectedEntries = async (entry, entrypoints) => {
3
+ export const getSelectedEntries = async (entry, entrypoints) => {
4
4
  const entryNames = entrypoints.map((e) => e.entryName);
5
5
  if (!entry) {
6
6
  return entryNames;
@@ -24,15 +24,8 @@ const getSelectedEntries = async (entry, entrypoints) => {
24
24
  }
25
25
  entry.forEach((name) => {
26
26
  if (!entryNames.includes(name)) {
27
- throw new Error(
28
- `Can not found entry ${chalk.yellow(
29
- name
30
- )}, the entry should be one of ${chalk.yellow(entryNames.join(", "))}`
31
- );
27
+ throw new Error(`Can not found entry ${chalk.yellow(name)}, the entry should be one of ${chalk.yellow(entryNames.join(", "))}`);
32
28
  }
33
29
  });
34
30
  return entry;
35
31
  };
36
- export {
37
- getSelectedEntries
38
- };