@modern-js/app-tools 2.0.0-beta.1 → 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 (220) hide show
  1. package/CHANGELOG.md +194 -0
  2. package/dist/js/modern/analyze/generateCode.js +1 -1
  3. package/dist/js/modern/analyze/getBundleEntry.js +1 -1
  4. package/dist/js/modern/analyze/getFileSystemEntry.js +1 -1
  5. package/dist/js/modern/analyze/getHtmlTemplate.js +1 -1
  6. package/dist/js/modern/analyze/getServerRoutes.js +10 -6
  7. package/dist/js/modern/analyze/index.js +12 -27
  8. package/dist/js/modern/builder/builderPlugins/compatModern.js +12 -11
  9. package/dist/js/modern/builder/index.js +33 -16
  10. package/dist/js/modern/builder/share.js +1 -1
  11. package/dist/js/modern/commands/build.js +8 -2
  12. package/dist/js/modern/commands/dev.js +18 -9
  13. package/dist/js/modern/commands/inspect.js +4 -2
  14. package/dist/js/modern/commands/start.js +1 -0
  15. package/dist/js/modern/config/default.js +207 -0
  16. package/dist/js/modern/config/index.js +2 -0
  17. package/dist/js/modern/config/initial/createHtmlConfig.js +32 -0
  18. package/dist/js/modern/{builder → config/initial}/createOutputConfig.js +14 -16
  19. package/dist/js/modern/config/initial/createSourceConfig.js +32 -0
  20. package/dist/js/modern/config/initial/createToolsConfig.js +41 -0
  21. package/dist/js/modern/config/initial/index.js +11 -0
  22. package/dist/js/modern/config/initial/inits.js +117 -0
  23. package/dist/js/modern/config/initial/transformNormalizedConfig.js +40 -0
  24. package/dist/js/modern/defineConfig.js +12 -0
  25. package/dist/js/modern/hooks.js +23 -19
  26. package/dist/js/modern/index.js +7 -5
  27. package/dist/js/modern/initialize/index.js +72 -0
  28. package/dist/js/modern/schema/Schema.js +39 -0
  29. package/dist/js/modern/schema/index.js +139 -0
  30. package/dist/js/modern/schema/legacy.js +284 -0
  31. package/dist/js/modern/types/config/deploy.js +0 -0
  32. package/dist/js/modern/types/config/dev.js +0 -0
  33. package/dist/js/modern/types/config/experiments.js +0 -0
  34. package/dist/js/modern/types/config/html.js +0 -0
  35. package/dist/js/modern/types/config/index.js +2 -0
  36. package/dist/js/modern/types/config/output.js +0 -0
  37. package/dist/js/modern/types/config/performance.js +0 -0
  38. package/dist/js/modern/types/config/security.js +0 -0
  39. package/dist/js/modern/types/config/source.js +0 -0
  40. package/dist/js/modern/types/config/tools.js +0 -0
  41. package/dist/js/modern/types/hooks.js +0 -0
  42. package/dist/js/modern/types/index.js +4 -0
  43. package/dist/js/modern/types/legacyConfig/deploy.js +0 -0
  44. package/dist/js/modern/types/legacyConfig/dev.js +0 -0
  45. package/dist/js/modern/types/legacyConfig/index.js +0 -0
  46. package/dist/js/modern/types/legacyConfig/output.js +1 -0
  47. package/dist/js/modern/types/legacyConfig/source.js +0 -0
  48. package/dist/js/modern/types/legacyConfig/tools.js +0 -0
  49. package/dist/js/modern/utils/config.js +1 -1
  50. package/dist/js/modern/utils/createFileWatcher.js +82 -0
  51. package/dist/js/modern/utils/restart.js +17 -0
  52. package/dist/js/node/analyze/generateCode.js +1 -1
  53. package/dist/js/node/analyze/getBundleEntry.js +1 -1
  54. package/dist/js/node/analyze/getFileSystemEntry.js +1 -1
  55. package/dist/js/node/analyze/getHtmlTemplate.js +1 -1
  56. package/dist/js/node/analyze/getServerRoutes.js +10 -6
  57. package/dist/js/node/analyze/index.js +13 -39
  58. package/dist/js/node/builder/builderPlugins/compatModern.js +12 -11
  59. package/dist/js/node/builder/index.js +34 -16
  60. package/dist/js/node/builder/share.js +1 -1
  61. package/dist/js/node/commands/build.js +8 -2
  62. package/dist/js/node/commands/dev.js +18 -9
  63. package/dist/js/node/commands/inspect.js +4 -2
  64. package/dist/js/node/commands/start.js +1 -0
  65. package/dist/js/node/config/default.js +214 -0
  66. package/dist/js/node/config/index.js +31 -0
  67. package/dist/js/node/config/initial/createHtmlConfig.js +38 -0
  68. package/dist/js/node/{builder → config/initial}/createOutputConfig.js +14 -16
  69. package/dist/js/node/config/initial/createSourceConfig.js +38 -0
  70. package/dist/js/node/config/initial/createToolsConfig.js +47 -0
  71. package/dist/js/node/config/initial/index.js +24 -0
  72. package/dist/js/node/config/initial/inits.js +127 -0
  73. package/dist/js/node/config/initial/transformNormalizedConfig.js +46 -0
  74. package/dist/js/node/defineConfig.js +20 -0
  75. package/dist/js/node/hooks.js +23 -28
  76. package/dist/js/node/index.js +30 -16
  77. package/dist/js/node/initialize/index.js +79 -0
  78. package/dist/js/node/schema/Schema.js +46 -0
  79. package/dist/js/node/schema/index.js +152 -0
  80. package/dist/js/node/schema/legacy.js +291 -0
  81. package/dist/js/node/types/config/deploy.js +0 -0
  82. package/dist/js/node/types/config/dev.js +0 -0
  83. package/dist/js/node/types/config/experiments.js +0 -0
  84. package/dist/js/node/types/config/html.js +0 -0
  85. package/dist/js/node/types/config/index.js +16 -0
  86. package/dist/js/node/types/config/output.js +0 -0
  87. package/dist/js/node/types/config/performance.js +0 -0
  88. package/dist/js/node/types/config/security.js +0 -0
  89. package/dist/js/node/types/config/source.js +0 -0
  90. package/dist/js/node/types/config/tools.js +0 -0
  91. package/dist/js/node/types/hooks.js +0 -0
  92. package/dist/js/node/types/index.js +38 -0
  93. package/dist/js/node/types/legacyConfig/deploy.js +0 -0
  94. package/dist/js/node/types/legacyConfig/dev.js +0 -0
  95. package/dist/js/node/types/legacyConfig/index.js +0 -0
  96. package/dist/js/node/types/legacyConfig/output.js +5 -0
  97. package/dist/js/node/types/legacyConfig/source.js +0 -0
  98. package/dist/js/node/types/legacyConfig/tools.js +0 -0
  99. package/dist/js/node/utils/config.js +1 -1
  100. package/dist/js/node/utils/createFileWatcher.js +90 -0
  101. package/dist/js/node/utils/restart.js +23 -0
  102. package/dist/js/treeshaking/analyze/generateCode.js +1 -1
  103. package/dist/js/treeshaking/analyze/getBundleEntry.js +1 -1
  104. package/dist/js/treeshaking/analyze/getFileSystemEntry.js +1 -1
  105. package/dist/js/treeshaking/analyze/getHtmlTemplate.js +1 -1
  106. package/dist/js/treeshaking/analyze/getServerRoutes.js +8 -7
  107. package/dist/js/treeshaking/analyze/index.js +10 -26
  108. package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +12 -11
  109. package/dist/js/treeshaking/builder/index.js +31 -16
  110. package/dist/js/treeshaking/builder/share.js +1 -1
  111. package/dist/js/treeshaking/commands/build.js +33 -23
  112. package/dist/js/treeshaking/commands/dev.js +36 -22
  113. package/dist/js/treeshaking/commands/inspect.js +8 -3
  114. package/dist/js/treeshaking/commands/start.js +1 -0
  115. package/dist/js/treeshaking/config/default.js +200 -0
  116. package/dist/js/treeshaking/config/index.js +2 -0
  117. package/dist/js/treeshaking/config/initial/createHtmlConfig.js +31 -0
  118. package/dist/js/treeshaking/config/initial/createOutputConfig.js +67 -0
  119. package/dist/js/treeshaking/config/initial/createSourceConfig.js +41 -0
  120. package/dist/js/treeshaking/config/initial/createToolsConfig.js +38 -0
  121. package/dist/js/treeshaking/config/initial/index.js +11 -0
  122. package/dist/js/treeshaking/config/initial/inits.js +114 -0
  123. package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +38 -0
  124. package/dist/js/treeshaking/defineConfig.js +14 -0
  125. package/dist/js/treeshaking/hooks.js +23 -19
  126. package/dist/js/treeshaking/index.js +7 -5
  127. package/dist/js/treeshaking/initialize/index.js +121 -0
  128. package/dist/js/treeshaking/schema/Schema.js +75 -0
  129. package/dist/js/treeshaking/schema/index.js +138 -0
  130. package/dist/js/treeshaking/schema/legacy.js +273 -0
  131. package/dist/js/treeshaking/types/config/deploy.js +0 -0
  132. package/dist/js/treeshaking/types/config/dev.js +0 -0
  133. package/dist/js/treeshaking/types/config/experiments.js +0 -0
  134. package/dist/js/treeshaking/types/config/html.js +0 -0
  135. package/dist/js/treeshaking/types/config/index.js +2 -0
  136. package/dist/js/treeshaking/types/config/output.js +0 -0
  137. package/dist/js/treeshaking/types/config/performance.js +0 -0
  138. package/dist/js/treeshaking/types/config/security.js +0 -0
  139. package/dist/js/treeshaking/types/config/source.js +0 -0
  140. package/dist/js/treeshaking/types/config/tools.js +0 -0
  141. package/dist/js/treeshaking/types/hooks.js +0 -0
  142. package/dist/js/treeshaking/types/index.js +4 -0
  143. package/dist/js/treeshaking/types/legacyConfig/deploy.js +0 -0
  144. package/dist/js/treeshaking/types/legacyConfig/dev.js +0 -0
  145. package/dist/js/treeshaking/types/legacyConfig/index.js +0 -0
  146. package/dist/js/treeshaking/types/legacyConfig/output.js +1 -0
  147. package/dist/js/treeshaking/types/legacyConfig/source.js +0 -0
  148. package/dist/js/treeshaking/types/legacyConfig/tools.js +0 -0
  149. package/dist/js/treeshaking/utils/config.js +1 -1
  150. package/dist/js/treeshaking/utils/createFileWatcher.js +123 -0
  151. package/dist/js/treeshaking/utils/restart.js +45 -0
  152. package/dist/types/analyze/generateCode.d.ts +3 -2
  153. package/dist/types/analyze/getBundleEntry.d.ts +2 -2
  154. package/dist/types/analyze/getFileSystemEntry.d.ts +2 -2
  155. package/dist/types/analyze/getHtmlTemplate.d.ts +3 -3
  156. package/dist/types/analyze/getServerRoutes.d.ts +3 -2
  157. package/dist/types/analyze/index.d.ts +3 -41
  158. package/dist/types/analyze/templates.d.ts +1 -1
  159. package/dist/types/analyze/utils.d.ts +1 -1
  160. package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -2
  161. package/dist/types/builder/index.d.ts +5 -2
  162. package/dist/types/builder/share.d.ts +2 -2
  163. package/dist/types/commands/build.d.ts +2 -2
  164. package/dist/types/commands/deploy.d.ts +2 -2
  165. package/dist/types/commands/dev.d.ts +2 -2
  166. package/dist/types/commands/inspect.d.ts +9 -1
  167. package/dist/types/commands/start.d.ts +2 -2
  168. package/dist/types/config/default.d.ts +3 -0
  169. package/dist/types/config/index.d.ts +2 -0
  170. package/dist/types/config/initial/createHtmlConfig.d.ts +2 -0
  171. package/dist/types/config/initial/createOutputConfig.d.ts +2 -0
  172. package/dist/types/config/initial/createSourceConfig.d.ts +2 -0
  173. package/dist/types/config/initial/createToolsConfig.d.ts +2 -0
  174. package/dist/types/config/initial/index.d.ts +4 -0
  175. package/dist/types/config/initial/inits.d.ts +4 -0
  176. package/dist/types/config/initial/transformNormalizedConfig.d.ts +2 -0
  177. package/dist/types/defineConfig.d.ts +7 -0
  178. package/dist/types/hooks.d.ts +2 -42
  179. package/dist/types/index.d.ts +5 -5
  180. package/dist/types/initialize/index.d.ts +3 -0
  181. package/dist/types/schema/Schema.d.ts +14 -0
  182. package/dist/types/schema/index.d.ts +4 -0
  183. package/dist/types/schema/legacy.d.ts +3 -0
  184. package/dist/types/types/config/deploy.d.ts +9 -0
  185. package/dist/types/types/config/dev.d.ts +13 -0
  186. package/dist/types/types/config/experiments.d.ts +4 -0
  187. package/dist/types/types/config/html.d.ts +4 -0
  188. package/dist/types/types/config/index.d.ts +62 -0
  189. package/dist/types/types/config/output.d.ts +23 -0
  190. package/dist/types/types/config/performance.d.ts +4 -0
  191. package/dist/types/types/config/security.d.ts +4 -0
  192. package/dist/types/types/config/source.d.ts +22 -0
  193. package/dist/types/types/config/tools.d.ts +15 -0
  194. package/dist/types/types/hooks.d.ts +80 -0
  195. package/dist/types/types/index.d.ts +23 -0
  196. package/dist/types/types/legacyConfig/deploy.d.ts +8 -0
  197. package/dist/types/types/legacyConfig/dev.d.ts +12 -0
  198. package/dist/types/types/legacyConfig/index.d.ts +33 -0
  199. package/dist/types/types/legacyConfig/output.d.ts +51 -0
  200. package/dist/types/types/legacyConfig/source.d.ts +25 -0
  201. package/dist/types/types/legacyConfig/tools.d.ts +16 -0
  202. package/dist/types/utils/config.d.ts +2 -2
  203. package/dist/types/utils/createFileWatcher.d.ts +3 -0
  204. package/dist/types/utils/printInstructions.d.ts +3 -3
  205. package/dist/types/utils/restart.d.ts +3 -0
  206. package/package.json +24 -24
  207. package/dist/js/modern/builder/createHtmlConfig.js +0 -58
  208. package/dist/js/modern/builder/createSourceConfig.js +0 -74
  209. package/dist/js/modern/builder/createToolsConfig.js +0 -87
  210. package/dist/js/node/builder/createHtmlConfig.js +0 -68
  211. package/dist/js/node/builder/createSourceConfig.js +0 -82
  212. package/dist/js/node/builder/createToolsConfig.js +0 -94
  213. package/dist/js/treeshaking/builder/createHtmlConfig.js +0 -59
  214. package/dist/js/treeshaking/builder/createOutputConfig.js +0 -70
  215. package/dist/js/treeshaking/builder/createSourceConfig.js +0 -88
  216. package/dist/js/treeshaking/builder/createToolsConfig.js +0 -85
  217. package/dist/types/builder/createHtmlConfig.d.ts +0 -6
  218. package/dist/types/builder/createOutputConfig.d.ts +0 -3
  219. package/dist/types/builder/createSourceConfig.d.ts +0 -5
  220. package/dist/types/builder/createToolsConfig.d.ts +0 -13
@@ -0,0 +1,121 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import { ensureAbsolutePath, getPort, isDev } from '@modern-js/utils';
5
+ import { legacySchema, schema } from "../schema";
6
+ import { getCommand } from "../utils/commands";
7
+ import { transformNormalizedConfig } from "../config/initial/transformNormalizedConfig";
8
+ import { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig } from "../config";
9
+ export default (function () {
10
+ return {
11
+ name: '@modern-js/plugin-initialize',
12
+ setup: function setup(api) {
13
+ var config = function config() {
14
+ var appContext = api.useAppContext();
15
+ var userConfig = api.useConfigContext();
16
+ return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext);
17
+ };
18
+ var validateSchema = function validateSchema() {
19
+ var userConfig = api.useConfigContext();
20
+ var schemas = checkIsLegacyConfig(userConfig) ? legacySchema : schema;
21
+ return schemas.generate();
22
+ };
23
+ return {
24
+ config: config,
25
+ validateSchema: validateSchema,
26
+ resolvedConfig: function resolvedConfig(_ref) {
27
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
28
+ var _resolved$output$dist, _normalizedConfig$ser;
29
+ var resolved, appContext, userConfig, port, normalizedConfig;
30
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
31
+ while (1) {
32
+ switch (_context.prev = _context.next) {
33
+ case 0:
34
+ resolved = _ref.resolved;
35
+ appContext = api.useAppContext();
36
+ userConfig = api.useConfigContext();
37
+ _context.next = 5;
38
+ return getDevServerPort(appContext, resolved);
39
+ case 5:
40
+ port = _context.sent;
41
+ appContext = _objectSpread(_objectSpread({}, appContext), {}, {
42
+ port: port,
43
+ distDirectory: ensureAbsolutePath(appContext.distDirectory, ((_resolved$output$dist = resolved.output.distPath) === null || _resolved$output$dist === void 0 ? void 0 : _resolved$output$dist.root) || 'dist')
44
+ });
45
+ api.setAppContext(appContext);
46
+ normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
47
+ return _context.abrupt("return", {
48
+ resolved: {
49
+ // FIXME: the userConfig mayby legacy userConfig
50
+ _raw: userConfig,
51
+ source: normalizedConfig.source || {},
52
+ server: _objectSpread(_objectSpread({}, normalizedConfig.server || {}), {}, {
53
+ port: port || ((_normalizedConfig$ser = normalizedConfig.server) === null || _normalizedConfig$ser === void 0 ? void 0 : _normalizedConfig$ser.port)
54
+ }),
55
+ bff: normalizedConfig.bff || {},
56
+ dev: normalizedConfig.dev || {},
57
+ html: normalizedConfig.html || {},
58
+ output: normalizedConfig.output || {},
59
+ security: normalizedConfig.security || {},
60
+ tools: normalizedConfig.tools || {},
61
+ testing: normalizedConfig.testing || {},
62
+ plugins: normalizedConfig.plugins || [],
63
+ runtime: normalizedConfig.runtime || {},
64
+ runtimeByEntries: normalizedConfig.runtimeByEntries || {},
65
+ deploy: normalizedConfig.deploy || {},
66
+ performance: normalizedConfig.performance || {},
67
+ experiments: normalizedConfig.experiments || {}
68
+ }
69
+ });
70
+ case 10:
71
+ case "end":
72
+ return _context.stop();
73
+ }
74
+ }
75
+ }, _callee);
76
+ }))();
77
+ }
78
+ };
79
+ }
80
+ };
81
+ });
82
+ function getDevServerPort(_x, _x2) {
83
+ return _getDevServerPort.apply(this, arguments);
84
+ }
85
+ function _getDevServerPort() {
86
+ _getDevServerPort = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appContext, resolved) {
87
+ var command, _appContext$port;
88
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
89
+ while (1) {
90
+ switch (_context2.prev = _context2.next) {
91
+ case 0:
92
+ command = getCommand();
93
+ if (!(isDev() && command === 'dev')) {
94
+ _context2.next = 10;
95
+ break;
96
+ }
97
+ if (!(((_appContext$port = appContext.port) !== null && _appContext$port !== void 0 ? _appContext$port : 0) > 0)) {
98
+ _context2.next = 6;
99
+ break;
100
+ }
101
+ _context2.t0 = appContext.port;
102
+ _context2.next = 9;
103
+ break;
104
+ case 6:
105
+ _context2.next = 8;
106
+ return getPort(resolved.server.port || 8080);
107
+ case 8:
108
+ _context2.t0 = _context2.sent;
109
+ case 9:
110
+ return _context2.abrupt("return", _context2.t0);
111
+ case 10:
112
+ return _context2.abrupt("return", resolved.server.port);
113
+ case 11:
114
+ case "end":
115
+ return _context2.stop();
116
+ }
117
+ }
118
+ }, _callee2);
119
+ }));
120
+ return _getDevServerPort.apply(this, arguments);
121
+ }
@@ -0,0 +1,75 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
+ import _wrapNativeSuper from "@babel/runtime/helpers/esm/wrapNativeSuper";
8
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
+ import { merge } from '@modern-js/utils/lodash';
10
+ export var Schema = /*#__PURE__*/function (_Map) {
11
+ _inherits(Schema, _Map);
12
+ var _super = _createSuper(Schema);
13
+ function Schema() {
14
+ var _this;
15
+ var baseSchema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16
+ _classCallCheck(this, Schema);
17
+ _this = _super.call(this);
18
+ _defineProperty(_assertThisInitialized(_this), "schema", void 0);
19
+ _this.schema = baseSchema;
20
+ return _this;
21
+ }
22
+ _createClass(Schema, [{
23
+ key: "setSchema",
24
+ value: function setSchema(key, object) {
25
+ var _this2 = this;
26
+ Object.entries(object).forEach(function (_ref) {
27
+ var _ref2 = _slicedToArray(_ref, 2),
28
+ k = _ref2[0],
29
+ v = _ref2[1];
30
+ var target = "".concat(key, ".").concat(k);
31
+ _this2.set(target, v);
32
+ });
33
+ return this;
34
+ }
35
+ }, {
36
+ key: "set",
37
+ value: function set(key, value) {
38
+ if (this.has(key)) {
39
+ merge(this.schema[key], value);
40
+ } else {
41
+ this.schema[key] = value;
42
+ }
43
+ return this;
44
+ }
45
+ }, {
46
+ key: "has",
47
+ value: function has(key) {
48
+ return key in this.schema;
49
+ }
50
+ }, {
51
+ key: "get",
52
+ value: function get(key) {
53
+ return this.schema[key];
54
+ }
55
+ }, {
56
+ key: "delete",
57
+ value: function _delete(key) {
58
+ return delete this.schema[key];
59
+ }
60
+ }, {
61
+ key: "generate",
62
+ value: function generate() {
63
+ return Object.entries(this.schema).map(function (_ref3) {
64
+ var _ref4 = _slicedToArray(_ref3, 2),
65
+ target = _ref4[0],
66
+ schema = _ref4[1];
67
+ return {
68
+ target: target,
69
+ schema: schema
70
+ };
71
+ });
72
+ }
73
+ }]);
74
+ return Schema;
75
+ }( /*#__PURE__*/_wrapNativeSuper(Map));
@@ -0,0 +1,138 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import { ENTRY_NAME_PATTERN } from '@modern-js/utils/constants';
3
+ import { Schema } from "./Schema";
4
+ var source = {
5
+ entries: {
6
+ type: 'object',
7
+ patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
8
+ "if": {
9
+ type: 'object'
10
+ },
11
+ then: {
12
+ required: ['entry'],
13
+ properties: {
14
+ entry: {
15
+ type: ['string', 'array']
16
+ },
17
+ disableMount: {
18
+ type: 'boolean'
19
+ },
20
+ enableFileSystemRoutes: {
21
+ type: 'boolean'
22
+ }
23
+ },
24
+ additionalProperties: false
25
+ },
26
+ "else": {
27
+ type: ['string', 'array']
28
+ }
29
+ })
30
+ },
31
+ enableAsyncEntry: {
32
+ type: 'boolean'
33
+ },
34
+ disableDefaultEntries: {
35
+ type: 'boolean'
36
+ },
37
+ entriesDir: {
38
+ type: 'string'
39
+ },
40
+ configDir: {
41
+ type: 'string'
42
+ },
43
+ designSystem: {
44
+ type: 'object'
45
+ }
46
+ };
47
+ var bff = {
48
+ prefix: {
49
+ type: 'string'
50
+ },
51
+ proxy: {
52
+ type: 'object',
53
+ additionalProperties: {
54
+ type: 'string'
55
+ }
56
+ }
57
+ };
58
+ var output = {
59
+ ssg: {
60
+ "typeof": ['boolean', 'object', 'function']
61
+ },
62
+ enableModernMode: {
63
+ type: 'boolean'
64
+ },
65
+ disableNodePolyfill: {
66
+ type: 'boolean'
67
+ }
68
+ };
69
+ var dev = {
70
+ proxy: {
71
+ type: ['boolean', 'object']
72
+ }
73
+ };
74
+ var server = {
75
+ routes: {
76
+ type: 'object'
77
+ },
78
+ publicRoutes: {
79
+ type: 'object'
80
+ },
81
+ ssr: {
82
+ type: ['boolean', 'object']
83
+ },
84
+ ssrByEntries: {
85
+ type: 'object'
86
+ },
87
+ baseUrl: {
88
+ anyOf: [{
89
+ type: 'string'
90
+ }, {
91
+ type: 'array',
92
+ items: {
93
+ type: 'string'
94
+ }
95
+ }]
96
+ },
97
+ port: {
98
+ type: 'number'
99
+ },
100
+ logger: {
101
+ type: ['boolean', 'object']
102
+ },
103
+ metrics: {
104
+ type: ['boolean', 'object']
105
+ },
106
+ enableMicroFrontendDebug: {
107
+ type: 'boolean'
108
+ },
109
+ watchOptions: {
110
+ type: 'object'
111
+ },
112
+ compiler: {
113
+ type: 'string'
114
+ },
115
+ disableFrameworkExt: {
116
+ type: 'boolean'
117
+ }
118
+ };
119
+ var tools = {
120
+ tailwindcss: {
121
+ type: 'object'
122
+ },
123
+ jest: {
124
+ "typeof": ['object', 'function']
125
+ },
126
+ esbuild: {
127
+ "typeof": ['object']
128
+ }
129
+ };
130
+ var deploy = {
131
+ microFrontend: {
132
+ type: ['boolean', 'object']
133
+ }
134
+ };
135
+ var schema = new Schema();
136
+ schema.setSchema('bff', bff).setSchema('dev', dev).setSchema('server', server).setSchema('source', source).setSchema('output', output).setSchema('tools', tools).setSchema('deploy', deploy);
137
+ export { default as legacySchema } from "./legacy";
138
+ export { schema };
@@ -0,0 +1,273 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import { ENTRY_NAME_PATTERN } from '@modern-js/utils/constants';
3
+ import { Schema } from "./Schema";
4
+ var source = {
5
+ entries: {
6
+ type: 'object',
7
+ patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
8
+ "if": {
9
+ type: 'object'
10
+ },
11
+ then: {
12
+ required: ['entry'],
13
+ properties: {
14
+ entry: {
15
+ type: ['string', 'array']
16
+ },
17
+ disableMount: {
18
+ type: 'boolean'
19
+ },
20
+ enableFileSystemRoutes: {
21
+ type: 'boolean'
22
+ }
23
+ },
24
+ additionalProperties: false
25
+ },
26
+ "else": {
27
+ type: ['string', 'array']
28
+ }
29
+ })
30
+ },
31
+ preEntry: {
32
+ type: ['string', 'array']
33
+ },
34
+ alias: {
35
+ "typeof": ['object', 'function']
36
+ },
37
+ enableAsyncEntry: {
38
+ type: 'boolean'
39
+ },
40
+ disableDefaultEntries: {
41
+ type: 'boolean'
42
+ },
43
+ envVars: {
44
+ type: 'array'
45
+ },
46
+ globalVars: {
47
+ type: 'object'
48
+ },
49
+ moduleScopes: {
50
+ "instanceof": ['Array', 'Function']
51
+ },
52
+ entriesDir: {
53
+ type: 'string'
54
+ },
55
+ configDir: {
56
+ type: 'string'
57
+ },
58
+ include: {
59
+ type: ['array']
60
+ }
61
+ };
62
+ var output = {
63
+ assetPrefix: {
64
+ type: 'string'
65
+ },
66
+ path: {
67
+ type: 'string'
68
+ },
69
+ jsPath: {
70
+ type: 'string'
71
+ },
72
+ cssPath: {
73
+ type: 'string'
74
+ },
75
+ htmlPath: {
76
+ type: 'string'
77
+ },
78
+ mediaPath: {
79
+ type: 'string'
80
+ },
81
+ mountId: {
82
+ type: 'string'
83
+ },
84
+ favicon: {
85
+ type: 'string'
86
+ },
87
+ faviconByEntries: {
88
+ type: 'object',
89
+ patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
90
+ type: 'string'
91
+ })
92
+ },
93
+ title: {
94
+ type: 'string'
95
+ },
96
+ titleByEntries: {
97
+ type: 'object',
98
+ patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
99
+ type: 'string'
100
+ })
101
+ },
102
+ meta: {
103
+ type: 'object'
104
+ },
105
+ metaByEntries: {
106
+ type: 'object',
107
+ patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
108
+ type: 'object'
109
+ })
110
+ },
111
+ inject: {
112
+ "enum": [true, 'head', 'body', false]
113
+ },
114
+ injectByEntries: {
115
+ type: 'object',
116
+ patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
117
+ "enum": [true, 'head', 'body', false]
118
+ })
119
+ },
120
+ copy: {
121
+ type: 'array'
122
+ },
123
+ scriptExt: {
124
+ type: 'object'
125
+ },
126
+ disableTsChecker: {
127
+ type: 'boolean'
128
+ },
129
+ disableHtmlFolder: {
130
+ type: 'boolean'
131
+ },
132
+ disableCssModuleExtension: {
133
+ type: 'boolean'
134
+ },
135
+ disableCssExtract: {
136
+ type: 'boolean'
137
+ },
138
+ enableCssModuleTSDeclaration: {
139
+ type: 'boolean'
140
+ },
141
+ disableMinimize: {
142
+ type: 'boolean'
143
+ },
144
+ enableInlineStyles: {
145
+ type: 'boolean'
146
+ },
147
+ enableInlineScripts: {
148
+ type: 'boolean'
149
+ },
150
+ disableSourceMap: {
151
+ type: 'boolean'
152
+ },
153
+ disableInlineRuntimeChunk: {
154
+ type: 'boolean'
155
+ },
156
+ disableAssetsCache: {
157
+ type: 'boolean'
158
+ },
159
+ enableLatestDecorators: {
160
+ type: 'boolean'
161
+ },
162
+ enableTsLoader: {
163
+ type: 'boolean'
164
+ },
165
+ dataUriLimit: {
166
+ type: 'number'
167
+ },
168
+ templateParameters: {
169
+ type: 'object'
170
+ },
171
+ templateParametersByEntries: {
172
+ type: 'object',
173
+ patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
174
+ type: 'object'
175
+ })
176
+ },
177
+ polyfill: {
178
+ type: 'string',
179
+ "enum": ['usage', 'entry', 'off', 'ua']
180
+ },
181
+ cssModuleLocalIdentName: {
182
+ type: 'string'
183
+ },
184
+ federation: {
185
+ type: 'object'
186
+ },
187
+ disableNodePolyfill: {
188
+ type: 'boolean'
189
+ },
190
+ enableModernMode: {
191
+ type: 'boolean'
192
+ }
193
+ };
194
+ var server = {
195
+ routes: {
196
+ type: 'object'
197
+ },
198
+ publicRoutes: {
199
+ type: 'object'
200
+ },
201
+ ssr: {
202
+ type: ['boolean', 'object']
203
+ },
204
+ ssrByEntries: {
205
+ type: 'object'
206
+ },
207
+ baseUrl: {
208
+ anyOf: [{
209
+ type: 'string'
210
+ }, {
211
+ type: 'array',
212
+ items: {
213
+ type: 'string'
214
+ }
215
+ }]
216
+ },
217
+ port: {
218
+ type: 'number'
219
+ },
220
+ logger: {
221
+ type: ['boolean', 'object']
222
+ },
223
+ metrics: {
224
+ type: ['boolean', 'object']
225
+ },
226
+ enableMicroFrontendDebug: {
227
+ type: 'boolean'
228
+ },
229
+ watchOptions: {
230
+ type: 'object'
231
+ },
232
+ compiler: {
233
+ type: 'string'
234
+ },
235
+ disableFrameworkExt: {
236
+ type: 'boolean'
237
+ }
238
+ };
239
+ var dev = {
240
+ proxy: {
241
+ type: ['boolean', 'object']
242
+ }
243
+ };
244
+ var deploy = {
245
+ microFrontend: {
246
+ type: ['boolean', 'object']
247
+ }
248
+ };
249
+ var tools = {
250
+ tailwindcss: {
251
+ type: 'object'
252
+ },
253
+ jest: {
254
+ "typeof": ['object', 'function']
255
+ },
256
+ esbuild: {
257
+ "typeof": ['object']
258
+ }
259
+ };
260
+ var bff = {
261
+ prefix: {
262
+ type: 'string'
263
+ },
264
+ proxy: {
265
+ type: 'object',
266
+ additionalProperties: {
267
+ type: 'string'
268
+ }
269
+ }
270
+ };
271
+ var schema = new Schema();
272
+ schema.setSchema('bff', bff).setSchema('dev', dev).setSchema('server', server).setSchema('source', source).setSchema('output', output).setSchema('tools', tools).setSchema('deploy', deploy);
273
+ export default schema;
File without changes
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ export * from "./output";
2
+ export {};
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ export * from "./hooks";
2
+ export * from "./config";
3
+ export * from "./legacyConfig";
4
+ export {};
File without changes
@@ -0,0 +1 @@
1
+ export {};
@@ -105,7 +105,7 @@ export var emitResolvedConfig = /*#__PURE__*/function () {
105
105
  while (1) {
106
106
  switch (_context3.prev = _context3.next) {
107
107
  case 0:
108
- outputPath = path.join(appDirectory, (resolvedConfig === null || resolvedConfig === void 0 ? void 0 : (_resolvedConfig$outpu = resolvedConfig.output) === null || _resolvedConfig$outpu === void 0 ? void 0 : _resolvedConfig$outpu.path) || './dist', OUTPUT_CONFIG_FILE);
108
+ outputPath = path.join(appDirectory, ((_resolvedConfig$outpu = resolvedConfig.output.distPath) === null || _resolvedConfig$outpu === void 0 ? void 0 : _resolvedConfig$outpu.root) || './dist', OUTPUT_CONFIG_FILE);
109
109
  _context3.next = 3;
110
110
  return fs.writeJSON(outputPath, resolvedConfig, {
111
111
  spaces: 2,